Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. DRY with Actions in QtControls 2
QtWS25 Last Chance

DRY with Actions in QtControls 2

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
control 2actiondrybuttonmenuitem
1 Posts 1 Posters 486 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.
  • D Offline
    D Offline
    Devinder
    wrote on 7 Sept 2018, 14:49 last edited by Devinder 9 Jul 2018, 14:54
    #1

    Hello,

    I m fairly new and experimenting with the flavors of QT/QML, so please bare with me if I m not being clear.

    When using Qt Quick Controls 1._ I was able to figure out that using Action{} in QML, i can eliminate repeated code when trying to use Menu's (file, edit) and corresponding Toolbuttons. So The same Action was able to identify the icon for the toolbar, and the text with the & shortcut for the MenuItem.

    The action looked something like
    Action
    {
    id: newFileActionId
    text: qsTr("&file")
    iconSource: "url"
    onTriggered: Something.Done()

    }
    I am trying to do something similar using Qt QuickControls 2.3. The difference is that when i try to use the icon, the Text still shows up. I tried ditching icons all together, using a specialized font to create my icons. This works, but the Action Text seems to override the content inside my MenuItem or ToolButton. This is even true when i dont add the text property to Action. I looked at the QT TextEditor Example for QtControls 2, and even there, they just repeat the same commands. If someone knows how to get the DRY style like in QtQuickControls 1._ , I would really appreciate the instruction.

    Thank you.

    Ps: i have to use the msvc 2013 compiler and so am using Qt 5.10 for now.

    1 Reply Last reply
    0

    1/1

    7 Sept 2018, 14:49

    • Login

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