mirror of https://github.com/procxx/kepka.git
Don't uncheck a radiobutton on second click.
This commit is contained in:
parent
794ad7bda7
commit
077e128e9a
|
@ -408,9 +408,13 @@ void Checkbox::onStateChanged(State was, StateChangeSource source) {
|
||||||
auto now = state();
|
auto now = state();
|
||||||
if (!isDisabled() && (was & StateFlag::Over) && (now & StateFlag::Over)) {
|
if (!isDisabled() && (was & StateFlag::Over) && (now & StateFlag::Over)) {
|
||||||
if ((was & StateFlag::Down) && !(now & StateFlag::Down)) {
|
if ((was & StateFlag::Down) && !(now & StateFlag::Down)) {
|
||||||
|
handlePress();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Checkbox::handlePress() {
|
||||||
setChecked(!checked());
|
setChecked(!checked());
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Checkbox::resizeGetHeight(int newWidth) {
|
int Checkbox::resizeGetHeight(int newWidth) {
|
||||||
|
@ -461,14 +465,9 @@ void Radiobutton::handleNewGroupValue(int value) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Radiobutton::onStateChanged(State was, StateChangeSource source) {
|
void Radiobutton::handlePress() {
|
||||||
Checkbox::onStateChanged(was, source);
|
if (!checkbox()->checked()) {
|
||||||
|
checkbox()->setChecked(true);
|
||||||
auto now = state();
|
|
||||||
if (!isDisabled() && (was & StateFlag::Over) && (now & StateFlag::Over)) {
|
|
||||||
if ((was & StateFlag::Down) && !(now & StateFlag::Down)) {
|
|
||||||
_group->setValue(_value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,8 @@ protected:
|
||||||
QImage prepareRippleMask() const override;
|
QImage prepareRippleMask() const override;
|
||||||
QPoint prepareRippleStartPosition() const override;
|
QPoint prepareRippleStartPosition() const override;
|
||||||
|
|
||||||
|
virtual void handlePress();
|
||||||
|
|
||||||
void updateCheck() {
|
void updateCheck() {
|
||||||
rtlupdate(_checkRect);
|
rtlupdate(_checkRect);
|
||||||
}
|
}
|
||||||
|
@ -209,7 +211,7 @@ public:
|
||||||
~Radiobutton();
|
~Radiobutton();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onStateChanged(State was, StateChangeSource source) override;
|
void handlePress() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Hide the names from Checkbox.
|
// Hide the names from Checkbox.
|
||||||
|
|
Loading…
Reference in New Issue