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
2 answers

Adapt QMessageBox size to its text size

I would like to create a QMessageBox::critical which would automatically adapt its size depending on the size of the content (the message text). How can I do it? This is the message I would like to display on the QMessageBox std::wstring…
user3473325
  • 103
  • 1
  • 8
0
votes
2 answers

pyqt: QMessageBox - Textbox and set data?

I'm trying to work on a GUI done in pyqt. I'm trying to create a pop-up window has a textbox where a user can type/set the user's id (1-99) and then click an 'ok' button to set it and close the window. This is what I have so far. def…
user3295674
  • 893
  • 5
  • 19
  • 42
0
votes
2 answers

Moving QMessageBox?

Basically I'm learning the basics of Qt C++ and I'm trying to open up two different QMessageBox's at the same time but they overlap each other. I was wondering if it was possible to have them side by side. Any input on how to do so would be greatly…
user3183586
  • 167
  • 1
  • 5
  • 15
0
votes
1 answer

Which button is pressed in a non-blocking QMessageBox?

I'm trying to make a non-blocking QMessageBox as described here. In the slot msgBoxClosed() I only get a QAbstractButton* back, so how can I check which of the buttons (QMessageBox::Yes, QMessageBox::No) was pressed?
slenox
  • 3
  • 1
0
votes
1 answer

How to return focus to the window?

After close MessageBox the focus self does not return to the window. I tried so: QMessageBox msgBox; msgBox.setText("Ok"); msgBox.exec(); this->setFocus(); How to return focus to the main window (this)? //dialog.h #ifndef DIALOG_H #define…
Adam Shakhabov
  • 1,194
  • 2
  • 14
  • 35
0
votes
1 answer

Not all QMessageBox's in the same function actually show up

This is part of a basic QtCreator code in C++ for TCP client-server communication. This is supposed to be the last function I need to get working. But to understand how this works and where the errors are, I am trying to show a whole bunch of…
DDauS
  • 105
  • 1
  • 2
  • 11
0
votes
1 answer

cleanlook style for message box pyqt4

I have an PYQT4 application. I try to display a lot of differnt messages based on user interaction. The problem I have is the displayed message using QMessageBox doest come up in clean look style, whereas the other part of the application works well…
Sri
  • 693
  • 1
  • 9
  • 22
0
votes
1 answer

PyQT threading error while passing a signal to a QMessageBox

I tried to receive a string from a thread to my main GUI using SIGNALs. Everything works fine until I want to use the string in a QMessageBox. Printing out is no problem but starting a QMessageBox gives me several errors (some are about QPixmap…
honeymoon
  • 2,400
  • 5
  • 34
  • 43
0
votes
2 answers

Qt-creator: my QMessageBox is not closing

I am using a QMessageBox to warn the user if he pressed Delete button by mistake. when the user press Ok button in the QMessageBox, a function is called to delete a row from QTableView (that is connected to a database). after the deletion, the…
hashDefine
  • 1,491
  • 6
  • 23
  • 33
0
votes
0 answers

QMessageBox crash when using QStyle::drawControl in a QStyledItemDelegate

I have an odd problem. I am using QStyle's drawControl() to draw a progress bar in a custom QStyledItemDelegate's paint(). Now the application crashes, when I try to open a QMessageBox with either show() or exec() or whatever. I am quite sure, that…
Niklas
  • 249
  • 3
  • 7
0
votes
2 answers

QDialogButtonBox: Is there any way to fill different colors to Individual Buttons?

I am creating an Error Message Box for my Screen. I am using QDialogButtonBox for buttons. Now i want to fill Buttons with different colors. For example: "OK" --> Green "Cancel" --> Red etc. I am able to change the background for all buttons ,…
skg
  • 948
  • 2
  • 19
  • 35
0
votes
1 answer

How to flush the QWidget Painting-Cache?

I'm working on a custom styled QMessageBox. In my custom QStyle class in method polish() I call: if( (pDialog = qobject_cast( pWidget )) != NULL ) { pDialog->setWindowFlags( pDialog->windowFlags() | Qt::FramelessWindowHint ); //…
Charly
  • 1,270
  • 19
  • 42
0
votes
1 answer

Display MySQL error in QMessageBox

I'm running a local MySQL server for developing my PyQt application. It would be nice if I could display a QMessageBox if server is down, so that endusers would have some idea why is application not starting. If I shut down the server and run my…
ivica
  • 1,388
  • 1
  • 22
  • 38
0
votes
1 answer

QWidget and showing of QMessageBox

I have a QWidget which shows a QMessageBox on the show event. I have overridden the showEvent function for the QWidget. The problem is, that the messagebox is displayed first, and the rest of the widget is displayed later. How do I resolve this…
saurabhsood91
  • 449
  • 1
  • 5
  • 21
0
votes
0 answers

PyQt QMessageBox acting funny

I have somewhat strange issue with my QMessageBox answers. This function is used to remove a row from an SQLite database. Before deletion, a message box pops and asks for confirmation. Query executes fine, except it ALWAYS deletes, whether I answer…
ivica
  • 1,388
  • 1
  • 22
  • 38
1 2 3
15
16