summarylogtreecommitdiffstats
path: root/tableshow.cpp
blob: a78af0cb9ae4a26df3c52207fb109fa2a7637d2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "tableshow.h"
#include "ui_tableshow.h"

TableShow::TableShow(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::TableShow)
{
    ui->setupUi(this);
    setFixedSize(650, 450);
    int start = 100, end = 800;
    move(rand() % (end - start + 1) + start, rand() % (end - start + 1) + start);
    QPalette pal = palette();
    pal.setBrush(QPalette::Window, QBrush(QColor(209, 255, 213), Qt::SolidPattern));
    setPalette(pal);
}

TableShow::~TableShow()
{
    delete ui;
}

void TableShow::updateTableData(QList<QStringList>& data_table_to_view){
    int col_count = 0;
    for (const auto& row: data_table_to_view){
        ui->tableWidget->setRowCount(data_table_to_view.size());
        ui->tableWidget->setColumnCount(row.size());
        for (const auto& elem: row){
            ui->tableWidget->setItem(0, col_count, new QTableWidgetItem(elem));
            col_count++;
        }
    }
}