-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
42 lines (33 loc) · 918 Bytes
/
Copy pathmainwindow.cpp
File metadata and controls
42 lines (33 loc) · 918 Bytes
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
33
34
35
36
37
38
39
40
41
#include "mainwindow.h"
#include "./ui_mainwindow.h"
const static QVector<MyObject> g_my_objects{
{0, 1, 1.1, "object1"},
{1, 11, 1.2, "object2"},
{2, 12, 1.3, "object3"},
{3, 13, 1.4, "object4"},
{4, 14, 1.5, "object5"},
{5, 15, 1.6, "object6"},
{6, 16, 1.7, "object7"},
{7, 17, 1.8, "object8"}
};
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
ui->tableView->setModel(&my_model_);
for(const auto& g_my_object : g_my_objects) {
my_model_.add(g_my_object);
}
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::onEditClicked()
{
qDebug() << __PRETTY_FUNCTION__;
my_model_.edit({2, 22222, 2222.222, "myobject22222"});
// ui->tableView->update(); /// seems to be doing nothing.
}