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
0
votes
0 answers

How to reinitialize QMessageBox for reuse

I have some code whereby I need to create 2 occurrences of a QMessageBox in C++. I would like to use the same declaration for both. How can I reinitialize the original declare to avoid seeing the additional "Proceed" button on the second…
panofish
  • 7,578
  • 13
  • 55
  • 96
0
votes
0 answers

QMessageBox does not close when I click on X button

I have following code 1) File dialog.h class Dialog : public QDialog { Q_OBJECT public: Dialog(QWidget *parent = 0); private slots: void questionMessage(); }; Case1: 2) dialog.cpp void Dialog::questionMessage() { …
TechEnthusiast
  • 273
  • 4
  • 18
0
votes
1 answer

How to remove icon from QMessageBox in PyQt5?

I am trying to code a message box that just pops up and says something and has a single button to close it however as I only have a small amount of text in the box the icon/image to the left of it is huge and looks bad. I want to know how to remove…
John O'Neil
  • 355
  • 1
  • 5
  • 15
0
votes
1 answer

Showing a messagebox from library

I need to show a messagebox to user from my static library but using QMessageBox needs QApplication; How can I show a message box without QApplication?
Ariyan
  • 14,760
  • 31
  • 112
  • 175
0
votes
1 answer

Why is the Qt event loop left

I want a small program doing the following: start a single-shot QTimer when it times out, a QMessageBox is shown if button "Continue" is clicked, the box is closed and the timer restarted if button "Stop" is clicked, the box is closed and the…
Dams
  • 11
  • 3
0
votes
1 answer

QMessageBox and tabOrdering

Is there any way to setTabOrder in QMessageBox without subclassing it or writing my own? In cases when you already got big project - this might be useful.
htzfun
  • 1,231
  • 10
  • 41
0
votes
1 answer

python 3.4, setting up QWidgets.QMessageBox

an update to my code, based on the reply of Israel Unterman: The Error-Class is now from PyQt5 import QtWidgets from PyQt5.QtWidgets import QMainWindow class Error(QtWidgets.QMainWindow): reply = False last_reply_id = None last_id = 0 …
0
votes
2 answers

How to add variable value in Qt QMessageBox?

printf("This machine calculated all prime numbers under %d %d times in %d seconds\n", MAX_PRIME, NUM_OF_CORES, run_time); I want this output to be printed in QMessageBox text Box. I have gone through QMessageBox documentation didn't find…
0
votes
1 answer

PyQt5 how to destroy last widget when clicked 'OK' button on QMessageBox created by a button on that widget

I have a QMainWindow that have a button, when clicked this button, another widget pops up. This widget have a button, when clicked this button an alert message pops up. When I press 'OK' on that message button, only QMessageBox is closing, small…
GLHF
  • 3,835
  • 10
  • 38
  • 83
0
votes
2 answers

QMessageBox::Ok is not responding for mouse clicks on Ok button

I am relatively new to Qt. I have the following piece of code in a function (which is in a user defined class inherited from QObject): QMessageBox msgBox; msgBox.setText("Try clicking Ok button."); int ret = msgBox.exec(); qDebug() << "Return…
Avog
  • 139
  • 17
0
votes
1 answer

How to change stylesheet of QMessageBox button?

I want to chanhe the background colour and font of QMessageBox button? Any help will be greatly appreciated.
dilip yadav
  • 123
  • 1
  • 10
0
votes
1 answer

Qt: Issuing a message before emitting a signal

Brief description of my application and my question: In a QTabWidget I have several groupBoxes containing each 2 QRadioButtons. E.g. Select Menu (groupBox): (RadioButton:) A (RadioButton:) B At one point of time, only one Menu can be active. Both…
Havefun
  • 13
  • 4
0
votes
2 answers

Parent window actions suspended when a MessageBox is shown

I have a Qt front end application, which connects to a back end server in a different machine. And it keeps sending the heart beat messages to inform that it's alive. The problem is when a QMessageBox is shown (using QMessageBox::warning(...)), it…
Praneeth Peiris
  • 2,008
  • 20
  • 40
0
votes
2 answers

Closing QMessageBox on timer, setText not showing

The following piece of code closes my QMessageBox after 2 secs. But my text shows when the box is closing, It flashes really quick before the box closes. What is going on here? QMessageBox *msgBox = new QMessageBox(); msgBox->setText("Coördinate…
Pim
  • 393
  • 3
  • 18
0
votes
2 answers

In QMessageBox, how do I add to the text copied by Ctrl-C?

Using Qt, C++ on Windows, Ctrl-C copies a selection of text that includes the title, message, and so forth from a QMessageBox. I have added some additional fields and would like to add some custom text to the information copied from the standard…
Mike
  • 3,084
  • 1
  • 25
  • 44