Jump to content

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


Cuq
Go to solution Solved by Cuq,

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

    • Solution
    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

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

    I'm sure there is a simplest solution, but nothing better for the moment.

     

    		width: childrenRect.width
    		height: !freeformButton.checked && !abutmentButton.checked  ? 0 : (abutmentButton.checked ? (UM.Theme.getSize("setting_control").height*2+UM.Theme.getSize("default_margin").height): childrenRect.height)
    		anchors.leftMargin: UM.Theme.getSize("default_margin").width
    		anchors.top: textfields.bottom
    		anchors.topMargin: UM.Theme.getSize("default_margin").height

     

  • 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
    • Our picks

      • UltiMaker Cura 5.7 stable released
        Cura 5.7 is here and it brings a handy new workflow improvement when using Thingiverse and Cura together, as well as additional capabilities for Method series printers, and a powerful way of sharing print settings using new printer-agnostic project files! Read on to find out about all of these improvements and more. 
         
          • Like
        • 18 replies
      • S-Line Firmware 8.3.0 was released Nov. 20th on the "Latest" firmware branch.
        (Sorry, was out of office when this released)

        This update is for...
        All UltiMaker S series  
        New features
         
        Temperature status. During print preparation, the temperatures of the print cores and build plate will be shown on the display. This gives a better indication of the progress and remaining wait time. Save log files in paused state. It is now possible to save the printer's log files to USB if the currently active print job is paused. Previously, the Dump logs to USB option was only enabled if the printer was in idle state. Confirm print removal via Digital Factory. If the printer is connected to the Digital Factory, it is now possible to confirm the removal of a previous print job via the Digital Factory interface. This is useful in situations where the build plate is clear, but the operator forgot to select Confirm removal on the printer’s display. Visit this page for more information about this feature.
          • Like
        • 0 replies
    ×
    ×
    • Create New...