From a3448cde76516108864ea0a04756d4a1502cbb5b Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 17 Feb 2024 20:22:56 +0200 Subject: [PATCH] Refactoring. --- .../vpropertyexplorer/vpropertyformview.cpp | 21 ++++++++++--------- .../vpropertyexplorer/vpropertyformview.h | 2 ++ .../tools/piece/dialogseamallowance.cpp | 16 +++----------- .../dialogs/tools/piece/dialogseamallowance.h | 3 +-- src/libs/vwidgets/qtcolorpicker.cpp | 2 +- src/libs/vwidgets/qtcolorpicker.h | 6 +++--- 6 files changed, 21 insertions(+), 29 deletions(-) diff --git a/src/libs/vpropertyexplorer/vpropertyformview.cpp b/src/libs/vpropertyexplorer/vpropertyformview.cpp index a5c648b62..d546588bc 100644 --- a/src/libs/vpropertyexplorer/vpropertyformview.cpp +++ b/src/libs/vpropertyexplorer/vpropertyformview.cpp @@ -103,20 +103,12 @@ void VPE::VPropertyFormView::setPropertySet(VPropertySet *property_set) void VPE::VPropertyFormView::rowsRemoved(const QModelIndex &parent, int start, int end) { - // todo: Only rebuild the neccessary parts - Q_UNUSED(parent) - Q_UNUSED(start) - Q_UNUSED(end) - updatePropertyList(); + rowsChanged(parent, start, end); } void VPE::VPropertyFormView::rowsInserted(const QModelIndex &parent, int start, int end) //-V524 { - // todo: Only rebuild the neccessary parts - Q_UNUSED(parent) - Q_UNUSED(start) - Q_UNUSED(end) - updatePropertyList(); + rowsChanged(parent, start, end); } void VPE::VPropertyFormView::modelReset() @@ -219,3 +211,12 @@ void VPE::VPropertyFormView::connectPropertyFormWidget(VPropertyFormWidget *widg connectPropertyFormWidget(tmpEditorWidget); } } + +void VPE::VPropertyFormView::rowsChanged(const QModelIndex &parent, int start, int end) +{ + // todo: Only rebuild the neccessary parts + Q_UNUSED(parent) + Q_UNUSED(start) + Q_UNUSED(end) + updatePropertyList(); +} diff --git a/src/libs/vpropertyexplorer/vpropertyformview.h b/src/libs/vpropertyexplorer/vpropertyformview.h index 9424dc5b1..def3c6207 100644 --- a/src/libs/vpropertyexplorer/vpropertyformview.h +++ b/src/libs/vpropertyexplorer/vpropertyformview.h @@ -103,6 +103,8 @@ protected: private: Q_DISABLE_COPY_MOVE(VPropertyFormView) // NOLINT + + void rowsChanged(const QModelIndex &parent, int start, int end); }; QT_WARNING_POP diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index 755f615b3..ef900cb8a 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -1620,17 +1620,7 @@ void DialogSeamAllowance::CSAEndPointChanged(int index) } //--------------------------------------------------------------------------------------------------------------------- -void DialogSeamAllowance::MirrorLineStartPointChanged(int index) -{ - Q_UNUSED(index) - - flagMirrorLineIsValid = MirrorLineIsValid(); - uiTabPaths->checkBoxShowFullPiece->setEnabled(flagMirrorLineIsValid); - CheckState(); -} - -//--------------------------------------------------------------------------------------------------------------------- -void DialogSeamAllowance::MirrorLineEndPointChanged(int index) +void DialogSeamAllowance::MirrorLinePointChanged(int index) { Q_UNUSED(index) @@ -3827,9 +3817,9 @@ void DialogSeamAllowance::InitMainPathTab() }); connect(uiTabPaths->comboBoxMLStartPoint, QOverload::of(&QComboBox::currentIndexChanged), this, - &DialogSeamAllowance::MirrorLineStartPointChanged); + &DialogSeamAllowance::MirrorLinePointChanged); connect(uiTabPaths->comboBoxMLEndPoint, QOverload::of(&QComboBox::currentIndexChanged), this, - &DialogSeamAllowance::MirrorLineEndPointChanged); + &DialogSeamAllowance::MirrorLinePointChanged); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.h b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.h index 0f68fa113..dd8786347 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.h +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.h @@ -96,8 +96,7 @@ private slots: void PassmarkChanged(int index); void CSAStartPointChanged(int index); void CSAEndPointChanged(int index); - void MirrorLineStartPointChanged(int index); - void MirrorLineEndPointChanged(int index); + void MirrorLinePointChanged(int index); void CSAIncludeTypeChanged(int index); void NodeAngleChanged(int index); void ReturnDefBefore(); diff --git a/src/libs/vwidgets/qtcolorpicker.cpp b/src/libs/vwidgets/qtcolorpicker.cpp index 948cf24ca..e0cfb8eb0 100644 --- a/src/libs/vwidgets/qtcolorpicker.cpp +++ b/src/libs/vwidgets/qtcolorpicker.cpp @@ -1224,7 +1224,7 @@ void ColorPickerButton::focusInEvent(QFocusEvent *e) { setFrameShadow(Raised); update(); - QFrame::focusOutEvent(e); + QFrame::focusInEvent(e); } /*! diff --git a/src/libs/vwidgets/qtcolorpicker.h b/src/libs/vwidgets/qtcolorpicker.h index 5d1533669..24e1d3fe7 100644 --- a/src/libs/vwidgets/qtcolorpicker.h +++ b/src/libs/vwidgets/qtcolorpicker.h @@ -64,9 +64,9 @@ class QtColorPicker : public QPushButton Q_PROPERTY(bool colorDialog READ colorDialogEnabled WRITE setColorDialogEnabled) public: - QtColorPicker(QWidget *parent = 0, int columns = -1, bool enableColorDialog = true); + explicit QtColorPicker(QWidget *parent = 0, int columns = -1, bool enableColorDialog = true); - ~QtColorPicker(); + ~QtColorPicker() override; void insertColor(const QColor &color, const QString &text = QString(), int index = -1); @@ -90,7 +90,7 @@ Q_SIGNALS: void colorChanged(const QColor &); protected: - void paintEvent(QPaintEvent *e); + void paintEvent(QPaintEvent *e) override; private Q_SLOTS: void buttonPressed(bool toggled);