From 8480d1ca26dd8b1e24638445188a720c7fb04163 Mon Sep 17 00:00:00 2001 From: szeli1 <143485814+szeli1@users.noreply.github.com> Date: Sat, 23 Nov 2024 18:25:37 +0100 Subject: [PATCH] MainWindow_renaming_CustomQMdiArea_to_MovableQMdiArea --- include/MainWindow.h | 9 ++++----- src/gui/MainWindow.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/include/MainWindow.h b/include/MainWindow.h index c3c804a0699..99e6228bdee 100644 --- a/include/MainWindow.h +++ b/include/MainWindow.h @@ -46,7 +46,6 @@ class ConfigManager; namespace gui { -class CustomQMdiArea; class PluginView; class SubWindow; class ToolButton; @@ -202,11 +201,11 @@ private slots: bool guiSaveProject(); bool guiSaveProjectAs( const QString & filename ); - class CustomQMdiArea : public QMdiArea + class MovableQMdiArea : public QMdiArea { public: - CustomQMdiArea(QWidget* parent = nullptr); - ~CustomQMdiArea() {} + MovableQMdiArea(QWidget* parent = nullptr); + ~MovableQMdiArea() {} protected: void mousePressEvent(QMouseEvent* event) override; void mouseMoveEvent(QMouseEvent* event) override; @@ -217,7 +216,7 @@ private slots: int m_lastY; }; - CustomQMdiArea * m_workspace; + MovableQMdiArea * m_workspace; QWidget * m_toolBar; QGridLayout * m_toolBarLayout; diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index b64da0f999b..32de9b6f79b 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -159,7 +159,7 @@ MainWindow::MainWindow() : sideBar->appendTab(new FileBrowser(root_paths.join("*"), FileItem::defaultFilters(), title, embed::getIconPixmap("computer").transformed(QTransform().rotate(90)), splitter, dirs_as_items)); - m_workspace = new CustomQMdiArea(splitter); + m_workspace = new MovableQMdiArea(splitter); // Load background emit initProgress(tr("Loading background picture")); @@ -1614,21 +1614,21 @@ void MainWindow::onProjectFileNameChanged() this->resetWindowTitle(); } -MainWindow::CustomQMdiArea::CustomQMdiArea(QWidget* parent) : +MainWindow::MovableQMdiArea::MovableQMdiArea(QWidget* parent) : QMdiArea(parent), m_isBeingMoved(false), m_lastX(0), m_lastY(0) {} -void MainWindow::CustomQMdiArea::mousePressEvent(QMouseEvent* event) +void MainWindow::MovableQMdiArea::mousePressEvent(QMouseEvent* event) { m_lastX = event->x(); m_lastY = event->y(); m_isBeingMoved = true; } -void MainWindow::CustomQMdiArea::mouseMoveEvent(QMouseEvent* event) +void MainWindow::MovableQMdiArea::mouseMoveEvent(QMouseEvent* event) { if (m_isBeingMoved == false) { return; } @@ -1646,7 +1646,7 @@ void MainWindow::CustomQMdiArea::mouseMoveEvent(QMouseEvent* event) } } -void MainWindow::CustomQMdiArea::mouseReleaseEvent(QMouseEvent* event) +void MainWindow::MovableQMdiArea::mouseReleaseEvent(QMouseEvent* event) { m_isBeingMoved = false; }