0

是程序,这是屏幕截图

这也是函数(in )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!这可能是上述选项不起作用的问题根源。
请问怎么修?

4

1 回答 1

0

代码中有错字。如果已修复,则应用程序可以正常运行。setShowGrid不使用setShowGride

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

于 2017-08-11T04:58:53.823 回答