Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Brainstorm
  4. Is it a good practice or good idea to have a stock of actions?

Is it a good practice or good idea to have a stock of actions?

Scheduled Pinned Locked Moved Solved Brainstorm
good practicedesign pattern
6 Posts 3 Posters 2.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.
  • R Offline
    R Offline
    remizero
    wrote on last edited by
    #1

    Hi my friends, today I come with the following questions.

    I am trying to create a basic structure type RCP but extensible by means of plugins for my applications and thus not having to copy and paste and modify some other things before starting a new project.

    The doubts are the following:

    1-. Is it a good practice or good idea to have a stock of actions for the application? (so there are actions that are needed in different contexts, but the exact same thing must be performed)
    2-. On the other hand and in the same order of ideas, it would be a good practice or good idea to work with a factory of actions (factory pattern)?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      QAction is meant for the exact use case of multiple ways
      for user to activate a command and at the same time make it easy to manage its
      status without having to manually handle all the different contexts.

      http://doc.qt.io/qt-5/qaction.html

      So if you mean if its ok to have a list actions to reuse for menus and toolsbars
      then yes, surely.

      Regarding the factory pattern. If you plan on subclassing QAction to add custom data or
      features so the contexts would be handed mixed types of QActions, it might make sense, but outside that , im not really sure what you would gain from it ?

      You plan that the plugins can ask MainApp about a list of Action or anything like that?

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

        Hi,

        Shouldn't rather your plugins provide a set of action to do whatever they provide ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        R 1 Reply Last reply
        3
        • mrjjM mrjj

          Hi
          QAction is meant for the exact use case of multiple ways
          for user to activate a command and at the same time make it easy to manage its
          status without having to manually handle all the different contexts.

          http://doc.qt.io/qt-5/qaction.html

          So if you mean if its ok to have a list actions to reuse for menus and toolsbars
          then yes, surely.

          Regarding the factory pattern. If you plan on subclassing QAction to add custom data or
          features so the contexts would be handed mixed types of QActions, it might make sense, but outside that , im not really sure what you would gain from it ?

          You plan that the plugins can ask MainApp about a list of Action or anything like that?

          R Offline
          R Offline
          remizero
          wrote on last edited by
          #4

          @mrjj
          Hello mrjj.

          For some plugins yes. I need to do what you ask me.

          1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            Shouldn't rather your plugins provide a set of action to do whatever they provide ?

            R Offline
            R Offline
            remizero
            wrote on last edited by
            #5

            @SGaist
            Hello SGaist.

            Yes, in effect, the plugins will provide that set of actions to do what they provide, but some plugins will require certain "global" actions of the application.

            1 Reply Last reply
            0
            • R Offline
              R Offline
              remizero
              wrote on last edited by
              #6

              Thank you very much for your answers, because they have been very useful to solve a problem within my application.

              1 Reply Last reply
              1

              • Login

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