src/RelpipeChartMainWindow.cpp
branchv_0
changeset 20 b13e7ed9eea3
parent 19 ac70c7af6a9b
child 22 0f0344e1ba61
equal deleted inserted replaced
19:ac70c7af6a9b 20:b13e7ed9eea3
    21 }
    21 }
    22 
    22 
    23 RelpipeChartMainWindow::~RelpipeChartMainWindow() {
    23 RelpipeChartMainWindow::~RelpipeChartMainWindow() {
    24 }
    24 }
    25 
    25 
    26 void RelpipeChartMainWindow::startRelation(string_t name, std::vector<AttributeMetadata> attributes) {
    26 void RelpipeChartMainWindow::startRelation(const string_t name, std::vector<AttributeMetadata> attributes) {
    27 	setStatusMessage(L"Reading relation: " + name);
    27 	setStatusMessage(L"Reading relation: " + name);
    28 	attributeCounter = 0;
    28 	attributeCounter = 0;
    29 	QSplitter* splitter = new QSplitter(Qt::Orientation::Vertical, tabs);
    29 	QSplitter* splitter = new QSplitter(Qt::Orientation::Vertical, tabs);
    30 
    30 
    31 	currentTable = new QTableWidget(0, attributes.size(), splitter);
    31 	currentTable = new QTableWidget(0, attributes.size(), splitter);
    41 	int index = tabs->addTab(splitter, QString::fromWCharArray(name.c_str()));
    41 	int index = tabs->addTab(splitter, QString::fromWCharArray(name.c_str()));
    42 	if (tabs->count() == 2) tabs->setCurrentIndex(index); // switch to the first relation (first tab is Options tab)
    42 	if (tabs->count() == 2) tabs->setCurrentIndex(index); // switch to the first relation (first tab is Options tab)
    43 	tabs->setTabIcon(index, QIcon::fromTheme("application-vnd.oasis.opendocument.spreadsheet"));
    43 	tabs->setTabIcon(index, QIcon::fromTheme("application-vnd.oasis.opendocument.spreadsheet"));
    44 }
    44 }
    45 
    45 
    46 void RelpipeChartMainWindow::attribute(const string_t& value) {
    46 void RelpipeChartMainWindow::attribute(const string_t value) {
    47 	// TODO: draw chart
    47 	// TODO: draw chart
    48 	integer_t column = attributeCounter % currentTable->columnCount();
    48 	integer_t column = attributeCounter % currentTable->columnCount();
    49 	integer_t row = attributeCounter / currentTable->columnCount();
    49 	integer_t row = attributeCounter / currentTable->columnCount();
    50 	if (row >= currentTable->rowCount()) currentTable->insertRow(currentTable->rowCount());
    50 	if (row >= currentTable->rowCount()) currentTable->insertRow(currentTable->rowCount());
    51 	currentTable->setItem(row, column, new QTableWidgetItem(QString::fromWCharArray(value.c_str())));
    51 	currentTable->setItem(row, column, new QTableWidgetItem(QString::fromWCharArray(value.c_str())));