Commit 191a9997 authored by Frederik Schwarzer's avatar Frederik Schwarzer
Browse files

use standard text colors for constants buttons

This fixes constants button text being unreadable in dark mode.
parent 83e81f2d
......@@ -281,6 +281,33 @@
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="textLabel13">
<property name="text">
<string>&amp;Constants:</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="buddy">
<cstring>kcfg_ConstantsButtonsColor</cstring>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="KColorButton" name="kcfg_ConstantsButtonsColor">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="KColorButton" name="kcfg_ConstantsFontsColor">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
......
......@@ -2169,6 +2169,11 @@ void KCalculator::setColors() {
qobject_cast<KCalcButton*>(btn)->setTextColor(opFontColor);
}
const QColor coFontColor(KCalcSettings::constantsFontsColor());
foreach(QAbstractButton *btn, const_buttons_) {
qobject_cast<KCalcButton*>(btn)->setTextColor(coFontColor);
}
KColorScheme schemeButtons(QPalette::Active, KColorScheme::Button);
const QColor defaultColor = schemeButtons.background().color();
......@@ -2178,7 +2183,8 @@ void KCalculator::setColors() {
&& KCalcSettings::statButtonsColor() == defaultColor
&& KCalcSettings::hexButtonsColor() == defaultColor
&& KCalcSettings::memoryButtonsColor() == defaultColor
&& KCalcSettings::operationButtonsColor() == defaultColor) {
&& KCalcSettings::operationButtonsColor() == defaultColor
&& KCalcSettings::constantsButtonsColor() == defaultColor) {
return;
}
......@@ -2213,6 +2219,11 @@ void KCalculator::setColors() {
foreach(QAbstractButton *btn, operation_button_list_) {
btn->setStyleSheet(sheet.arg(opPal.name()));
}
const QColor coPal(KCalcSettings::constantsButtonsColor());
foreach(QAbstractButton *btn, const_buttons_) {
btn->setStyleSheet(sheet.arg(coPal.name()));
}
}
//------------------------------------------------------------------------------
......
......@@ -45,6 +45,10 @@
<label>The color of operation buttons.</label>
<default code="true">defaultButtonColor</default>
</entry>
<entry name="ConstantsButtonsColor" type="Color">
<label>The color of constants buttons.</label>
<default code="true">defaultButtonColor</default>
</entry>
<entry name="NumberFontsColor" type="Color">
<label>The color of number fonts.</label>
<code>KColorScheme schemeFonts(QPalette::Active, KColorScheme::Button);
......@@ -71,6 +75,10 @@
<label>The color of operation font.</label>
<default code="true">defaultFontColor</default>
</entry>
<entry name="ConstantsFontsColor" type="Color">
<label>The color of constants fonts.</label>
<default code="true">defaultFontColor</default>
</entry>
</group>
<group name="Font">
<entry name="ButtonFont" type="Font">
......
......@@ -35,6 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
KCalcConstButton::KCalcConstButton(QWidget *parent) : KCalcButton(parent), button_num_(-1) {
setTextColor(KCalcSettings::constantsFontsColor());
addMode(ModeShift, i18nc("Write display data into memory", "Store"), i18n("Write display data into memory"));
initPopupMenu();
connect(this, &QAbstractButton::clicked, this, &KCalcConstButton::slotClicked);
......@@ -46,6 +47,7 @@ KCalcConstButton::KCalcConstButton(QWidget *parent) : KCalcButton(parent), butto
//------------------------------------------------------------------------------
KCalcConstButton::KCalcConstButton(const QString &label, QWidget *parent, const QString &tooltip) : KCalcButton(label, parent, tooltip), button_num_(-1) {
setTextColor(KCalcSettings::constantsFontsColor());
addMode(ModeShift, i18nc("Write display data into memory", "Store"), i18n("Write display data into memory"));
initPopupMenu();
}
......
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