kcontrol: do not update the time while text is selected in clock KCM

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-04-06 16:17:40 +03:00
parent 8a124d6491
commit 569b6d8ebb

View file

@ -289,9 +289,14 @@ void KCMClock::slotUpdate()
{
const QDateTime now = QDateTime::currentDateTime();
if (!m_timechanged) {
m_timeedit->blockSignals(true);
m_timeedit->setTime(now.time());
m_timeedit->blockSignals(false);
// do not update while text has been selected otherwise selection changes, the value will
// be updated once selection is cleared
QLineEdit* timeeditlineedit = m_timeedit->findChild<QLineEdit*>();
if (!timeeditlineedit || !timeeditlineedit->hasSelectedText()) {
m_timeedit->blockSignals(true);
m_timeedit->setTime(now.time());
m_timeedit->blockSignals(false);
}
}
if (!m_datechanged) {
m_dateedit->blockSignals(true);