QMessageBox error
-
wrote on 8 Oct 2012, 15:13 last edited by
Hi,
I put a QMessageBox in a QMainwindow sub-class:@
QMessageBox::StandardButton action = QMessageBox::warning(this, "Save", " ",
QMessageBox::Save | QMessageBox::Discard , QMessageBox::Save);
@When I run the application, and exactly every-time the message widget is shown, I get the following error message:
@
X Error: BadWindow (invalid Window parameter) 3
Major opcode: 20 (X_GetProperty)
Resource id: 0x780967c
@The application, despite, still run.
Has someone a solution for this problem ? -
wrote on 9 Oct 2012, 20:25 last edited by
Ooops :)
-
wrote on 10 Oct 2012, 14:43 last edited by
Oops? Does that mean that you figured out the problem? If so, please let us know what it was so that others facing the same issue might be able to learn from your experience. (And be sure and mark the thread as [Solved] if so.)
-
wrote on 10 Oct 2012, 17:56 last edited by
Unfortunately ... no :(
I am waiting for a solution :) -
wrote on 11 Oct 2012, 08:20 last edited by
Maybe a suggestion, but try this:
@
int selection = msgBox.exec();
if(selection == QMessageBox::Yes)
@
the enum StandardButtons might cause the problem. Normally the compiler should allocate enough memory space to hold the returned enum, but you never know ;-)
Also the text (third part) can be set with "".
Don't know what might go wrong otherwise.
Does the program stops when the dialog is opened, or closed? At opening it would seem that the dialog has improper arguments, on close it might have to do with the return value.
Greetz -
wrote on 11 Oct 2012, 08:41 last edited by
The code itself has no problem. What you get is an X error — an error in the X Window System. Most likely there is a bug somewhere else. You might need to specify your environment (OS and Qt version, etc.).
-
wrote on 11 Oct 2012, 14:57 last edited by
The method is a static member so I don't have to create a QMessageBox object ! And so I can't use
QMessageBox::exec(). If you mean that I have to create a custom QDialog this is a point of view, but - as uranusjr said- it seems to be an X Window problem.
I didn't understand what you mean by "You might need to specify your environment". -
wrote on 11 Oct 2012, 22:19 last edited by
He wants to know which operating system you use, which version of Qt and so on. Everything which might help to track down the problem on your specific or a more general environment.
-
wrote on 12 Oct 2012, 10:40 last edited by
Ok :
- OS : GNU/Linux OpenSUSE 11.4 (32-bit)
- architecture : i686
- kernel 2.6.37.6-0.20-desktop
- KDE : 4.7.4
- Compiler : gcc 4.5.1
- Qt version : 4.7.4
Is this enough ?
9/9