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. findObject equivalent
Forum Updated to NodeBB v4.3 + New Features

findObject equivalent

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 366 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by
    #1

    I'm using Qt 4.8, is there a call equivalent to findObject ?

    Kind Regards,
    Sy

    J.HilkJ 1 Reply Last reply
    0
    • SPlattenS SPlatten

      @J-Hilk , trying to use that with:

      if ( parent ! =NULL ) {
          pOverallTab = qobject_cast<QWidget*>(parent->findChild("overall_tab"));
      }
      

      And getting compile errors:

      error: no matching function for call to `QWidget::findChild(const char[12])'
      
      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #5

      @SPlatten its a template function!

      You use it like this:

      findChild<QPushButton *>("button1");
      

      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      3
      • SPlattenS SPlatten

        I'm using Qt 4.8, is there a call equivalent to findObject ?

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #2

        @SPlatten findChild has been in Qt since the very beginning


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        JonBJ SPlattenS 2 Replies Last reply
        2
        • J.HilkJ J.Hilk

          @SPlatten findChild has been in Qt since the very beginning

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #3

          @J-Hilk
          Yes, and there never has been any findObject()....

          1 Reply Last reply
          0
          • J.HilkJ J.Hilk

            @SPlatten findChild has been in Qt since the very beginning

            SPlattenS Offline
            SPlattenS Offline
            SPlatten
            wrote on last edited by
            #4

            @J-Hilk , trying to use that with:

            if ( parent ! =NULL ) {
                pOverallTab = qobject_cast<QWidget*>(parent->findChild("overall_tab"));
            }
            

            And getting compile errors:

            error: no matching function for call to `QWidget::findChild(const char[12])'
            

            Kind Regards,
            Sy

            J.HilkJ 1 Reply Last reply
            0
            • SPlattenS SPlatten

              @J-Hilk , trying to use that with:

              if ( parent ! =NULL ) {
                  pOverallTab = qobject_cast<QWidget*>(parent->findChild("overall_tab"));
              }
              

              And getting compile errors:

              error: no matching function for call to `QWidget::findChild(const char[12])'
              
              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #5

              @SPlatten its a template function!

              You use it like this:

              findChild<QPushButton *>("button1");
              

              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              1 Reply Last reply
              3

              • Login

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