mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
parent
528eee0a25
commit
ce8b4e3a21
@ -564,6 +564,33 @@ GuiSearch::GuiSearch(GuiView & parent, Qt::DockWidgetArea area, Qt::WindowFlags
|
||||
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()
|
||||
{
|
||||
widget_->setEnabled(static_cast<bool>(bufferview()));
|
||||
|
@ -127,6 +127,9 @@ public:
|
||||
|
||||
protected:
|
||||
bool wantInitialFocus() const override { return true; }
|
||||
void mouseMoveEvent(QMouseEvent * event) override;
|
||||
void mousePressEvent(QMouseEvent * event) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
|
||||
public Q_SLOTS:
|
||||
///
|
||||
@ -141,6 +144,8 @@ private Q_SLOTS:
|
||||
private:
|
||||
/// The encapsulated widget.
|
||||
GuiSearchWidget * widget_;
|
||||
///
|
||||
QPoint dragPosition;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
Loading…
Reference in New Issue
Block a user