mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +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)
|
||||
: QWebInspector(parent)
|
||||
, m_closeButton(0)
|
||||
, m_blockHideEvent(true)
|
||||
{
|
||||
setObjectName(QSL("web-inspector"));
|
||||
setMinimumHeight(80);
|
||||
@ -35,17 +36,30 @@ void WebInspector::updateCloseButton()
|
||||
m_closeButton = new ToolButton(this);
|
||||
m_closeButton->setAutoRaise(true);
|
||||
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->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)
|
||||
{
|
||||
// Prevent re-initializing QWebInspector after changing tab / virtual desktop
|
||||
Q_UNUSED(event);
|
||||
// Prevent re-initializing QWebInspector after changing tab
|
||||
if (!m_blockHideEvent) {
|
||||
QWebInspector::hideEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void WebInspector::resizeEvent(QResizeEvent* event)
|
||||
|
@ -33,12 +33,14 @@ public:
|
||||
|
||||
private slots:
|
||||
void updateCloseButton();
|
||||
void hideInspector();
|
||||
|
||||
private:
|
||||
void hideEvent(QHideEvent* event);
|
||||
void resizeEvent(QResizeEvent* event);
|
||||
|
||||
ToolButton* m_closeButton;
|
||||
bool m_blockHideEvent;
|
||||
};
|
||||
|
||||
#endif // WEBINSPECTORDOCKWIDGET_H
|
||||
|
Loading…
Reference in New Issue
Block a user