当更改值的值时(返回之前)的信号 我有一个关于EnhtableWidget字段的信号的问题: 当我单击该表的单元格时 - > ..发出的currentCellchanged(int,int,int,int) 当我单击返回时...

问题描述 投票:0回答:2
当我单击该表的单元格时 - > ..

currentCellChanged(int,int,int,int)

is emitted
  • 当我在桌子的单元格中返回时 - > .. cellchanged(int,int)发出

    我需要在更改单元格的值时启动计算方法,但是按下了
  • before
  • 返回。是否有信号,类似

    当我更改字段的值时(尚未返回!)

    创建一个定制的代表,该定制代表会由单元编辑器发出变化:
MyDelegate::MyDelegate(QObject *parent) : QStyledItemDelegate(parent) { } QWidget* MyDelegate::createEditor(QWidget* parent,const QStyleOptionViewItem &option,const QModelIndex &index) const { // Assume you want a QLineEdit editor for the QTableWidget cell QLineEdit* editor = new QLineEdit(parent); // Get notified when editor changes QObject::connect(editor, &QLineEdit::textEdited, this, [=](const QString &newValue) { qDebug() << "Cell has changed without pressing return: " << newValue; } return editor; }

ITEMCHANGED

信号发射 void QTableWidget::itemChanged(QTableWidgetItem * item) 此外,您也可以尝试捕获从qabstractitemview class

继承的
c++ qt widget signals-slots
2个回答
2
投票
信号

void QAbstractItemView::dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight, const QVector<int> & roles = QVector<int> ())
或者您可以亚类qtablewidget和重新进化

1
投票
或使用自定义键盘汉,如果您不想子类别:

tableWidget->installEventFilter(keyPressHandler);


最新问题
© www.soinside.com 2019 - 2025. All rights reserved.