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. [SOLVED] Show Widget in UnitTest - Qt 5.3
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Show Widget in UnitTest - Qt 5.3

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 2.2k 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.
  • R Offline
    R Offline
    richard_h
    wrote on last edited by
    #1

    I want to use a gui-Test in my UnitTests. Different to the normal use, I want to show a QWidget with Buttons etc. and use it as a Simulator (for example for Cameras)

    At Qt 4.3 all is running well but under Qt 5.3 - the Unit Test starts but I can't see the Widget.

    Does anyone has the same problem?

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

      Hi and welcome to devnet,

      Can you post a minimal code sample that reproduce this ?

      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
      • R Offline
        R Offline
        richard_h
        wrote on last edited by
        #3

        Thanks for the answer. Oh yes sorry. Here I have a little example which works on Qt 4.8.3 but not at Qt 5.3. I see that the test is running but I cant't see the label.

        @
        try {
        QLabel* pMain = new QLabel(0);
        pMain->setMinimumSize(480+25, 480+90);

          pMain->show();
        
          while (pMain->isVisible()) {
             QTest::qWait(50);
          }
        

        } catch (const std::exception &x) {
        // do something
        }
        @

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

          I can't say for sure why, but calling show and isVisible in a row without waiting, you where probably lucky with Qt 4.8 that it worked.

          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
          • R Offline
            R Offline
            richard_h
            wrote on last edited by
            #5

            I test this case, too. But has nothing changed.

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

              You can try qWaitForWindowExposed

              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
              • R Offline
                R Offline
                richard_h
                wrote on last edited by
                #7

                Thank you for your help. I fixed the problem now. I had an TestMain which executes the tests and there I set the qminimal plugin. Because of this I haven't seen the GUI.

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

                  You're welcome !

                  Nice you found a solution !

                  Since it's all working now please update the thread title prepending [solved] so other forum users may know a solution has been found :)

                  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