Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: cneben <benoit@destrat.io>
  • Loading branch information
cneben committed Nov 17, 2023
1 parent 6d2b1e3 commit 2f69b48
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
6 changes: 5 additions & 1 deletion samples/advanced/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)

qt_add_resources(source_files ${resources_files})

add_subdirectory(./QuickQanava)
if(NOT TARGET QuickQanava)
#set(QUICK_QANAVA_BUILD_STATIC_QRC ON)
add_subdirectory(../../ quickqanava_build) # Use ../../src as quickqanava_build subdirectory
# see https://stackoverflow.com/questions/50408169/cmake-error-add-subdirectory-not-given-a-binary-directory/50408555
endif()

set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_executable(sample_advanced ${source_files} advanced.qrc)
Expand Down
4 changes: 2 additions & 2 deletions src/qanGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,9 +892,9 @@ bool Graph::hasEdge(const qan::Edge* edge) const { return hasEdge(edge->get_s
//-----------------------------------------------------------------------------

/* Graph Group Management *///-------------------------------------------------
qan::Group* Graph::insertGroup()
qan::Group* Graph::insertGroup(QQmlComponent* groupComponent)
{
return insertGroup<qan::Group>();
return insertGroup<qan::Group>(groupComponent);
}

qan::Group* Graph::insertTable(int cols, int rows)
Expand Down
4 changes: 2 additions & 2 deletions src/qanGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ class Graph : public gtpo::graph<QQuickItem, qan::Node, qan::Group, qan::Edge>
//@{
public:
//! Shortcut to gtpo::GenGraph<>::insertGroup().
Q_INVOKABLE virtual qan::Group* insertGroup();
Q_INVOKABLE virtual qan::Group* insertGroup(QQmlComponent* groupComponent = nullptr);

//! Insert a `qan::TableGroup` table.
Q_INVOKABLE virtual qan::Group* insertTable(int cols, int rows);
Expand All @@ -583,7 +583,7 @@ class Graph : public gtpo::graph<QQuickItem, qan::Node, qan::Group, qan::Edge>

//! Insert a group using its static delegate() and style() factories.
template <class Group_t>
qan::Group* insertGroup();
qan::Group* insertGroup(QQmlComponent* groupComponent = nullptr);

//! Insert a group using its static delegate() and style() factories.
template <class TableGroup_t>
Expand Down
11 changes: 6 additions & 5 deletions src/qanGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,13 @@ qan::Edge* Graph::insertNonVisualEdge(qan::Node& src, qan::Node* dstNode)

/* Graph Group Management *///-------------------------------------------------
template <class Group_t>
qan::Group* Graph::insertGroup()
qan::Group* Graph::insertGroup(QQmlComponent* groupComponent)
{
const auto engine = qmlEngine(this);
QQmlComponent* groupComponent = nullptr;
if (engine != nullptr)
groupComponent = Group_t::delegate(*engine, nullptr);
if (groupComponent == nullptr) {
const auto engine = qmlEngine(this);
if (engine != nullptr)
groupComponent = Group_t::delegate(*engine, nullptr);
}
if (groupComponent == nullptr)
groupComponent = _groupDelegate.get();
auto group = new Group_t();
Expand Down

0 comments on commit 2f69b48

Please sign in to comment.