Questions tagged [qmessagebox]

QMessageBox is a Qt class that provides a modal window for informing the user or asking for a simple input (like "yes"/"no").

The simplest QMessageBox to alert a user will look like this:

QMessageBox myBox;
myBox.setText("Hello, World!");
myBox.exec();

This will pop up a small modal window (which will block the rest of the interface until dismissed) with the text, and a standard "ok" button.

Basically the QMessageBox provides text for informing the user, informative text for a more detailed explanation, and an optional detailed text for even more additional info, should the user request it. The message box can also have standard buttons.

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

233 questions
4
votes
1 answer

How to place custom image onto QMessageBox

Clicking "Submit" button brings a QMessageBox with three response buttons. 'Critical', 'Information', 'Question', 'Warning' boxes each have their icon. Is there a way to customize the icon on QMessageBox? from PyQt4 import QtGui, QtCore import…
alphanumeric
  • 17,967
  • 64
  • 244
  • 392
4
votes
3 answers

Can you put QWidgets on the stack?

Backstory: I had some of my code reviewed, and I had made a local QMessageBox for displaying an error, and allocated it to the heap: if (getAutopilotList.error() == 0) { QMessageBox* error = new QMessageBox(0); …
Anon
  • 2,267
  • 3
  • 34
  • 51
4
votes
4 answers

Monospaced detailedText in QMessageBox

I've been using a QMessageBox to display the outcome of a statistical test. It's nice, because I can put a summary result in the informative text, then the full result in the detailed text. The trouble is, the full result is a table, so I'd like it…
rainbowgoblin
  • 1,221
  • 12
  • 28
4
votes
2 answers

QMessageBox warning yellow exclamation mark icon

How is possible to display a QMessageBox::warning with the triangular exclamation mark symbol like the one following? I can't find any option in QMessageBox::warning, I only get the red circular symbol.
linello
  • 8,451
  • 18
  • 63
  • 109
4
votes
1 answer

A blocking but non-modal QDialog?

I have a stack of images on which I want to perform some operations. After processing each image, my program should pop up a dialog to prompt the user if they want to proceed with the next image or to abort. Before that, they should have an…
Anton Poznyakovskiy
  • 2,109
  • 1
  • 20
  • 38
3
votes
2 answers

QMessageBox blocks QDialog

I don't really know how to formulate my question this time... I have my application with a QDialog as a main window. The application is getting different values like temperature, humidity and so on from a remote machine. For development I added a…
matthias
  • 247
  • 6
  • 17
3
votes
1 answer

QMessageBox prevent line breaks in DetailedText

I am trying to build a message dialog that shows the details of impacts to my UI. This list is long enough that a scroll bar is needed but the text is long enough that I would prefer the lines to not be broken. Seems changign the size of QMessage…
Jim
  • 2,034
  • 2
  • 15
  • 29
3
votes
1 answer

How to make QMessageBox buttons resized to fit translated text?

I am currently working on localization of an application. Everything's translating as I expected, however, the QMessageBox doesn't resize the buttons to fit the text. This is the code I'm using to generate the question box, the QTranslator is…
cechow
  • 170
  • 8
3
votes
2 answers

How to use variable in pyqt MessageBox

I'm using MessageBox to get user input if data is to be added to database, but I don't know how to place my variables inside the actual message. MessageBox function looks like this: def message(self, par_1, par_2): odp =…
HyperQBE
  • 67
  • 10
3
votes
2 answers

Values of QMessageBox.Yes/QMessageBox.No

I learn PyQt5 (which looks quite complicated for me) and I am wondering why QMessageBox.Yes(or no) has some special value, for me it is 16384. That is what I mean: from PyQt5 import QApplication, QWidget, QMessageBox class App(QWidget): def…
m4k5
  • 33
  • 1
  • 4
3
votes
1 answer

QMessageBox result as a buttonrole

I wanna get result of QMessagebox as a buttonrole. but result always 16384 or 65536 I dont wantto use standartresults, want to use only buttonrole kind of buttons. what am I doing wrong here ? (Im very newbie in QT) void…
Zen Of Kursat
  • 2,672
  • 1
  • 31
  • 47
3
votes
1 answer

How to change the buttons order in QMessageBox

The code creates a QDialog window with a single QPushButton. Clicking the button brings up the QMessageBox window with three buttons. Is there a way to re-arrange the buttons order? from PyQt4 import QtGui, QtCore app =…
alphanumeric
  • 17,967
  • 64
  • 244
  • 392
3
votes
1 answer

Adding a scrollbar to QMessageBox

I am doing a project with Qt. After calling a QMessageBox, I have found that there are too many words to be printed and I want a scrollbar in the QMessageBox. Is it possible to make a scrollbar to the text so that I will not very long…
Man Lok Hui
  • 95
  • 1
  • 10
3
votes
3 answers

QMessageBox with a countdown timer

I wanted to know what would be the best approach of adding a countdown timer to a QMessageBox ? For instance when a message box is displayed the countdown timer starts for say 5 seconds. If the user doesn't respond to the Message box the message box…
MistyD
  • 16,373
  • 40
  • 138
  • 240
3
votes
1 answer

QDialog without tab in task bar

The question is very simple. Is it possible to show QDialog or QMessageBox without creating a tab in the task bar for it? I tried using exec(), show(), changing value of modal, but the tab is always on.
Andrey Chernukha
  • 21,488
  • 17
  • 97
  • 161
1 2
3
15 16