PDA

View Full Version : Dialog and minimize, maximize buttons



lotek
23rd November 2010, 22:09
In the Qt::dialog Window Flag description one can read: "decorated as a dialog (i.e., typically no maximize or minimize buttons in the title bar)"

Any idea why this does not work (at least under Linux)?

I can get either the whole Title Bar (with minimize/maximize buttons) or nothing.

How to eliminate the minimize/maximize buttons in Dialog?
(Arithmetical & with negation of according flags does not work)

thanks for your help
me :)

waynew
24th November 2010, 00:09
Try this:
setWindowFlags(Qt::Dialog);

That gives me a dialog with a title bar and a close X but no minimize or maximize buttons.

Ignore the icon, it's Qt: Dialog without the space.

lotek
24th November 2010, 00:49
Thanks for the answer, but exactly this (and some other things) does not work on Linux. I suppose you are working on Windows. I am afraid, that it is the the X Manager feature and I can't remove this stupid buttons. Even the dialog examples have the minimize/maximize buttons, and there is nothing to do to get rid of them.

waynew
24th November 2010, 02:54
Yes, I am working on Windows, for now. But from what you said, I will have the same problems when I go over to Linux.

lotek
24th November 2010, 13:28
Hi,

The maximize button disappears when the setMaximumSize() ;) method is called for a dialog.

For the context help button the arithmetical & with negation of the Qt::WindowContextHelpButtonHint flag works.

Qt::WindowFlags f = windowFlags();
f &= ~Qt::WindowContextHelpButtonHint;
setWindowFlags(f);

Only the minimize button stays, but i can live with it.

srazi
24th November 2010, 13:57
You should set "Qt::CustomizeWindowHint" for window flags,


setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint);

lotek
24th November 2010, 22:07
Nice idea, but sorry...

I've already checked it. on Linux ( SuSE 11.2) the minimize and maximize buttons ale still visible. The close button and context help button disappear.

Anyway thanks for the hint!
me:)

BalaQT
25th November 2010, 06:15
hi,
In Debian its working. It should work with windowflags ,
try Qt::FramelessWindowHint and if u want to show a title ,add a QLabel and show ur title.

Or Try window styles, like motif,kde etc using QStyle

Thnks
Bala

srazi
25th November 2010, 09:34
Nice idea, but sorry...

I've already checked it. on Linux ( SuSE 11.2) the minimize and maximize buttons ale still visible. The close button and context help button disappear.

Anyway thanks for the hint!
me:)
I used this and it works with Ubuntu 9.10 and 10.04,
Please when you found the solution, write it here.

Phalanx
19th December 2010, 21:57
Works well in Ubuntu 10.04 :)

All buttons visible and all buttons enabled: setWindowFlags(Qt::Tool)
All buttons visible, close and maximize buttons enabled, minimize button disabled: setWindowFlags(Qt::Tool | Qt::WindowTitleHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint)
All buttons visible, maximize button enabled, close and minimize disabled: setWindowFlags(Qt::Tool | Qt::WindowTitleHint | Qt::WindowMaximizeButtonHint | Qt::CustomizeWindowHint)
Only close button is visible and enabled setWindowFlags(Qt::Tool | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint)
No buttons in title bar: setWindowFlags(Qt::Tool | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint)

TpwUK
15th February 2011, 21:39
If i am understanding this problem correctly then this works with Qt4 on Ubuntu 10.10

w.setWindowFlags(Qt::Tool);

add that line before w.show() in your main.cpp and all you will have is the close button

HTH
TpwUK;)