简体   繁体   中英

QImage / Logo in QCustomPlot

How can I add a logo/QImage in a QCustomPlot plot ?

I am fairly new to both Qt and QCustomPlot .

I am using 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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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