Qt-interest Archive, March 2008
Qt::WindowStaysOnTopHint still causes app exit in 4.3.4
Pages: Prev | 1 | 2 | Next
Message 1 in thread
Windows XP
Qt::WindowStaysOnTopHint kills app in 4.3.2, 4.3.3, 4.3.4.
void MyApp::onStayTop() // Warning! causes instant app exit.
{
Qt::WindowFlags flags = this->windowFlags();
flags |= Qt::WindowStaysOnTopHint;
this->setWindowFlags(flags);
return;
}
--
[ signature omitted ]
Message 2 in thread
Report this to Trolltech. qt-bugs at trolltech.com
On Mon, Mar 3, 2008 at 6:59 PM, John Smith <invalid@xxxxxxxxxxx> wrote:
> Windows XP
>
> Qt::WindowStaysOnTopHint kills app in 4.3.2, 4.3.3, 4.3.4.
>
> void MyApp::onStayTop() // Warning! causes instant app exit.
> {
> Qt::WindowFlags flags = this->windowFlags();
> flags |= Qt::WindowStaysOnTopHint;
> this->setWindowFlags(flags);
> return;
> }
--
[ signature omitted ]
Message 3 in thread
This is not a bug but rather intended behavior.
setWindowFlags() documentation says:
This function calls setParent() when changing the flags for a window, and
the side effects documented in setParent() also apply.
And there's a note in setParent() description:
The widget becomes invisible as part of changing its parent, even if it
was previously visible. You must call show() to make the widget visible
again.
Just add "show()" after calling "setWindowFlags(flags)" and it'll work
fine.
On Mon, 03 Mar 2008 20:59:10 +0300, John Smith <invalid@xxxxxxxxxxx> wrote:
> Windows XP
>
> Qt::WindowStaysOnTopHint kills app in 4.3.2, 4.3.3, 4.3.4.
>
> void MyApp::onStayTop() // Warning! causes instant app exit.
> {
> Qt::WindowFlags flags = this->windowFlags();
> flags |= Qt::WindowStaysOnTopHint;
> this->setWindowFlags(flags);
> return;
> }
>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]
Message 4 in thread
On Mon, Mar 3, 2008 at 10:37 PM, Constantin Makshin
<dinosaur-rus@xxxxxxxxxxxxxxxxxxxxx> wrote:
> This is not a bug but rather intended behavior.
If the application crashes, then it's a bug. Maybe not particular in
Qt, maybe in the op's own app, but if he doesn't raise the issue at
Trolltech, it's never going to get fixed if it's a Qt bug.
--
[ signature omitted ]
Message 5 in thread
He didn't say his application crashes. I guess he thought it exited
because the window got hidden.
On Tue, 04 Mar 2008 00:56:48 +0300, Robin Helgelin <lobbin@xxxxxxxxx>
wrote:
> On Mon, Mar 3, 2008 at 10:37 PM, Constantin Makshin
> <dinosaur-rus@xxxxxxxxxxxxxxxxxxxxx> wrote:
>> This is not a bug but rather intended behavior.
>
> If the application crashes, then it's a bug. Maybe not particular in
> Qt, maybe in the op's own app, but if he doesn't raise the issue at
> Trolltech, it's never going to get fixed if it's a Qt bug.
--
[ signature omitted ]
Message 6 in thread
On Mon, Mar 3, 2008 at 11:14 PM, Constantin Makshin
<dinosaur-rus@xxxxxxxxxxxxxxxxxxxxx> wrote:
> He didn't say his application crashes. I guess he thought it exited
> because the window got hidden.
Actually he did :)
"""
Qt::WindowStaysOnTopHint kills app in 4.3.2, 4.3.3, 4.3.4.
void MyApp::onStayTop() // Warning! causes instant app exit.
"""
"kills app" and "causes instant app exit" :)
--
[ signature omitted ]
Message 7 in thread
>"Constantin Makshin" <dinosaur-rus@xxxxxxxxxxxxxxxxxxxxx> wrote in message
> >news:op.t7gmb6anp27x8p@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>This is not a bug but rather intended behavior.
>setWindowFlags() documentation says:
>This function calls setParent() when changing the flags for a window, and
>the side effects documented in setParent() also apply.
>And there's a note in setParent() description:
>The widget becomes invisible as part of changing its parent, even if it
>was previously visible. You must call show() to make the widget visible
>again.
>Just add "show()" after calling "setWindowFlags(flags)" and it'll work
>fine.
Still crashes. Causes app to exit instantly with no message or debug
output, whether it is being run from withing the Visual Studio IDE or from
the command line, or from Windows Explorer.
void MyApp::onStayTop() // Warning! causes instant app exit. Reported to Qt.
{
Qt::WindowFlags flags = this->windowFlags();
flags |= Qt::WindowStaysOnTopHint;
this->setWindowFlags(flags);
this->show();
return;
}
--
[ signature omitted ]
Message 8 in thread
John Smith wrote:
>> "Constantin Makshin" <dinosaur-rus@xxxxxxxxxxxxxxxxxxxxx> wrote in message
>>> news:op.t7gmb6anp27x8p@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>> This is not a bug but rather intended behavior.
>
>> setWindowFlags() documentation says:
>> This function calls setParent() when changing the flags for a window, and
>> the side effects documented in setParent() also apply.
>
>> And there's a note in setParent() description:
>> The widget becomes invisible as part of changing its parent, even if it
>> was previously visible. You must call show() to make the widget visible
>> again.
>
>> Just add "show()" after calling "setWindowFlags(flags)" and it'll work
>> fine.
>
> Still crashes. Causes app to exit instantly with no message or debug
> output, whether it is being run from withing the Visual Studio IDE or from
> the command line, or from Windows Explorer.
Is this causing the lastWindowClosed() signal which is usually bound to
QApplication::quit()?
--
[ signature omitted ]
Message 9 in thread
Hi,
> Is this causing the lastWindowClosed() signal which is usually bound to
> QApplication::quit()?
Yes, try calling QApplication::setQuitOnLastWindowClosed(false) first:
http://doc.trolltech.com/4.3/qapplication.html#quitOnLastWindowClosed-prop
--
[ signature omitted ]
Message 10 in thread
According to documentation, setWindowFlags() doesn't close the window, nor
does setParent(). It just gets hidden, what actually happens on my system.
I've tested this "bug" with this small program:
#include <QApplication>
#include <QPushButton>
#include <QVBoxLayout>
#include <QWidget>
class MyWindow : public QWidget
{
Q_OBJECT;
public slots:
void setStayOnTop ()
{
Qt::WindowFlags flags = windowFlags();
flags |= Qt::WindowStaysOnTopHint;
setWindowFlags(flags);
show();
}
public:
MyWindow ()
{
QPushButton* btn = new QPushButton("Enable \"Stay On Top\" mode",
this);
connect(btn, SIGNAL(clicked()), this, SLOT(setStayOnTop()));
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget(btn);
setLayout(layout);
}
};
#include "stay-on-top.moc"
int main (int argc, char** argv)
{
QApplication app(argc, argv);
MyWindow wnd;
wnd.show();
return app.exec();
}
If I remove/comment show() after setWindowFlags(), the window hides but
application can still be found in processes list of Task Manager. If show()
is called, everything works correctly.
So, I think, it's most probably that the problem is in John's program, not Qt.
On Tuesday 04 March 2008, Dimitri wrote:
> Hi,
>
> > Is this causing the lastWindowClosed() signal which is usually bound to
> > QApplication::quit()?
>
> Yes, try calling QApplication::setQuitOnLastWindowClosed(false) first:
> http://doc.trolltech.com/4.3/qapplication.html#quitOnLastWindowClosed-prop
>
> --
> Dimitri
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]
Message 11 in thread
Calling QApplication::setQuitOnLastWindowClosed(false) has no effect. When
the app exits, it's no longer listed as a process in task manager.
--
[ signature omitted ]
Message 12 in thread
On Tue, Mar 4, 2008 at 6:37 PM, John Smith <invalid@xxxxxxxxxxx> wrote:
> Calling QApplication::setQuitOnLastWindowClosed(false) has no effect. When
> the app exits, it's no longer listed as a process in task manager.
I guess you haven't run it through a debugger?
--
[ signature omitted ]
Message 13 in thread
Hi,
> Calling QApplication::setQuitOnLastWindowClosed(false) has no effect. When
> the app exits, it's no longer listed as a process in task manager.
Could you provide a minimal, compilable program that reproduces the problem?
--
[ signature omitted ]
Message 14 in thread
"Dimitri" <dimitri@xxxxxxxxxxxxx> wrote in message
news:fqkf53$6pb$1@xxxxxxxxxxxxxxxxxxxxx
> Hi,
>
>> Calling QApplication::setQuitOnLastWindowClosed(false) has no effect.
>> When the app exits, it's no longer listed as a process in task manager.
>
> Could you provide a minimal, compilable program that reproduces the
> problem?
>
> --
> Dimitri
main.cpp:
#include <QApplication>
#include <QTranslator>
#include <QLocale>
#include <QLibraryInfo>
#include "dialog.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Dialog dialog;
return dialog.exec();
}
Dialog.cpp
#include <QtGui>
#include "dialog.h"
Dialog::Dialog(QWidget *parent) : QDialog(parent), m_pButton(0)
{
setWindowTitle(tr("Sample dialog-based application"));
m_pButton = new QPushButton("Button", this);
connect(m_pButton, SIGNAL(clicked()), this, SLOT(onButton()));
}
void Dialog::onButton()
{
Qt::WindowFlags flags = this->windowFlags();
flags |= Qt::WindowStaysOnTopHint;
this->setWindowFlags(flags);
this->show();
return;
}
Qt::WindowStaysOnTopHint causes app exit.
--
[ signature omitted ]
Message 15 in thread
Well, the application really exits. But it's not a bug as I found this in
QDialog code (in QDialog::setVisible() function):
if (visible) {
...
} else {
...
// Reimplemented to exit a modal event loop when the dialog is hidden.
QWidget::setVisible(visible);
if (d->eventLoop)
d->eventLoop->exit();
}
So it's still an intended behavior so your program works as expected.
On Fri, 07 Mar 2008 03:43:11 +0300, John Smith <invalid@xxxxxxxxxxx> wrote:
> #include <QtGui>
> #include "dialog.h"
> Dialog::Dialog(QWidget *parent) : QDialog(parent), m_pButton(0)
> {
> setWindowTitle(tr("Sample dialog-based application"));
> m_pButton = new QPushButton("Button", this);
> connect(m_pButton, SIGNAL(clicked()), this, SLOT(onButton()));
> }
> void Dialog::onButton()
> {
> Qt::WindowFlags flags = this->windowFlags();
> flags |= Qt::WindowStaysOnTopHint;
> this->setWindowFlags(flags);
> this->show();
> return;
> }
--
[ signature omitted ]
Pages: Prev | 1 | 2 | Next