Remove some virtuals and add some overrides

In our case this is more a question of code style.
This commit is contained in:
Martin Kleusberg
2018-10-09 20:28:22 +02:00
parent 00b57a79dd
commit fb1eba1391
34 changed files with 140 additions and 138 deletions

View File

@@ -65,7 +65,7 @@ protected:
class NoEditDelegate: public QStyledItemDelegate {
public:
NoEditDelegate(QObject* parent=nullptr): QStyledItemDelegate(parent) {}
virtual QWidget* createEditor(QWidget* /* parent */, const QStyleOptionViewItem& /* option */, const QModelIndex& /* index */) const {
QWidget* createEditor(QWidget* /* parent */, const QStyleOptionViewItem& /* option */, const QModelIndex& /* index */) const override {
return nullptr;
}
};
@@ -75,11 +75,11 @@ class EditDelegate: public QStyledItemDelegate {
public:
EditDelegate(QObject* parent=nullptr): QStyledItemDelegate(parent) {}
virtual QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem& /* option */, const QModelIndex& /* index */) const {
QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem& /* option */, const QModelIndex& /* index */) const override {
return new NullLineEdit(parent);
}
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const {
void setEditorData(QWidget *editor, const QModelIndex &index) const override {
NullLineEdit* lineEditor = dynamic_cast<NullLineEdit*>(editor);
// Set the editor in the null state (unless the user has actually written NULL)
@@ -91,7 +91,7 @@ public:
lineEditor->setNull(false);
}
}
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const {
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override {
NullLineEdit* lineEditor = dynamic_cast<NullLineEdit*>(editor);
// Restore NULL text (unless the user has already modified the value)