Muse.UiCmmponents 1.0

• Sep 23, 2024 - 13:58

You can perfectly make a plugin work with 4.4 without using Muse.UiComponents, but in case you'd like the built-in design I gathered some common Muse.Uicomponents that i coud figure out. Sharing them here for reference.

Obs. Rounded Radio has built-in text component but i couldnt make it work so i had to add a StyledTextLabel.

import QtQuick.Controls 2.15
import Muse.UiComponents 1.0

1. RoundedRadioButton
radio.jpg

        ButtonGroup{ id: radioGroup }
        Column {
            spacing:10            
            RoundedRadioButton{
                id: radio1                                  
                text: "text"
                ButtonGroup.group: radioGroup
            }      
            Row {                
                RoundedRadioButton{
                    id: radio2
                    text: "buttontext"
                    ButtonGroup.group: radioGroup
                }                
                StyledTextLabel{
                    leftPadding: 5
                    text: "text here"
                }            
            }
        }

2. checkBox
checkbox.jpg

    Column{
            spacing:10
            id:boxes
            CheckBox{
                id:checkbox1
                text: "text here..."
                onClicked: checked = !checked   
            }   
            CheckBox{
                id:checkbox2
                text: "text here..."    
                onClicked: checked = !checked
            }
        }

3. Standard buttons
okcancel.jpg

    ButtonBox {
        id: buttonBox       
        anchors.right: parent.right
        anchors.bottom: parent.bottom
        anchors.top: window.bottom
        anchors.margins: 10
        buttons: [ ButtonBoxModel.Cancel, ButtonBoxModel.Ok ]
 
        FlatButton {
            text:"some other button"
            //accentButton: true
            buttonRole: ButtonBoxModel.CustomRole
            buttonId: ButtonBoxModel.CustomButton + 1
            //isLeftSide: true
            onClicked: {
                //somefunction()
            }
        }
        onStandardButtonClicked: function(buttonId) {
            if (buttonId === ButtonBoxModel.Cancel) {
               quit()
            } else if (buttonId === ButtonBoxModel.Ok) {
                //somefunction()
            }
        }
    }

4. IncrementalPropertyControl
counter.jpg

    Row{
            spacing: 12            
             StyledTextLabel {
                id: titleLabel
               // width: root.columnWidth
                anchors.verticalCenter: parent.verticalCenter
                text: " text here: "
                //horizontalAlignment: Qt.AlignLeft
                //wrapMode: Text.WordWrap
                maximumLineCount: 2
            }
            IncrementalPropertyControl {
                id: rounding
                implicitWidth: 60
                step: 1
                minValue: 0
                maxValue: 2
                decimals: 0
                currentValue: 0
                onValueEdited: function(newValue) {currentValue = newValue}
            }
        }

5.Dropdown
dropdown.jpg

    Row{
            spacing: 12
            StyledTextLabel {               
                text: "text here.."                
            }
            StyledDropdown {
                id: comboBox    
                //width: 60  //optional
                currentIndex: 1 
                model: ["Option 0", "Option 1" ,  "Option 2"]
                onActivated: function(index, value) { currentIndex = index }
            }
        }

6. Popup Dialog
warning.jpg

    ApplicationWindow {
        id: errorDialog
        title: "WARNING!"
        property var msg: "Warning message here."
        visible: false
        flags: Qt.Dialog | Qt.WindowStaysOnTopHint
        // Qt.WindowStaysOnTopHint => dialog always on top
        // Qt.FramelessWindowHint  => dialog without title bar
        width: 320
        height: 100        
 
        StyledTextLabel {
            text: errorDialog.msg            
            anchors{
                top: parent.top 
                horizontalCenter: parent.horizontalCenter                
                margins:20 
            } 
        }
        FlatButton {            
            accentButton: true
            text: "Ok!"
            anchors{
                horizontalCenter: parent.horizontalCenter
                bottom: parent.bottom
                margins: 10
            }             
            onClicked: errorDialog.close()            
        }        
    } 

note: open dialog by "errorDialog.show()"

7. Horizontal separator line
separator.jpg

SeparatorLine { //orientation: Qt.Vertical 
        }

Comments

In reply to by SilverGreen93

right! i couldnt figure out why that is and how to make it work. Hopefully someone figures this out and shares how to do it.

Another issue i had was with the text component of RoundedRadioButton. It seems that is has a text component (just like the checkbox but the text doesnt appear for some reason...

In reply to by SilverGreen93

Awesome! i'll add that to the original post. I also noticed you dont need to encapsulate checked = !checked inside a function def.
Thanks!

Let me know if you ficgure out how to enable the text element in the RoundedRadioButton or if you have a new element to be added to the list.

Do you still have an unanswered question? Please log in first to post your question.