Skip to content

Commit 9af64e6

Browse files
authored
Merge pull request #162 from cneben/develop
2.1.0
2 parents e40b81c + 3902d60 commit 9af64e6

34 files changed

+973
-157
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.5.0)
22

3-
project(QuickQanava VERSION 0.11.0 LANGUAGES CXX)
3+
project(QuickQanava VERSION 2.1.0 LANGUAGES CXX)
44
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
55

66
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050F00)

QuickContainers/include/qcmAdapter.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct adapter< QList, T > {
7878
inline static int indexOf(const QList<T>& c, const T& t) { return c.indexOf(t); }
7979
};
8080

81-
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
81+
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) || defined(__clang__)
8282
template <typename T>
8383
struct adapter<QVector, T> {
8484
inline static void reserve(QVector<T>& c, std::size_t size) { c.reserve(static_cast<int>(size)); }

quickqanava.pro

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,19 @@ test-style.subdir = samples/style
1212
test-dataflow.subdir = samples/dataflow
1313
test-topology.subdir = samples/topology
1414
test-cpp.subdir = samples/cpp
15+
test-tools.subdir = samples/tools
1516

1617
# Uncomment to activate samples projects:
1718
#SUBDIRS += test-nodes
1819
#SUBDIRS += test-edges
19-
SUBDIRS += test-connector
20+
#SUBDIRS += test-connector
2021
#SUBDIRS += test-groups
2122
#SUBDIRS += test-selection
2223
#SUBDIRS += test-style
23-
SUBDIRS += test-topology
24+
#SUBDIRS += test-topology
2425
#SUBDIRS += test-dataflow
2526
#SUBDIRS += test-cpp
27+
SUBDIRS += test-tools
2628

2729
# Theses ones are test projects, not sample:
2830
#SUBDIRS += test-resizer

samples/tools/qtquickcontrols2.conf

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Material]
2+
Primary=#03A9F4
3+
Accent=#03A9F4
4+
Theme=Light
5+
Variant=Dense
6+
7+
[Universal]
8+
Accent=#41cd52
9+
Theme=Light

samples/tools/tools.cpp

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
Copyright (c) 2008-2022, Benoit AUTHEMAN All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
* Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the above copyright
9+
notice, this list of conditions and the following disclaimer in the
10+
documentation and/or other materials provided with the distribution.
11+
* Neither the name of the author or Destrat.io nor the
12+
names of its contributors may be used to endorse or promote products
13+
derived from this software without specific prior written permission.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
DISCLAIMED. IN NO EVENT SHALL AUTHOR BE LIABLE FOR ANY
19+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25+
*/
26+
27+
//-----------------------------------------------------------------------------
28+
// This file is a part of the QuickQanava software library.
29+
//
30+
// \file tools.cpp
31+
32+
// \date 2022 08 10
33+
//-----------------------------------------------------------------------------
34+
35+
// Qt headers
36+
#include <QApplication>
37+
#include <QQuickStyle>
38+
#include <QIcon>
39+
40+
// QuickQanava headers
41+
#include "../../src/QuickQanava.h"
42+
43+
using namespace qan;
44+
45+
int main(int argc, char** argv)
46+
{
47+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
48+
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
49+
#endif
50+
QApplication app(argc, argv);
51+
app.setQuitOnLastWindowClosed(true);
52+
QQuickStyle::setStyle("Material");
53+
QQmlApplicationEngine engine;
54+
engine.addPluginPath(QStringLiteral("../../src")); // Necessary only for development when plugin is not installed to QTDIR/qml
55+
QuickQanava::initialize(&engine);
56+
engine.load(QUrl("qrc:/tools.qml"));
57+
return app.exec();
58+
}
59+

samples/tools/tools.pro

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
TEMPLATE = app
2+
TARGET = test-tools
3+
CONFIG += qt warn_on thread c++14
4+
QT += widgets core gui qml quick quickcontrols2
5+
6+
include(../../src/quickqanava.pri)
7+
8+
RESOURCES += ./tools.qrc
9+
10+
SOURCES += ./tools.cpp
11+
12+
HEADERS += ./tools.qml
13+
14+
OTHER_FILES += tools.qml

samples/tools/tools.qml

