Commit 8b2f75f1 authored by Benjamin Port's avatar Benjamin Port
Browse files

Fix a bug in KCM cursor theme, after applying change, cursor preview don't work

Summary:
This fix work only after applying other patch (but fix an issue that exist on master)  (24519)
Bug: When you go to the kcm cursor,  if you go hover a theme the "real" cursor change to show a preview. After applying a new theme the preview don't work anymore before you change the cursor size.
In order to work we need a call to setTheme that is done by setCursorSize.
Currently the  if (m_currentSize == size) prevent the call to setTheme, so I removed it and removed the unused signal

Reviewers: #plasma, mart, ervin, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D24520
parent fec538fb
......@@ -334,6 +334,7 @@ bool CursorThemeConfig::applyTheme(const CursorTheme *theme, const int size)
XFixesChangeCursorByName(QX11Info::display(), theme->loadCursor(name, size), QFile::encodeName(name));
}
updateSizeComboBox();
emit themeApplied();
return true;
#else
Q_UNUSED(theme)
......
......@@ -89,6 +89,7 @@ Q_SIGNALS:
void selectedSizeRowChanged();
void downloadingFileChanged();
void preferredSizeChanged();
void themeApplied();
void showSuccessMessage(const QString &message);
void showInfoMessage(const QString &message);
......
......@@ -51,6 +51,13 @@ KCM.GridDelegate {
currentSize: kcm.cursorThemeSettings.cursorSize
}
Connections {
target: kcm
onThemeApplied: {
previewWidget.refresh();
}
}
actions: [
Kirigami.Action {
iconName: "edit-delete"
......
......@@ -197,6 +197,16 @@ int PreviewWidget::currentSize() const
return m_currentSize;
}
void PreviewWidget::refresh()
{
if (!m_themeModel) {
return;
}
const CursorTheme *theme = m_themeModel->theme(m_themeModel->index(m_currentIndex, 0));
setTheme(theme, m_currentSize);
}
void PreviewWidget::updateImplicitSize()
{
qreal totalWidth = 0;
......
......@@ -51,6 +51,8 @@ class PreviewWidget : public QQuickPaintedItem
void setCurrentSize(int size);
int currentSize() const;
Q_INVOKABLE void refresh();
Q_SIGNALS:
void themeModelChanged();
void currentIndexChanged();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment