mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 12:35:43 +08:00
Ref T592, navigator dialog
* movable by mouse * UI border
This commit is contained in:
committed by
Mat Sutcliffe
parent
d33b913e62
commit
eb5670abef
@@ -183,12 +183,42 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CNavigatorDialog::mouseMoveEvent(QMouseEvent *event)
|
void CNavigatorDialog::mouseMoveEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (!handleMouseMoveEvent(event)) { QDialog::mouseMoveEvent(event); } ;
|
if (handleMouseMoveEvent(event)) { return; }
|
||||||
|
|
||||||
|
// frameless has moving already, but here we also do it dor dialog
|
||||||
|
if (!this->isFrameless())
|
||||||
|
{
|
||||||
|
if (event->buttons() & Qt::LeftButton)
|
||||||
|
{
|
||||||
|
this->move(event->globalPos() - m_framelessDragPosition);
|
||||||
|
event->accept();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QDialog::mouseMoveEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNavigatorDialog::mousePressEvent(QMouseEvent *event)
|
void CNavigatorDialog::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (!handleMousePressEvent(event)) { QDialog::mousePressEvent(event); }
|
if (handleMousePressEvent(event)) { return; }
|
||||||
|
|
||||||
|
// frameless has moving already, but here we also do it dor dialog
|
||||||
|
if (!this->isFrameless())
|
||||||
|
{
|
||||||
|
if (event->buttons() & Qt::LeftButton)
|
||||||
|
{
|
||||||
|
m_framelessDragPosition = this->mapToParent(event->pos());
|
||||||
|
event->accept();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QDialog::mousePressEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNavigatorDialog::mouseReleaseEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
m_framelessDragPosition = QPoint();
|
||||||
|
QDialog::mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNavigatorDialog::changeEvent(QEvent *evt)
|
void CNavigatorDialog::changeEvent(QEvent *evt)
|
||||||
@@ -264,8 +294,8 @@ namespace BlackGui
|
|||||||
void CNavigatorDialog::insertOwnActions()
|
void CNavigatorDialog::insertOwnActions()
|
||||||
{
|
{
|
||||||
// add some space for frameless navigators where I can move the navigator
|
// add some space for frameless navigators where I can move the navigator
|
||||||
QAction *a = new QAction(CIcons::empty16(), "move navigator here", this);
|
QAction *a = nullptr; // new QAction(CIcons::empty16(), "move navigator here", this);
|
||||||
if (this->actions().isEmpty())
|
if (a && this->actions().isEmpty())
|
||||||
{
|
{
|
||||||
this->addAction(a);
|
this->addAction(a);
|
||||||
}
|
}
|
||||||
@@ -274,7 +304,7 @@ namespace BlackGui
|
|||||||
this->insertAction(this->actions().first(), a);
|
this->insertAction(this->actions().first(), a);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool c;
|
bool c = false;
|
||||||
if (sGui)
|
if (sGui)
|
||||||
{
|
{
|
||||||
a = new QAction(CIcons::swiftLauncher16(), "Start launcher", this);
|
a = new QAction(CIcons::swiftLauncher16(), "Start launcher", this);
|
||||||
@@ -319,7 +349,7 @@ namespace BlackGui
|
|||||||
int h = 16 * gridLayout->rowCount();
|
int h = 16 * gridLayout->rowCount();
|
||||||
|
|
||||||
// margins
|
// margins
|
||||||
QMargins margins = gridLayout->contentsMargins() + this->contentsMargins();
|
const QMargins margins = gridLayout->contentsMargins() + this->contentsMargins();
|
||||||
h = h + margins.top() + margins.bottom();
|
h = h + margins.top() + margins.bottom();
|
||||||
w = w + margins.left() + margins.right();
|
w = w + margins.left() + margins.right();
|
||||||
|
|
||||||
@@ -352,7 +382,7 @@ namespace BlackGui
|
|||||||
contextMenu->addAction("Adjust margins", this, &CNavigatorDialog::dummyFunction);
|
contextMenu->addAction("Adjust margins", this, &CNavigatorDialog::dummyFunction);
|
||||||
contextMenu->addAction(m_marginMenuAction);
|
contextMenu->addAction(m_marginMenuAction);
|
||||||
contextMenu->addSeparator();
|
contextMenu->addSeparator();
|
||||||
contextMenu->addAction(CIcons::load16(), "Restore state", this, &CNavigatorDialog::restoreFromSettings);
|
contextMenu->addAction(CIcons::load16(), "Restore from settings", this, &CNavigatorDialog::restoreFromSettings);
|
||||||
contextMenu->addAction(CIcons::save16(), "Save state", this, &CNavigatorDialog::saveToSettings);
|
contextMenu->addAction(CIcons::save16(), "Save state", this, &CNavigatorDialog::saveToSettings);
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -22,11 +22,11 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QPoint>
|
||||||
|
|
||||||
class QEvent;
|
class QEvent;
|
||||||
class QMenu;
|
class QMenu;
|
||||||
class QMouseEvent;
|
class QMouseEvent;
|
||||||
class QPoint;
|
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
namespace Ui { class CNavigatorDialog; }
|
namespace Ui { class CNavigatorDialog; }
|
||||||
@@ -82,6 +82,7 @@ namespace BlackGui
|
|||||||
//! @{
|
//! @{
|
||||||
virtual void mouseMoveEvent(QMouseEvent *event) override;
|
virtual void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
virtual void mousePressEvent(QMouseEvent *event) override;
|
virtual void mousePressEvent(QMouseEvent *event) override;
|
||||||
|
virtual void mouseReleaseEvent(QMouseEvent *event) override;
|
||||||
virtual void changeEvent(QEvent *evt) override;
|
virtual void changeEvent(QEvent *evt) override;
|
||||||
virtual void windowFlagsChanged() override;
|
virtual void windowFlagsChanged() override;
|
||||||
virtual void paintEvent(QPaintEvent *event) override;
|
virtual void paintEvent(QPaintEvent *event) override;
|
||||||
|
|||||||
@@ -6,16 +6,10 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>48</width>
|
<width>20</width>
|
||||||
<height>381</height>
|
<height>278</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16</width>
|
<width>16</width>
|
||||||
@@ -23,33 +17,23 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Navigator</string>
|
<string>swift Navigator</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gl_NavigatorDialog">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QFrame" name="fr_NavigatorDialogInner">
|
<widget class="QFrame" name="fr_NavigatorDialogInner"/>
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|||||||
Reference in New Issue
Block a user