I hav created a Dialog ...I want to disable the close button on the dialog...
I hav created a Dialog ...I want to disable the close button on the dialog...
Hello,
You have to use setWindowFlags() method, and I think you'll have to omit this particular flag :
Qt::WindowSystemMenuHint
I have used designer to create the dialog. i hav used setContextMenuPolicy(Qt::NoContextMenu) to disable the maximize,minimize and close buttons.The ui file works fine for Windows OS but on Linux i am getting the close button on the dialog..Is there any option in the designer to remove the close button
use m_pCloseBtn->setEnabled(false);
Rajesh Kumar Singh
Bangalore, India.
Qt Search
Must Watch:
See how we can connect digital world objects to our day to day life….
Its not the qPushButton the clse,maximize,minimize button the Dialog
you write following code, this will not disable but don't close your application.
Qt Code:
{ event->ignore(); }To copy to clipboard, switch view to plain text mode
Last edited by jacek; 16th July 2007 at 12:58.
Rajesh Kumar Singh
Bangalore, India.
Qt Search
Must Watch:
See how we can connect digital world objects to our day to day life….
I have used designer to create the dialog. i hav used setContextMenuPolicy(Qt::NoContextMenu) to make the maximize,minimize and close buttons invisble.The ui file works fine for Windows OS but on Linux the close button on the dialog is visible ..Is there any option in the designer to remove the close button...Sorry for using the term disable its actually visiblity.....
this following code working for me on window.this code removing "X"button from title. I dont know it work on unix or not.
Qt Code:
setWindowFlags(Qt::FramelessWindowHint); setWindowFlags(Qt::WindowTitleHint); setWindowTitle(tr("Virtual Development Board"));To copy to clipboard, switch view to plain text mode
Last edited by jacek; 16th July 2007 at 12:58. Reason: changed [html] to [code]
Rajesh Kumar Singh
Bangalore, India.
Qt Search
Must Watch:
See how we can connect digital world objects to our day to day life….
U r code works fine. But i do not get the title bar.Is there any way to hav the title bar with close button only..The maximize and minimize buttons on the MainWindow should be invisible....
see the example code Window Flags Example: from
http://doc.trolltech.com/4.3/widgets-windowflags.html
this example code working fine on windows. you test this on linux, in this example depend on different check box it showing minimize , maximize and close button, and none of these also.
see void ControllerWindow::updatePreview() in example.
Rajesh Kumar Singh
Bangalore, India.
Qt Search
Must Watch:
See how we can connect digital world objects to our day to day life….
I tested the code given in the website..It has solved my problem.I hav another one.I need a Dialog that has no close button on the dialog but has a titlebar...I tried using FramelessWindowHint but titlebar is not visible...Suggest some approach where i can hav a titlebar with no close button.
Bookmarks