Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. accessing the QPushButton of QWindow
Qt 6.12 LTS is out! See what's new in the release blog

accessing the QPushButton of QWindow

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 698 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.
  • H Offline
    H Offline
    Het Aghera
    wrote on last edited by
    #1

    Hi all,
    I have one Qt destkop application in which I am having one QWindow with some QlineEdits and QPushButtons. I am this app I am using .exec() function to show my window. Now I have to write QTest to check the functionality of the QPushButton which is used in that window. Here is one issue that I am using .exec() function so it will go in a loop and it not execute the main thread until I close the window. So I want to ask that is there any way to access the QPushButton in the QTest while that window in executed.

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

      Hi and welcome to devnet,

      Did you already read this tutorial in Qt's documentation ?

      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
      • H Offline
        H Offline
        Het Aghera
        wrote on last edited by
        #3

        Yes I have already read the documentation but there nothing related to my query.

        SGaistS 1 Reply Last reply
        0
        • H Het Aghera

          Yes I have already read the documentation but there nothing related to my query.

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          So it's a good start. Usually, when designing a widget such as a dialog, it should be usable without calling exec but using the open method. Hence my recommendation would be to ensure that yours can be used with open to make it properly testable.

          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
          • H Offline
            H Offline
            Het Aghera
            wrote on last edited by
            #5

            Hi
            Thank you for your suggestion, So, you telling about show() method or you taking about some other method.
            So in my case I am using exec() to open the window because it will enter in a new loop and won't allow the main thread to execute further code until you close the window. I am using this because I don't want the user do something else while this window is open. So now I want to test this window.

            SGaistS 1 Reply Last reply
            0
            • H Het Aghera

              Hi
              Thank you for your suggestion, So, you telling about show() method or you taking about some other method.
              So in my case I am using exec() to open the window because it will enter in a new loop and won't allow the main thread to execute further code until you close the window. I am using this because I don't want the user do something else while this window is open. So now I want to test this window.

              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              No, not show, open which allows to have the same blocking effect as exec without requiring a second event loop.

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