Navigate workspace in the main window by dragging the mouse (#7595)

The scroll bars shown in the main window were removed in favor of a new navigation feature that utilizes dragging the mouse instead. Users can now hold the mouse down on an empty part of the workspace and drag the mouse around to navigate where necessary.
This commit is contained in:
szeli1
2025-03-03 00:03:37 +01:00
committed by GitHub
parent ef1d86fa41
commit 5fa01e7dbc
2 changed files with 81 additions and 14 deletions

View File

@@ -29,6 +29,7 @@
#include <QTimer>
#include <QList>
#include <QMainWindow>
#include <QMdiArea>
#include "ConfigManager.h"
@@ -57,7 +58,7 @@ class MainWindow : public QMainWindow
public:
QMdiArea* workspace()
{
return m_workspace;
return static_cast<QMdiArea*>(m_workspace);
}
QWidget* toolBar()
@@ -203,7 +204,22 @@ private:
bool guiSaveProject();
bool guiSaveProjectAs( const QString & filename );
QMdiArea * m_workspace;
class MovableQMdiArea : public QMdiArea
{
public:
MovableQMdiArea(QWidget* parent = nullptr);
~MovableQMdiArea() {}
protected:
void mousePressEvent(QMouseEvent* event) override;
void mouseMoveEvent(QMouseEvent* event) override;
void mouseReleaseEvent(QMouseEvent* event) override;
private:
bool m_isBeingMoved;
int m_lastX;
int m_lastY;
};
MovableQMdiArea * m_workspace;
QWidget * m_toolBar;
QGridLayout * m_toolBarLayout;
@@ -258,7 +274,6 @@ signals:
} ;
} // namespace gui
} // namespace lmms