CANdevStudio
Development tool for CAN bus simulation
Loading...
Searching...
No Matches
crsgui.h
Go to the documentation of this file.
1#ifndef CRSGUI_H
2#define CRSGUI_H
3
4#include "crsguiinterface.h"
5#include "ui_canrawsender.h"
6#include <memory>
7
8namespace Ui {
10}
11
12struct CRSGui : public CRSGuiInterface {
14 : ui(new Ui::CanRawSenderPrivate)
15 , widget(new QWidget)
16 {
17 ui->setupUi(widget);
18 widget->setMinimumSize(ui->tv->minimumSize());
19 }
20
21 void setAddCbk(const add_t& cb) override
22 {
23 QObject::connect(ui->pbAdd, &QPushButton::pressed, cb);
24 }
25
26 void setRemoveCbk(const remove_t& cb) override
27 {
28 QObject::connect(ui->pbRemove, &QPushButton::pressed, cb);
29 }
30
31 void setDockUndockCbk(const dockUndock_t& cb) override
32 {
33 QObject::connect(ui->pbDockUndock, &QPushButton::toggled, cb);
34 }
35
36 QWidget* mainWidget() override
37 {
38 return widget;
39 }
40
41 void initTableView(QAbstractItemModel& _tvModel) override
42 {
43
44 ui->tv->setModel(&_tvModel);
45 ui->tv->setSelectionBehavior(QAbstractItemView::SelectRows);
46 ui->tv->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
47 }
48
49 QModelIndexList getSelectedRows() override
50 {
51 return ui->tv->selectionModel()->selectedRows();
52 }
53
54 void setIndexWidget(const QModelIndex& index, QWidget* widget) override
55 {
56 ui->tv->setIndexWidget(index, widget);
57 }
58
59private:
60 Ui::CanRawSenderPrivate* ui;
61 QWidget* widget;
62};
63#endif // CRSGUI_H
This class is responsible for manage can raw sender window.
Definition canrawsender_p.h:19
Definition canrawsender_p.h:13
Definition crsgui.h:12
void setDockUndockCbk(const dockUndock_t &cb) override
Definition crsgui.h:31
void initTableView(QAbstractItemModel &_tvModel) override
Definition crsgui.h:41
QWidget * mainWidget() override
Definition crsgui.h:36
QModelIndexList getSelectedRows() override
Definition crsgui.h:49
void setAddCbk(const add_t &cb) override
Definition crsgui.h:21
void setRemoveCbk(const remove_t &cb) override
Definition crsgui.h:26
CRSGui()
Definition crsgui.h:13
void setIndexWidget(const QModelIndex &index, QWidget *widget) override
Definition crsgui.h:54
Definition crsguiinterface.h:12
std::function< void()> remove_t
Definition crsguiinterface.h:18
std::function< void()> add_t
Definition crsguiinterface.h:17
std::function< void()> dockUndock_t
Definition crsguiinterface.h:19