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
    288
    Thanks
    23
    Thanked 32 Times in 28 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.
    __________________________________________________
    My projects: calculator MathGraphica ; SuperEpicMegaHero game ; GooglePlay ; bitbucket ; github
    Like my projects ? Buy me a kofi

  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
    288
    Thanks
    23
    Thanked 32 Times in 28 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 
    __________________________________________________
    My projects: calculator MathGraphica ; SuperEpicMegaHero game ; GooglePlay ; bitbucket ; github
    Like my projects ? Buy me a kofi

Similar Threads

  1. Signal when end edit Item
    By TomASS in forum Qt Programming
    Replies: 12
    Last Post: 20th June 2015, 21:57
  2. How to edit Horizontal Header Item in QTableWidget
    By ioannis in forum Qt Programming
    Replies: 6
    Last Post: 5th March 2013, 19:50
  3. Replies: 1
    Last Post: 9th December 2010, 13:53
  4. How can I edit an invisible menu item?
    By brazso in forum Qt Tools
    Replies: 1
    Last Post: 5th January 2009, 18:45
  5. Replies: 8
    Last Post: 15th May 2007, 10: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.