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. prototype of signal QAction::triggered

prototype of signal QAction::triggered

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

    After testing, both proto types of QAction::triggered as below work
    void QAction::triggered(bool checked = false)
    void QAction::triggered()

    But only the former is documented in the doc of QAction.
    What about the latter one?

    jsulmJ 1 Reply Last reply
    0
    • jronaldJ jronald

      @jsulm said in prototype of signal QAction::triggered:

      @jronald There is only https://doc.qt.io/qt-5/qaction.html#triggered
      But since checked has a default value you can call triggered() without parameter (parameter will have false as value in this case).

      But the handler is like void on_actionOpen_triggered() (auto generated by the designer) instead of void on_actionOpen_triggered(bool checked = false).
      Is it legal?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @jronald said in prototype of signal QAction::triggered:

      Is it legal?

      Yes, it is fine if the slot has fewer parameters than signal (but not other way around!).

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

      1 Reply Last reply
      2
      • jronaldJ jronald

        After testing, both proto types of QAction::triggered as below work
        void QAction::triggered(bool checked = false)
        void QAction::triggered()

        But only the former is documented in the doc of QAction.
        What about the latter one?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @jronald There is only https://doc.qt.io/qt-5/qaction.html#triggered
        But since checked has a default value you can call triggered() without parameter (parameter will have false as value in this case).

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

        jronaldJ 1 Reply Last reply
        3
        • jsulmJ jsulm

          @jronald There is only https://doc.qt.io/qt-5/qaction.html#triggered
          But since checked has a default value you can call triggered() without parameter (parameter will have false as value in this case).

          jronaldJ Offline
          jronaldJ Offline
          jronald
          wrote on last edited by jronald
          #3

          @jsulm said in prototype of signal QAction::triggered:

          @jronald There is only https://doc.qt.io/qt-5/qaction.html#triggered
          But since checked has a default value you can call triggered() without parameter (parameter will have false as value in this case).

          But the handler is like void on_actionOpen_triggered() (auto generated by the designer) instead of void on_actionOpen_triggered(bool checked = false).
          Is it legal?

          jsulmJ J.HilkJ 2 Replies Last reply
          0
          • jronaldJ jronald

            @jsulm said in prototype of signal QAction::triggered:

            @jronald There is only https://doc.qt.io/qt-5/qaction.html#triggered
            But since checked has a default value you can call triggered() without parameter (parameter will have false as value in this case).

            But the handler is like void on_actionOpen_triggered() (auto generated by the designer) instead of void on_actionOpen_triggered(bool checked = false).
            Is it legal?

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @jronald said in prototype of signal QAction::triggered:

            Is it legal?

            Yes, it is fine if the slot has fewer parameters than signal (but not other way around!).

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

            1 Reply Last reply
            2
            • jronaldJ jronald

              @jsulm said in prototype of signal QAction::triggered:

              @jronald There is only https://doc.qt.io/qt-5/qaction.html#triggered
              But since checked has a default value you can call triggered() without parameter (parameter will have false as value in this case).

              But the handler is like void on_actionOpen_triggered() (auto generated by the designer) instead of void on_actionOpen_triggered(bool checked = false).
              Is it legal?

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

              @jronald do yourself a favour and do not use the connectSlotByName (void on_<object name>_<signal name>(<signal parameters>);) feature, but rather use the Qt5 connect syntax and connect signals to slots by hand

              https://doc.qt.io/qt-5/qmetaobject.html#connectSlotsByName

              https://wiki.qt.io/New_Signal_Slot_Syntax
              https://doc.qt.io/qt-5/signalsandslots.html

              its far less error prone


              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
              4

              • Login

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