[4/4] kernel-shark: Change KsDualMarker's inactive button style to default
diff mbox series

Message ID 20191010212429.469155-5-mike.rudenko@gmail.com
State Accepted
Headers show
Series
  • Fix KernelShark appearance on dark color schemes
Related show

Commit Message

Mikhail Rudenko Oct. 10, 2019, 9:24 p.m. UTC
At present, the style of an "inactive" KsDualMarker toolbar button is
set to "system default background + rgb(70,70,70) text color". As a
result, on dark qt color schemes (e.g. Breeze Dark) inactive button
looks disabled ("gray on gray").

This patch addresses the issue by changing "inactive" button style to
system default. This makes the UI intuitive across different color
schemes.

QStateMachine::setGlobalRestorePolicy is used for reducing the
boilerplate of manually resetting button style when it becomes
"inactive".

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
---
 kernel-shark/src/KsDualMarker.cpp | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

--
2.23.0

Patch
diff mbox series

diff --git a/kernel-shark/src/KsDualMarker.cpp b/kernel-shark/src/KsDualMarker.cpp
index 0070777..90c5373 100644
--- a/kernel-shark/src/KsDualMarker.cpp
+++ b/kernel-shark/src/KsDualMarker.cpp
@@ -171,20 +171,12 @@  KsDualMarkerSM::KsDualMarkerSM(QWidget *parent)
 				"styleSheet",
 				styleSheetA);

-	_stateA->assignProperty(&_buttonB,
-				"styleSheet",
-				"color : rgb(70, 70, 70)");
-
 	styleSheetB = "background : " +
 		      _markB._color.name() +
 		      "; color : white";

 	_stateB = new QState;
 	_stateB->setObjectName("B");
-	_stateB->assignProperty(&_buttonA,
-				"styleSheet",
-				"color : rgb(70, 70, 70)");
-
 	_stateB->assignProperty(&_buttonB,
 				"styleSheet",
 				styleSheetB);
@@ -223,6 +215,7 @@  KsDualMarkerSM::KsDualMarkerSM(QWidget *parent)
 	connect(&_buttonA,	&KsMarkerButton::deselect,
 		this,		&KsDualMarkerSM::deselectA);

+	_machine.setGlobalRestorePolicy(QState::RestoreProperties);
 	_machine.addState(_stateA);
 	_machine.addState(_stateB);
 	_machine.setInitialState(_stateA);