Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
KCalc
Commits
191a9997
Commit
191a9997
authored
Mar 13, 2021
by
Frederik Schwarzer
Browse files
use standard text colors for constants buttons
This fixes constants button text being unreadable in dark mode.
parent
83e81f2d
Changes
4
Hide whitespace changes
Inline
Side-by-side
colors.ui
View file @
191a9997
...
...
@@ -281,6 +281,33 @@
</property>
</widget>
</item>
<item
row=
"7"
column=
"0"
>
<widget
class=
"QLabel"
name=
"textLabel13"
>
<property
name=
"text"
>
<string>
&
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>
...
...
kcalc.cpp
View file @
191a9997
...
...
@@ -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
()));
}
}
//------------------------------------------------------------------------------
...
...
kcalc.kcfg
View file @
191a9997
...
...
@@ -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"
>
...
...
kcalc_const_button.cpp
View file @
191a9997
...
...
@@ -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
();
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment