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. Need a little help with QPushButton & connect

Need a little help with QPushButton & connect

Scheduled Pinned Locked Moved Solved General and Desktop
qpushbuttonconnect
35 Posts 5 Posters 12.3k Views
  • 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.
  • M Offline
    M Offline
    mrmorph
    wrote on 22 Nov 2015, 23:17 last edited by mrmorph
    #21

    Not sure about that signal, I had a look through what's in dzscene.h and it all seems to be to do with loading models, cameras and the general interface.

    I wondered if it might have a global loop too, that makes some sense to me.

    The button animates yes and the radio boxes work too.

    "also, could you move connect over "showpane"" - Nope, still does not work....

    http://i799.photobucket.com/albums/yy275/Rogad/hmmm_zpseuusbmw5.png

    The samples given in the SDK work yes. There's only one that really does what I am trying to do. Basically it just shows details about what's in the scene, like polygon count and things like that. There's a sort of tree structure that you can use to select models in the scene. Unfortunately it does not have any buttons or similar for me to work by.

    The sample that works with connect uses QTextBrowser and it clearly seems to connect okay as it works - when you click on something in the scene you get the details updated.

    M 1 Reply Last reply 22 Nov 2015, 23:30
    0
    • M mrmorph
      22 Nov 2015, 23:17

      Not sure about that signal, I had a look through what's in dzscene.h and it all seems to be to do with loading models, cameras and the general interface.

      I wondered if it might have a global loop too, that makes some sense to me.

      The button animates yes and the radio boxes work too.

      "also, could you move connect over "showpane"" - Nope, still does not work....

      http://i799.photobucket.com/albums/yy275/Rogad/hmmm_zpseuusbmw5.png

      The samples given in the SDK work yes. There's only one that really does what I am trying to do. Basically it just shows details about what's in the scene, like polygon count and things like that. There's a sort of tree structure that you can use to select models in the scene. Unfortunately it does not have any buttons or similar for me to work by.

      The sample that works with connect uses QTextBrowser and it clearly seems to connect okay as it works - when you click on something in the scene you get the details updated.

      M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 22 Nov 2015, 23:30 last edited by
      #22

      @mrmorph
      Ok,i'm 99.9% sure that event loop is running as
      MessageBox can be clicked and button animate etc.

      Also, if you make a normal qt project, it just works? Im asking if you setup Visual Studio so it runs the
      extra moc tool. etc. As moc.exe makes slot / signals work.
      But if normale example works, I guess all fine in setup.

      QMetaObject::connectSlotsByName(this);
      Is that from sample?
      Not that is should do anything bad.

      have you tried to hook up anything else? like the radio buttons?
      I am out of ideas why button wont work. seems perfectly fine.
      Normally one can see a warning in Creator, application output when connect fails.
      but with DLL, im not sure as it is not run in creator.

      1 Reply Last reply
      1
      • M Offline
        M Offline
        mrmorph
        wrote on 22 Nov 2015, 23:38 last edited by
        #23

        I can't run this as a normal Qt project, it just own't work standalone. But I will make a new project in Qt Creator and make a form to see how the buttons work and what code it makes. Maybe I can use that.

        I did use QtCreator a bit though to start it off. There is a moc file, but I don't know what to do with it, not sure how to add the moc file to Visual Studio Express. Maybe that's it.

        QMetaObject::connectSlotsByName(this); - no sorry that should not be there, that was from an earlier attempt, I have removed it now, but it had no effect anyway.

        I tried to get radio buttons to work too, but they would not either.

        I think you might be onto something with the moc file - I wasn't sure if I even needed that. I am using Visual Studio Express, so I'll have to find out how to use moc files then and try that.

        M 1 Reply Last reply 22 Nov 2015, 23:42
        0
        • M mrmorph
          22 Nov 2015, 23:38

          I can't run this as a normal Qt project, it just own't work standalone. But I will make a new project in Qt Creator and make a form to see how the buttons work and what code it makes. Maybe I can use that.

          I did use QtCreator a bit though to start it off. There is a moc file, but I don't know what to do with it, not sure how to add the moc file to Visual Studio Express. Maybe that's it.

          QMetaObject::connectSlotsByName(this); - no sorry that should not be there, that was from an earlier attempt, I have removed it now, but it had no effect anyway.

          I tried to get radio buttons to work too, but they would not either.

          I think you might be onto something with the moc file - I wasn't sure if I even needed that. I am using Visual Studio Express, so I'll have to find out how to use moc files then and try that.

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 22 Nov 2015, 23:42 last edited by mrjj
          #24

          @mrmorph
          aha, studio express. so you are not using the qt plugins.
          Im not so deep into using visual studio but I know sometimes its need to manually add compile step to run
          moc.exe tool that generate meta info for qt signal system etc.
          .
          Test by 1:delete all moc files. and clean build folder.
          then rebuild all. if moc files comes back, all ok. if not
          then its using the moc file from long time ago and might not know about your slot. (dothis)

          http://stackoverflow.com/questions/15465932/using-qt-with-visual-studio-without-add-in

          Note: Im not 100% in what cases moc are run as using creator its automatic.

          its just a tool so you can run it by hand
          http://doc.qt.io/qt-5.5/moc.html

          if its not running moc.exe, it would explain the strangeness :)

          1 Reply Last reply
          1
          • M Offline
            M Offline
            mrmorph
            wrote on 22 Nov 2015, 23:49 last edited by
            #25

            Ok thanks I'll give that a go then.

            I need to get some sleep, so I will do it tomorrow.

            Many thanks for taking the time to help me, it's much appreciated :)

            Take care,

            Rog.

            M 1 Reply Last reply 22 Nov 2015, 23:50
            0
            • M mrmorph
              22 Nov 2015, 23:49

              Ok thanks I'll give that a go then.

              I need to get some sleep, so I will do it tomorrow.

              Many thanks for taking the time to help me, it's much appreciated :)

              Take care,

              Rog.

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 22 Nov 2015, 23:50 last edited by mrjj
              #26

              @mrmorph
              well same here.
              My money is on moc files :)
              you are welcome.
              Take care too

              Just for test i used your code as QDialog and button just worked
              http://postimg.org/image/7rjevwz15/

              1 Reply Last reply
              1
              • J Offline
                J Offline
                JKSH
                Moderators
                wrote on 22 Nov 2015, 23:59 last edited by
                #27

                @mrmorph said:

                I think you might be onto something with the moc file - I wasn't sure if I even needed that. I am using Visual Studio Express, so I'll have to find out how to use moc files then and try that.

                You definitely need moc. All of the features listed at http://doc.qt.io/qt-5/metaobjects.html (including signals and slots) require moc to work.

                VS Express is rather limiting. What version of VS are you using? Are you able to switch to Visual Studio Community Edition instead? If so, you'll be able to use the Qt Visual Studio Add-In, which makes your life much much easier. See http://doc.qt.io/vs-addin/

                Or, even better, could you use Qt Creator to develop your plug-in? Qt Creator can use the Visual Studio compiler.

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                1 Reply Last reply
                1
                • M Offline
                  M Offline
                  mrmorph
                  wrote on 23 Nov 2015, 00:06 last edited by mrmorph
                  #28

                  I thought what the heck I will spend a minute seeing what was going on.

                  Like I said I started building it in Qt Creator, then moved it over to Visual Studio, but kept it all in one folder.

                  So I remembered I could load it all up in Qt Creator still. So I re-built it in Qt to get the C++ source files and then I built those in Visual Studio.

                  Anyway, Qt Creator rebuilt the moc and it worked :)

                  http://i799.photobucket.com/albums/yy275/Rogad/misc/yay_zpsabp2qac2.png

                  So big thanks to you for narrowing it down to this. I have to remember to get Creator to rebuild the moc file when I add slots.

                  Very happy, thank you very much :)

                  EDIT : Ahh and I see you got it to work right too.

                  Hi JKSH,

                  Thanks for that. Yes I am using Community, sorry I've been using the name Express for so long, I just auto-typed it.

                  And I am using Qt Creator as mentioned above. I'll take a look at the Qt Visual Studio Add-In tomorrow, thanks.

                  Cheers both, so nice to nail that one.

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 23 Nov 2015, 00:07 last edited by
                    #29

                    \o/
                    it was a sneaky one :)

                    1 Reply Last reply
                    1
                    • M Offline
                      M Offline
                      mrmorph
                      wrote on 23 Nov 2015, 12:07 last edited by
                      #30

                      @JKSH said:

                      Qt Visual Studio Add-In

                      HI again, just tried this but it says it did not find anything compatible. I tried the Qt4 version because I am using Qt 4.8.1 and I tried the Qt5 version but neither install. Perhaps I downloaded the wrong ones.

                      Also, I can't figure out how to make this topic solved.

                      Many thanks.

                      M 1 Reply Last reply 23 Nov 2015, 12:08
                      0
                      • M mrmorph
                        23 Nov 2015, 12:07

                        @JKSH said:

                        Qt Visual Studio Add-In

                        HI again, just tried this but it says it did not find anything compatible. I tried the Qt4 version because I am using Qt 4.8.1 and I tried the Qt5 version but neither install. Perhaps I downloaded the wrong ones.

                        Also, I can't figure out how to make this topic solved.

                        Many thanks.

                        M Offline
                        M Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on 23 Nov 2015, 12:08 last edited by
                        #31

                        @mrmorph
                        hi
                        use the Topic Tools button to mark as Solved.
                        its sort of below topic (first one) and to the right.

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          mrmorph
                          wrote on 23 Nov 2015, 12:21 last edited by
                          #32

                          Yep tried that, all I see is this...

                          http://i799.photobucket.com/albums/yy275/Rogad/hmm_zpsgkxjvof6.png

                          M 1 Reply Last reply 23 Nov 2015, 12:24
                          0
                          • M mrmorph
                            23 Nov 2015, 12:21

                            Yep tried that, all I see is this...

                            http://i799.photobucket.com/albums/yy275/Rogad/hmm_zpsgkxjvof6.png

                            M Offline
                            M Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on 23 Nov 2015, 12:24 last edited by mrjj
                            #33

                            @mrmorph
                            hi its not the gear
                            its near reply button and sort by.

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              mrmorph
                              wrote on 23 Nov 2015, 12:30 last edited by
                              #34

                              Got it, sorry I was looking in the wrong place, thanks.

                              M 1 Reply Last reply 23 Nov 2015, 12:35
                              1
                              • M mrmorph
                                23 Nov 2015, 12:30

                                Got it, sorry I was looking in the wrong place, thanks.

                                M Offline
                                M Offline
                                mrjj
                                Lifetime Qt Champion
                                wrote on 23 Nov 2015, 12:35 last edited by
                                #35

                                @mrmorph
                                well you are NOT the first to not see it.

                                1 Reply Last reply
                                0

                                30/35

                                23 Nov 2015, 12:07

                                • Login

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