diff --git a/src/service/updates.cpp b/src/service/updates.cpp index 0b32fb0..c35cff1 100644 --- a/src/service/updates.cpp +++ b/src/service/updates.cpp @@ -825,11 +825,6 @@ Qt::ItemFlags Model::flags(const QModelIndex &index) const return result; result |= Qt::ItemIsEnabled; - if (index.column() != int(Column::Action) || - ptr->state == State::NotAvailable) - return result; - - result |= Qt::ItemIsEditable; return result; } @@ -861,47 +856,6 @@ void UpdateDelegate::paint(QPainter *painter, QStyledItemDelegate::paint(painter, option, index); } -QWidget *UpdateDelegate::createEditor(QWidget *parent, - const QStyleOptionViewItem &option, - const QModelIndex &index) const -{ - if (index.column() == int(Model::Column::Action)) { - auto combo = new QComboBox(parent); - combo->setEditable(false); - combo->addItems({toString(Action::NoAction), toString(Action::Remove), - toString(Action::Install)}); - return combo; - } - - return QStyledItemDelegate::createEditor(parent, option, index); -} - -void UpdateDelegate::setEditorData(QWidget *editor, - const QModelIndex &index) const -{ - if (index.column() == int(Model::Column::Action)) { - auto combo = qobject_cast(editor); - SOFT_ASSERT(combo, return ); - combo->setCurrentText(index.data(Qt::EditRole).toString()); - return; - } - - return QStyledItemDelegate::setEditorData(editor, index); -} - -void UpdateDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, - const QModelIndex &index) const -{ - if (index.column() == int(Model::Column::Action)) { - auto combo = qobject_cast(editor); - SOFT_ASSERT(combo, return ); - model->setData(index, combo->currentIndex()); - return; - } - - return QStyledItemDelegate::setModelData(editor, model, index); -} - Installer::Installer(const UserActions &actions) : actions_(actions) { diff --git a/src/service/updates.h b/src/service/updates.h index 9a0614c..0003e90 100644 --- a/src/service/updates.h +++ b/src/service/updates.h @@ -32,11 +32,6 @@ public: explicit UpdateDelegate(QObject* parent = nullptr); void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override; - QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, - const QModelIndex& index) const override; - void setEditorData(QWidget* editor, const QModelIndex& index) const override; - void setModelData(QWidget* editor, QAbstractItemModel* model, - const QModelIndex& index) const override; }; class Model : public QAbstractItemModel