@@ -64,8 +64,8 MainWindow::MainWindow(QWidget *parent) : QMainWindow{parent}, m_Ui{new Ui::Main | |||||
64 | mainToolBar->addAction("A1"); |
|
64 | mainToolBar->addAction("A1"); | |
65 |
|
65 | |||
66 | // Widgets / controllers connections |
|
66 | // Widgets / controllers connections | |
67 |
connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem |
|
67 | connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)), | |
68 |
m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem |
|
68 | m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *))); | |
69 |
|
69 | |||
70 | /* QLopGUI::registerMenuBar(menuBar()); |
|
70 | /* QLopGUI::registerMenuBar(menuBar()); | |
71 | this->setWindowIcon(QIcon(":/sciqlopLOGO.svg")); |
|
71 | this->setWindowIcon(QIcon(":/sciqlopLOGO.svg")); |
@@ -49,7 +49,7 public slots: | |||||
49 |
|
49 | |||
50 | signals: |
|
50 | signals: | |
51 | /// Signal emitted when a structure has been set for a data source |
|
51 | /// Signal emitted when a structure has been set for a data source | |
52 |
void dataSourceItemSet(DataSourceItem |
|
52 | void dataSourceItemSet(DataSourceItem *dataSourceItem); | |
53 |
|
53 | |||
54 | private: |
|
54 | private: | |
55 | void waitForFinish(); |
|
55 | void waitForFinish(); |
@@ -49,7 +49,7 void DataSourceController::setDataSourceItem( | |||||
49 | // Retrieves the data source item to emit the signal with it |
|
49 | // Retrieves the data source item to emit the signal with it | |
50 | auto it = impl->m_DataSourceItems.find(dataSourceUid); |
|
50 | auto it = impl->m_DataSourceItems.find(dataSourceUid); | |
51 | if (it != impl->m_DataSourceItems.end()) { |
|
51 | if (it != impl->m_DataSourceItems.end()) { | |
52 |
emit dataSourceItemSet( |
|
52 | emit dataSourceItemSet(it->second.get()); | |
53 | } |
|
53 | } | |
54 | } |
|
54 | } | |
55 | else { |
|
55 | else { |
@@ -26,7 +26,7 void TestDataSourceController::testSetDataSourceItem() | |||||
26 | DataSourceController dataSourceController{}; |
|
26 | DataSourceController dataSourceController{}; | |
27 |
|
27 | |||
28 | // Spy to test controllers' signals |
|
28 | // Spy to test controllers' signals | |
29 |
QSignalSpy signalSpy{&dataSourceController, SIGNAL(dataSourceItemSet( |
|
29 | QSignalSpy signalSpy{&dataSourceController, SIGNAL(dataSourceItemSet(DataSourceItem *))}; | |
30 |
|
30 | |||
31 | // Create a data source item |
|
31 | // Create a data source item | |
32 | auto source1Name = QStringLiteral("Source1"); |
|
32 | auto source1Name = QStringLiteral("Source1"); |
@@ -21,9 +21,9 public slots: | |||||
21 | /** |
|
21 | /** | |
22 | * Adds a data source. An item associated to the data source is created and then added to the |
|
22 | * Adds a data source. An item associated to the data source is created and then added to the | |
23 | * representation tree |
|
23 | * representation tree | |
24 | * @param dataSource the data source to add |
|
24 | * @param dataSource the data source to add. The pointer has to be not null | |
25 | */ |
|
25 | */ | |
26 |
void addDataSource(DataSourceItem |
|
26 | void addDataSource(DataSourceItem *dataSource) noexcept; | |
27 |
|
27 | |||
28 | private: |
|
28 | private: | |
29 | class DataSourceWidgetPrivate; |
|
29 | class DataSourceWidgetPrivate; |
@@ -20,6 +20,13 QIcon itemIcon(const DataSourceItem *dataSource) | |||||
20 | // No action |
|
20 | // No action | |
21 | break; |
|
21 | break; | |
22 | } |
|
22 | } | |
|
23 | ||||
|
24 | qCWarning(LOG_DataSourceTreeWidgetItem()) | |||
|
25 | << QObject::tr("Can't set data source icon : unknown data source type"); | |||
|
26 | } | |||
|
27 | else { | |||
|
28 | qCWarning(LOG_DataSourceTreeWidgetItem()) | |||
|
29 | << QObject::tr("Can't set data source icon : the data source is null"); | |||
23 | } |
|
30 | } | |
24 |
|
31 | |||
25 | // Default cases |
|
32 | // Default cases |
@@ -53,9 +53,11 DataSourceWidget::DataSourceWidget(QWidget *parent) | |||||
53 | { |
|
53 | { | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 |
void DataSourceWidget::addDataSource(DataSourceItem |
|
56 | void DataSourceWidget::addDataSource(DataSourceItem *dataSource) noexcept | |
57 | { |
|
57 | { | |
58 | // Creates the item associated to the source and adds it to the tree widget. The tree widget |
|
58 | // Creates the item associated to the source and adds it to the tree widget. The tree widget | |
59 | // takes the ownership of the item |
|
59 | // takes the ownership of the item | |
60 | impl->m_Ui->treeWidget->addTopLevelItem(createTreeWidgetItem(&dataSource)); |
|
60 | if (dataSource) { | |
|
61 | impl->m_Ui->treeWidget->addTopLevelItem(createTreeWidgetItem(dataSource)); | |||
|
62 | } | |||
61 | } |
|
63 | } |
General Comments 0
You need to be logged in to leave comments.
Login now