Created
January 10, 2020 15:38
-
-
Save sawaYch/5f5f2445ad00b1cff2a377bc9db0c039 to your computer and use it in GitHub Desktop.
QML svg antialiasing example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LogoImage { | |
| id: distroLogo | |
| Layout.minimumWidth: (implicitWidth < implicitHeight) ? 100*implicitWidth/implicitHeight : 100 | |
| Layout.minimumHeight: (implicitHeight < implicitWidth) ? 100*implicitHeight/implicitWidth : 100 | |
| Layout.preferredWidth: (Layout.fillWidth) ? Layout.minimumWidth : height * implicitWidth/implicitHeight | |
| Layout.preferredHeight: (Layout.fillHeight) ? Layout.minimumHeight : width * implicitHeight/implicitWidth | |
| Layout.fillWidth: (implicitWidth < implicitHeight) ? false: true | |
| Layout.fillHeight: !Layout.fillWidth | |
| Layout.alignment: Qt.AlignCenter | |
| image.source: "../" + Code.getStandardLogo(logo, osInfoItem.distroId) | |
| image.sourceSize.width: parent.width // This line is important | |
| image.sourceSize.height: parent.height // This line is important | |
| image.smooth:true // This line is important | |
| image.antialiasing: true // This line is important | |
| fillScale: plasmoid.configuration.logoScale | |
| onFillScaleChanged: if (fillScale !== plasmoid.configuration.logoScale) plasmoid.configuration.logoScale = fillScale | |
| MouseArea { | |
| anchors.fill: parent | |
| acceptedButtons: Qt.RightButton | |
| onClicked: logoPopup.open(mouse.x, mouse.y) | |
| } | |
| PlasmaComponents.ContextMenu { | |
| id: logoPopup | |
| PlasmaComponents.MenuItem { | |
| text: distroLogo.editMode ? i18n("Lock image scaling") : i18n("Unlock image scaling") | |
| onClicked: distroLogo.editMode = !distroLogo.editMode | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment