Qt-interest Archive, January 2008
How to get rid of the close button of a dialog?
Message 1 in thread
How to set the flag to get rid of the close button (x) sitting at the
most right-top corner of a dialog?
--
[ signature omitted ]
Message 2 in thread
On tirsdag den 29. Januar 2008, Lingfa Yang wrote:
> How to set the flag to get rid of the close button (x) sitting at the
> most right-top corner of a dialog?
You need to set some window flags on the dialog. I can never remember them
exactly, but reading the documentation should get you to the correct set.
IIRC, you need to set Qt::CustomizeWindowHint | WindowTitleHint on the dialog
to get a dialog that has a title bar but no close button.
You need to be careful with this, though. Unless you have a really good reason
for doing it, users aren't going to appreciate you taking away their close
button.
Bo.
--
[ signature omitted ]
Message 3 in thread
Also, notice that these are only hints to the underlying window
system. Not every window manager respects them.
--
[ signature omitted ]
Message 4 in thread
On onsdag den 30. Januar 2008, J-P Nurmi wrote:
> Also, notice that these are only hints to the underlying window
> system. Not every window manager respects them.
It's supported on Windows and Mac OS X and all recent (decent) window managers
on Unix/Linux platforms. If users want to run on some odd window manager that
doesn't support this, they chose it themselves. Don't worry about it, it's
only a theoretic issue.
Bo.
--
[ signature omitted ]
Message 5 in thread
Bo,
Thank you for your informative reply.
Problem solved by subclass the QDialog using the correct flag:
ProgressCtrl::ProgressCtrl(QWidget *parent) : QDialog(parent,
Qt::WindowTitleHint)
The reason why I take away the close button is:
Progress control is designed for thread:
Suspend/Resume/Stop/Kill(terminate).
The control is a modaless dialog, which shows up when a thread emits
started() signal, and hide when the thread emits finished() or
terminated(). At this circumstance, I have no job assign to the
close-button, so I remove it.
Regards,
Lingfa
Bo Thorsen wrote:
> On tirsdag den 29. Januar 2008, Lingfa Yang wrote:
>
>> How to set the flag to get rid of the close button (x) sitting at the
>> most right-top corner of a dialog?
>>
>
> You need to set some window flags on the dialog. I can never remember them
> exactly, but reading the documentation should get you to the correct set.
> IIRC, you need to set Qt::CustomizeWindowHint | WindowTitleHint on the dialog
> to get a dialog that has a title bar but no close button.
>
> You need to be careful with this, though. Unless you have a really good reason
> for doing it, users aren't going to appreciate you taking away their close
> button.
>
> Bo.
>
>
--
[ signature omitted ]