2017-08-10 40 views
0

Here是程序,這裏是the screenshot插槽setShowGride不適用於我的應用程序

這裏也是裏面的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時,它也不會帶我走!這可能是上述選項不起作用的問題的根源。
如何解決它?

回答

0

代碼中存在拼寫錯誤。如果它已修復,則應用程序正常運行。使用setShowGrid而不是setShowGride

關於代碼的那部分,是的,因爲您使用的是Qt 5.9,所以不需要它。

相關問題