Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. When QMessagBOx met with QGLWidget?
Qt 6.11 is out! See what's new in the release blog

When QMessagBOx met with QGLWidget?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello everyone
    Just now, i have come cross an small issue, i have tried hours, but without any effetcs. the problem descibes as follows:

    when i using QGLWidget to implement opengl funtions, in the overrided initializeGL() of my subclass , once i call QMessagebox::warning(this, "Title", "Content"); the messsage box cause the initializeGL function execute twice, and the box apears double too.

    So, any can help? many thanks!

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi, welcome to devnet.

      That is strange indeed.
      You can report a bug here: https://bugreports.qt-project.org

      It seems a strange place to deal with UI. It's intended for OpenGL initialization, not for interacting with the user.
      The only "workaround" I can think of is just not calling the warning message in there. Maybe instead of a message box you could emit a custom warning signal and connect a queued slot that would show the message later on?

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #3

        [quote author="Chris Kawa" date="1415635477"]Maybe instead of a message box you could emit a custom warning signal and connect a queued slot that would show the message later on?[/quote]

        Or good old QTimer::singleShot();

        (Z(:^

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          thanks for your suggestion, i will try later, since now, i have removed the QmessageBox out of the initializeGL().

          Thanks again!

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi and welcome to devnet,

            While I agree with Chris Kawa about the strangeness, I'd say that it's also not the right place to put a dialog, initializeGL's role is to setup OpenGL for your widget

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved