pixmap resize
Solved
General and Desktop
-
Draw a chart and get a pixmap with chartview->grab().
Then, I want to expand the chart to fit the label, but I can't get a full screen. And the resolution is broken... Help me.this->ui.label_13->setAlignment(Qt::AlignCenter); this->ui.label_13->setFrameShape(QFrame::Box); this->ui.label_13->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); this->ui.label_13->setBackgroundRole(QPalette::Base); this->ui.label_13->setAutoFillBackground(true); this->ui.label_13->setMinimumSize(132, 132); void QReportForm::SetChartPixmap(QPixmap* pix) { m_pPixmap = pix; this->ui.label_13->setPixmap( pix->scaled( this->ui.label_13->width(), this->ui.label_13->height(), Qt::KeepAspectRatio) ); }
-
you generate svg image to fit the full screen without losing resolution. Do not create pixmap.
https://doc.qt.io/qt-5/qtsvg-svggenerator-example.html