Qt World Summit: Register Today!

QMessageBox error

  • 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 ?

  • Ooops :)

  • 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.)

  • Unfortunately ... no :(
    I am waiting for a solution :)

  • 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.

  • 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.).

  • 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".

  • 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.

  • Ok :

    • OS : GNU/Linux OpenSUSE 11.4 (32-bit)
    • architecture : i686
    • kernel
    • KDE : 4.7.4
    • Compiler : gcc 4.5.1
    • Qt version : 4.7.4

    Is this enough ?

Log in to reply