Results 1 to 3 of 3

Thread: Actions and what to do with them?

  1. #1
    Join Date
    Jan 2006
    Posts
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Windows

    Default Actions and what to do with them?

    The 4.1 designer lets you create actions. I can assign icons to the actions and then use them in the menu and toolbar. What does an action accomplish that a signal from a button, "clicked()" to a slot "handleClick()" doesn't do. The docs on QAction leave a lot to be desired. Does the action aid in the implementation of undo?

    I guess I am trying to get a grasp of the intent of QAction and QActionGroup.

    M

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Actions and what to do with them?

    Actions are meant to be put into a menu or a toolbar. You can't put a single button to the toolbar and the menu. You can do (and actually do) it with an action. It's just easier to operate on it. Comparing an action to a signal emitted from a button is some kind of newbie thing actions emit signals and buttons emit signals. You connect "slots" to both of them, so they have exactly the same capabilities of invoking slots. The difference is that you put actions into toolbars and menus and buttons on the form.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Actions and what to do with them?

    Suppose you have a lot of menu items, yet not every user needs all of them and different users need different set of menu items. I bet you would allow your users to customize menus, but how?

    You need a list of objects that describe all possible menu items. Such object would have to hold some text, an icon, tool tip, status tip, "What's this?" text, shortcut and some information about the method that must be called when the menu item is activated and so on.

    Which class you should use in such situation?

    PS. In fact there is no QMenuItem class in Qt 4 (except for Qt 3 Support module). Guess what class is there instead
    Last edited by jacek; 20th January 2006 at 23:10.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.