Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion panels/notification/osd/osdpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bool OsdPanel::init()
m_osdTimer = new QTimer(this);
m_osdTimer->setInterval(m_interval);
m_osdTimer->setSingleShot(true);
QObject::connect(m_osdTimer, &QTimer::timeout, this, &OsdPanel::hideOsd);
QObject::connect(m_osdTimer, &QTimer::timeout, this, &OsdPanel::doneSetting);
return DPanel::init();
}

Expand All @@ -74,6 +74,20 @@ void OsdPanel::ShowOSD(const QString &text)
});
}

void OsdPanel::doneSetting()
{
if (qApp->queryKeyboardModifiers().testFlag(Qt::MetaModifier)) {
m_osdTimer->start();
return;
}

int delay = m_osdTimer->interval() - m_osdTimer->remainingTime();
if (delay < 0) delay = 0;
QTimer::singleShot(delay,this, [this](){
hideOsd();
});
}

void OsdPanel::hideOsd()
{
m_osdTimer->stop();
Expand Down
2 changes: 2 additions & 0 deletions panels/notification/osd/osdpanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public Q_SLOTS:

private Q_SLOTS:
void hideOsd();
void doneSetting();

private:
void showOsd();
void setVisible(const bool visible);
Expand Down