mirror of
https://invent.kde.org/network/falkon.git
synced 2024-09-22 02:02:10 +02:00
[SiteIcon] Don't set :pressed state when popup is not shown
Popup will not be shown eg. on qupzilla: sites
This commit is contained in:
parent
fcfe2999f7
commit
a284a7c864
|
@ -97,11 +97,15 @@ void SiteIcon::mouseReleaseEvent(QMouseEvent* e)
|
||||||
// Mouse release event is restoring Down state
|
// Mouse release event is restoring Down state
|
||||||
// So we pause updates to prevent flicker
|
// So we pause updates to prevent flicker
|
||||||
|
|
||||||
bool activated = e->button() == Qt::LeftButton && rect().contains(e->pos());
|
bool activated = false;
|
||||||
|
|
||||||
|
if (e->button() == Qt::LeftButton && rect().contains(e->pos())) {
|
||||||
|
// Popup may not be always shown, eg. on qupzilla: pages
|
||||||
|
activated = showPopup();
|
||||||
|
}
|
||||||
|
|
||||||
if (activated) {
|
if (activated) {
|
||||||
setUpdatesEnabled(false);
|
setUpdatesEnabled(false);
|
||||||
showPopup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolButton::mouseReleaseEvent(e);
|
ToolButton::mouseReleaseEvent(e);
|
||||||
|
@ -147,16 +151,16 @@ void SiteIcon::mouseMoveEvent(QMouseEvent* e)
|
||||||
setDown(false);
|
setDown(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SiteIcon::showPopup()
|
bool SiteIcon::showPopup()
|
||||||
{
|
{
|
||||||
if (!m_view || !m_window) {
|
if (!m_view || !m_window) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl url = m_view->url();
|
QUrl url = m_view->url();
|
||||||
|
|
||||||
if (url.isEmpty() || url.scheme() == QLatin1String("qupzilla")) {
|
if (url.isEmpty() || url.scheme() == QLatin1String("qupzilla")) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
setDown(true);
|
setDown(true);
|
||||||
|
@ -165,4 +169,6 @@ void SiteIcon::showPopup()
|
||||||
info->showAt(parentWidget());
|
info->showAt(parentWidget());
|
||||||
|
|
||||||
connect(info, SIGNAL(destroyed()), this, SLOT(popupClosed()));
|
connect(info, SIGNAL(destroyed()), this, SLOT(popupClosed()));
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ private:
|
||||||
void mouseReleaseEvent(QMouseEvent* e);
|
void mouseReleaseEvent(QMouseEvent* e);
|
||||||
void mouseMoveEvent(QMouseEvent* e);
|
void mouseMoveEvent(QMouseEvent* e);
|
||||||
|
|
||||||
void showPopup();
|
bool showPopup();
|
||||||
|
|
||||||
BrowserWindow* m_window;
|
BrowserWindow* m_window;
|
||||||
LocationBar* m_locationBar;
|
LocationBar* m_locationBar;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user