【发布时间】:2017-08-10 19:30:54
【问题描述】:
Here 是程序,这里是the screenshot。
这也是showGridAction(我在其中看到问题)的代码:void MainWindow::createActions() 函数(在MainWindow.cpp):
showGridAction = new QAction(tr("&Show Grid"), this);
showGridAction -> setCheckable(true);
showGridAction -> setChecked(spreadsheet -> showGrid());
showGridAction -> setStatusTip(tr("Show or hide the spreadsheet's"
" grid"));
connect(showGridAction, SIGNAL(toggled(bool)),
spreadsheet, SLOT(setShowGride(bool)));
#if QT_VERSION < 0x040102
// workaround for a QTableWidget bug in Qt 4.1.1
connect(showGridAction, SIGNAL(toggled(bool)),
spreadsheet->viewport(), SLOT(update()));
#endif
我的问题:
1- 首先我认为 #if QT_VERSION < 0x040102 直到 #endif 部分不再需要,因为我使用的是 Qt 5.9。你也这么认为吗?
2- 该代码无效。从上面的屏幕截图中可以看出,选中和取消选中 Show Grid 选项不会改变!请问如何使它适用于该应用程序?
3- 代码中有一个名为setShowGride(bool) 的插槽。这个从哪里来?当我点击它时它不会被突出显示,当我按F2 时它也不会带我去任何地方!这可能是上述选项不起作用的问题根源。
请问怎么解决?
【问题讨论】:
标签: c++ qt signals-slots qt5.9