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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user