+196
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
/*
2+
Copyright (c) 2008-2022, Benoit AUTHEMAN All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
* Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the above copyright
9+
notice, this list of conditions and the following disclaimer in the
10+
documentation and/or other materials provided with the distribution.
11+
* Neither the name of the author or Destrat.io nor the
12+
names of its contributors may be used to endorse or promote products
13+
derived from this software without specific prior written permission.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
DISCLAIMED. IN NO EVENT SHALL AUTHOR BE LIABLE FOR ANY
19+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25+
*/
26+
27+
import QtQuick.Window 2.2
28+
import QtQuick 2.13
29+
30+
import QtQuick.Controls 2.13
31+
32+
import QtQuick.Layouts 1.3
33+
import QtQuick.Controls.Material 2.1
34+
import QtQuick.Shapes 1.0
35+
36+
import QuickQanava 2.0 as Qan
37+
import "qrc:/QuickQanava" as Qan
38+
39+
ApplicationWindow {
40+
id: window
41+
visible: true
42+
width: 1280
43+
height: 720 // MPEG - 2 HD 720p - 1280 x 720 16:9
44+
title: "Tools test"
45+
Pane {
46+
anchors.fill: parent
47+
padding: 0
48+
}
49+
50+
function centerItem(item) {
51+
if (!item || !window.contentItem)
52+
return
53+
var windowCenter = Qt.point(
54+
(window.contentItem.width - item.width) / 2.,
55+
(window.contentItem.height - item.height) / 2.)
56+
var graphNodeCenter = window.contentItem.mapToItem(
57+
graphView.containerItem, windowCenter.x, windowCenter.y)
58+
item.x = graphNodeCenter.x
59+
item.y = graphNodeCenter.y
60+
}
61+
62+
Qan.GraphView {
63+
id: graphView
64+
anchors.fill: parent
65+
graph: topology
66+
navigable: true
67+
resizeHandlerColor: Material.accent
68+
gridThickColor: Material.theme === Material.Dark ? "#4e4e4e" : "#c1c1c1"
69+
70+
Qan.Graph {
71+
id: topology
72+
objectName: "graph"
73+
anchors.fill: parent
74+
clip: true
75+
connectorEnabled: true
76+
selectionColor: Material.accent
77+
connectorColor: Material.accent
78+
connectorEdgeColor: Material.accent
79+
onConnectorEdgeInserted: edge => {
80+
//if (edge)
81+
// edge.label = "My edge"
82+
}
83+
property Component faceNodeComponent: Qt.createComponent("qrc:/FaceNode.qml")
84+
85+
Component.onCompleted: {
86+
var n1 = topology.insertNode()
87+
n1.label = "n1"
88+
89+
var n2 = topology.insertNode()
90+
n2.label = "n2"
91+
n2.item.x = 150
92+
n2.item.y = 55
93+
94+
graphView.centerOnPosition(Qt.point(0, 0));
95+
}
96+
} // Qan.Graph: graph
97+
}
98+
99+
Qan.GraphPreview {
100+
id: graphPreview
101+
source: graphView
102+
viewWindowColor: Material.accent
103+
anchors.right: graphView.right
104+
anchors.bottom: graphView.bottom
105+
anchors.rightMargin: 8
106+
anchors.bottomMargin: 8
107+
width: previewMenu.mediumPreview.width
108+
height: previewMenu.mediumPreview.height
109+
Menu {
110+
id: previewMenu
111+
readonly property size smallPreview: Qt.size(150, 85)
112+
readonly property size mediumPreview: Qt.size(250, 141)
113+
readonly property size largePreview: Qt.size(350, 198)
114+
MenuItem {
115+
text: "Hide preview"
116+
onTriggered: graphPreview.visible = false
117+
}
118+
MenuSeparator { }
119+
MenuItem {
120+
text: qsTr('Small')
121+
checkable: true
122+
checked: graphPreview.width === previewMenu.smallPreview.width &&
123+
graphPreview.height === previewMenu.smallPreview.height
124+
onTriggered: {
125+
graphPreview.width = previewMenu.smallPreview.width
126+
graphPreview.height = previewMenu.smallPreview.height
127+
}
128+
}
129+
MenuItem {
130+
text: qsTr('Medium')
131+
checkable: true
132+
checked: graphPreview.width === previewMenu.mediumPreview.width &&
133+
graphPreview.height === previewMenu.mediumPreview.height
134+
onTriggered: {
135+
graphPreview.width = previewMenu.mediumPreview.width
136+
graphPreview.height = previewMenu.mediumPreview.height
137+
}
138+
}
139+
MenuItem {
140+
text: qsTr('Large')
141+
checkable: true
142+
checked: graphPreview.width === previewMenu.largePreview.width &&
143+
graphPreview.height === previewMenu.largePreview.height
144+
onTriggered: {
145+
graphPreview.width = previewMenu.largePreview.width
146+
graphPreview.height = previewMenu.largePreview.height
147+
}
148+
}
149+
}
150+
MouseArea {
151+
anchors.fill: parent
152+
acceptedButtons: Qt.RightButton
153+
onClicked: previewMenu.open(mouse.x, mouse.y)
154+
}
155+
}
156+
157+
Qan.HeatMapPreview {
158+
id: heatMapPreview
159+
anchors.left: graphView.left
160+
anchors.bottom: graphView.bottom
161+
source: graphView
162+
viewWindowColor: Material.accent
163+
Menu {
164+
id: heatMapMenu
165+
MenuItem {
166+
text: qsTr("Clear heat map")
167+
onClicked: heatMapPreview.clearHeatMap()
168+
}
169+
MenuItem {
170+
text: qsTr("Increase preview size")
171+
onTriggered: {
172+
heatMapPreview.width *= 1.15
173+
heatMapPreview.height *= 1.15
174+
}
175+
}
176+
MenuItem {
177+
text: qsTr("Decrease preview size")
178+
onTriggered: {
179+
heatMapPreview.width *= Math.max(50, heatMapPreview.width * 0.85)
180+
heatMapPreview.height *= Math.max(50, heatMapPreview.height * 0.85)
181+
}
182+
}
183+
}
184+
MouseArea {
185+
anchors.fill: parent
186+
acceptedButtons: Qt.RightButton; preventStealing: true
187+
onClicked: {
188+
if (mouse.button === Qt.RightButton) {
189+
heatMapMenu.x = mouse.x
190+
heatMapMenu.y = mouse.y
191+
heatMapMenu.open()
192+
}
193+
}
194+
}
195+
} // Qan.HeatMapPreview
196+
} // ApplicationWindow

