Skip to content

Commit

Permalink
Fixed problems in updating Kvantum Manager GUI on theme change
Browse files Browse the repository at this point in the history
  • Loading branch information
tsujan committed Oct 12, 2019
1 parent 3413464 commit 6804fd3
Show file tree
Hide file tree
Showing 22 changed files with 403 additions and 362 deletions.
1 change: 1 addition & 0 deletions Kvantum/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
V0.12.1
---------
* Added a hacking option for kinetic scrolling to Kvantum Manager. Although Qt's kinetic scrolling has bugs, it doesn't cause crashes with Qt ≥ 5.13.1.
* Fixed problems in updating the GUI of Kvantum Manager on theme change.

V0.12.0
---------
Expand Down
2 changes: 1 addition & 1 deletion Kvantum/NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Latest version:

10 Oct 2019, V0.12.1
12 Oct 2019, V0.12.1

See "ChangeLog" for changes.
38 changes: 38 additions & 0 deletions Kvantum/kvantummanager/KvantumManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,12 @@ void KvantumManager::defaultThemeButtons()
/*************************/
void KvantumManager::restyleWindow()
{
const QWidgetList topLevels = QApplication::topLevelWidgets();
for (QWidget *widget : topLevels)
{ // this is needed with Qt >= 5.13.1 but is harmless otherwise
widget->setAttribute (Qt::WA_NoSystemBackground, false);
widget->setAttribute (Qt::WA_TranslucentBackground, false);
}
QApplication::setStyle (QStyleFactory::create ("kvantum"));
// Qt5 has QEvent::ThemeChange
const QWidgetList widgets = QApplication::allWidgets();
Expand All @@ -1105,6 +1111,38 @@ void KvantumManager::restyleWindow()
QEvent event (QEvent::ThemeChange);
QApplication::sendEvent (widget, &event);
}
/* this may be needed if the previous theme didn't have combo menus */
QTimer::singleShot (0, this, [this] {
for (int i = 0; i < 2; ++i)
{
QComboBox *combo = (i == 0 ? ui->comboBox : ui->appCombo);
QList<QScrollBar*> widgets = combo->findChildren<QScrollBar*>();
for (int j = 0; j < widgets.size(); ++j)
{
QPalette palette = widgets.at (j)->palette();
palette.setColor (QPalette::Window,
QApplication::palette().color (QPalette::Window));
palette.setColor (QPalette::Base,
QApplication::palette().color (QPalette::Base));
widgets.at (j)->setPalette (palette);
}
if (QAbstractItemView *cv = combo->completer()->popup())
{
QPalette palette = cv->palette();
palette.setColor (QPalette::Text,
QApplication::palette().color (QPalette::Text));
palette.setColor (QPalette::HighlightedText,
QApplication::palette().color (QPalette::HighlightedText));
palette.setColor (QPalette::Base,
QApplication::palette().color (QPalette::Base));
palette.setColor (QPalette::Window,
QApplication::palette().color (QPalette::Window));
palette.setColor (QPalette::Highlight,
QApplication::palette().color (QPalette::Highlight));
cv->setPalette (palette);
}
}
});
}
/*************************/
void KvantumManager::tabChanged (int index)
Expand Down
40 changes: 20 additions & 20 deletions Kvantum/kvantummanager/data/translations/kvantummanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ or update its preview.</source>
<message>
<location filename="../../KvantumManager.cpp" line="498"/>
<location filename="../../KvantumManager.cpp" line="652"/>
<location filename="../../KvantumManager.cpp" line="2451"/>
<location filename="../../KvantumManager.cpp" line="2489"/>
<source>Confirmation</source>
<translation type="unfinished"></translation>
</message>
Expand Down Expand Up @@ -1477,75 +1477,75 @@ or update its preview.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="1144"/>
<location filename="../../KvantumManager.cpp" line="1163"/>
<location filename="../../KvantumManager.cpp" line="1182"/>
<location filename="../../KvantumManager.cpp" line="1201"/>
<source>These are the settings that can be safely changed.&lt;br&gt;For the others, click &lt;i&gt;Save&lt;/i&gt; and then edit this file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="1159"/>
<location filename="../../KvantumManager.cpp" line="2359"/>
<location filename="../../KvantumManager.cpp" line="1197"/>
<location filename="../../KvantumManager.cpp" line="2397"/>
<source>These are the settings that can be safely changed.&lt;br&gt;For the others, edit this file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="1546"/>
<location filename="../../KvantumManager.cpp" line="1584"/>
<source>No description</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2017"/>
<location filename="../../KvantumManager.cpp" line="2055"/>
<source>A copy of the root config is created.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2028"/>
<location filename="../../KvantumManager.cpp" line="2066"/>
<source>A copy was already created.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2345"/>
<location filename="../../KvantumManager.cpp" line="2383"/>
<source>Configuration saved.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2452"/>
<location filename="../../KvantumManager.cpp" line="2490"/>
<source>Do you want to revert to the default (root) settings of this theme?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2455"/>
<location filename="../../KvantumManager.cpp" line="2493"/>
<source>You will lose the changes you might have made.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2490"/>
<location filename="../../KvantumManager.cpp" line="2528"/>
<source>Restored the rool default settings of %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2491"/>
<location filename="../../KvantumManager.cpp" line="2529"/>
<source>the default theme</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2627"/>
<location filename="../../KvantumManager.cpp" line="2628"/>
<location filename="../../KvantumManager.cpp" line="2665"/>
<location filename="../../KvantumManager.cpp" line="2666"/>
<source>About Kvantum Manager</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2627"/>
<location filename="../../KvantumManager.cpp" line="2665"/>
<source>Translators</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2625"/>
<location filename="../../KvantumManager.cpp" line="2663"/>
<source>A tool for installing, selecting&lt;br&gt;and configuring &lt;a href=&apos;https://github.com/tsujan/Kvantum&apos;&gt;Kvantum&lt;/a&gt; themes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2626"/>
<location filename="../../KvantumManager.cpp" line="2664"/>
<source>Author: &lt;a href=&apos;mailto:tsujan2000@gmail.com?Subject=My%20Subject&apos;&gt;Pedram Pourang (aka. Tsu Jan)&lt;/a&gt; &lt;/center&gt;&lt;br&gt;</source>
<translation type="unfinished"></translation>
</message>
Expand All @@ -1571,8 +1571,8 @@ or update its preview.</source>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="836"/>
<location filename="../../KvantumManager.cpp" line="1957"/>
<location filename="../../KvantumManager.cpp" line="2354"/>
<location filename="../../KvantumManager.cpp" line="1995"/>
<location filename="../../KvantumManager.cpp" line="2392"/>
<source>Active theme:</source>
<translation type="unfinished"></translation>
</message>
Expand Down
40 changes: 20 additions & 20 deletions Kvantum/kvantummanager/data/translations/kvantummanager_be.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ or update its preview.</source>
<message>
<location filename="../../KvantumManager.cpp" line="498"/>
<location filename="../../KvantumManager.cpp" line="652"/>
<location filename="../../KvantumManager.cpp" line="2451"/>
<location filename="../../KvantumManager.cpp" line="2489"/>
<source>Confirmation</source>
<translation type="unfinished"></translation>
</message>
Expand Down Expand Up @@ -1487,75 +1487,75 @@ or update its preview.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="1144"/>
<location filename="../../KvantumManager.cpp" line="1163"/>
<location filename="../../KvantumManager.cpp" line="1182"/>
<location filename="../../KvantumManager.cpp" line="1201"/>
<source>These are the settings that can be safely changed.&lt;br&gt;For the others, click &lt;i&gt;Save&lt;/i&gt; and then edit this file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="1159"/>
<location filename="../../KvantumManager.cpp" line="2359"/>
<location filename="../../KvantumManager.cpp" line="1197"/>
<location filename="../../KvantumManager.cpp" line="2397"/>
<source>These are the settings that can be safely changed.&lt;br&gt;For the others, edit this file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="1546"/>
<location filename="../../KvantumManager.cpp" line="1584"/>
<source>No description</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2017"/>
<location filename="../../KvantumManager.cpp" line="2055"/>
<source>A copy of the root config is created.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2028"/>
<location filename="../../KvantumManager.cpp" line="2066"/>
<source>A copy was already created.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2345"/>
<location filename="../../KvantumManager.cpp" line="2383"/>
<source>Configuration saved.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2452"/>
<location filename="../../KvantumManager.cpp" line="2490"/>
<source>Do you want to revert to the default (root) settings of this theme?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2455"/>
<location filename="../../KvantumManager.cpp" line="2493"/>
<source>You will lose the changes you might have made.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2490"/>
<location filename="../../KvantumManager.cpp" line="2528"/>
<source>Restored the rool default settings of %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2491"/>
<location filename="../../KvantumManager.cpp" line="2529"/>
<source>the default theme</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2627"/>
<location filename="../../KvantumManager.cpp" line="2628"/>
<location filename="../../KvantumManager.cpp" line="2665"/>
<location filename="../../KvantumManager.cpp" line="2666"/>
<source>About Kvantum Manager</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2627"/>
<location filename="../../KvantumManager.cpp" line="2665"/>
<source>Translators</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2625"/>
<location filename="../../KvantumManager.cpp" line="2663"/>
<source>A tool for installing, selecting&lt;br&gt;and configuring &lt;a href=&apos;https://github.com/tsujan/Kvantum&apos;&gt;Kvantum&lt;/a&gt; themes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="2626"/>
<location filename="../../KvantumManager.cpp" line="2664"/>
<source>Author: &lt;a href=&apos;mailto:tsujan2000@gmail.com?Subject=My%20Subject&apos;&gt;Pedram Pourang (aka. Tsu Jan)&lt;/a&gt; &lt;/center&gt;&lt;br&gt;</source>
<translation type="unfinished"></translation>
</message>
Expand All @@ -1581,8 +1581,8 @@ or update its preview.</source>
</message>
<message>
<location filename="../../KvantumManager.cpp" line="836"/>
<location filename="../../KvantumManager.cpp" line="1957"/>
<location filename="../../KvantumManager.cpp" line="2354"/>
<location filename="../../KvantumManager.cpp" line="1995"/>
<location filename="../../KvantumManager.cpp" line="2392"/>
<source>Active theme:</source>
<translation type="unfinished"></translation>
</message>
Expand Down
Loading

0 comments on commit 6804fd3

Please sign in to comment.