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. Can we Get Previous Cursor Address
Forum Updated to NodeBB v4.3 + New Features

Can we Get Previous Cursor Address

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.5k Views 1 Watching
  • 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.
  • P Offline
    P Offline
    petergollapalli
    wrote on last edited by
    #1

    Hi every one I am new to Qt
    I have one QDialog in that i kept one QtableWidget
    and also iam having two Push Buttons
    One Button is for adding Rows dynamically to Qtablewidget
    and another push button is for Calculating sum of Columns

    here my problem
    my Tab key is at “Sum” Button
    when i pressed Shift+Tab key
    Tab position is moving to last but one Row
    What i want is It should move to last Row

    Sorry my english not so good, I hope You understand my problem
    can any one help in this problem
    Thanks in advance

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      [quote author="petergollapalli" date="1363780662"]
      here my problem
      my Tab key is at “Sum” Button
      when i pressed Shift+Tab key
      Tab position is moving to last but one Row
      What i want is It should move to last Row
      [/quote]

      In my opinion you can achieve this behavior if you handle the focus event of QTableWidget using "eventFilter":http://qt-project.org/doc/qt-4.8/qobject.html#eventFilter and select the last row. The source code should be something similar to (please note that I have not tested it):

      @
      bool MainWindow::eventFilter(QObject *obj, QEvent *event)
      {
      if (obj == pMyTable)
      {
      if ( QEvent::FocusIn == event->type() )
      {
      pMyTable->selectRow(pMyTable->rowCount() - 1);
      return true;
      }
      else
      {
      return false;
      }
      }
      else
      {
      // pass the event on to the parent class
      return QMainWindow::eventFilter(obj, event);
      }
      }
      @

      http://anavi.org/

      1 Reply Last reply
      0
      • L Offline
        L Offline
        leon.anavi
        wrote on last edited by
        #3

        Did you try the solution that I proposed yesterday?

        http://anavi.org/

        1 Reply Last reply
        0
        • P Offline
          P Offline
          petergollapalli
          wrote on last edited by
          #4

          where should i include this code

          1 Reply Last reply
          0
          • L Offline
            L Offline
            leon.anavi
            wrote on last edited by
            #5

            [quote author="petergollapalli" date="1363946230"]where should i include this code
            [/quote]

            The "eventFilter is a virtual method of class QObject":http://qt-project.org/doc/qt-5.0/qtcore/qobject.html#eventFilter. The example that I gave is for implementation at a class that inherits "QMainWindow":http://qt-project.org/doc/qt-5.0/qtwidgets/qmainwindow.html.

            http://anavi.org/

            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