samples/tools/tools.qrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<RCC>
2+
<qresource prefix="/">
3+
<file>tools.qml</file>
4+
<file>qtquickcontrols2.conf</file>
5+
</qresource>
6+
</RCC>

samples/topology/EdgesListView.qml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2020, Benoit AUTHEMAN All rights reserved.
2+
Copyright (c) 2008-2022, Benoit AUTHEMAN All rights reserved.
33
44
Redistribution and use in source and binary forms, with or without
55
modification, are permitted provided that the following conditions are met:

samples/topology/NodesListView.qml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2020, Benoit AUTHEMAN All rights reserved.
2+
Copyright (c) 2008-2022, Benoit AUTHEMAN All rights reserved.
33
44
Redistribution and use in source and binary forms, with or without
55
modification, are permitted provided that the following conditions are met:

samples/topology/ScreenshotPopup.qml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2020, Benoit AUTHEMAN All rights reserved.
2+
Copyright (c) 2008-2022, Benoit AUTHEMAN All rights reserved.
33
44
Redistribution and use in source and binary forms, with or without
55
modification, are permitted provided that the following conditions are met:

samples/topology/qanFaceNode.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2020, Benoit AUTHEMAN All rights reserved.
2+
Copyright (c) 2008-2022, Benoit AUTHEMAN All rights reserved.
33
44
Redistribution and use in source and binary forms, with or without
55
modification, are permitted provided that the following conditions are met:

samples/topology/qanFaceNode.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2020, Benoit AUTHEMAN All rights reserved.
2+
Copyright (c) 2008-2022, Benoit AUTHEMAN All rights reserved.
33
44
Redistribution and use in source and binary forms, with or without
55
modification, are permitted provided that the following conditions are met:

samples/topology/topology.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2020, Benoit AUTHEMAN All rights reserved.
2+
Copyright (c) 2008-2022, Benoit AUTHEMAN All rights reserved.
33
44
Redistribution and use in source and binary forms, with or without
55
modification, are permitted provided that the following conditions are met:

samples/topology/topology.qml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2020, Benoit AUTHEMAN All rights reserved.
2+
Copyright (c) 2008-2022, Benoit AUTHEMAN All rights reserved.
33
44
Redistribution and use in source and binary forms, with or without
55
modification, are permitted provided that the following conditions are met:

src/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ set(qan_source_files
2222
qanSelectable.cpp
2323
qanStyle.cpp
2424
qanStyleManager.cpp
25+
qanAnalysisTimeHeatMap.cpp
2526
qanUtils.cpp
2627
)
2728

@@ -49,6 +50,7 @@ set (qan_header_files
4950
qanSelectable.h
5051
qanStyle.h
5152
qanStyleManager.h
53+
qanAnalysisTimeHeatMap.cpp
5254
qanUtils.h
5355
QuickQanava.h
5456
gtpo/container_adapter.h

0 commit comments

Comments
 (0)