diff --git a/BionxControl.pro b/BionxControl.pro index de45e5e..b645e15 100644 --- a/BionxControl.pro +++ b/BionxControl.pro @@ -59,6 +59,7 @@ SOURCES += \ bcvaluedelegate.cpp \ bcvalueeditor.cpp \ bcvaluemodel.cpp \ + bcvaluewidget.cpp \ bcxmlloader.cpp \ libwin/can_drv_win.c \ libwin/mhs_can_drv.c \ @@ -81,10 +82,12 @@ HEADERS += \ bcvaluedelegate.h \ bcvalueeditor.h \ bcvaluemodel.h \ + bcvaluewidget.h \ bcxmlloader.h FORMS += \ - bcmainwindow.ui + bcmainwindow.ui \ + bcvaluewidget.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/bcdeviceview.cpp b/bcdeviceview.cpp index 8b8b317..9688d29 100644 --- a/bcdeviceview.cpp +++ b/bcdeviceview.cpp @@ -90,7 +90,21 @@ bool BCDeviceView::firstExpose() void BCDeviceView::onValueListReady( BCDevice::ID deviceID, BCValueList valueList ) { if(_devideID == deviceID) + { _valueModel.takeValueList( valueList ); + const BCValueList& list = _valueModel.getValueList(); + int rows = _valueModel.rowCount(); + for (int r = 0; r < rows; ++r) + { + BCValuePtr bcValue = list[r]; + if( !bcValue->isReadOnly() ) + { + QModelIndex index = _valueModel.index(r, 1); + openPersistentEditor(index); + } + } + } // if id + } diff --git a/bcdeviceview.h b/bcdeviceview.h index ff2fbb8..9ac0fd4 100644 --- a/bcdeviceview.h +++ b/bcdeviceview.h @@ -64,9 +64,9 @@ protected: void resizeEvent(QResizeEvent *event) override; - bool _firstExpose{true}; - BCDevice::ID _devideID{BCDevice::ID::Invalid}; - BCValueModel _valueModel; + bool _firstExpose{true}; + BCDevice::ID _devideID{BCDevice::ID::Invalid}; + BCValueModel _valueModel; BCValueDelegate* _itemDelegate{}; diff --git a/bcmainwindow.cpp b/bcmainwindow.cpp index 5834c87..b716453 100644 --- a/bcmainwindow.cpp +++ b/bcmainwindow.cpp @@ -204,7 +204,7 @@ void BCMainWindow::initStatusBar() _statusBar->showMessage("Bereit. (Dummy-Treiber eingestellt)"); - setApplicationStyleSheet(cLightModeStyle); + //setApplicationStyleSheet(cLightModeStyle); } diff --git a/bcvaluedelegate.cpp b/bcvaluedelegate.cpp index 83f4fa0..0eabfa5 100644 --- a/bcvaluedelegate.cpp +++ b/bcvaluedelegate.cpp @@ -44,7 +44,8 @@ #include #include -#include + +#include BCValueDelegate::BCValueDelegate(const BCValueList& valueList, QTableView* view) : QStyledItemDelegate{view}, _valueList{valueList}, _view{view} @@ -58,13 +59,15 @@ QWidget* BCValueDelegate::createEditor(QWidget *parent, const QStyleOptionViewIt { const BCValue& bcValue = *(_valueList[ index.row()].get()); + qDebug() << " --- Create EDITOR: " << index.row(); + Q_UNUSED(option) Q_UNUSED(index) - auto* valueEditor = new BCValueEditor(bcValue, parent); + auto* valueEditor = new BCValueWidget(bcValue, parent); // Signal für sofortige Updates - connect(valueEditor, &BCValueEditor::valueChanged, this, [this, valueEditor]() + connect(valueEditor, &BCValueWidget::valueChanged, this, [this, valueEditor]() { // Commit data sofort bei Änderung emit const_cast(this)->commitData(valueEditor); @@ -155,12 +158,14 @@ void BCValueDelegate::paint(QPainter *painter, const QStyleOptionViewItem& optio if( index.column() == 1 ) { + /* if( row>-1 && row <= _valueList.size() ) { const BCValue& bcValue = *(_valueList[ index.row()].get()); if( !bcValue.isReadOnly()) paintSliderIndicator(painter,option,bcValue); } +*/ if(_rowOpacities.contains(row)) paintHighlightRow(painter,option,index.row()); diff --git a/bionxcontrol.qrc b/bionxcontrol.qrc index ef3ffb3..c400ad1 100644 --- a/bionxcontrol.qrc +++ b/bionxcontrol.qrc @@ -29,5 +29,6 @@ resources/smile/face-smile-big.png resources/smile/face-smirk.png resources/smile/face-surprise.png + resources/update.png diff --git a/resources/update.svg b/resources/update.svg new file mode 100644 index 0000000..548f23c --- /dev/null +++ b/resources/update.svg @@ -0,0 +1 @@ + \ No newline at end of file