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

How to programmatically close QMenu

I have pretty specific situation. I want to place a QAction into QToolbar and reach following behaviour: Checkable QAction with icon. Classic arrow on the right side which is used for showing menu By pressing this arrow my QDialog should appears on…
tema
  • 1,115
  • 14
  • 33
6
votes
4 answers

QDialog remove title bar

The net is flooded with similar questions, but for all I have seen nothing suits to solve the problem at hand. In my QT-C++ app, I have a mainwindow form with some functions, there is a QPushButton, Pressing which a QDialog opens. Now, all…
RicoRicochet
  • 2,249
  • 9
  • 28
  • 53
6
votes
3 answers

Open new dialog from a dialog in qt

I am trying to open a new dialog Window from a existing dialog on a a button click event,but I am not able to do this as i opened the dialog window from MainWindow. I am trying with: Dialog1 *New = new Dialog1(); New->show(); Is there a…
Tanmay J Shetty
  • 197
  • 2
  • 3
  • 9
5
votes
3 answers

Non-pixelized rounded corner for top-level window

I want to set rounded corners on a QDialog. Since it is a top-level window, border-radius doesn't work, so I've to do this : QRegion EnterPinDialog::roundedRect(const QRect& rect, int r) { QRegion region; // middle and borders region +=…
Tangui
  • 3,626
  • 2
  • 26
  • 28
5
votes
1 answer

QDialog return value, Accepted or Rejected only?

How to return custom value from a QDialog? It's documented it returns QDialog::Accepted 1 QDialog::Rejected 0 respectively if user press Ok of Cancel. I'm thinking in a custom dialog presenting i.e. three check boxes to allow user to select…
KcFnMi
  • 5,516
  • 10
  • 62
  • 136
5
votes
3 answers

how to restart an application in qt?

I do this works for restarting my game but program has error .I want to show a QDialog when user losses .In this QDilag i put two pushbutton for retry and exit.also i have a QDialog for beginning of game.Where is my mistake? (I read similar…
maryam
  • 1,437
  • 2
  • 18
  • 40
5
votes
1 answer

How can I change the modality of QDialog at runtime?

I have a QDialog and I read a lot about the differences of show(), exec() and open(). Unfortunately I never found a solved solution to change the modality of a dialog at runtime. I have an application and from there my QDialog is started. I have a…
user1416940
  • 53
  • 1
  • 1
  • 3
4
votes
2 answers

How to use a process (QProcess) in a new thread (QThread)?

I have the following code: void Processmethod() { QDialog *ProcessMessage = new QDialog; Ui::DialogProcessMessage Dialog; Dialog.setupUi(ProcessMessage); ProcessMessage->setModal(true); …
Streight
  • 811
  • 4
  • 15
  • 28
4
votes
1 answer

QDialog not opening from Main window (pyQt)

I'm trying to launch a dialog by clicking a button in the main window: Here's the (qtdesigner generated) code which I modified just to test it .. I've set the showDial function to show the dial when the button is clicked. But it doesn't work : from…
flak37
  • 885
  • 2
  • 10
  • 18
4
votes
2 answers

QDialog explicit constructor without argument - how to use correctly?

I experienced this with a derived class, but it's the same with QDialog base class: when I do QDialog dialog(); dialog.exec(); the compiler complains J:\...\mainwindow.cpp:-1: In member function 'void…
friede
  • 137
  • 8
4
votes
2 answers

Moving a frameless QDialog with a MouseMoveEvent

So I have a frameless QDialog that I want to be able to move around simply by clicking and dragging it. Given the code below, dragging the dialog always snaps the very top-left (0,0) of the dialog to the mouse. How might I circumvent this, or…
Cryptite
  • 1,426
  • 2
  • 28
  • 50
4
votes
1 answer

Prevent okay QPushButton from accepting dialog on press enter

In the following code, the Ok button of the dialog always seems to come into focus, thus when enter is pressed, the dialog is accepted and closes. What I am aiming for is that to have the user edit text in the line edit, and then be allowed to…
Vince W.
  • 3,561
  • 3
  • 31
  • 59
4
votes
2 answers

Pressing Tab in QTextEdit in Dialog - change behavior

I have QDialog that contains few buttons and a QTextEdit. after writing something in the QTextEdit, I press tab in order to get to one of the buttons, but when I pressing tab, a tab space is added to the QTextEdit. How can I change this behavior?
kakush
  • 3,334
  • 14
  • 47
  • 68
4
votes
2 answers

QDialog: show() vs open()

Whats the difference between QDialog::show() and QDialog::open()?
Jan Rüegg
  • 9,587
  • 8
  • 63
  • 105
4
votes
1 answer

QDialogButtonBox buttons not responding

When I run the following function, the dialog shows with everything in place. The problem is that the buttons won't connect. OK and Cancel do not response to mouse clicks. void MainWindow::initializeBOX(){ QDialog dlg; QVBoxLayout…
AAFF
  • 89
  • 1
  • 8
1 2
3
31 32