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,11 +408,15 @@ void Checkbox::onStateChanged(State was, StateChangeSource source) {
|
|||
auto now = state();
|
||||
if (!isDisabled() && (was & StateFlag::Over) && (now & StateFlag::Over)) {
|
||||
if ((was & StateFlag::Down) && !(now & StateFlag::Down)) {
|
||||
setChecked(!checked());
|
||||
handlePress();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Checkbox::handlePress() {
|
||||
setChecked(!checked());
|
||||
}
|
||||
|
||||
int Checkbox::resizeGetHeight(int newWidth) {
|
||||
return _check->getSize().height();
|
||||
}
|
||||
|
@ -461,14 +465,9 @@ void Radiobutton::handleNewGroupValue(int value) {
|
|||
}
|
||||
}
|
||||
|
||||
void Radiobutton::onStateChanged(State was, StateChangeSource source) {
|
||||
Checkbox::onStateChanged(was, source);
|
||||
|
||||
auto now = state();
|
||||
if (!isDisabled() && (was & StateFlag::Over) && (now & StateFlag::Over)) {
|
||||
if ((was & StateFlag::Down) && !(now & StateFlag::Down)) {
|
||||
_group->setValue(_value);
|
||||
}
|
||||
void Radiobutton::handlePress() {
|
||||
if (!checkbox()->checked()) {
|
||||
checkbox()->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -148,6 +148,8 @@ protected:
|
|||
QImage prepareRippleMask() const override;
|
||||
QPoint prepareRippleStartPosition() const override;
|
||||
|
||||
virtual void handlePress();
|
||||
|
||||
void updateCheck() {
|
||||
rtlupdate(_checkRect);
|
||||
}
|
||||
|
@ -209,7 +211,7 @@ public:
|
|||
~Radiobutton();
|
||||
|
||||
protected:
|
||||
void onStateChanged(State was, StateChangeSource source) override;
|
||||
void handlePress() override;
|
||||
|
||||
private:
|
||||
// Hide the names from Checkbox.
|
||||
|
|
Loading…
Reference in New Issue