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
0
votes
1 answer

QDialog exec returning Rejected always

I have a QDialog box which accepts password and has a Ok button. When closing the Dialog box on "X", a function should be called. But that function is being called even if clicked on Ok button. Qdialog exec function is always returning Rejected.…
0
votes
1 answer

qt - allow user to press only one button with a dialog opened

I'm using QT and I have done a full screen application with some buttons and controls. Sometimes when an error pops up a dialog is showed and stay opened (stay on top). I would like to have a button inside the application screen that could be…
SNC
  • 59
  • 2
  • 15
0
votes
1 answer

How is Qdialog.exec() returning

I know that qdialog->exec() only returns if accept() or reject() is called. However I am using the following code: mydialog* p =new mydialog(this); p->setWindowModality(Qt::WindowModal); int return_code= p->exec() ;//Block …
Rajeshwar
  • 11,179
  • 26
  • 86
  • 158
0
votes
1 answer

How to return values from a QDialog instance in Python?

I'm trying to open a QtGui.QDialog, request a set of values from the user, then return the values after "save" is clicked. The following code should run without modification. import sys from PySide import QtCore, QtGui import numpy as np class…
Paul
  • 358
  • 3
  • 14
0
votes
2 answers

UI element are blocked on programmatically opened QWidget

There is MainWindow inherited from QMainWindow. And there is SettingsDialog inherited from QDialog. From MainWindow user can open SettingsDialog as modal dialog by clicking "Settings" button. void MainWindow::showSettingsDialog() { …
mroot
  • 135
  • 9
0
votes
1 answer

Change my Qdialog to QMainWindow

Building off of some random example I hacked out this beautiful window. I regret using a QDialog example rather than a QMainWindow. I like the look of the QMainWindow and its features. Now I cannot make the conversion (sheer ignorance). The code is…
tempneff
  • 97
  • 2
  • 10
0
votes
1 answer

How to stop a QDialog from executing while still in the __init__ statement (or immediately after)?

I am wondering how I can go about stopping a dialog from opening if certain conditions are met in its __init__ statement. The following code tries to call the 'self.close()' function and it does, but (I'm assuming) since the dialog has not yet…
Jonathan
  • 1,205
  • 1
  • 10
  • 12
0
votes
1 answer

Getting a QDialog to show up with show or exec functions

Right now the QDialog I created is not showing up. Is there any way you can help me find the error? My main.cpp #include #include "numplayers.h" #include "playerinfo.h" #include "mainwindow.h" int main( int argv, char* argc[] ) { …
0
votes
3 answers

How to make non-modal QDialog not cancellable by pressing Esc key?

Can I prevent non-modal QDialog from closing when the user hits Esc, other than by overriding reject() or using event filter / event method? If not, is it possible with a modal QDialog?
Violet Giraffe
  • 32,368
  • 48
  • 194
  • 335
0
votes
0 answers

Spacing of QToolButton in a QDialog

I have a QDialog with QToolButton's. All QToolButton's are grouped in couples in QHBoxLayout, which are then added to a QVBoxLayout as final layout. I have used the QVBoxLayout.spacing(0) to remove spacing, but i still see empty space between the…
Francesco
  • 481
  • 2
  • 4
  • 16
0
votes
0 answers

Mouse position and a QDialog

I am trying to figure out if there is a way to make a qdialog to input the co-ordinates of a line such that the co-ordinates can be given by mouse position or a qdialog (via QLineEdit items). Is there a way to have the mouse position be displayed in…
Francesco
  • 481
  • 2
  • 4
  • 16
0
votes
0 answers

How do I hide QDialog that has Qt::WA_DeleteOnClose flag?

I have a QDialog that was created with Qt::WA_DeleteOnClose flag. When specific event happens I need to hide the dialog and restore it later upon another specific event. If I make a call to QWidget::hide() the dialog object is deleted (due to…
user2724991
  • 121
  • 1
  • 2
  • 6
0
votes
1 answer

How to use qAction submenu in Qt

I want to implement simple commands like a qDebug() when I click on a sub menu in the mainwindow. I was referring to sample program given along with the Qt 5 IDE (...\Qt\Qt5.2.0\5.2.0\msvc2010\examples\widgets\mainwindows\menus), and using it, I…
cappy0704
  • 557
  • 2
  • 9
  • 30
0
votes
1 answer

Qt debug pointer not following expected flow in 2nd and successive iterations

I want to display a "generating image..." kind of modal dialog, other than the main GUI. This "generating image..." dialog should be temporary, and be displayed and disappear without user intervention. For displaying this dialog, the Qt code should…
cappy0704
  • 557
  • 2
  • 9
  • 30
0
votes
1 answer

How to embed QFontDialog and QColorDialog into QWidget?

I need to pop up Qwidget with some properties functions from QMainWindow. This QWidget has to embed QFontDialog and QColorDialog. I want it pop everything with single click, not via i.e. QFontComboBox... Is it possible? Can these dialogs be embedded…
Alex
  • 3,167
  • 6
  • 35
  • 50