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
1
vote
1 answer

Qt 4.8.5 Understanding QMessagebox .exec() and .show()

I'm doing a QWizard with QT 4.8.5 and in some pages I have to close some other applications and exit my program. This works fine but now I want to show a pop up message that tells the user that the programs are restarting (There are others a part of…
Megasa3
  • 766
  • 10
  • 25
1
vote
0 answers

QMessageBox .gif file is not visible

I have a QMessageBox and I put an animated gif on this Dialog with QLabel and inside QMovie instead of an icon. But there is a problem with the gif. When I refresh the screen somehow QMessageBox is working but the gif is not visible…
Wilmort
  • 294
  • 2
  • 15
1
vote
2 answers

Qmessagebox, Error: argument 1 has unexpected type 'Ui_MainWindow'

With QTDesigner in version 5, I have done a mainwindow, now i like to create a QMessagebox on click on the Button in the mainwindow. I got an error : argument 1 has unexpected type 'Ui_MainWindow' I have no idea why this is not working, hopefully…
chao-samu
  • 153
  • 2
  • 7
1
vote
3 answers

Get name to my buttons in QMessage box

I would like put a name for my buttons in this code. It is about a QMessageBox. if(QMessageBox::Ok == QMessageBox( QMessageBox::Question, "Confirmar registro.", "¿Desea confirmar guardar los datos?", QMessageBox::Ok, …
Arkhan6
  • 157
  • 1
  • 1
  • 10
1
vote
2 answers

Display QMessageBox with multiple arguments

I'm using the Qt framework and I'm a little rusty with it. I have two QStrings first and last I want to display them in a QMessageBox but don't know how to include multiple arguments. This is what I have to code it with on…
Barry Michael Doyle
  • 9,333
  • 30
  • 83
  • 143
1
vote
1 answer

How to prevent double slot invocation when showing a QMessageBox?

I've connected the editingFinished signal of a QLineEdit to a slot in my application showing a QMessageBox if the input is in some way unexpected. Strangely enough the message box is shown twice, so I put a breakpoint where it is executed and had a…
user1709708
  • 1,557
  • 2
  • 14
  • 27
1
vote
2 answers

Don’t close Dialog on pressing OK button of QMessageBox

I have called QMessageBox() like this: class Main(QDialog): def __init__(self): self.view = QUiLoader().load("app.ui", self) self.view.show() self.functionA() .... functionA(): try: .... …
Patrick
  • 2,464
  • 3
  • 30
  • 47
1
vote
1 answer

closing pyqt messageBox with closeevent of the parent window

I have folllowing piece of cake def __init__(): self._taskInProgress = threading.Event() def isFinished(self): self._taskInProgress.clear() self.progressBar.hide() self.close() def closeEvent(self, event): if…
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
1
vote
1 answer

QMessageBox With HTML Layout Formatting

For my program, I'm doing a QMessageBox for the about section, and I import an html file to set the layout of the said box : // Program.cpp QMessageBox about; about.setWindowTitle(tr("About")); // Enable the HTML…
Romain
  • 3,586
  • 7
  • 31
  • 52
1
vote
0 answers

Qt QMessageBox Unit test

I'm trying to do unit tests in qt of Gui. It fills correctly data in QLineEdit. The problem is that I cannot close automatically a QMessageBox which is called in a method that is tested. I have to push ok button manually in the test app. How can I…
user1336326
  • 71
  • 1
  • 8
1
vote
2 answers

Customize exceptions by showing error message C++ and Qt

I use Qt Creator for a project and I would like to handle multiple exceptions in my Qt code. When an error occurs, I would like to show it in a QMessageBox::critical(). For that I created a class myExceptions.h as follow: #ifndef…
Colet
  • 495
  • 2
  • 8
  • 22
1
vote
1 answer

pyqt: Variable values in QMessageBox output?

Right now I'm displaying a window with text in a QMessageBox. It works and displays the text accurately. profBox = QMessageBox() QMessageBox.about(self,'Profile', "Gender:
Age: < br />") #Ideal output is gender: F (stored in a variable) and…
user3295674
  • 893
  • 5
  • 19
  • 42
1
vote
0 answers

How to control placement of "Show Details..." button on PyQt / PySide QMessageBox that uses setDetailedText

When I use setDetailedText on a QMessageBox in PySide, the "Show Details..." button places itself between the Ok and Cancel buttons. Is there a way to control the placement of the button? I like the way it appears in the documentation, but I'd like…
flutefreak7
  • 2,321
  • 5
  • 29
  • 39
1
vote
1 answer

closeEvent and QMessageBox seems to block updating UI

I have been getting this issue for hours now. I have investigated a lot of things (I even created a custom QDialog), but now I am determined that it's the closeEvent and QMessageBox combination that causes this problem. What I want to know is if…
1
vote
1 answer

QtGui.QMessageBox.information and customizing it

According to you the doucmentation, QtGui.QMessageBox.information() function can be used to create a dialog box with many push buttons, using the following constants: QMessageBox.Ok An “OK” button defined with the AcceptRole . QMessageBox.Open A…
PersianGulf
  • 2,845
  • 6
  • 47
  • 67