diff -r 8c5364450a46 -r 04f1ac8a931b src/RelpipeChartMainWindow.cpp --- a/src/RelpipeChartMainWindow.cpp Tue Oct 30 23:52:55 2018 +0100 +++ b/src/RelpipeChartMainWindow.cpp Sun Nov 18 00:38:49 2018 +0100 @@ -1,22 +1,13 @@ #include #include -#include #include -#include -#include -#include -#include -#include - #include "RelpipeChartMainWindow.h" using namespace relpipe::reader; using namespace relpipe::reader::handlers; -QT_CHARTS_USE_NAMESPACE - RelpipeChartMainWindow::RelpipeChartMainWindow() { widget.setupUi(this); @@ -31,16 +22,18 @@ void RelpipeChartMainWindow::startRelation(const string_t name, std::vector attributes) { setStatusMessage(L"Reading relation: " + name); - QSplitter* splitter = new QSplitter(Qt::Orientation::Vertical, tabs); currentModel = new RelpipeTableModel(attributes, this); QTableView* tableView = new QTableView(this); tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeMode::ResizeToContents); tableView->setModel(currentModel); - - // TODO: chart - splitter->addWidget(new QPushButton("here will be the chart", splitter)); + + if (currentChartWidget) currentChartWidget->endOfRelation(); + currentChartWidget = new RelpipeChartWidget(currentModel, splitter); + splitter->addWidget(currentChartWidget); splitter->addWidget(tableView); + splitter->setSizes({currentChartWidget->hasChartData() ? 1 : 0, 1}); + // splitter->setStretchFactor(currentChartWidget->hasChartData() ? 1 : 0, 1); // FIXME: 50:50 if chart is present int index = tabs->addTab(splitter, QString::fromWCharArray(name.c_str())); if (tabs->count() == 2) tabs->setCurrentIndex(index); // switch to the first relation (first tab is Options tab) tabs->setTabIcon(index, QIcon::fromTheme("application-vnd.oasis.opendocument.spreadsheet")); @@ -55,5 +48,6 @@ } void RelpipeChartMainWindow::endOfPipe() { + if (currentChartWidget) currentChartWidget->endOfRelation(); setStatusMessage(L"Reading successfully finished."); }