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

PyQt QMessageBox crush program

I have a problem with my code. How to correct the code below to QMessageBox not crash program? I don't know why this problem really exists. I tried run QMessageBox in new QThread but it changed nothing. import sys from time import sleep from…
Andy
  • 1
  • 3
0
votes
1 answer

QMessageBox and unicode character

I'm trying to display the bullet character in a QMessageBox, but it renders as a typical "unknown" character (a ? on a black background). Here's how I try to do it : QString message = QString::fromUtf8("\u2022"); QMessageBox::warning(this, "some…
undu
  • 2,411
  • 3
  • 21
  • 28
0
votes
0 answers

Using QmessageBox in translated mode causes the first charactor of each sentences go under the messageBox icon

I use QMessageBox to show messages in program(Information, Critical, Warnings and ...). It works well in English but when it is translated to farsi, the first charactors of each sentences will go under the icon.It doesn't happen always and as I…
maryamT
  • 23
  • 8
0
votes
1 answer

Making QMessageBox InformativeText Bold and increase font size

In my qt C++ gui application, I have a QMessageBox with 3 buttons and some standard functionality. I want to decorate all these with stylesheets and fonts and what not. I am successfully able to do the following - i. Set MessageBox background. ii.…
RicoRicochet
  • 2,249
  • 9
  • 28
  • 53
0
votes
1 answer

How to crop text in a QComboBox or how to get its actual width?

I want to crop a text in a QComboBox. But for this, I need to know the width of a QComboBox. And when I call something like this: ui->qcombobox->width() I get incorrect value (actual width is about 260 px but the resulting width is always 100…
RedEyed
  • 2,062
  • 1
  • 23
  • 26
0
votes
1 answer

pyqt: qmessagebox duplication

I've added a confirmation message box when the user types in the answer. However, when the user confirms and proceeds to the next question, 2 message boxes are showing up, then 3 and so on. How can I fix this duplication error? class…
mcseth antwi
  • 131
  • 1
  • 1
  • 9
0
votes
0 answers

QMessageBox on top of QDialog

I'm reimplementing the accept method of a qdialog so that when the ok button is clicked, a QMessageBox will show up on top of the qdialog. The QDialog is a modal window on top of a main window. What's the best way to do this?
Michael
  • 713
  • 10
  • 27
0
votes
1 answer

close QMessageBox when certain condition is fulfilled

This is working: #ifndef MYWARMUPMESSAGEBOX_H #define MYWARMUPMESSAGEBOX_H #include #include #include class myWarmUpMessageBox : public QMessageBox { Q_OBJECT private: QString _text; int…
newandlost
  • 935
  • 2
  • 10
  • 21
0
votes
1 answer

Will QMessageBox block the running of the whole main thread in Qt?

I am new to Qt My situation is: For some reason, I have to emit a heartbeat signal from the main thread, at the same time I would like to create a QMessageBox window using: reply = QMessageBox::question(this, tr("Sure want to quit?"), tr("Sure…
Nyaruko
  • 4,329
  • 9
  • 54
  • 105
0
votes
0 answers

get error when trying to show message box in function called from thread in python

I am trying to show message box in pyside python in function called from thread but I got error " Fatal IO error: client killed" and form closes while it shows correctly if I called function normally without thread code for button click when…
Mohamed Yousof
  • 725
  • 1
  • 9
  • 38
0
votes
1 answer

PyQt4 ---- I want to use closeEvent() in my code

I am python newbie. I am developing pr-room management program. I think if the user presses the x button , i want to give a warning message . So, I want to use closeEvent() in first code. In other words, first code + second code please # -*-…
Jinhong Park
  • 45
  • 1
  • 1
  • 5
0
votes
2 answers

QErrorMessage keeps on appearing

I count some entries and want to emit a message, when the user has many entries, since it will be confusing. Nevertheless the other hand the user should have the option to disable this warning. That's why I wanted to use a QErrorMessage. But my…
liquid.pizza
  • 505
  • 1
  • 10
  • 26
0
votes
1 answer

QMessageBox::critical make it stay on top

I'm currently using static called QMessageBox::critical() message box and I really need it to stay on top of all windows. Does somebody has an idea how to implement it? Only static version of QMessageBox is needed. Thanks in advance.
0
votes
1 answer

How to make QWidget behave like QMessageBox?

I've been trying to create a QWidget which behave like QMessageBox. When I have for example two QWidget and one QMessageBox until I don't close the QMessageBox I can't available QWidget! Is it exist the function that the QWidget behave like this?
sara
  • 13
  • 4
0
votes
1 answer

Check for a QMessageBox and close it

I need to automate gui tests in c++ qt using qtest (in eclipse) I have given a function that adds some tabs to a tabwidget (up to max 9) and if you try to open a 10th tab, a QMessageBox appears: QMessageBox::critical(this, "MAX9", tr("Only a maximum…