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

Adjust Window Logo, Name and Center Buttons in QMessageBox (Qt/C++)

I am trying to adjust a QMessageBox, but somehow I did not find anything about how to address the WindowLogo and Name of the occurring Message Box correctly. It would be additionally nice to center the Button "ok" horizontally. My Code (Qt/C++) and…
Miau
  • 301
  • 1
  • 3
  • 12
1
vote
1 answer

How to put an event on the buttons of QMessageBox

I just want to set an event on the yes button of the message box but when I click the yes button it returns me None value and it not satisfies the condition. def question(self): msg = QMessageBox() result = msg.setStandardButtons(msg.Yes |…
user14287729
1
vote
0 answers

Touch coordinates offset in QMessageBox when Qt::FramelessWindowHint is set

I found that my QMessageBox was not responding to touch events whenever the Qt::FramelessWindowHint window flag is set. When cleared, the dialog responds normally. After some additional testing, I found that the touch DOES work, but it is…
Jason O
  • 753
  • 9
  • 28
1
vote
1 answer

String and Variable combination

i m a beginner in c++ and i have a question. how can i combine a variable and a string in the folowing line. QMessageBox::Question(this,"Report", "the Report is in Path: " + pdfPath + "saved, do you want to open it", QMessageBox::Yes |…
Boumo
  • 19
  • 2
1
vote
1 answer

Show QListView in QMessageBox

I'm completely new with QT and find it quite confusing. I created a QListView (called "listview") and would like to show that in my QMessageBox: const int resultInfo = QMessageBox::information(this, tr("Generate Software"), tr("The following…
1
vote
1 answer

How to keep the dialog open after message box in PyQt5?

I have a QmainWindow called "first page" it has two buttons in it "Signin" and "Signup".Both buttons will open Qdialogs. In my sign in dialog I have two line edits that takes user's input and two buttons "cancel" and "ok". When "ok" is clicked I…
ladypary
  • 93
  • 8
1
vote
1 answer

print something if the Yes Button is clicked in QMessageBox

I'm Using PyQt5 and I've created a QMessagebox and I want to print something if the Yes Button is clicked. Here's my code self.messageBox = QMessageBox() self.messageBox.setText("Are You Sure with Left Edge You…
M.H.Muhamadi
  • 139
  • 2
  • 8
1
vote
1 answer

Using PyQt5 lineEdit widget, is there any simple way only integer values are available?

I try to build a code that input a certain number on lineEdit Widget and press the button Widget and I can get that value as integer type. But still the type of value I get is string. Is there any beautiful way that I can restrict type of value in…
Yong Hwan Kim
  • 137
  • 1
  • 10
1
vote
0 answers

In X11 (Linux) systems, Qt Widget does not appear on top of parent when QWidget.show() is called soon after the parent's QWidget.show(). Any ideas?

This is a request to see if anyone has found any work-arounds or hacks to prevent the somewhat random placement of X11 Qt windows. These X11 pecularities are discussed at the bottom of this page in the Qt documentation. This occurs often in my…
Garret
  • 1,137
  • 9
  • 17
1
vote
1 answer

QMessageBox to block parent while calculation

I want to use QMessageBox to block its parent QDialog, while doing calculation. I came upon something like that, but this does not work. msgBox = QtWidgets.QMessageBox() msgBox.setWindowTitle('Working ....') msgBox.setText("Working, please wait…
Pygmalion
  • 785
  • 2
  • 8
  • 24
1
vote
1 answer

show pop up on main window?

Currently, I'm building a web automation app on Chrome to help me automate some tasks. And in the process of running, if the program encountered errors or finished the work, it would show errors messages or notification. To to that I'm using…
leminhnguyen
  • 1,518
  • 2
  • 13
  • 19
1
vote
3 answers

QMessageBox add custom button and keep open

I want to add a custom button to QMessagebox that opens up a matplotlib window, along with an Ok button for user to click when they want to close it I currently have it somewhat working, but I want the two buttons to do separate things and not open…
Drees
  • 688
  • 1
  • 6
  • 21
1
vote
1 answer

How to prevent PyQt Line Edit and Message Box from being stuck in an infinite loop?

In the code below, after any sort of editing or completion in the line edit box, the modify function will be called. Then, the program will be stuck in an infinite loop, resulting in continuous QMessageBox pop-ups and 'modifying..' print statements,…
Ethan
  • 37
  • 5
1
vote
1 answer

In PyQt5, new parent is in a different Qthread after pop up QMessageBox

This is PyQt5 code. I want to count down 5 seconds and update every 1 second. Then application will pop up QMessageBox. But it will closed after click button on QMessageBox due to QObject::setParent: Cannot set parent, new parent is in a different…
movep
  • 21
  • 4
1
vote
1 answer

How to set the default button to "Show details"?

I am having this trouble with QMessageBox: QMessageBox box; box.setWindowTitle(tr("Warning box")); box.setIcon(QMessageBox::Warning); box.setText(tr("Something happened, see details or press OK")); box.setDetailedText("There is a detail. World is…