Small enhancements in the SdbWidget class. (#2796)

* Small enhancements in SdbWidget class.

Destructors of child classes should be marked with the `override` keyword. Also since Qt's
widgets aren't movable or copyable, we can explicitly let the compiler know with the `Q_DISABLE_COPY_MOVE`
macro.

* Define Q_DISABLE_COPY_MOVE macro for versions < 5.13.0 in SdbWidget
This commit is contained in:
Petros S 2021-10-09 19:15:38 +03:00 committed by GitHub
parent 12df7a001d
commit 311cd0307e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -80,7 +80,7 @@ void SdbWidget::on_treeWidget_itemDoubleClicked(QTreeWidgetItem *item, int colum
}
}
SdbWidget::~SdbWidget() {}
SdbWidget::~SdbWidget() = default;
void SdbWidget::on_lockButton_clicked()
{

View File

@ -16,9 +16,25 @@ class SdbWidget : public CutterDockWidget
{
Q_OBJECT
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
# define Q_DISABLE_COPY(SdbWidget) \
SdbWidget(const SdbWidget &s) = delete; \
SdbWidget &operator=(const SdbWidget &s) = delete;
# define Q_DISABLE_MOVE(SdbWidget) \
SdbWidget(SdbWidget &&s) = delete; \
SdbWidget &operator=(SdbWidget &&s) = delete;
# define Q_DISABLE_COPY_MOVE(SdbWidget) \
Q_DISABLE_COPY(SdbWidget) \
Q_DISABLE_MOVE(SdbWidget)
#endif
Q_DISABLE_COPY_MOVE(SdbWidget)
public:
explicit SdbWidget(MainWindow *main);
~SdbWidget();
~SdbWidget() override;
private slots:
void on_treeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column);