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. Connect() wont work!
Qt 6.11 is out! See what's new in the release blog

Connect() wont work!

Scheduled Pinned Locked Moved General and Desktop
16 Posts 5 Posters 5.7k 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.
  • dheerendraD Offline
    dheerendraD Offline
    dheerendra
    Qt Champions 2022
    wrote on last edited by
    #2

    Is lineEdit shown ? Did you enter some text in linEdit ? Put some debugs in slots and ensure that slot is indeed called. Here I don't see any issue at all with code.

    Dheerendra
    @Community Service
    Certified Qt Specialist
    http://www.pthinks.com

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #3

      Hi,

      Do you see any errors on runtime ?
      Is TextChanged(QString text) declared as a slot ?
      Try putting some debug statements in TextChanged(QString text) to check if the slot is entered.

      157

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

        Hi,

        One thing that looks wrong is your header name. Why is it Win.h and your class name Window ?

        In any case it's a bad idea to have a class with that name, it might easily clash with something on Windows

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

          no errors im not sure how to put debug but i google it now!

          SGaist: i made many projects with headerfiler name diffrent from class anme and it worked :\ i think they aren't support to be same :O

          i entered many texts hit enter re typed ttryed many things, text is shown in it!

          renamed them to window.h and .cpp still wont work, i get the pie chart correctly, and stats are correct, but my Slot wont be collect on text change or buttom push, tryed many diffrent Widgets and slots and items, non worked!

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kamhagh
            wrote on last edited by
            #6

            wait, i reopened QtCreator this time, and after re loading it now i get error:
            QObject::connect: No such slot QWidget::TextChanged(QString) in ..\PieChart\window.cpp:49

            i didnt used to.

            but i have the Text Changed slot in both .h and .cpp file, why is qtCreator making this error :o

            1 Reply Last reply
            0
            • ZlatomirZ Offline
              ZlatomirZ Offline
              Zlatomir
              wrote on last edited by
              #7

              The problem is the missing Q_OBJECT macro from the Window class declaration:
              @//...
              class Window : public QWidget
              {
              Q_OBJECT
              public:
              //...@

              https://forum.qt.io/category/41/romanian

              1 Reply Last reply
              0
              • K Offline
                K Offline
                kamhagh
                wrote on last edited by
                #8

                [quote author="Zlatomir" date="1403612099"]The problem is the missing Q_OBJECT macro from the Window class declaration:
                @//...
                class Window : public QWidget
                {
                Q_OBJECT
                public:
                //...@[/quote]

                silly mistake ! but still after including it it didnt work, still gives same error:

                QObject::connect: No such slot QWidget::TextChanged(QString) in ..\PieChart\window.cpp:49

                1 Reply Last reply
                0
                • ZlatomirZ Offline
                  ZlatomirZ Offline
                  Zlatomir
                  wrote on last edited by
                  #9

                  Make sure you renamed the files in the project file too, and run qmake and then build your project.

                  https://forum.qt.io/category/41/romanian

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    kamhagh
                    wrote on last edited by
                    #10

                    [quote author="Zlatomir" date="1403613053"]Make sure you renamed the files in the project file too, and run qmake and then build your project.[/quote]

                    i did but i always used the play green button on Qtcreator to make my projects im not sure what Qmake is

                    1 Reply Last reply
                    0
                    • ZlatomirZ Offline
                      ZlatomirZ Offline
                      Zlatomir
                      wrote on last edited by
                      #11

                      In the Build menu you have Run qmake use that and only after that build your project.

                      https://forum.qt.io/category/41/romanian

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        kamhagh
                        wrote on last edited by
                        #12

                        some weird thing:

                        i made another project exactly copy pasted the codes there, it didnt give the error but still didn't work,

                        now my old project wont work gives error:

                        C:\Qt\Qt5.3.0\Tools\QtCreator\bin\PieChart\window.h:10: error: undefined reference to `vtable for Window'

                        1 Reply Last reply
                        0
                        • K Offline
                          K Offline
                          kamhagh
                          wrote on last edited by
                          #13

                          06:03:53: Running steps for project PieChart...
                          06:03:53: Starting: "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\qmake.exe" C:\Qt\Qt5.3.0\Tools\QtCreator\bin\PieChart\PieChart.pro -r -spec win32-g++ "CONFIG+=debug"
                          06:03:54: The process "C:\Qt\Qt5.3.0\5.3\mingw482_32\bin\qmake.exe" exited normally.
                          06:03:54: Elapsed time: 00:00.

                          nothing happened

                          damn it why didn't it work:(

                          1 Reply Last reply
                          0
                          • dheerendraD Offline
                            dheerendraD Offline
                            dheerendra
                            Qt Champions 2022
                            wrote on last edited by
                            #14

                            please check with simple example of lineEdit. See how it works. I suggest you clean everything and rebuild your application. If you want to me to check send me the complete project. I can check and revert to you.

                            Dheerendra
                            @Community Service
                            Certified Qt Specialist
                            http://www.pthinks.com

                            1 Reply Last reply
                            0
                            • K Offline
                              K Offline
                              kamhagh
                              wrote on last edited by
                              #15

                              [quote author="Dheerendra" date="1403619438"]please check with simple example of lineEdit. See how it works. I suggest you clean everything and rebuild your application. If you want to me to check send me the complete project. I can check and revert to you.[/quote]

                              sorry my code is so long i can't send it:( (in a post)
                              i thought a lot nothing seems wrong , if you have time, how can i send it to you :(

                              1 Reply Last reply
                              0
                              • K Offline
                                K Offline
                                kamhagh
                                wrote on last edited by
                                #16

                                Ok i fixed the connect ! but problem is ,i can't use pie->clearPies() in the slot:( it doesn't do it when i change text, it only shows that slot is triggered

                                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