插槽 setShowGride 在我的应用程序中不起作用

弗兰基

是程序,这是屏幕截图

这也是以下代码showGridAction(我在其中看到问题的地方):void MainWindow::createActions()函数(in 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去!这可能是上述选项不起作用的问题根源。
请问怎么修?

弗兰基

代码中有一个错字。如果已修复,应用程序将正常运行。使用setShowGridsetShowGride

关于代码的那部分,是的,它不需要,因为您使用的是 Qt 5.9。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章