28 #include <relpipe/reader/Factory.h> |
28 #include <relpipe/reader/Factory.h> |
29 #include <relpipe/reader/RelationalReader.h> |
29 #include <relpipe/reader/RelationalReader.h> |
30 #include <relpipe/reader/RelpipeReaderException.h> |
30 #include <relpipe/reader/RelpipeReaderException.h> |
31 |
31 |
32 #include "RelpipeChartMainWindow.h" |
32 #include "RelpipeChartMainWindow.h" |
33 #include "QtRelationalReaderStringHadler.h" |
33 #include "QtRelationalReaderStringHandler.h" |
34 |
34 |
35 using namespace relpipe::cli; |
35 using namespace relpipe::cli; |
36 using namespace relpipe::reader; |
36 using namespace relpipe::reader; |
37 |
37 |
38 // signal/slot parameters must be declared here and registered with qRegisterMetaType() |
38 // signal/slot parameters must be declared here and registered with qRegisterMetaType() |
76 window.show(); |
76 window.show(); |
77 |
77 |
78 RelationalReaderThread t(reader); |
78 RelationalReaderThread t(reader); |
79 |
79 |
80 // Proxy that passes calls from the background thread to the GUI thread using signal-slot mechanism: |
80 // Proxy that passes calls from the background thread to the GUI thread using signal-slot mechanism: |
81 QtRelationalReaderStringHadler handler(&t); // &t instead of handler.moveToThread(&t); // QObject::moveToThread: Cannot move objects with a parent |
81 QtRelationalReaderStringHandler handler(&t); // &t instead of handler.moveToThread(&t); // QObject::moveToThread: Cannot move objects with a parent |
82 |
82 |
83 // see Q_DECLARE_METATYPE above |
83 // see Q_DECLARE_METATYPE above |
84 qRegisterMetaType<string_t>(); |
84 qRegisterMetaType<string_t>(); |
85 qRegisterMetaType<std::vector < AttributeMetadata >> (); |
85 qRegisterMetaType<std::vector < AttributeMetadata >> (); |
86 |
86 |
87 QObject::connect(&handler, &QtRelationalReaderStringHadler::startRelationReceived, &window, &RelpipeChartMainWindow::startRelation, Qt::ConnectionType::QueuedConnection); |
87 QObject::connect(&handler, &QtRelationalReaderStringHandler::startRelationReceived, &window, &RelpipeChartMainWindow::startRelation, Qt::ConnectionType::QueuedConnection); |
88 QObject::connect(&handler, &QtRelationalReaderStringHadler::attributeReceived, &window, &RelpipeChartMainWindow::attribute, Qt::ConnectionType::QueuedConnection); |
88 QObject::connect(&handler, &QtRelationalReaderStringHandler::attributeReceived, &window, &RelpipeChartMainWindow::attribute, Qt::ConnectionType::QueuedConnection); |
89 QObject::connect(&handler, &QtRelationalReaderStringHadler::endOfPipeReceived, &window, &RelpipeChartMainWindow::endOfPipe, Qt::ConnectionType::QueuedConnection); |
89 QObject::connect(&handler, &QtRelationalReaderStringHandler::endOfPipeReceived, &window, &RelpipeChartMainWindow::endOfPipe, Qt::ConnectionType::QueuedConnection); |
90 |
90 |
91 reader->addHandler(&handler); |
91 reader->addHandler(&handler); |
92 |
92 |
93 // Start background thread |
93 // Start background thread |
94 t.start(); |
94 t.start(); |