Movable minimised Quick Search Widget

Fix for bug #12207.
This commit is contained in:
Daniel Ramoeller 2021-03-19 07:37:11 +01:00 committed by Juergen Spitzmueller
parent 528eee0a25
commit ce8b4e3a21
2 changed files with 32 additions and 0 deletions

View File

@ -564,6 +564,33 @@ GuiSearch::GuiSearch(GuiView & parent, Qt::DockWidgetArea area, Qt::WindowFlags
connect(widget_, SIGNAL(needSizeUpdate()), this, SLOT(updateSize())); connect(widget_, SIGNAL(needSizeUpdate()), this, SLOT(updateSize()));
} }
void GuiSearch::mousePressEvent(QMouseEvent *event)
{
if (isFloating() && event->button() == Qt::LeftButton) {
dragPosition = event->globalPos() - frameGeometry().topLeft();
event->accept();
}
}
void GuiSearch::mouseMoveEvent(QMouseEvent *event)
{
if (isFloating() && event->buttons() & Qt::LeftButton) {
move(event->globalPos() - dragPosition);
event->accept();
}
}
void GuiSearch::mouseDoubleClickEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
setFloating(!isFloating());
}
}
void GuiSearch::onBufferViewChanged() void GuiSearch::onBufferViewChanged()
{ {
widget_->setEnabled(static_cast<bool>(bufferview())); widget_->setEnabled(static_cast<bool>(bufferview()));

View File

@ -127,6 +127,9 @@ public:
protected: protected:
bool wantInitialFocus() const override { return true; } bool wantInitialFocus() const override { return true; }
void mouseMoveEvent(QMouseEvent * event) override;
void mousePressEvent(QMouseEvent * event) override;
void mouseDoubleClickEvent(QMouseEvent *event) override;
public Q_SLOTS: public Q_SLOTS:
/// ///
@ -141,6 +144,8 @@ private Q_SLOTS:
private: private:
/// The encapsulated widget. /// The encapsulated widget.
GuiSearchWidget * widget_; GuiSearchWidget * widget_;
///
QPoint dragPosition;
}; };
} // namespace frontend } // namespace frontend