Jump to content
Ultimaker Community of 3D Printing Experts

How to specify the Icon file in a UM.ToolbarButton QT6 ?


Cuq
 Share

Recommended Posts

Posted · How to specify the Icon file in a UM.ToolbarButton QT6 ?

Hello,

 

I'm trying to improve the look of my toolbar plugin interface, And I don't find the solution to specify the Icon File for a UM.Button ?

Actual code :

 

            Button
            {
                id: tubeButton;
                text: catalog.i18nc("@label", "Tube")
                display: AbstractButton.IconOnly
                width: UM.Theme.getSize("button").width
                height: UM.Theme.getSize("button").height	
                icon.source: "type_tube.svg"
                checkable:true
                onClicked: setSType('tube')
                checked: UM.ActiveTool.properties.getValue("SType") === 'tube'
                ToolTip.delay: 500
                ToolTip.timeout: 5000
                ToolTip.visible: hovered
                ToolTip.text: qsTr("Tube as custom support")
                z: 5 // Profondeur
            }

 

Expected new definition

 

            UM.ToolbarButton
            {
                id: tubeButton;
                text: catalog.i18nc("@label", "Tube")
                icon.source: "type_tube.svg"
                onClicked: setSType('tube')
                checked: UM.ActiveTool.properties.getValue("SType") === 'tube'
                z: 5 // Profondeur
            }

 

Any advice will be welcome

 

Cuq

  • Link to post
    Share on other sites

    Posted (edited) · How to specify the Icon file in a UM.ToolbarButton QT6 ?

    OK Got it !

     

    UM.ToolbarButton
    {
      id: customButton;
      text: catalog.i18nc("@label", "custom");
      toolItem: UM.ColorImage
      {
        source: Qt.resolvedUrl("type_custom.svg")
        color: UM.Theme.getColor("icon")
      }
      property bool needBorder: true;
      checkable:true;
      onClicked: setSType('custom');
      checked: UM.ActiveTool.properties.getValue("SType") === 'custom';
      z: 1; // Profondeur
    }

     

    Edited by Cuq
    • Like 1
    Link to post
    Share on other sites

    Posted · How to specify the Icon file in a UM.ToolbarButton QT6 ?

    I use the UM theme.  That looks fine to me.

    I do have some critiques though as I've used it quite a bit for blocking supports.  After you get it straightened out I'll look again at the re-worked version and send you a message.  Off the top of my head - I've never understood the Max Size box.

  • Link to post
    Share on other sites

    Posted · How to specify the Icon file in a UM.ToolbarButton QT6 ?
    13 minutes ago, GregValiant said:

    I've never understood the Max Size box.

     

    Max Size must be used with the Angle Parameter. If you specify a value for Angle this parameter will limit the size of your support to this dimension .

     

    Ie Max Size = 0 and Angle = 20°

    image.thumb.png.f9dc98be124e4bcbe8a878f1e9076c23.png

     

    A value of 30 mm will limite the diameter of the support.

     

    image.thumb.png.bd22163bbda57476ca114857681feb8c.png

  • Link to post
    Share on other sites

    Posted · How to specify the Icon file in a UM.ToolbarButton QT6 ?

    Compact Style :

    image.png.9103cc4e1ebc09f6e68ab92cb78315d5.png

  • Link to post
    Share on other sites

    Posted (edited) · How to specify the Icon file in a UM.ToolbarButton QT6 ?

    By The way I'm still fighting with this QML file , I have some difficulties to reduce this space when the CheckBox are not visible. That's certainly something stupid but as I'm not an expert If someone can give me an advice :

     

    The issue  this space 

    image.png.6182fc65ac0bf8e443b9f50f529bbd5c.png

     

    The source code : https://github.com/5axes/CustomSupportCylinder/blob/master/qml_qt6/CustomSupport.qml

    Edited by Cuq
  • Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    • Our picks

      • Ultimaker showcase | April 2022 | 4pm CEST | 10am EDT
        I'm excited because I've personally produced this showcase event, so if you are curious what else I'm up to nowadays, come check it out and say hi in the chat! It would mean a lot! 
        • 4 replies
      • New here? Get ahead with a free onboarding course
        Hi,
         
        Often getting started is the most difficult part of any process. A good start sets you up for success and saves you time and energy that could be spent elsewhere. That is why we have a onboarding course ready for
        Ultimaker S5 Pro Bundle, Ultimaker S5, Ultimaker S3 Ultimaker 2+ Connect.   
        They're ready for you on the Ultimaker Academy platform. All you need to do to gain access is to register your product to gain free access. 
        Ready? Register your product here in just 60 seconds.
        • 11 replies
    ×
    ×
    • Create New...