当您按 Return 键时,以下代码行在 Windows 上有效,但在 Mac 上无效。有谁知道为什么?
connect(qTreeView, SIGNAL(activated(const QModelIndex &)), this, SLOT(actJoin()));
当我查看它提到的 API 时
This signal is emitted when the item specified by index is activated by the user. How to activate items depends on the platform; e.g., by single- or double-clicking the item, or by pressing the Return or Enter key when the item is current.
是否还有其他方法可以在我缺少的 Mac 上激活?
最佳答案
CMD+O应该是激活的Mac版本,如图here
#ifdef Q_WS_MAC
if (event->key() == Qt::Key_O && event->modifiers() & Qt::ControlModifier && currentIndex().isValid()) {
emit activated(currentIndex());
break;
}
在 Mac 上按 Return 键不会激活它,它会进入编辑模式。
关于c++ - `QTreeView` 什么时候在 Mac 上发出激活信号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31650780/