Solved QWindow::showFullScreen() crashes the application
-
the code is simple.
if(!window) { window = new QWindow; connect(window, SIGNAL(visibleChanged(bool)), this, SLOT(update(bool))); store = new QBackingStore(window); } window->showFullScreen();
this is inside a slot that is connected to a button click. When run to the line window->showFullScreen(), I got a segment fault and crashed.
Debugger shows:1 QWindow::setWindowState qwindow.cpp 1153 2 QWindow::showFullScreen qwindow.cpp 1910 3 Widget::process widget.cpp 73 ...
on Windows 7, kit: Desktop QT 5.7.0 MinGW 32 bit
Any ideas? Please help. Thanks in advance! -
@rockinJ
why do you need to create a QWindow by yourself?!
Are you sure about what you are doing? -
@raven-worx
I want to create another window to show pictures in full screen besides my main window. -
@rockinJ said:
if(!window) { window = new QWindow; connect(window, SIGNAL(visibleChanged(bool)), this, SLOT(update(bool))); store = new QBackingStore(window); } window->showFullScreen();
do you set window pointer to NULL to start with?
else first time you click, u will crash at
window->showFullScreen(); -
@mrjj
Thank you! You solved the problem. Forgot to set window to null in constructor. Sorry, new to C++. -
@rockinJ
Hurra :)
well its a classic.if you are using C++11 you are allowed to set directly in class
class XX {
QWindow *win=NULL;
}; -
@rockinJ
i was asking, because it's possible show any QWidget as window.
This is in most cases easier to handle, because most of the stuff then happens internally. -
@raven-worx
I see, thanks anyway!