From 441a01bdc397cfb2a784cbe5e99dfb1162984b33 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Fri, 18 May 2018 20:36:48 +0200 Subject: [PATCH] moved meta-data to sub-project --- source/CMakeLists.txt | 11 +++++---- source/DataModel.h | 2 +- source/MetaData/CMakeLists.txt | 31 ++++++++++++++++++++++++ source/{ => MetaData}/MetaDataModel.cpp | 8 +++--- source/{ => MetaData}/MetaDataModel.h | 0 source/{ => MetaData}/MetaDataWidget.cpp | 0 source/{ => MetaData}/MetaDataWidget.h | 0 source/{ => MetaData}/MetaDataWidget.ui | 0 source/mainwindow.cpp | 1 - source/mainwindow.ui | 2 +- 10 files changed, 43 insertions(+), 12 deletions(-) create mode 100644 source/MetaData/CMakeLists.txt rename source/{ => MetaData}/MetaDataModel.cpp (100%) rename source/{ => MetaData}/MetaDataModel.h (100%) rename source/{ => MetaData}/MetaDataWidget.cpp (100%) rename source/{ => MetaData}/MetaDataWidget.h (100%) rename source/{ => MetaData}/MetaDataWidget.ui (100%) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index dd0e16f..7a39d17 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -9,18 +9,16 @@ set(CMAKE_AUTORCC ON) qt5_wrap_ui(UI_HEADERS mainwindow.ui - MetaDataWidget.ui ) - qt5_add_resources(UI_RESOURCES - mainwindow.qrc + +qt5_add_resources(UI_RESOURCES + mainwindow.qrc ) add_executable(${PROJECT_NAME} LogoTest.cpp DataModel.cpp - MetaDataModel.cpp mainwindow.cpp - MetaDataWidget.cpp ${UI_HEADERS} ${UI_RESOURCES} ) @@ -37,5 +35,8 @@ target_include_directories(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME} PRIVATE + MetaData Qt5::Widgets ) + +add_subdirectory(MetaData) diff --git a/source/DataModel.h b/source/DataModel.h index 02f8e29..34258f0 100644 --- a/source/DataModel.h +++ b/source/DataModel.h @@ -1,6 +1,6 @@ #pragma once -#include "MetaDataModel.h" +#include "MetaData/MetaDataModel.h" #include diff --git a/source/MetaData/CMakeLists.txt b/source/MetaData/CMakeLists.txt new file mode 100644 index 0000000..c58cb53 --- /dev/null +++ b/source/MetaData/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.6) + +project(MetaData LANGUAGES CXX) + +find_package(Qt5Widgets REQUIRED) + +set(CMAKE_AUTOMOC ON) + +qt5_wrap_ui(UI_HEADERS + MetaDataWidget.ui +) + +add_library(${PROJECT_NAME} + MetaDataModel.cpp + MetaDataWidget.cpp + ${UI_HEADERS} +) + +set_target_properties(${PROJECT_NAME} + PROPERTIES CXX_STANDARD 14 +) + +target_include_directories(${PROJECT_NAME} + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} +) + +target_link_libraries(${PROJECT_NAME} + PRIVATE + Qt5::Widgets +) diff --git a/source/MetaDataModel.cpp b/source/MetaData/MetaDataModel.cpp similarity index 100% rename from source/MetaDataModel.cpp rename to source/MetaData/MetaDataModel.cpp index 026d37c..eaabd04 100644 --- a/source/MetaDataModel.cpp +++ b/source/MetaData/MetaDataModel.cpp @@ -72,16 +72,16 @@ bool MetaDataModel::setData( } break; case 2: - if (value.toDate() != m_dateOfTest) + if (value.toDate() != m_dateOfBirth) { - m_dateOfTest = value.toDate(); + m_dateOfBirth = value.toDate(); valueChanged = true; } break; case 3: - if (value.toDate() != m_dateOfBirth) + if (value.toDate() != m_dateOfTest) { - m_dateOfBirth = value.toDate(); + m_dateOfTest = value.toDate(); valueChanged = true; } break; diff --git a/source/MetaDataModel.h b/source/MetaData/MetaDataModel.h similarity index 100% rename from source/MetaDataModel.h rename to source/MetaData/MetaDataModel.h diff --git a/source/MetaDataWidget.cpp b/source/MetaData/MetaDataWidget.cpp similarity index 100% rename from source/MetaDataWidget.cpp rename to source/MetaData/MetaDataWidget.cpp diff --git a/source/MetaDataWidget.h b/source/MetaData/MetaDataWidget.h similarity index 100% rename from source/MetaDataWidget.h rename to source/MetaData/MetaDataWidget.h diff --git a/source/MetaDataWidget.ui b/source/MetaData/MetaDataWidget.ui similarity index 100% rename from source/MetaDataWidget.ui rename to source/MetaData/MetaDataWidget.ui diff --git a/source/mainwindow.cpp b/source/mainwindow.cpp index c7b709c..15d470f 100644 --- a/source/mainwindow.cpp +++ b/source/mainwindow.cpp @@ -2,7 +2,6 @@ #include "ui_mainwindow.h" #include "DataModel.h" -#include "MetaDataModel.h" #include #include diff --git a/source/mainwindow.ui b/source/mainwindow.ui index b36a315..1a0d18c 100644 --- a/source/mainwindow.ui +++ b/source/mainwindow.ui @@ -103,7 +103,7 @@ MetaDataWidget QWidget -
MetaDataWidget.h
+
MetaData/MetaDataWidget.h
1