Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Some issues related to a program

Some issues related to a program

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 4 Posters 958 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • tomyT Offline
    tomyT Offline
    tomy
    wrote on last edited by tomy
    #1

    Hello,

    Here is the program and it's its screenshot.

    Here is also the code for the showGridAction (where I see issues in that) inside the:
    void MainWindow::createActions() function (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
    

    My questions:

    1- First I think the part #if QT_VERSION < 0x040102 until #endif is not needed anymore, because I'm using Qt 5.9. Do you think so too?

    2- That code doesn't work in effect. As you can see from the screenshot above, checking and unchecking the Show Grid option makes no changes! How to make it work for the app please?

    3- There is a slot in the code named setShowGride(bool). Where is it from? It won't be highlited when I click it and also takes me nowhere when I press F2 on it! It's probably the source of the issue for the option above not to function. How to fix it please?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Yes, you can remove the code in the #if statement since you won't compile it with Qt 4.

      Are you sure it's not setShowGrid without the final e ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • tomyT Offline
        tomyT Offline
        tomy
        wrote on last edited by tomy
        #3

        You solved the issue, thanks. I always make typos. ;)
        Thank you very much.
        I don't know why the compiler didn't catch it as an error!

        N M 2 Replies Last reply
        0
        • tomyT tomy

          You solved the issue, thanks. I always make typos. ;)
          Thank you very much.
          I don't know why the compiler didn't catch it as an error!

          N Offline
          N Offline
          Nmut
          wrote on last edited by Nmut
          #4

          @tomy
          You only have the error at runtime on the console (maybe only in debug, I don't remember) as the signal/slot mechanism is not static but build at runtime. The compiler can't do anything is this case.

          1 Reply Last reply
          0
          • tomyT tomy

            You solved the issue, thanks. I always make typos. ;)
            Thank you very much.
            I don't know why the compiler didn't catch it as an error!

            M Offline
            M Offline
            mchinand
            wrote on last edited by
            #5

            @tomy said in Some issues related to a program:

            I don't know why the compiler didn't catch it as an error!

            To catch an error like this at compile time, you should use the new connect syntax:

            connect(showGridAction, &QAction::toggled, spreadsheet, &QTableWidget::setShowGrid);
            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved