Skip to content

Commit

Permalink
Merge pull request #250 from cneben/f/#248-modern-qt-cmake
Browse files Browse the repository at this point in the history
F/#248 modern qt cmake
  • Loading branch information
cneben authored Sep 22, 2024
2 parents 2b36555 + f4db809 commit 7c34e1d
Show file tree
Hide file tree
Showing 136 changed files with 489 additions and 726 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ samples/build*
.idea
.DS_Store
build-tests-*

build
25 changes: 14 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@ add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050F00)
add_subdirectory(src)

option(QUICK_QANAVA_BUILD_SAMPLES "Build QuickQanava samples" OFF)
if (${QUICK_QANAVA_BUILD_SAMPLES})
#add_subdirectory(samples/advanced)
#add_subdirectory(samples/connector)
#add_subdirectory(samples/cpp)
#add_subdirectory(samples/dataflow)
#add_subdirectory(samples/edges)
#if (${QUICK_QANAVA_BUILD_SAMPLES})
add_subdirectory(samples/advanced)
add_subdirectory(samples/connector)
add_subdirectory(samples/cpp)

add_subdirectory(samples/dataflow)
add_subdirectory(samples/edges)
add_subdirectory(samples/groups)
#add_subdirectory(samples/navigable)
add_subdirectory(samples/navigable)

add_subdirectory(samples/nodes)
add_subdirectory(samples/layouts)
#add_subdirectory(samples/selection)
#add_subdirectory(samples/style)
#add_subdirectory(samples/topology)
endif()
add_subdirectory(samples/selection)

add_subdirectory(samples/style)
add_subdirectory(samples/topology)
#endif()
13 changes: 4 additions & 9 deletions samples/advanced/AdvancedGroup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ import QtQuick 2.8
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3

import QuickQanava 2.0 as Qan
import "qrc:/QuickQanava" as Qan
import QuickQanava as Qan

Qan.GroupItem {
id: advancedGroup
Expand All @@ -47,13 +46,9 @@ Qan.GroupItem {
height: 150

default property alias children : template
container: template.content // See qan::GroupItem::container property documentation

//! Show or hide group top left label editor (default to visible).
property alias labelEditorVisible : template.labelEditorVisible

//! Show or hide group top left expand button (default to visible).
property alias expandButtonVisible : template.expandButtonVisible
container: template.container // See qan::GroupItem::container property documentation
labelEditorVisible : template.labelEditorVisible
//expandButtonVisible : template.expandButtonVisible

Qan.RectGroupTemplate {
id: template
Expand Down
3 changes: 1 addition & 2 deletions samples/advanced/AdvancedNode.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ import QtQuick 2.8
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3

import QuickQanava 2.0 as Qan
import "qrc:/QuickQanava" as Qan
import QuickQanava as Qan

Qan.NodeItem {
id: customNode
Expand Down
12 changes: 6 additions & 6 deletions samples/advanced/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@ cmake_minimum_required(VERSION 3.16)

project(QuickQanava_sample_advanced VERSION 2.5.0 LANGUAGES CXX)

# Configure Qt
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml Quick QuickControls2)
qt_standard_project_setup(REQUIRES 6.6)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(source_files main.cpp)
set(resources_files advanced.qrc)

# Configure Qt
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml Quick QuickControls2)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:QT_QML_DEBUG>)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(source_files main.cpp)
set(resources_files advanced.qrc)
qt_add_resources(source_files ${resources_files})

if(NOT TARGET QuickQanava)
Expand All @@ -28,6 +27,7 @@ add_executable(sample_advanced ${source_files} advanced.qrc)
target_include_directories(sample_advanced PUBLIC QuickQanava Qt${QT_VERSION_MAJOR}::QuickControls2)
target_link_libraries(sample_advanced
QuickQanava
QuickQanavaplugin
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::QuickControls2
Expand Down
4 changes: 2 additions & 2 deletions samples/advanced/Hook.qml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
// \date 2023 11 17
//-----------------------------------------------------------------------------

import QtQuick 2.7
import QuickQanava 2.0 as Qan
import QtQuick 2.7
import QuickQanava as Qan

/*! A Hook has is transparent square which is only visible when selected.
*
Expand Down
7 changes: 3 additions & 4 deletions samples/advanced/advanced.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ import QtQuick.Controls.Material 2.1
import QtQuick.Layouts 1.3
import QtQuick.Shapes 1.0

import QuickQanava 2.0 as Qan
import "qrc:/QuickQanava" as Qan
import QuickQanava as Qan
import "." as Qan

ApplicationWindow {
Expand Down Expand Up @@ -67,7 +66,7 @@ ApplicationWindow {
const g1 = topology.insertGroup(advancedGroupDelegate);
g1.label = "GROUP 1";
g1.item.x = 300; g1.item.y = 80;
g1.item.width = 450; g1.item.height = 220;
g1.item.width = 450; g1.item.height = 260;

const g1n1 = topology.insertNode(advancedNodeDelegate);
topology.groupNode(g1, g1n1);
Expand Down Expand Up @@ -98,7 +97,7 @@ ApplicationWindow {
const g2 = topology.insertGroup(advancedGroupDelegate);
g2.label = "GROUP 2";
g2.item.x = 200; g2.item.y = 380;
g2.item.width = 190; g2.item.height = 120;
g2.item.width = 190; g2.item.height = 150;

const g2n1 = topology.insertNode(advancedNodeDelegate);
topology.groupNode(g2, g2n1);
Expand Down
3 changes: 2 additions & 1 deletion samples/advanced/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@
#include <QuickQanava>

//-----------------------------------------------------------------------------
int main( int argc, char** argv )
int main(int argc, char** argv)
{
QGuiApplication app(argc, argv);
QQuickStyle::setStyle("Material");
QQmlApplicationEngine engine;
engine.addImportPath("../../src/");
QuickQanava::initialize(&engine);
engine.load(QUrl("qrc:/advanced.qml"));
return app.exec();
Expand Down
7 changes: 4 additions & 3 deletions samples/connector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ cmake_minimum_required(VERSION 3.16)

project(QuickQanava_sample_connector VERSION 2.5.0 LANGUAGES CXX)

# Configure Qt
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml Quick QuickControls2)
qt_standard_project_setup(REQUIRES 6.6)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Configure Qt
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml Quick QuickControls2)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:QT_QML_DEBUG>)
Expand All @@ -28,6 +28,7 @@ add_executable(sample_connector ${source_files} connector.qrc)
target_include_directories(sample_connector PUBLIC QuickQanava Qt${QT_VERSION_MAJOR}::QuickControls2)
target_link_libraries(sample_connector
QuickQanava
QuickQanavaplugin
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::QuickControls2
Expand Down
2 changes: 1 addition & 1 deletion samples/connector/connector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int main( int argc, char** argv )
QGuiApplication app(argc, argv); // Necessary for Qt.labs ColorDialog
QQuickStyle::setStyle("Material");
QQmlApplicationEngine engine;
engine.addPluginPath(QStringLiteral("../../src")); // Necessary only for development when plugin is not installed to QTDIR/qml
engine.addImportPath("../../src/");
QuickQanava::initialize(&engine);
engine.load(QUrl("qrc:/connector.qml"));
return app.exec();
Expand Down
3 changes: 1 addition & 2 deletions samples/connector/connector.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ import QtQuick.Controls.Material 2.1
import QtQuick.Layouts 1.3
import QtQuick.Shapes 1.0

import QuickQanava 2.0 as Qan
import "qrc:/QuickQanava" as Qan
import QuickQanava as Qan
import "." as Qan

ApplicationWindow {
Expand Down
3 changes: 1 addition & 2 deletions samples/connector/custom.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ import QtQuick.Controls 2.1
import QtQuick.Controls.Material 2.1
import QtQuick.Layouts 1.3

import QuickQanava 2.0 as Qan
import "qrc:/QuickQanava" as Qan
import QuickQanava as Qan
import "." as Qan

Qan.GraphView {
Expand Down
4 changes: 1 addition & 3 deletions samples/connector/customdocks.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ import QtQuick.Controls.Material 2.1
import QtQuick.Layouts 1.3
import Qt.labs.platform 1.0 // ColorDialog

import QuickQanava 2.0 as Qan
import "qrc:/QuickQanava" as Qan
import QuickQanava as Qan
import "." as Qan


Qan.GraphView {
id: graphView
z: -1
Expand Down
3 changes: 1 addition & 2 deletions samples/connector/default.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ import QtQuick.Controls.Material 2.1
import QtQuick.Layouts 1.3
import Qt.labs.platform 1.0 // ColorDialog

import QuickQanava 2.0 as Qan
import "qrc:/QuickQanava" as Qan
import QuickQanava as Qan
import "." as Qan

Qan.GraphView {
Expand Down
3 changes: 1 addition & 2 deletions samples/connector/docks.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ import QtQuick.Controls.Material 2.1
import QtQuick.Layouts 1.3
import Qt.labs.platform 1.0 // ColorDialog

import QuickQanava 2.0 as Qan
import "qrc:/QuickQanava" as Qan
import QuickQanava as Qan
import "." as Qan

Qan.GraphView {
Expand Down
8 changes: 4 additions & 4 deletions samples/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ cmake_minimum_required(VERSION 3.16)

project(QuickQanava_sample_cpp VERSION 2.5.0 LANGUAGES CXX)


# Configure Qt
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml Quick QuickControls2)
qt_standard_project_setup(REQUIRES 6.6)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Configure Qt
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml Quick QuickControls2)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:QT_QML_DEBUG>)
Expand All @@ -31,6 +30,7 @@ endif()
add_executable(sample_cpp ${source_files} cpp_sample.qrc)
target_link_libraries(sample_cpp PUBLIC
QuickQanava
QuickQanavaplugin
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::QuickControls2)
Expand Down
7 changes: 3 additions & 4 deletions samples/cpp/CustomEdge.qml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@
// \date 2015 06 20
//-----------------------------------------------------------------------------

import QtQuick 2.7
import QtQuick.Controls.Material 2.1
import QtQuick
import QtQuick.Controls.Material

import QuickQanava 2.0 as Qan
import "qrc:/QuickQanava" as Qan
import QuickQanava as Qan

Qan.EdgeItem {
id: edgeItem
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp/CustomGroup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import QtQuick.Layouts
import QtQuick.Effects
import QtQuick.Controls.Material

import QuickQanava 2.0 as Qan
import QuickQanava as Qan

Qan.GroupItem {
id: customGroup
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp/CustomNode.qml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import QtQuick.Layouts
import QtQuick.Effects
import QtQuick.Controls.Material

import QuickQanava 2.0 as Qan
import QuickQanava as Qan

Qan.NodeItem {
id: rectNode
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp/cpp_sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ int main( int argc, char** argv )
QGuiApplication app(argc, argv);
QQuickStyle::setStyle("Material");
QQmlApplicationEngine engine;
engine.addPluginPath(QStringLiteral("../../src")); // Necessary only for development when plugin is not installed to QTDIR/qml
engine.addImportPath("../../src/");
QuickQanava::initialize(&engine);

qmlRegisterType<CustomGroup>("MyModule", 1, 0, "CustomGroup");
Expand Down
13 changes: 6 additions & 7 deletions samples/cpp/cpp_sample.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

import QtQuick 2.8
import QtQuick.Controls 2.1
import QtQuick.Controls.Material 2.1
import QtQuick.Layouts 1.3
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Material
import QtQuick.Layouts

import QuickQanava 2.0 as Qan
import "qrc:/QuickQanava" as Qan
import MyModule 1.0 // Our custom topology is defined in MyModule
import QuickQanava as Qan
import MyModule // Our custom topology is defined in MyModule

ApplicationWindow {
id: window
Expand Down
Loading

0 comments on commit 7c34e1d

Please sign in to comment.