Added a QUndoStack and made it accessible for UIs.
This commit is contained in:
@ -10,7 +10,7 @@ set(CMAKE_CXX_STANDARD 17)
|
|||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core LinguistTools)
|
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core LinguistTools)
|
||||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core LinguistTools)
|
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core LinguistTools Gui)
|
||||||
|
|
||||||
configure_file(CoreConfig.h.in CoreConfig.h)
|
configure_file(CoreConfig.h.in CoreConfig.h)
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ add_library(${TARGET_APP} STATIC
|
|||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
target_link_libraries(${TARGET_APP} PRIVATE Qt${QT_VERSION_MAJOR}::Core)
|
target_link_libraries(${TARGET_APP} PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui)
|
||||||
|
|
||||||
target_compile_definitions(${TARGET_APP} PRIVATE ${TARGET_APP}_LIBRARY)
|
target_compile_definitions(${TARGET_APP} PRIVATE ${TARGET_APP}_LIBRARY)
|
||||||
|
|
||||||
|
|||||||
@ -12,11 +12,15 @@
|
|||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "model/tablemodel.h"
|
#include "model/tablemodel.h"
|
||||||
|
|
||||||
|
#include <QtGui/QUndoStack>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
GenericCore::GenericCore() {
|
GenericCore::GenericCore() {
|
||||||
qDebug() << "Creating core...";
|
qDebug() << "Creating core...";
|
||||||
|
|
||||||
|
m_modelUndoStack = make_shared<QUndoStack>(this);
|
||||||
|
|
||||||
setupModels();
|
setupModels();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +74,8 @@ void GenericCore::triggerApplicationUpdate() {
|
|||||||
QProcess::startDetached(toolFilePath, args);
|
QProcess::startDetached(toolFilePath, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<QUndoStack> GenericCore::getModUndoStack() const { return m_modelUndoStack; }
|
||||||
|
|
||||||
std::shared_ptr<QAbstractItemModel> GenericCore::getModel() const { return m_mainModel; }
|
std::shared_ptr<QAbstractItemModel> GenericCore::getModel() const { return m_mainModel; }
|
||||||
|
|
||||||
void GenericCore::setupModels() {
|
void GenericCore::setupModels() {
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
class QUndoStack;
|
||||||
class QAbstractItemModel;
|
class QAbstractItemModel;
|
||||||
class QString;
|
class QString;
|
||||||
|
|
||||||
@ -21,12 +22,14 @@ class GenericCore : public QObject {
|
|||||||
bool isApplicationUpdateAvailable();
|
bool isApplicationUpdateAvailable();
|
||||||
void triggerApplicationUpdate();
|
void triggerApplicationUpdate();
|
||||||
|
|
||||||
|
std::shared_ptr<QUndoStack> getModUndoStack() const;
|
||||||
std::shared_ptr<QAbstractItemModel> getModel() const;
|
std::shared_ptr<QAbstractItemModel> getModel() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void displayStatusMessage(QString message);
|
void displayStatusMessage(QString message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::shared_ptr<QUndoStack> m_modelUndoStack;
|
||||||
std::shared_ptr<TableModel> m_mainModel;
|
std::shared_ptr<TableModel> m_mainModel;
|
||||||
|
|
||||||
void setupModels();
|
void setupModels();
|
||||||
|
|||||||
Reference in New Issue
Block a user