diff --git a/bcdatamodel.cpp b/bcdatamodel.cpp index 0d30745..36596ab 100644 --- a/bcdatamodel.cpp +++ b/bcdatamodel.cpp @@ -33,7 +33,11 @@ -BCDataModel::BCDataModel(QObject *parent) : QAbstractListModel(parent) {} +BCDataModel::BCDataModel(QObject *parent) + : QAbstractTableModel(parent) +{ + +} void BCDataModel::addValue(const BCDataValue& val) { @@ -62,6 +66,28 @@ int BCDataModel::rowCount(const QModelIndex& parent) const return _valueList.size(); } +int BCDataModel::columnCount(const QModelIndex &parent) const +{ + if (parent.isValid()) return 0; + return 2; +} + +QVariant BCDataModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (role != Qt::DisplayRole || orientation != Qt::Horizontal) + return QVariant(); + + switch (section) + { + case 0: + return QString("Bezeichnung"); + case 1: + return QString("Wert"); + default: + return QVariant(); + } +} + QVariant BCDataModel::data(const QModelIndex& index, int role) const { int row = index.row(); @@ -83,7 +109,7 @@ Qt::ItemFlags BCDataModel::flags(const QModelIndex& index) const if (!index.isValid()) return Qt::NoItemFlags; - return QAbstractListModel::flags(index) | Qt::ItemIsEditable; + return QAbstractTableModel::flags(index) | Qt::ItemIsEditable; } diff --git a/bcdatamodel.h b/bcdatamodel.h index 4b7c6c9..bc3c331 100644 --- a/bcdatamodel.h +++ b/bcdatamodel.h @@ -36,7 +36,7 @@ #include -class BCDataModel : public QAbstractListModel +class BCDataModel : public QAbstractTableModel { Q_OBJECT @@ -48,8 +48,12 @@ public: void setValueList(const BCDataList& valueList); BCDataList& getValueList(); - int rowCount(const QModelIndex& parent = QModelIndex()) const override; - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; + // Pure Virtual Functions von QAbstractTableModel + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; // Nötig für Editierbarkeit Qt::ItemFlags flags(const QModelIndex& index) const override; diff --git a/bcdatavalue.cpp b/bcdatavalue.cpp index 18ac5ec..67bb860 100644 --- a/bcdatavalue.cpp +++ b/bcdatavalue.cpp @@ -45,7 +45,7 @@ void BCDataValue::readRawValueX( const BCAbstractTransmitter& transmitter ) cons { qDebug() << " --- READ X!"; - uint32_t devID = static_cast(deviceID); + uint32_t devID = static_cast(deviceID); uint8_t regID = static_cast (registerID); visibleValue = valueType->createStringValue( transmitter, devID, regID ); diff --git a/bcitemdelegate.cpp b/bcitemdelegate.cpp index 3f0a5c3..5ff28c7 100644 --- a/bcitemdelegate.cpp +++ b/bcitemdelegate.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include @@ -17,7 +17,7 @@ -BCItemDelegate::BCItemDelegate(QListView *view) +BCItemDelegate::BCItemDelegate(QTableView* view) : QStyledItemDelegate(view), _view{view} { diff --git a/bcitemdelegate.h b/bcitemdelegate.h index 705ef52..02f0f13 100644 --- a/bcitemdelegate.h +++ b/bcitemdelegate.h @@ -1,4 +1,4 @@ -// BCItemDelegate.h + #ifndef BCITEMDELEGATE_H #define BCITEMDELEGATE_H @@ -6,7 +6,7 @@ class QPropertyAnimation; class QVariantAnimation; -class QListView; +class QTableView; class BCItemDelegate : public QStyledItemDelegate { @@ -15,7 +15,7 @@ class BCItemDelegate : public QStyledItemDelegate public: - explicit BCItemDelegate(QListView *view ); + explicit BCItemDelegate(QTableView* view ); QString displayText(const QVariant& dataValue, const QLocale& locale) const override; @@ -60,7 +60,7 @@ private: int _highlightedRow{-1}; qreal _opacity{1.0}; - QListView* _view{}; + QTableView* _view{}; QPropertyAnimation *_animation{}; private: diff --git a/bcmainwindow.ui b/bcmainwindow.ui index b05f712..4c86684 100644 --- a/bcmainwindow.ui +++ b/bcmainwindow.ui @@ -92,7 +92,7 @@ - + QFrame::Shape::NoFrame @@ -111,7 +111,7 @@ - 200 + 0 0 diff --git a/bcmainwindow.ui.autosave b/bcmainwindow.ui.autosave new file mode 100644 index 0000000..fbfa924 --- /dev/null +++ b/bcmainwindow.ui.autosave @@ -0,0 +1,230 @@ + + + BCMainWindow + + + + 0 + 0 + 800 + 600 + + + + BCMainWindow + + + + + + + Qt::Orientation::Horizontal + + + + QFrame::Shape::StyledPanel + + + QFrame::Shadow::Raised + + + + + 30 + 50 + 171 + 51 + + + + Sync + + + + + + 10 + 180 + 171 + 51 + + + + Connect + + + true + + + + + + 70 + 240 + 71 + 71 + + + + ... + + + + 64 + 64 + + + + true + + + + + + 50 + 320 + 22 + 22 + + + + ... + + + + + + QFrame::Shape::NoFrame + + + QFrame::Shadow::Plain + + + false + + + + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + toolBar + + + false + + + + 64 + 64 + + + + true + + + LeftToolBarArea + + + false + + + + + + + + + + :restart.png:restart.png + + + pimp + + + Pimp my Ride + + + + + + :bionx_motor.png:bionx_motor.png + + + motor + + + Show motor settings + + + + + + :bionx_akku.png:bionx_akku.png + + + battery + + + Show battery settings + + + + + + :bionx_console.png:bionx_console.png + + + console + + + Show console settings + + + + + + :exit.png:exit.png + + + Exit + + + Exit + + + + + + :/connected.png:/connected.png + + + connect + + + connect to bike + + + QAction::MenuRole::TextHeuristicRole + + + + + + + + diff --git a/doc/material_dummy/mainwindow.h b/doc/material_dummy/mainwindow.h index 3807a76..06d61b4 100644 --- a/doc/material_dummy/mainwindow.h +++ b/doc/material_dummy/mainwindow.h @@ -45,9 +45,10 @@ public: model->setHorizontalHeaderLabels({"Name", "Wert"}); // Daten einfügen - for (int row = 0; row < 10; ++row) { + for (int row = 0; row < 10; ++row) + { auto* nameItem = new QStandardItem(QString("Eintrag %1").arg(row + 1)); - auto* valueItem = new QStandardItem(); + auto* valueItem = new QStandardItem(); // Wert-Item editierbar machen valueItem->setData(row * 10, Qt::EditRole); // Startwert 0-90 diff --git a/resources/96/bottom.png b/resources/96/bottom.png new file mode 100644 index 0000000..bf1949d Binary files /dev/null and b/resources/96/bottom.png differ diff --git a/resources/96/browser-download.png b/resources/96/browser-download.png new file mode 100644 index 0000000..e29f13e Binary files /dev/null and b/resources/96/browser-download.png differ diff --git a/resources/96/cab_extract.png b/resources/96/cab_extract.png new file mode 100644 index 0000000..c266ab8 Binary files /dev/null and b/resources/96/cab_extract.png differ diff --git a/resources/96/document-export.png b/resources/96/document-export.png new file mode 100644 index 0000000..a48c806 Binary files /dev/null and b/resources/96/document-export.png differ diff --git a/resources/96/document-import.png b/resources/96/document-import.png new file mode 100644 index 0000000..b74531d Binary files /dev/null and b/resources/96/document-import.png differ diff --git a/resources/96/document-revert.png b/resources/96/document-revert.png new file mode 100644 index 0000000..58e62c1 Binary files /dev/null and b/resources/96/document-revert.png differ diff --git a/resources/96/document-save-as.png b/resources/96/document-save-as.png new file mode 100644 index 0000000..67c38ee Binary files /dev/null and b/resources/96/document-save-as.png differ diff --git a/resources/96/document-save.png b/resources/96/document-save.png new file mode 100644 index 0000000..e29f13e Binary files /dev/null and b/resources/96/document-save.png differ diff --git a/resources/96/go-jump.png b/resources/96/go-jump.png new file mode 100644 index 0000000..dde9987 Binary files /dev/null and b/resources/96/go-jump.png differ diff --git a/resources/96/gtk-apply.png b/resources/96/gtk-apply.png new file mode 100644 index 0000000..4d7baf1 Binary files /dev/null and b/resources/96/gtk-apply.png differ diff --git a/resources/96/gtk-goto-first-ltr.png b/resources/96/gtk-goto-first-ltr.png new file mode 100644 index 0000000..ed710d1 Binary files /dev/null and b/resources/96/gtk-goto-first-ltr.png differ diff --git a/resources/96/gtk-goto-last-ltr.png b/resources/96/gtk-goto-last-ltr.png new file mode 100644 index 0000000..c337a0b Binary files /dev/null and b/resources/96/gtk-goto-last-ltr.png differ diff --git a/resources/96/gtk-revert-to-saved-ltr.png b/resources/96/gtk-revert-to-saved-ltr.png new file mode 100644 index 0000000..58e62c1 Binary files /dev/null and b/resources/96/gtk-revert-to-saved-ltr.png differ diff --git a/resources/96/gtk-revert-to-saved-rtl.png b/resources/96/gtk-revert-to-saved-rtl.png new file mode 100644 index 0000000..58e62c1 Binary files /dev/null and b/resources/96/gtk-revert-to-saved-rtl.png differ diff --git a/resources/96/gtk-save.png b/resources/96/gtk-save.png new file mode 100644 index 0000000..e29f13e Binary files /dev/null and b/resources/96/gtk-save.png differ diff --git a/resources/96/gtk-undo-ltr.png b/resources/96/gtk-undo-ltr.png new file mode 100644 index 0000000..e879b42 Binary files /dev/null and b/resources/96/gtk-undo-ltr.png differ diff --git a/resources/96/object-rotate-left.png b/resources/96/object-rotate-left.png new file mode 100644 index 0000000..927abf5 Binary files /dev/null and b/resources/96/object-rotate-left.png differ diff --git a/resources/96/object-rotate-right.png b/resources/96/object-rotate-right.png new file mode 100644 index 0000000..ab21f3e Binary files /dev/null and b/resources/96/object-rotate-right.png differ diff --git a/resources/96/reload.png b/resources/96/reload.png new file mode 100644 index 0000000..502394b Binary files /dev/null and b/resources/96/reload.png differ diff --git a/resources/96/rotate.png b/resources/96/rotate.png new file mode 100644 index 0000000..ab21f3e Binary files /dev/null and b/resources/96/rotate.png differ diff --git a/resources/96/stock_bottom.png b/resources/96/stock_bottom.png new file mode 100644 index 0000000..bf1949d Binary files /dev/null and b/resources/96/stock_bottom.png differ diff --git a/resources/96/stock_mail-send-receive.png b/resources/96/stock_mail-send-receive.png new file mode 100644 index 0000000..5be2a73 Binary files /dev/null and b/resources/96/stock_mail-send-receive.png differ diff --git a/resources/96/view-refresh96.png b/resources/96/view-refresh96.png new file mode 100644 index 0000000..502394b Binary files /dev/null and b/resources/96/view-refresh96.png differ diff --git a/resources/document-import.png b/resources/document-import.png new file mode 100644 index 0000000..662b134 Binary files /dev/null and b/resources/document-import.png differ diff --git a/resources/document-revert.png b/resources/document-revert.png new file mode 100644 index 0000000..fb38bd5 Binary files /dev/null and b/resources/document-revert.png differ diff --git a/resources/document-save-as.png b/resources/document-save-as.png new file mode 100644 index 0000000..3f4641f Binary files /dev/null and b/resources/document-save-as.png differ diff --git a/resources/document-save.png b/resources/document-save.png new file mode 100644 index 0000000..f412793 Binary files /dev/null and b/resources/document-save.png differ diff --git a/resources/go-first.png b/resources/go-first.png new file mode 100644 index 0000000..c271161 Binary files /dev/null and b/resources/go-first.png differ diff --git a/resources/go-jump.png b/resources/go-jump.png new file mode 100644 index 0000000..e2002d6 Binary files /dev/null and b/resources/go-jump.png differ diff --git a/resources/go-last.png b/resources/go-last.png new file mode 100644 index 0000000..85ed476 Binary files /dev/null and b/resources/go-last.png differ