PDA

View Full Version : Windows Buttons



techno2007
7th March 2008, 07:03
Hiiii to all....................

I have one problem..........i need to hide all buttons which are shown on title bar of window ie
maxminized,minized,close. Even i go through the windows flags,window state,window types
but i don't get any apporpiate one.

Can any one suggest me how can i do this.I just want to hide buttons only not the title bar


thanxx in advance

jpn
7th March 2008, 07:15
Hi, play around with the Window Flags Example (http://doc.trolltech.com/4.3/widgets-windowflags.html) to find a suitable combination of window flags.

techno2007
7th March 2008, 09:25
hiiiiiiiiiii..............i hv seen the example too..............i don't get apporiate one.
instead just handle the close button by close event.
can any one suggest any better option
thanxx in advance.........

ashishsaryar
7th March 2008, 10:32
use this

setWindowFlags(Qt::WindowTitleHint);


I think it will work .

techno2007
10th March 2008, 05:04
hiiiii.................

i hv try it too....................but it appears both ie title bar as well as buttons.................
i am using platform redhat as-4.
so what shd i do to hide these buttons...................

plz suggest something..........i am using below mention code............can any one rectify it........

myform1-> setWindowFlags(Qt::FramelessWindowHint);
myform1-> setWindowFlags(Qt::WindowTitleHint);

thanxx in advance...........

pherthyl
10th March 2008, 20:36
Well the first line is overriding the second. If you want to set both you need to OR them together like this.

myform1-> setWindowFlags(Qt::FramelessWindowHint | Qt::WindowTitleHint);

techno2007
11th March 2008, 07:07
hiiiii....................

i hv tried ur code but becoz of 'or' operator it is working for only one option & taking first one.ie widget become frameless without any title bar. so i replaced or with and ie

myform1-> setWindowFlags(Qt::FramelessWindowHint & Qt::WindowTitleHint);
it show window title bar but problem is again that with all three buttons.

so plz suggest me what shd i do.

thanxx in advance..........

aamer4yu
11th March 2008, 13:29
Just try setWindowFlags(Qt::WindowTitleHint);
I didnt get any of the three buttons...
This is my code.. u can try

#include <QApplication>
#include <QLabel>
#include<QMainWindow>

int main(int argc, char **argv) {
QApplication app(argc, argv);

QMainWindow *window = new QMainWindow;
QLabel *label = new QLabel("Hello World!");

window->setCentralWidget(label);
window->setWindowFlags(Qt::WindowTitleHint);
window->show();

return app.exec();
}


BTW, I am using windows with Qt 4.3.0 on Visual Studio 2005.
Hope it helps u :)

techno2007
12th March 2008, 04:35
hiiii................
i hv tried ur code......but again all three buttons r visible...................
my platform is redhat as 4 might be coz of platfrom difference it is causing an error.........

can any one suggest me code ie effects on redhat platform


thanxx in advance..........

MarkoSan
12th March 2008, 04:42
Try reset flags to 0 first before setting them. It worked for me in Linux.

techno2007
13th March 2008, 04:10
hiiii.....................i hv already done this...........but it doesn't effect my code...........

here is my code.................but its not effect i mean show all three buttons..



Qt::WindowFlags flags = 0;
flags |= Qt::FramelessWindowHint;
flags &= Qt::WindowTitleHint; //even i tried with or also ie
//flags|= Qt::WindowTitleHint
myform1->setWindowFlags(flags);

so what shd i do.............


thanxx in advance...................

Lexrst
20th June 2008, 00:11
I'm seeing the same issue using Qt 4.3.3 on Open Suse 10.3.

No matter how I set the WindowFlags I can't get rid of the Maximize Button.

I'm using a QMainWindow as a dialog (so I can have menu items and a toolbar) but I'd like it to still look like a fixed size dialog. I tried:


JobEditor *jobEdit = new JobEditor(this); // job editor is a subclass of QMainWindow

jobEdit->setWindowFlags(0);
jobEdit->setWindowFlags(Qt::Dialog);
jobEdit->setAttribute(Qt:WADeleteOnClose);
jobEdit->show();

This gives me a window with a help, maximize and close button.

If I change the call to


jobEdit->setWindowFlags(Qt::Dialog|Qt::WindowMinimizeButton Hint);

I get a window with a maximize and a close button.

All I'd really like to have is a close button and I can't seem to do that.I tried the WindowFlags demo and I can't get just a close button using that either.

edit Sorry for dragging this up. Didn't see the original date was from March. My apologies, but I'm still seeing the problem described here in QT 4.3.3

looki
5th August 2008, 14:47
try this:

works with QT3

Qt::WStyle_Customize|Qt::WStyle_Title

regards looki