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. can create a user-defined signals static?Or Changing the value of a variable to make sure that the function?

can create a user-defined signals static?Or Changing the value of a variable to make sure that the function?

Scheduled Pinned Locked Moved General and Desktop
changevaluechangedfunctionsignals emit
9 Posts 2 Posters 2.9k 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.
  • F Offline
    F Offline
    ForestPoem
    wrote on 9 Sept 2015, 07:37 last edited by ForestPoem 9 Sept 2015, 07:56
    #1
    This post is deleted!
    1 Reply Last reply
    0
    • J Online
      J Online
      jsulm
      Lifetime Qt Champion
      wrote on 9 Sept 2015, 08:15 last edited by
      #2

      I don't really get what you want to do. Do you want to connect a signal to a slot in the same class (this is possible)?
      What do you mean by "keep a thread"?
      Signals cannot be static.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • J Online
        J Online
        jsulm
        Lifetime Qt Champion
        wrote on 9 Sept 2015, 08:17 last edited by
        #3

        One more comment: you do not define a signal, you only declare it in your class (the body of the signal is created by the moc meta compiler). So, this is wrong:
        void Widget::tick()
        {
        QMetaObject::activate(this, &staticMetaObject, 0, 0);
        }

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        F 1 Reply Last reply 9 Sept 2015, 08:23
        0
        • J jsulm
          9 Sept 2015, 08:17

          One more comment: you do not define a signal, you only declare it in your class (the body of the signal is created by the moc meta compiler). So, this is wrong:
          void Widget::tick()
          {
          QMetaObject::activate(this, &staticMetaObject, 0, 0);
          }

          F Offline
          F Offline
          ForestPoem
          wrote on 9 Sept 2015, 08:23 last edited by
          #4

          @jsulm

          Want to send a signal to the other classes.

          J 1 Reply Last reply 9 Sept 2015, 08:43
          0
          • F ForestPoem
            9 Sept 2015, 08:23

            @jsulm

            Want to send a signal to the other classes.

            J Online
            J Online
            jsulm
            Lifetime Qt Champion
            wrote on 9 Sept 2015, 08:43 last edited by
            #5

            @ForestPoem Then declare the signal in the class which is going to emit this signal. Create an instance of this class and connect the signals to the slots of all the other instances of other classes.
            Is there a special reason why you wanted a static signal?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            F 1 Reply Last reply 9 Sept 2015, 08:57
            0
            • J jsulm
              9 Sept 2015, 08:43

              @ForestPoem Then declare the signal in the class which is going to emit this signal. Create an instance of this class and connect the signals to the slots of all the other instances of other classes.
              Is there a special reason why you wanted a static signal?

              F Offline
              F Offline
              ForestPoem
              wrote on 9 Sept 2015, 08:57 last edited by
              #6

              @jsulm
              thanks you,
              To use a static function. Coding in the B class A class when you try to use the function.

              1 Reply Last reply
              0
              • J Online
                J Online
                jsulm
                Lifetime Qt Champion
                wrote on 9 Sept 2015, 09:22 last edited by
                #7

                Well, you can call the static method in a non static slot :-)

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                F 1 Reply Last reply 10 Sept 2015, 05:16
                0
                • J jsulm
                  9 Sept 2015, 09:22

                  Well, you can call the static method in a non static slot :-)

                  F Offline
                  F Offline
                  ForestPoem
                  wrote on 10 Sept 2015, 05:16 last edited by
                  #8

                  @jsulm Then change the value property to determine the signal or event that occurs?

                  J 1 Reply Last reply 10 Sept 2015, 05:20
                  0
                  • F ForestPoem
                    10 Sept 2015, 05:16

                    @jsulm Then change the value property to determine the signal or event that occurs?

                    J Online
                    J Online
                    jsulm
                    Lifetime Qt Champion
                    wrote on 10 Sept 2015, 05:20 last edited by
                    #9

                    @ForestPoem In the slot you know which signal was emitted (the one you connected it to), you can even get the pointer to the object which emitted the signal using sender()

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0

                    1/9

                    9 Sept 2015, 07:37

                    • Login

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