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
3
votes
1 answer

QMessageBox with link inside, unable to click

I've already set the textFormat to Qt::RichText, but the link is still un-clickable. QMessageBox msgBox(this); msgBox.setWindowTitle(QApplication::applicationName() + " $VER " +…
daisy
  • 22,498
  • 29
  • 129
  • 265
2
votes
2 answers

How to write on multiple lines in a QMessageBox in QtCreator?

I would like to have in a message box the following lines: name: surname: data: test: After each : I'll programmatically fill the line. I would like to ask how can I have this structure in a QMessageBox. It is possible? I am a beginner in Qt…
sunset
  • 1,359
  • 5
  • 22
  • 35
2
votes
1 answer

Is is possible to pass a QString to a QMessageBox?

I'm working on QT application where the user will enter their information into several QLineEdits. They then will click son a Submit button. I would like a QMessageBox to appear asking if they would like to confirm their information(OK) or cancel. I…
Dylan
  • 63
  • 2
  • 9
2
votes
2 answers

How to set StyleSheet for an specific label in QMessageBox?

I Want to have a bigger QMessageBox and centered texts in it but when I increase the size of it by stylsheet it'll be like this: if I could give it Some Padding or margin it would be fixed but I can't. void MainWindow::showMsg() { QMessageBox…
Muhammad Mirab Br.
  • 133
  • 1
  • 4
  • 13
2
votes
1 answer

How to display plain text using QMessageBox?

I need to display an HTML text: QString text="Hello"; QMessageBox::information(this,"info", text); The text is displayed as bold "Hello". How to display it as it is, i.e., Hello Thanks!
William
  • 761
  • 2
  • 10
  • 27
2
votes
1 answer

How to center QMessageBox and QInputDialog on the screen?

I have this function to center an object in the middle of the screen. I want to center a QMainWindow, QInputDialog and a QMessageBox. This is my MessageBox: def _Warning(self,_type): infoBox = QtWidgets.QMessageBox() …
Alexis
  • 117
  • 2
  • 7
2
votes
0 answers

QMessageBox doesn't display text and freezes GUI after using threads

After implementing a thread to prevent the main GUI from freezing during the function process, my QmessageBox error messages display the title, but not the text and becomes unresponsive. If the 'X' in the QmessageBox is clicked the main GUI becomes…
2
votes
3 answers

Qmessagebox background and text color

I have message response as you see on the above. I've managed to colour background to black: msg.setStyleSheet("background-color: rgb(0, 0, 0);") I've tried with same way for the text but it looks like this: msg.setStyleSheet("text-color:…
Twister Joe
  • 111
  • 2
  • 11
2
votes
1 answer

How do I integrate an animated GIF in a QMessageBox?

I would like to have a QMessageBox with a moving GIF as icon. So I made this: from PyQt5.QtGui import * from PyQt5.QtWidgets import * import os import sys def msg_wait(s): msg = QMessageBox() …
ymmx
  • 4,769
  • 5
  • 32
  • 64
2
votes
1 answer

Does html font size not work in informative text in QMessageBox?

The Informative Text of a QMessageBox can be formatted as rich text, and I understood that the html tag was allowable for rich text in this context. However, the size attribute does not seem to work as expected. When used, the size of…
Alexis
  • 784
  • 8
  • 32
2
votes
1 answer

Qt QMessageBox - closes application instead of just message box

have created a QMessageBox that appears when I press a 'Start' button on my application. When either button is pressed (Ok or Cancel) - I want the message box to close - but the application to remain open. Unfortunately, when I hit Ok or Cancel the…
2
votes
1 answer

Get system-default labels from QMessageBox standard buttons

I want to show the text from the 'Yes' and the 'No' button in the informative text of a QMessageBox, but I don't see how I can get these labels from the buttons. from PyQt5.QtWidgets import * import sys app = QApplication(sys.argv) msgbox =…
Schmuddi
  • 1,995
  • 21
  • 35
2
votes
3 answers

Set specific style to a certain QMessageBox

How to set a specific style to a certain QMessageBox in Qt. Particularly, I would like to invoke a message box which is written below by setting a font size and color for the text "Well done!!!". QMessageBox::information(this, "Done", "Well…
Narek
  • 38,779
  • 79
  • 233
  • 389
2
votes
1 answer

QMessageBox.setIcon() doesn't set the icon

I'm writing a program using PyQt4 that shows a QMessageBox to give the user a warning. I'm trying to set a default icon using setIcon(), but it doesn't show. I'm using Python 2.7 and PyQt4 4.11.4. Here's an example: import sys from PyQt4.QtGui…
fepegar
  • 595
  • 5
  • 15
2
votes
2 answers

Python PyQt5 QMessageBox not opening

I am trying to open a Message Box when I press the infoButton. It runs the infoDialogue method because it prints "I'm here" but it doesn't open the infoBox. What I'm missing? I'm using python 3.5 with PyQt5 Thanks! Here's the code: import sys from…
Luiz Domingues
  • 349
  • 7
  • 13