Add method findImage
Qt QuickControls require an abosolute path to the image
This commit is contained in:
parent
2431da8222
commit
fc662d175d
3 changed files with 14 additions and 3 deletions
|
@ -175,3 +175,8 @@ void EffectView::loadKWinEffects(const QHash<QString, bool> &effectsChanged) {
|
||||||
QDBusConnection::sessionBus().send(messageUnloadEffect);
|
QDBusConnection::sessionBus().send(messageUnloadEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString EffectView::findImage(const QString &imagePath, int size) {
|
||||||
|
const QString relativePath("icons/oxygen/" + QString::number(size) + 'x' + QString::number(size) + '/' + imagePath);
|
||||||
|
const QString fullImagePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, relativePath, QStandardPaths::LocateFile);
|
||||||
|
return fullImagePath;
|
||||||
|
}
|
||||||
|
|
|
@ -77,6 +77,7 @@ public:
|
||||||
Q_INVOKABLE void effectStatus(const QString &effectName, bool status);
|
Q_INVOKABLE void effectStatus(const QString &effectName, bool status);
|
||||||
Q_INVOKABLE bool isEnabled(const QString &effectName);
|
Q_INVOKABLE bool isEnabled(const QString &effectName);
|
||||||
Q_INVOKABLE void syncConfig();
|
Q_INVOKABLE void syncConfig();
|
||||||
|
Q_INVOKABLE QString findImage(const QString &imagePath, int size = 128);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QHash<QString, bool> m_effectStatus;
|
QHash<QString, bool> m_effectStatus;
|
||||||
|
|
|
@ -69,7 +69,7 @@ Component {
|
||||||
visible: false
|
visible: false
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "Author: " + model.AuthorName + "\n" + "License" + model.License
|
text: "Author: " + model.AuthorName + "\n" + "License: " + model.License
|
||||||
font.bold: true
|
font.bold: true
|
||||||
}
|
}
|
||||||
PropertyAnimation {id: animationAbout; target: aboutItem; property: "visible"; to: !aboutItem.visible}
|
PropertyAnimation {id: animationAbout; target: aboutItem; property: "visible"; to: !aboutItem.visible}
|
||||||
|
@ -90,7 +90,9 @@ Component {
|
||||||
id: configureButton
|
id: configureButton
|
||||||
anchors.left: effectItem.right
|
anchors.left: effectItem.right
|
||||||
visible: effectConfig.effectUiConfigExists(model.Name)
|
visible: effectConfig.effectUiConfigExists(model.Name)
|
||||||
text: "CONFIGURE EFFECT"
|
iconSource: engineObject.findImage("actions/configure.png")
|
||||||
|
width: 50
|
||||||
|
height: 25
|
||||||
enabled: myCheckBox.checked
|
enabled: myCheckBox.checked
|
||||||
onClicked: {
|
onClicked: {
|
||||||
effectConfig.openConfig(model.Name);
|
effectConfig.openConfig(model.Name);
|
||||||
|
@ -100,7 +102,10 @@ Component {
|
||||||
Button {
|
Button {
|
||||||
id: aboutButton
|
id: aboutButton
|
||||||
anchors.left: configureButton.right
|
anchors.left: configureButton.right
|
||||||
text: "ABOUT UI BUTTON"
|
width: 50
|
||||||
|
height: 25
|
||||||
|
iconSource: engineObject.findImage("status/dialog-information.png");
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
animationAbout.running = true;
|
animationAbout.running = true;
|
||||||
animationAboutSpacing.running = true;
|
animationAboutSpacing.running = true;
|
||||||
|
|
Loading…
Reference in a new issue