简体   繁体   English

QCustomPlot中的QImage /徽标

[英]QImage / Logo in QCustomPlot

How can I add a logo/QImage in a QCustomPlot plot ? 如何在QCustomPlot图中添加徽标/ QImage?

I am fairly new to both Qt and QCustomPlot . 我对Qt和QCustomPlot

I am using C++ 我正在使用C ++

QCustomPlot* plot = new QCustomPlot(parent);
logo = new QImage();
bool success  = logo->load("Logo-Wallpaper.png");

How to add logo to plot? 如何添加徽标以进行绘图?

You can set the pixmap of a label by the logo image and add the label to a layout in the plot : 您可以通过徽标图像设置标签的像素图,并将标签添加到绘图中的布局中:

QLabel *myLabel = new QLabel(this);
myLabel->setPixmap(QPixmap::fromImage(logo));

QGridLayout * layout = new QGridLayout(plot);
layout->setAlignment(Qt::AlignRight | Qt::AlignTop);
layout->addWidget(myLabel ,0,0);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM