+ Reply to Thread
Results 1 to 4 of 4

Thread: Item edit in QTableWidget

  1. #1
    Join Date
    Nov 2008
    Posts
    39
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Exclamation Item edit in QTableWidget

    Hi,
    I have created a small program, I have observed several thing in QTableWidget, even though we disable the TabKey Navigation, it still works. How to disable the Tabkey Navigation in QtableWidget? if I click on the 1st column of any row it allows me to edit where as it should. I have attached the code in zip file please help me out with this.


    tableWidgetTrial1.zip
    Thanks
    manmohan.

  2. #2
    Join Date
    Aug 2008
    Location
    Algarve, Portugal
    Posts
    269
    Thanks
    21
    Thanked 28 Times in 24 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Item edit in QTableWidget

    I have removed your connection in the constructor and added the following:

    Qt Code:
    1. for(int r=0;r<ui->tableWidget->rowCount();r++)
    2. for(int c=0;c<ui->tableWidget->columnCount();c++)
    3. {
    4. ui->tableWidget->item(r,c)->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
    5. }
    To copy to clipboard, switch view to plain text mode 

    It works now.
    _______________________________________________
    Math Graphica - scientific calculator with graphs 2D / 3D / 4D, user defined functions, system of equations, formulas and integrals
    Qt Ambassador

  3. #3
    Join Date
    Nov 2008
    Posts
    39
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Item edit in QTableWidget

    Thanks John,
    The tab key navigation is disabled. In the table I want to disable editing of the 1st column, and the rest of the 2 columns should be editable by mouse clicks only (not by tab key navigation).

    Qt Code:
    1. for(int r=0;r<ui->tableWidget->rowCount();r++)
    2. for(int c=0;c<ui->tableWidget->columnCount();c++)
    3. {
    4. if(c == 0)
    5. ui->tableWidget->item(r,c)->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
    6. }
    To copy to clipboard, switch view to plain text mode 


    Thanks and regards.
    Manmohan

  4. #4
    Join Date
    Aug 2008
    Location
    Algarve, Portugal
    Posts
    269
    Thanks
    21
    Thanked 28 Times in 24 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Item edit in QTableWidget

    Then, optimize it

    Qt Code:
    1. for(int r=0;r<ui->tableWidget->rowCount();r++)
    2. {
    3. ui->tableWidget->item(r,0)->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
    4. }
    To copy to clipboard, switch view to plain text mode 
    _______________________________________________
    Math Graphica - scientific calculator with graphs 2D / 3D / 4D, user defined functions, system of equations, formulas and integrals
    Qt Ambassador

+ Reply to Thread

Similar Threads

  1. How to edit Horizontal Header Item in QTableWidget
    By ioannis in forum Qt Programming
    Replies: 6
    Last Post: 5th March 2013, 18:50
  2. Replies: 1
    Last Post: 9th December 2010, 12:53
  3. Signal when end edit Item
    By TomASS in forum Qt Programming
    Replies: 11
    Last Post: 20th April 2009, 08:48
  4. How can I edit an invisible menu item?
    By brazso in forum Qt Tools
    Replies: 1
    Last Post: 5th January 2009, 17:45
  5. Replies: 8
    Last Post: 15th May 2007, 09:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts