Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save UniversalSuperBox/07235b6845b7f4bfa796e607ca23a371 to your computer and use it in GitHub Desktop.
Save UniversalSuperBox/07235b6845b7f4bfa796e607ca23a371 to your computer and use it in GitHub Desktop.
A quick QML app that renders an icon with the same shape that the Drawer does, then takes a screenshot of it.
//Copyright 2021 Dalton Durst
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so.
//
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
import QtQuick 2.7
import Ubuntu.Components 1.3
MainView {
id: root
objectName: 'mainView'
applicationName: 'icons.dalton'
automaticOrientation: true
width: units.gu(45)
height: units.gu(75)
Rectangle {
anchors.fill: parent
opacity: 0
}
Item {
id: rendering
anchors.fill: parent
UbuntuShape {
opacity: 1
id : icon
width: units.gu(64)
height: units.gu(64)
relativeRadius: 0.3625
source: Image {
sourceSize.width: icon.width
source: "file:///usr/share/address-book-app/artwork/address-book-app.svg"
}
}
}
Timer {
interval: 1000
onTriggered: icon.grabToImage(function(result) {
result.saveToFile("/home/phablet/Pictures/wow.png");
})
running: true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment