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

How to add QLineEdit to QMessageBox PyQt5

I want a copyable text on my QMessageBox so I thought I can put a QLineEdit on QMessageBox then set the text of QLineEdit whatever I want, so user can choose the text and copy it. But I couldn't success. Is there a way to add QLineEdit to…
GLHF
  • 3,835
  • 10
  • 38
  • 83
2
votes
2 answers

How to display icon in QMessageBox?

I have an about box that I'm trying to display an icon inside. Here is my code: QMessageBox about_box(this); about_box.setText("..."); about_box.setIconPixmap(QPixmap("qrc:/images/logo.png")); about_box.setParent(this); about_box.exec(); Here is…
Nathan Osman
  • 71,149
  • 71
  • 256
  • 361
2
votes
1 answer

QMessageBox - url encoding/decoding

I created a QMessageBox with an html link: QTMessageBox msgBox(Utility::UI::topLevelWidget()); msgBox.setText("Link"); msgBox.exec(); If I left click the link a new web browser tab opens. The…
MPeli
  • 570
  • 1
  • 8
  • 19
2
votes
1 answer

QInputDialog and QMessageBox

I'm doing some preparation for an exam using Qt framework and I would like to know how to use QInputDialog and QMessageBox in a basic way (my exams are hand written coding) The Qt API is really confusing to understand when it comes to using and it…
Barry Michael Doyle
  • 9,333
  • 30
  • 83
  • 143
2
votes
1 answer

PyQt close QMessageBox

So I have a QMessageBox that is not closable by the user. I want it to stay active until some work is done, and then close automatically. I tried MsgBox.close(), but it doesn't work. How do I close that MsgBox? Thanks in advance
Doc
  • 345
  • 4
  • 17
2
votes
2 answers

Where does QMessageBox get its styleguide, font-size, ... from?

I implemented a custom QMessageBox, inherited from QDialog. (Using qt 4.8.6) The problem is now that all the custom messageboxes look totally different from the QMessageBox static functions: QMessageBox::information(...)…
user1911091
  • 1,219
  • 2
  • 14
  • 32
2
votes
0 answers

QMessageBox QTextCursor::setPosition out of range

If I execute the following code, I get the message: QTextCursor::setPosition: Position '5' out of range This is just a small example to reproduce the error message. Does any one now how to avoid this or why it happen? from PyQt5 import QtWidgets…
DerJFK
  • 311
  • 2
  • 15
2
votes
1 answer

'QMessageBox::critical' : none of the 4 overloads could convert all the argument types

I want to display an error message whenever my independent thread encounters the word "alert1" in a specific .txt file. But I get the above error inside the monitorForAlerts() inside mythread.cpp file. The line expectedly executes if I were to place…
cappy0704
  • 557
  • 2
  • 9
  • 30
2
votes
1 answer

How to show list of strings in QT at run time?

I have a list of strings during run time. Any one help me to display these strings in QWidget. When I right click that string I need to have a option show index that will show index of that string in QMessageBox. If it is possible means give some…
user3176618
  • 35
  • 1
  • 6
1
vote
3 answers

QMessageBox; button layouts

I am a student programmer using Qt to build a GUI interface fro my company. I am currently building a reader table that reads in data and separates it appropriately based on file type. Anywho; when a certain file extension is selected I have a…
Wylie Coyote SG.
  • 1,009
  • 6
  • 22
  • 37
1
vote
1 answer

Cannot make a loop of opening dialog boxes in Qt

My goal is to open a dialog box. When the user clicks on OK, it will open the same dialog box in a loop. This means that opening the dialog box must be blocking the next opening. I not able to pass the second loop iteration and I have a runtime…
1
vote
1 answer

How to pass a parent to a QMessage subclass

How can I properly pass the parent to the QMessgaeBox subclass? If I don't use the parent, the messagebox doesn't appear at the center of the window! class onCloseMessage(QMessageBox): def __init__(self): QMessageBox.__init__(self,…
zezo
  • 445
  • 4
  • 16
1
vote
2 answers

Qt QMessageBox show buttons without color

I've created an QMessageBox with customized buttons and they are showing up in gray as the image bellow: Running on Linux is fine! But on Raspberry it gives me in trouble. The snippet of code that I wrote is the following: #include…
1
vote
1 answer

Setting multiple checkboxes in QMessageBox

I am trying to set two QCheckBox in a QMessageBox. Only the second checkbox appears. How do I achieve this? Is it better to just create a custom QDialog? void TextEditor::actionConfigure_triggered() { QCheckBox *checkbox = new…
pennyBoy
  • 397
  • 2
  • 17
1
vote
1 answer

Get the value of the pressed button for QMessageBox addButton function

I am trying to write a function to better manage QMessageBoxes for the program I am designing. It takes a number of parameters and creates a custom QMessageBox based on those parameters. def alert(**kwargs): # Initialization msg =…
Roein Saba
  • 13
  • 3