diff --git a/pe-bear/HexView.cpp b/pe-bear/HexView.cpp index af51be4..8c69195 100644 --- a/pe-bear/HexView.cpp +++ b/pe-bear/HexView.cpp @@ -82,15 +82,6 @@ HexItemDelegate::HexItemDelegate(QObject* parent) : #endif } -void HexItemDelegate::selectNextParentItem(const QModelIndex &index) const -{ - QTableView *parentView = qobject_cast(this->parent()); - if (!parentView) return; - - parentView->setCurrentIndex(index); - parentView->edit(index); -} - QWidget* HexItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const @@ -129,9 +120,14 @@ QWidget* HexItemDelegate::createEditor(QWidget *parent, void HexItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex& index) const { + const QString before = model->data(index, Qt::EditRole).toString(); QStyledItemDelegate::setModelData(editor, model, index); - emit dataSet(index.column(), index.row()); + const QString after = model->data(index, Qt::EditRole).toString(); + if (before != after) { + emit dataSet(index.column(), index.row()); + } } + void HexItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const diff --git a/pe-bear/HexView.h b/pe-bear/HexView.h index 0a4cc9d..4699eee 100644 --- a/pe-bear/HexView.h +++ b/pe-bear/HexView.h @@ -40,8 +40,6 @@ Q_SIGNALS: void dataSet(int col, int row) const; private: - void selectNextParentItem(const QModelIndex &index) const; - QColor m_selectionBgColor, m_selectionTextColor; QRegularExpressionValidator validator; };