Questions tagged [qdialog]

A QDialog is a class from the Qt Toolkit which is the base class for dialog windows.

QDialog serves as a base class in constructing dialog windows. It is different from an ordinary window or widget, because it has a return value, and default buttons. Dialogs can also be made modal or non-modal.

Qt offers a set of default dialogs derived from this class, and allows developers to make custom dialogs by deriving from QDialog. QDialog is always a top-level widget, but if it has a parent, its default location is centered on top of the parent's top-level widget (if it is not top-level itself)

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

467 questions
103
votes
9 answers

How can I hide/delete the "?" help button on the "title bar" of a Qt Dialog?

I am using Qt Dialogs in one of my application. I need to hide/delete the help button. But i am not able to locate where exactly I get the handle to his help button. Not sure if its a particular flag on the Qt window.
AMM
  • 17,130
  • 24
  • 65
  • 77
80
votes
10 answers

Non-resizeable QDialog with fixed size in Qt?

I have a Qt dialog application. Now I dont want that dialog to be resizeable. I am not sure how to achieve this. I tried a bunch of things but still when the dialog launches this dialog can be resized. What is the property that i should set to…
AMM
  • 17,130
  • 24
  • 65
  • 77
35
votes
2 answers

What is the signal for when a widget loses focus?

In a dialog, when the tab key is pressed, the focus changes to another widget. In Qt, is there any signal for when a widget loses its focus? Can I use it to check if the input is valid or not? If not, can I set the focus back and ask the user to…
user1899020
  • 13,167
  • 21
  • 79
  • 154
28
votes
3 answers

QDialog exec() and getting result value

I have subclassed QDialog to implement functionality similar to QMessageBox ( I needed this to allow for customization). It has a text message and OK, Cancel buttons. I am showing the dialog using exec() to make it blocking. Now, how do I return…
go4sri
  • 1,490
  • 2
  • 15
  • 29
26
votes
3 answers

PyQt: Prevent Resize and Maximize in QDialog?

How can I prevent a QDialog in PyQt from being resizeable or maximazable? I don't want the window's size changed.
Antoni4040
  • 2,297
  • 11
  • 44
  • 56
22
votes
4 answers

Qt - Disabling QDialog's "?" button

I create an instance of QDialog and on the left of 'x' (close) button i have also '?' button. How I can disable that '?' ?
Narek
  • 38,779
  • 79
  • 233
  • 389
22
votes
9 answers

How do I prevent the enter key from closing my QDialog (Qt 4.8.1)

I have a QDialog with a QDialogButtonBox. The OK and Cancel buttons are active. Occasionally I disable or hide the OK button based on the state of my dialog. It seems, no matter what I do, the Enter key always activates the OK button. I really DON'T…
cppguy
  • 3,611
  • 2
  • 21
  • 36
15
votes
2 answers

How to make a dialog window always on the front at my application level

How can I make a Qt dialog window always on top at my application level? I want to make a dialog window always on the front but remember always on the front at my application level, even if I click on an empty place, I want to it stay on the front…
Lion King
  • 32,851
  • 25
  • 81
  • 143
14
votes
5 answers

Disable QDialogs default close button (upper left "cross button")?

Is it possible to disable/delete the QDialogs default close button at the upper left of the dialog?
Streight
  • 811
  • 4
  • 15
  • 28
14
votes
1 answer

PyQt QDialog - returning a value and closing from dialog

I'm working on a user interface in PyQt, and I'm running into a few problems trying to use QDialog. Essentially I have a main widget and a sub-widget, saved in separate .py files; I would like the sub-widget to open when I click a certain button in…
Emily C
  • 281
  • 2
  • 4
  • 9
14
votes
3 answers

Can you add a toolbar to QDialog?

I'm working on a project that needs to call a modal window with a toolbar to do some work on some data before it's loaded. The reason I need the toolbar is the user has a few different possible options that can be combined. The obvious choice here…
John
  • 347
  • 1
  • 7
  • 14
13
votes
3 answers

How can I disable Alt + F4 window closing using Qt?

I've disabled X button in Qt from my dialog using this line: myDialog->setWindowFlags(Qt::Dialog | Qt::Desktop) but I couldn't detect Alt + F4 using this code: void myClass::keyPressEvent(QKeyEvent *e) { if ((e->key()==Qt::Key_F4) &&…
Mohammad Sheykholeslam
  • 1,379
  • 5
  • 18
  • 35
12
votes
3 answers

How do I auto-adjust the size of a QDialog depending on the text length of one of its children?

I have a QDialog I'm working with. It is made somewhat like a QMessageBox. I noticed that the size of the QMessageBox (and the size of its label) depends on the size of the message displayed. How would I make the size of my QDialog adjust…
yan bellavance
  • 4,710
  • 20
  • 62
  • 93
12
votes
1 answer

How do I catch a pyqt closeEvent and minimize the dialog instead of exiting?

I have a QDialog object. When the user clicks on the X button or presses Ctrl+Q, I want the dialog to go to a minimized view or system tray icon, instead of closing. How do I do that?
Shahin
  • 1,415
  • 4
  • 22
  • 33
11
votes
1 answer

Resize QDialog at a runtime

I have a QDialog subclass containing some options of my application. Some of the options are core, the other are advanced, so I decided to put them into separeted checkable QGroupBox. I want my dialog to shrink verticaly when the user checked off…
Mikhail Zimka
  • 694
  • 1
  • 9
  • 20
1
2 3
31 32