Replace window rectange with image
-
hi and welcome
please see this
http://stackoverflow.com/questions/19939938/qt-creator-how-do-i-add-a-background-image-to-the-qmainwindow -
many thanks :) but rectangle is still exist http://prntscr.com/9c3x8t and i have... black background
-
many thanks :) but rectangle is still exist http://prntscr.com/9c3x8t and i have... black background
@EpicLoyd
A note. the samples uses images that are stored in resource file.
not directly off hard disk.the last sample loads it from file
QPixmap bkgnd("/home/user/Pictures/background.png"); // from file if windows it would be c:/blabla/x.png bkgnd = bkgnd.scaled(this->size(), Qt::IgnoreAspectRatio); QPalette palette; palette.setBrush(QPalette::Background, bkgnd); this->setPalette(palette);
-
@EpicLoyd
A note. the samples uses images that are stored in resource file.
not directly off hard disk.the last sample loads it from file
QPixmap bkgnd("/home/user/Pictures/background.png"); // from file if windows it would be c:/blabla/x.png bkgnd = bkgnd.scaled(this->size(), Qt::IgnoreAspectRatio); QPalette palette; palette.setBrush(QPalette::Background, bkgnd); this->setPalette(palette);
-
@EpicLoyd
you mean you want to have a window with no frame and buttons ?
you can try
setWindowFlags(Qt::FramelessWindowHint);
in the constructor of the window.ahh just saw the other post.
look at this
http://www.codeprogress.com/cpp/libraries/qt/showQtExample.php?index=145&key=QMainWindowPartialTransparentmake sure the PNG do have transparent areas.
-
@EpicLoyd
you mean you want to have a window with no frame and buttons ?
you can try
setWindowFlags(Qt::FramelessWindowHint);
in the constructor of the window.ahh just saw the other post.
look at this
http://www.codeprogress.com/cpp/libraries/qt/showQtExample.php?index=145&key=QMainWindowPartialTransparentmake sure the PNG do have transparent areas.
@mrjj said:
@EpicLoyd
you mean you want to have a window with no frame and buttons ?
you can try
setWindowFlags(Qt::FramelessWindowHint);
in the constructor of the window.ahh just saw the other post.
look at this
http://www.codeprogress.com/cpp/libraries/qt/showQtExample.php?index=145&key=QMainWindowPartialTransparentmake sure the PNG do have transparent areas.
ha, found it too, helped a half: http://prntscr.com/9c4gh4
-
Super.
So you might need to add a button to close it :) -
@mrjj awwww, i don't think that this is super :( , i've expecting something like this http://prntscr.com/9c4hui