mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
[WebInspector] Propagate hideEvent only when closing inspector
This commit is contained in:
parent
551ccd6e3c
commit
34eeea4d58
@ -24,6 +24,7 @@
|
|||||||
WebInspector::WebInspector(QWidget* parent)
|
WebInspector::WebInspector(QWidget* parent)
|
||||||
: QWebInspector(parent)
|
: QWebInspector(parent)
|
||||||
, m_closeButton(0)
|
, m_closeButton(0)
|
||||||
|
, m_blockHideEvent(true)
|
||||||
{
|
{
|
||||||
setObjectName(QSL("web-inspector"));
|
setObjectName(QSL("web-inspector"));
|
||||||
setMinimumHeight(80);
|
setMinimumHeight(80);
|
||||||
@ -35,17 +36,30 @@ void WebInspector::updateCloseButton()
|
|||||||
m_closeButton = new ToolButton(this);
|
m_closeButton = new ToolButton(this);
|
||||||
m_closeButton->setAutoRaise(true);
|
m_closeButton->setAutoRaise(true);
|
||||||
m_closeButton->setIcon(IconProvider::standardIcon(QStyle::SP_DialogCloseButton));
|
m_closeButton->setIcon(IconProvider::standardIcon(QStyle::SP_DialogCloseButton));
|
||||||
connect(m_closeButton, SIGNAL(clicked()), this, SLOT(hide()));
|
connect(m_closeButton, SIGNAL(clicked()), this, SLOT(hideInspector()));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_closeButton->show();
|
m_closeButton->show();
|
||||||
m_closeButton->move(width() - m_closeButton->width(), 0);
|
m_closeButton->move(width() - m_closeButton->width(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebInspector::hideInspector()
|
||||||
|
{
|
||||||
|
m_blockHideEvent = false;
|
||||||
|
hide();
|
||||||
|
m_blockHideEvent = true;
|
||||||
|
|
||||||
|
// This is needed to correctly show close button after QWebInspector re-initialization
|
||||||
|
m_closeButton->deleteLater();
|
||||||
|
m_closeButton = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void WebInspector::hideEvent(QHideEvent* event)
|
void WebInspector::hideEvent(QHideEvent* event)
|
||||||
{
|
{
|
||||||
// Prevent re-initializing QWebInspector after changing tab / virtual desktop
|
// Prevent re-initializing QWebInspector after changing tab
|
||||||
Q_UNUSED(event);
|
if (!m_blockHideEvent) {
|
||||||
|
QWebInspector::hideEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebInspector::resizeEvent(QResizeEvent* event)
|
void WebInspector::resizeEvent(QResizeEvent* event)
|
||||||
|
@ -33,12 +33,14 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateCloseButton();
|
void updateCloseButton();
|
||||||
|
void hideInspector();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void hideEvent(QHideEvent* event);
|
void hideEvent(QHideEvent* event);
|
||||||
void resizeEvent(QResizeEvent* event);
|
void resizeEvent(QResizeEvent* event);
|
||||||
|
|
||||||
ToolButton* m_closeButton;
|
ToolButton* m_closeButton;
|
||||||
|
bool m_blockHideEvent;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WEBINSPECTORDOCKWIDGET_H
|
#endif // WEBINSPECTORDOCKWIDGET_H
|
||||||
|
Loading…
Reference in New Issue
Block a user