Unsolved how to scale the background image for the Mainwindow
-
I want to scale the image . (i.e) I want to place the image as the size of the Mainwindow when its in minimized size and resize the image when the Mainwindow widget is maximized .
-
Hi
What have you tried so far?
How did you set the background image on mainwindow in the first place?
There is an event for when resize happen which you can use.
http://doc.qt.io/qt-5/qwidget.html#resizeEvent -
QPixmap bkgnd("" + QDir::currentPath() + "./InputFiles/Images/Logo.png");
bkgnd = bkgnd.scaled(this->window()->size(), Qt::IgnoreAspectRatio);
QPalette palette;
palette.setBrush(QPalette::Background, bkgnd);
this->setPalette(palette);My Current Code
-
Hi,
What type of widget is your MainWindow ?
-
@SGaist said in how to scale the background image for the Mainwindow:
MainWindow
I used QT WIdget application type
-
In other words, the question was: what is the base class of MainWindow ?
-
@SGaist
class MainWindow : public QMainWindow is this the one. Or if i am saying it wrong kindly mention how to see it.