From 5dd4b511511fc07aef7fd1baa8eef16f577827ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Thu, 6 Feb 2014 00:56:50 +0100 Subject: [PATCH 01/10] Plasma::Theme gets API for KWS' background contrast effect From its api docs: This method allows Plasma to enable and disable the background contrast effect for a given theme, improving readability. The value is read from the "enabled" key in the "ContrastEffect" group in the Theme's metadata file. The configuration in the metadata.desktop file of the theme could look like this (for a lighter background): [ContrastEffect] enabled=true contrast=0.45 intensity=0.45 saturation=1.7 --- src/plasma/private/theme_p.cpp | 18 ++++++++++++- src/plasma/private/theme_p.h | 6 +++++ src/plasma/theme.cpp | 20 +++++++++++++++ src/plasma/theme.h | 47 ++++++++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+), 1 deletion(-) diff --git a/src/plasma/private/theme_p.cpp b/src/plasma/private/theme_p.cpp index 66dc8f64e..b0017bbe6 100644 --- a/src/plasma/private/theme_p.cpp +++ b/src/plasma/private/theme_p.cpp @@ -64,7 +64,8 @@ ThemePrivate::ThemePrivate(QObject *parent) blurActive(false), isDefault(true), useGlobal(true), - hasWallpapers(false) + hasWallpapers(false), + backgroundContrastEnabled(true) { ThemeConfig config; cacheTheme = config.cacheTheme(); @@ -521,6 +522,20 @@ void ThemePrivate::processWallpaperSettings(KConfigBase *metadata) defaultWallpaperHeight = cg.readEntry("defaultHeight", DEFAULT_WALLPAPER_HEIGHT); } +void ThemePrivate::processContrastSettings(KConfigBase* metadata) +{ + KConfigGroup cg; + if (metadata->hasGroup("ContrastEffect")) { + cg = KConfigGroup(metadata, "ContrastEffect"); + backgroundContrastEnabled = cg.readEntry("enabled", false); + backgroundContrast = cg.readEntry("contrast", 0.45); + backgroundIntensity = cg.readEntry("contrast", 0.45); + backgroundSaturation = cg.readEntry("saturation", 1.7); + } else { + backgroundContrastEnabled = false; + } +} + void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings) { QString theme = tempThemeName; @@ -570,6 +585,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings pluginInfo = KPluginInfo(metadataPath); processWallpaperSettings(&metadata); + processContrastSettings(&metadata); KConfigGroup cg(&metadata, "Settings"); QString fallback = cg.readEntry("FallbackTheme", QString()); diff --git a/src/plasma/private/theme_p.h b/src/plasma/private/theme_p.h index 9fea9d2e5..291ce33a6 100644 --- a/src/plasma/private/theme_p.h +++ b/src/plasma/private/theme_p.h @@ -78,6 +78,7 @@ public: bool useCache(); void setThemeName(const QString &themeName, bool writeSettings); void processWallpaperSettings(KConfigBase *metadata); + void processContrastSettings(KConfigBase *metadata); const QString processStyleSheet(const QString &css); const QString svgStyleSheet(); @@ -146,6 +147,11 @@ public: bool useGlobal : 1; bool hasWallpapers : 1; bool cacheTheme : 1; + + qreal backgroundContrast; + qreal backgroundIntensity; + qreal backgroundSaturation; + bool backgroundContrastEnabled; }; } diff --git a/src/plasma/theme.cpp b/src/plasma/theme.cpp index e2632eabb..aba84d58b 100644 --- a/src/plasma/theme.cpp +++ b/src/plasma/theme.cpp @@ -540,6 +540,26 @@ QSizeF Theme::mSize(const QFont &font) const return QFontMetrics(font).boundingRect("M").size(); } +bool Theme::backgroundContrastEnabled() const +{ + return d->backgroundContrastEnabled; +} + +qreal Theme::backgroundContrast() const +{ + return d->backgroundContrast; +} + +qreal Theme::backgroundIntensity() const +{ + return d->backgroundIntensity; +} + +qreal Theme::backgroundSaturation() const +{ + return d->backgroundSaturation; +} + } diff --git a/src/plasma/theme.h b/src/plasma/theme.h index 813df15aa..42677fb1b 100644 --- a/src/plasma/theme.h +++ b/src/plasma/theme.h @@ -420,6 +420,53 @@ class PLASMA_EXPORT Theme : public QObject */ QColor viewFocusColor() const; + /** This method allows Plasma to enable and disable the background + * contrast effect for a given theme, improving readability. The + * value is read from the "enabled" key in the "ContrastEffect" + * group in the Theme's metadata file. + * The configuration in the metadata.desktop file of the theme + * could look like this (for a lighter background): + * \code + * [ContrastEffect] + * enabled=true + * contrast=0.45 + * intensity=0.45 + * saturation=1.7 + * \endcode + * @return Whether or not to enable the contrasteffect + * @since 5.0 + */ + bool backgroundContrastEnabled() const; + + /** This method allows Plasma to set a background contrast effect + * for a given theme, improving readability. The value is read + * from the "contrast" key in the "ContrastEffect" group in the + * Theme's metadata file. + * @return The contrast provided to the contrasteffect + * @since 5.0 + * @see backgroundContrastEnabled + */ + qreal backgroundContrast() const; + + /** This method allows Plasma to set a background contrast effect + * for a given theme, improving readability. The value is read + * from the "intensity" key in the "ContrastEffect" group in the + * Theme's metadata file. + * @return The intensity provided to the contrasteffect + * @since 5.0 + * @see backgroundContrastEnabled + */ + qreal backgroundIntensity() const; + + /** This method allows Plasma to set a background contrast effect + * for a given theme, improving readability. The value is read + * from the "saturation" key in the "ContrastEffect" group in the + * Theme's metadata file. + * @return The saturation provided to the contrasteffect + * @since 5.0 + * @see backgroundContrastEnabled + */ + qreal backgroundSaturation() const; /** * Returns the size of the letter "M" as rendered on the screen with the given font. From 67f333b3879ea3e8000a750d73e8333cdda1910d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Thu, 6 Feb 2014 01:00:46 +0100 Subject: [PATCH 02/10] Air theme gets configured to use the contrast effect --- desktoptheme/air/metadata.desktop | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/desktoptheme/air/metadata.desktop b/desktoptheme/air/metadata.desktop index 1e195a031..45c20aa97 100644 --- a/desktoptheme/air/metadata.desktop +++ b/desktoptheme/air/metadata.desktop @@ -55,3 +55,9 @@ defaultWallpaperTheme=Elarun defaultFileSuffix=.png defaultWidth=2560 defaultHeight=1600 + +[ContrastEffect] +enabled=true +contrast=0.45 +intensity=0.45 +saturation=1.7 From 8e062ace171e1bb542686884aa4dc49342c148a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Thu, 6 Feb 2014 01:04:23 +0100 Subject: [PATCH 03/10] panelview takes contrast effect config from Theme --- src/shell/panelview.cpp | 19 ++++++++++++------- src/shell/panelview.h | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/shell/panelview.cpp b/src/shell/panelview.cpp index 9af9fa2eb..460c4520f 100644 --- a/src/shell/panelview.cpp +++ b/src/shell/panelview.cpp @@ -55,13 +55,8 @@ PanelView::PanelView(ShellCorona *corona, QWindow *parent) KWindowSystem::setType(winId(), NET::Dock); setVisible(false); - //TODO: how to take the shape from the framesvg? - KWindowEffects::enableBlurBehind(winId(), true); - if (qGray(m_theme.color(Plasma::Theme::BackgroundColor).rgb()) > 127) { - KWindowEffects::enableBackgroundContrast(winId(), true, 0.30, 1.9, 1.7); - } else { - KWindowEffects::enableBackgroundContrast(winId(), true, 0.45, 0.45, 1.7); - } + themeChanged(); + connect(&m_theme, &Plasma::Theme::themeChanged, this, &PanelView::themeChanged); //Screen management connect(this, &QWindow::screenChanged, @@ -604,4 +599,14 @@ void PanelView::updateStruts() //recreateUnhideTrigger(); } +void PanelView::themeChanged() +{ + qDebug() << "CON themeChanged ... " << m_theme.backgroundContrastEnabled() << " : " << m_theme.backgroundContrast() << m_theme.backgroundIntensity() << m_theme.backgroundSaturation(); + KWindowEffects::enableBackgroundContrast(winId(), m_theme.backgroundContrastEnabled(), + m_theme.backgroundContrast(), + m_theme.backgroundIntensity(), + m_theme.backgroundSaturation()); + //TODO: how to take the shape from the framesvg? +} + #include "moc_panelview.cpp" diff --git a/src/shell/panelview.h b/src/shell/panelview.h index cef08203c..e9947e4bd 100644 --- a/src/shell/panelview.h +++ b/src/shell/panelview.h @@ -97,6 +97,7 @@ protected Q_SLOTS: void updateStruts(); private Q_SLOTS: + void themeChanged(); void positionPanel(); void restore(); From d9e43ff979b7f7d48c4c991bc215bc9a0eb911c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Thu, 6 Feb 2014 02:51:46 +0100 Subject: [PATCH 04/10] Be smarter about contrast effect reading This commit allows the theme designer to just enable and disable the effect (enable=true). If no color values are set, values are picked based on the background color. This essentially restores the hardcoded values in some other places, and makes them available as sensible defaults to other themes. Also, make sure colors are read before the effect is applied (as we need the new bg color to decide whether it's light or dark). --- src/plasma/private/theme_p.cpp | 62 ++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/src/plasma/private/theme_p.cpp b/src/plasma/private/theme_p.cpp index b0017bbe6..55694af8f 100644 --- a/src/plasma/private/theme_p.cpp +++ b/src/plasma/private/theme_p.cpp @@ -528,9 +528,26 @@ void ThemePrivate::processContrastSettings(KConfigBase* metadata) if (metadata->hasGroup("ContrastEffect")) { cg = KConfigGroup(metadata, "ContrastEffect"); backgroundContrastEnabled = cg.readEntry("enabled", false); - backgroundContrast = cg.readEntry("contrast", 0.45); - backgroundIntensity = cg.readEntry("contrast", 0.45); - backgroundSaturation = cg.readEntry("saturation", 1.7); + + //if (backgroundContrastEnabled) { + // Make up sensible default values, based on the background color + // This works for a light theme -- lighting up the background + qreal _contrast = 0.3; + qreal _intensity = 1.9; + qreal _saturation = 1.7; + + // If we're using a dark background color, darken the background + qDebug() << "CON grey <<<<< " << qGray(color(Plasma::Theme::BackgroundColor).rgb()) << themeName << color(Plasma::Theme::BackgroundColor); + if (qGray(color(Plasma::Theme::BackgroundColor).rgb()) < 127) { + qDebug() << "CON Dark! <<<<< " << qGray(color(Plasma::Theme::BackgroundColor).rgb()); + _contrast = 0.45; + _intensity = 0.45; + _saturation = 1.7; + } + backgroundContrast = cg.readEntry("contrast", _contrast); + backgroundIntensity = cg.readEntry("intensity", _intensity); + backgroundSaturation = cg.readEntry("saturation", _saturation); + //} } else { backgroundContrastEnabled = false; } @@ -578,15 +595,34 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings //qDebug() << "we're going for..." << colorsFile << "*******************"; + if (colorsFile.isEmpty()) { + colors = 0; + if (qApp) { + installEventFilter(qApp); + } + } else { + if (qApp) { + removeEventFilter(qApp); + } + colors = KSharedConfig::openConfig(colorsFile); + } + + colorScheme = KColorScheme(QPalette::Active, KColorScheme::Window, colors); + buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, colors); + viewColorScheme = KColorScheme(QPalette::Active, KColorScheme::View, colors); + const QString wallpaperPath = QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/wallpapers/"); + hasWallpapers = !QStandardPaths::locate(QStandardPaths::GenericDataLocation, wallpaperPath, QStandardPaths::LocateDirectory).isEmpty(); + // load the wallpaper settings, if any if (realTheme) { const QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/metadata.desktop"))); KConfig metadata(metadataPath); pluginInfo = KPluginInfo(metadataPath); - processWallpaperSettings(&metadata); processContrastSettings(&metadata); + processWallpaperSettings(&metadata); + KConfigGroup cg(&metadata, "Settings"); QString fallback = cg.readEntry("FallbackTheme", QString()); @@ -615,24 +651,6 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings } } - if (colorsFile.isEmpty()) { - colors = 0; - if (qApp) { - installEventFilter(qApp); - } - } else { - if (qApp) { - removeEventFilter(qApp); - } - colors = KSharedConfig::openConfig(colorsFile); - } - - colorScheme = KColorScheme(QPalette::Active, KColorScheme::Window, colors); - buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, colors); - viewColorScheme = KColorScheme(QPalette::Active, KColorScheme::View, colors); - const QString wallpaperPath = QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/wallpapers/"); - hasWallpapers = !QStandardPaths::locate(QStandardPaths::GenericDataLocation, wallpaperPath, QStandardPaths::LocateDirectory).isEmpty(); - if (realTheme && isDefault && writeSettings) { // we're the default theme, let's save our state KConfigGroup &cg = config(); From f13ac96f29e2f5bdf22a15fc2d3fd41cad05ec99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Thu, 6 Feb 2014 02:54:18 +0100 Subject: [PATCH 05/10] Air uses values for light theme, not dark. --- desktoptheme/air/metadata.desktop | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desktoptheme/air/metadata.desktop b/desktoptheme/air/metadata.desktop index 45c20aa97..e16fadbec 100644 --- a/desktoptheme/air/metadata.desktop +++ b/desktoptheme/air/metadata.desktop @@ -58,6 +58,6 @@ defaultHeight=1600 [ContrastEffect] enabled=true -contrast=0.45 -intensity=0.45 +contrast=0.3 +intensity=1.9 saturation=1.7 From 60e955784cebd90cd2a895d556690ebc37928339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Thu, 6 Feb 2014 03:51:14 +0100 Subject: [PATCH 06/10] PlasmaCore.Dialog respects contrast effect settings --- src/declarativeimports/core/dialog.cpp | 19 ++++++++++++++----- src/declarativeimports/core/dialog.h | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/declarativeimports/core/dialog.cpp b/src/declarativeimports/core/dialog.cpp index 72737e9b7..e14712a1c 100644 --- a/src/declarativeimports/core/dialog.cpp +++ b/src/declarativeimports/core/dialog.cpp @@ -77,6 +77,9 @@ DialogProxy::DialogProxy(QQuickItem *parent) //Create the FrameSvg background. m_frameSvgItem = new Plasma::FrameSvgItem(contentItem()); m_frameSvgItem->setImagePath("dialogs/background"); + + connect(&m_theme, &Plasma::Theme::themeChanged, this, &DialogProxy::updateContrast); + //m_frameSvgItem->setImagePath("widgets/background"); // larger borders, for testing those } @@ -379,12 +382,9 @@ void DialogProxy::syncMainItemToSize() m_frameSvgItem->setY(0); m_frameSvgItem->setWidth(width()); m_frameSvgItem->setHeight(height()); + KWindowEffects::enableBlurBehind(winId(), true, m_frameSvgItem->frameSvg()->mask()); - if (qGray(m_theme.color(Plasma::Theme::BackgroundColor).rgb()) > 127) { - KWindowEffects::enableBackgroundContrast(winId(), true, 0.30, 1.9, 1.7, m_frameSvgItem->frameSvg()->mask()); - } else { - KWindowEffects::enableBackgroundContrast(winId(), true, 0.45, 0.45, 1.7, m_frameSvgItem->frameSvg()->mask()); - } + updateContrast(); if (m_mainItem) { m_mainItem.data()->setX(m_frameSvgItem->margins()->left()); @@ -427,6 +427,15 @@ void DialogProxy::requestSyncToMainItemSize(bool delayed) } } +void DialogProxy::updateContrast() +{ + KWindowEffects::enableBackgroundContrast(winId(), m_theme.backgroundContrastEnabled(), + m_theme.backgroundContrast(), + m_theme.backgroundIntensity(), + m_theme.backgroundSaturation(), + m_frameSvgItem->frameSvg()->mask()); +} + void DialogProxy::setType(WindowType type) { if (type == m_type) { diff --git a/src/declarativeimports/core/dialog.h b/src/declarativeimports/core/dialog.h index a2ea91746..643d56555 100644 --- a/src/declarativeimports/core/dialog.h +++ b/src/declarativeimports/core/dialog.h @@ -169,7 +169,7 @@ protected: private Q_SLOTS: void syncBorders(); - + void updateContrast(); void updateVisibility(bool visible); private: From 62de49128e10bbfd05e2689a32d4e89a9910c2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Thu, 6 Feb 2014 03:52:11 +0100 Subject: [PATCH 07/10] Don't forget the Blur behind the panel --- src/shell/panelview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shell/panelview.cpp b/src/shell/panelview.cpp index 460c4520f..5ef71146c 100644 --- a/src/shell/panelview.cpp +++ b/src/shell/panelview.cpp @@ -602,11 +602,12 @@ void PanelView::updateStruts() void PanelView::themeChanged() { qDebug() << "CON themeChanged ... " << m_theme.backgroundContrastEnabled() << " : " << m_theme.backgroundContrast() << m_theme.backgroundIntensity() << m_theme.backgroundSaturation(); + //TODO: how to take the shape from the framesvg? + KWindowEffects::enableBlurBehind(winId(), true); KWindowEffects::enableBackgroundContrast(winId(), m_theme.backgroundContrastEnabled(), m_theme.backgroundContrast(), m_theme.backgroundIntensity(), m_theme.backgroundSaturation()); - //TODO: how to take the shape from the framesvg? } #include "moc_panelview.cpp" From 15e4d931025c91e1997721e33ac4020fd41e4ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Thu, 6 Feb 2014 03:52:56 +0100 Subject: [PATCH 08/10] PanelConfigView respects contrast effect settings --- src/shell/panelconfigview.cpp | 15 ++++++++++----- src/shell/panelconfigview.h | 3 +++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/shell/panelconfigview.cpp b/src/shell/panelconfigview.cpp index 45026180f..54551c683 100644 --- a/src/shell/panelconfigview.cpp +++ b/src/shell/panelconfigview.cpp @@ -48,11 +48,8 @@ PanelConfigView::PanelConfigView(Plasma::Containment *containment, PanelView *pa setFlags(Qt::FramelessWindowHint); KWindowEffects::enableBlurBehind(winId(), true); - if (qGray(m_theme.color(Plasma::Theme::BackgroundColor).rgb()) > 127) { - KWindowEffects::enableBackgroundContrast(winId(), true, 0.30, 1.9, 1.7); - } else { - KWindowEffects::enableBackgroundContrast(winId(), true, 0.45, 0.45, 1.7); - } + updateContrast(); + connect(&m_theme, &Plasma::Theme::themeChanged, this, &PanelConfigView::updateContrast); engine()->rootContext()->setContextProperty("panel", panelView); engine()->rootContext()->setContextProperty("configDialog", this); @@ -70,6 +67,14 @@ void PanelConfigView::init() syncGeometry(); } +void PanelConfigView::updateContrast() +{ + KWindowEffects::enableBackgroundContrast(winId(), m_theme.backgroundContrastEnabled(), + m_theme.backgroundContrast(), + m_theme.backgroundIntensity(), + m_theme.backgroundSaturation()); +} + void PanelConfigView::showAddWidgetDialog() { QAction *addWidgetAction = m_containment->actions()->action("add widgets"); diff --git a/src/shell/panelconfigview.h b/src/shell/panelconfigview.h index 78023755c..44fd1bfba 100644 --- a/src/shell/panelconfigview.h +++ b/src/shell/panelconfigview.h @@ -56,6 +56,9 @@ protected: protected Q_SLOTS: void syncGeometry(); +private Q_SLOTS: + void updateContrast(); + private: Plasma::Containment *m_containment; PanelView *m_panelView; From 585aa4998a0498a73976f9e50ee2f365e4d13611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Thu, 6 Feb 2014 04:00:39 +0100 Subject: [PATCH 09/10] noise-- --- src/plasma/private/theme_p.cpp | 2 -- src/shell/panelview.cpp | 1 - 2 files changed, 3 deletions(-) diff --git a/src/plasma/private/theme_p.cpp b/src/plasma/private/theme_p.cpp index 55694af8f..9b8b7df2a 100644 --- a/src/plasma/private/theme_p.cpp +++ b/src/plasma/private/theme_p.cpp @@ -537,9 +537,7 @@ void ThemePrivate::processContrastSettings(KConfigBase* metadata) qreal _saturation = 1.7; // If we're using a dark background color, darken the background - qDebug() << "CON grey <<<<< " << qGray(color(Plasma::Theme::BackgroundColor).rgb()) << themeName << color(Plasma::Theme::BackgroundColor); if (qGray(color(Plasma::Theme::BackgroundColor).rgb()) < 127) { - qDebug() << "CON Dark! <<<<< " << qGray(color(Plasma::Theme::BackgroundColor).rgb()); _contrast = 0.45; _intensity = 0.45; _saturation = 1.7; diff --git a/src/shell/panelview.cpp b/src/shell/panelview.cpp index 5ef71146c..160de0993 100644 --- a/src/shell/panelview.cpp +++ b/src/shell/panelview.cpp @@ -601,7 +601,6 @@ void PanelView::updateStruts() void PanelView::themeChanged() { - qDebug() << "CON themeChanged ... " << m_theme.backgroundContrastEnabled() << " : " << m_theme.backgroundContrast() << m_theme.backgroundIntensity() << m_theme.backgroundSaturation(); //TODO: how to take the shape from the framesvg? KWindowEffects::enableBlurBehind(winId(), true); KWindowEffects::enableBackgroundContrast(winId(), m_theme.backgroundContrastEnabled(), From 462407eba7cd5dda32043dd23ae9aceeb0e128f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Fri, 7 Feb 2014 03:32:20 +0100 Subject: [PATCH 10/10] Fix notes example, svg loading was wrong --- examples/applets/notes/contents/ui/main.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/applets/notes/contents/ui/main.qml b/examples/applets/notes/contents/ui/main.qml index b74e15203..a3bdb9879 100644 --- a/examples/applets/notes/contents/ui/main.qml +++ b/examples/applets/notes/contents/ui/main.qml @@ -17,7 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.0 +import QtQuick 2.1 +import QtQuick.Layouts 1.1 import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents @@ -25,7 +26,7 @@ import org.kde.plasma.components 2.0 as PlasmaComponents PlasmaCore.SvgItem { Layout.minimumWidth: 150 Layout.minimumHeight: 150 - svg: PlasmaCore.Svg("widgets/notes") + svg: PlasmaCore.Svg { imagePath: "widgets/notes" } elementId: "yellow-notes" Connections { @@ -40,6 +41,7 @@ PlasmaCore.SvgItem { PlasmaComponents.TextArea { id: noteText anchors.fill: parent + anchors.margins: 20 text: plasmoid.configuration.Text onTextChanged: plasmoid.configuration.Text = text }