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)
|
||||
|
||||
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)
|
||||
|
||||
@ -28,7 +28,7 @@ add_library(${TARGET_APP} STATIC
|
||||
|
||||
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)
|
||||
|
||||
|
||||
@ -12,11 +12,15 @@
|
||||
#include "constants.h"
|
||||
#include "model/tablemodel.h"
|
||||
|
||||
#include <QtGui/QUndoStack>
|
||||
|
||||
using namespace std;
|
||||
|
||||
GenericCore::GenericCore() {
|
||||
qDebug() << "Creating core...";
|
||||
|
||||
m_modelUndoStack = make_shared<QUndoStack>(this);
|
||||
|
||||
setupModels();
|
||||
}
|
||||
|
||||
@ -70,6 +74,8 @@ void GenericCore::triggerApplicationUpdate() {
|
||||
QProcess::startDetached(toolFilePath, args);
|
||||
}
|
||||
|
||||
std::shared_ptr<QUndoStack> GenericCore::getModUndoStack() const { return m_modelUndoStack; }
|
||||
|
||||
std::shared_ptr<QAbstractItemModel> GenericCore::getModel() const { return m_mainModel; }
|
||||
|
||||
void GenericCore::setupModels() {
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class QUndoStack;
|
||||
class QAbstractItemModel;
|
||||
class QString;
|
||||
|
||||
@ -21,12 +22,14 @@ class GenericCore : public QObject {
|
||||
bool isApplicationUpdateAvailable();
|
||||
void triggerApplicationUpdate();
|
||||
|
||||
std::shared_ptr<QUndoStack> getModUndoStack() const;
|
||||
std::shared_ptr<QAbstractItemModel> getModel() const;
|
||||
|
||||
signals:
|
||||
void displayStatusMessage(QString message);
|
||||
|
||||
private:
|
||||
std::shared_ptr<QUndoStack> m_modelUndoStack;
|
||||
std::shared_ptr<TableModel> m_mainModel;
|
||||
|
||||
void setupModels();
|
||||
|
||||
Reference in New Issue
Block a user