Skip to content

Commit 7419b2d

Browse files
committed
Recursive loading plugins
1 parent e4b36e5 commit 7419b2d

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

examples/plugin_text/TextModel.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
TextModel::
66
TextModel()
7-
: _lineEdit{nullptr}
87
{
98
//
109
}
@@ -54,24 +53,24 @@ TextModel::
5453
outData(PortIndex const portIndex)
5554
{
5655
Q_UNUSED(portIndex);
57-
return std::make_shared<TextData>(_lineEdit->toPlainText());
56+
return std::make_shared<TextData>(_textEdit->toPlainText());
5857
}
5958

6059

6160
QWidget *
6261
TextModel::
6362
embeddedWidget()
6463
{
65-
if (!_lineEdit)
64+
if (!_textEdit)
6665
{
67-
_lineEdit = new QTextEdit();
66+
_textEdit = new QTextEdit();
6867

69-
connect(_lineEdit, &QTextEdit::textChanged,
68+
connect(_textEdit, &QTextEdit::textChanged,
7069
this, &TextModel::onTextEdited);
7170

7271
}
7372

74-
return _lineEdit;
73+
return _textEdit;
7574
}
7675

7776

@@ -92,6 +91,6 @@ setInData(std::shared_ptr<NodeData> data, PortIndex const)
9291
inputText = "";
9392
}
9493

95-
_lineEdit->setText(inputText);
94+
_textEdit->setText(inputText);
9695
}
9796

examples/plugin_text/TextModel.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ private Q_SLOTS:
6565
onTextEdited();
6666

6767
private:
68-
QTextEdit * _lineEdit;
68+
QTextEdit * _textEdit = nullptr;
6969
};

include/QtNodes/internal/PluginInterface.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#pragma once
22

3-
#include "NodeDelegateModelRegistry.hpp"
4-
53
#include <QtPlugin>
64

75
namespace QtNodes
86
{
97

8+
class NodeDelegateModelRegistry;
9+
1010
class PluginInterface
1111
{
1212
public:

src/PluginsManager.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,19 @@ loadPlugins(const QString &folderPath)
6161
}
6262
pluginsDir.cd(folderPath);
6363

64-
// TODO: Need recursive folder to get all plugins
65-
66-
QFileInfoList pluginsInfo = pluginsDir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
64+
QFileInfoList pluginsInfo = pluginsDir.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden);
6765

6866
for (QFileInfo fileInfo : pluginsInfo)
6967
{
70-
qDebug() << "plugin path: " << fileInfo.absoluteFilePath();
71-
loadPluginFromPath(fileInfo.absoluteFilePath());
68+
if(fileInfo.isFile())
69+
{
70+
qDebug() << "plugin path: " << fileInfo.absoluteFilePath();
71+
loadPluginFromPath(fileInfo.absoluteFilePath());
72+
}
73+
else
74+
{
75+
loadPlugins(fileInfo.absoluteFilePath());
76+
}
7277
}
7378
return 0;
7479
}

0 commit comments

Comments
 (0)