Results 1 to 2 of 2

Thread: QTableWidgetItem's setFlags() ???

  1. #1
    Join Date
    Mar 2006
    Posts
    47
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Default QTableWidgetItem's setFlags() ???

    Hi
    I have a QTableWidget placed on a form using QT4 Designer and it has three columns. First column item is checkable.

    Following code is used to insert row items in QTableWidget


    row = tableWidget->rowCount(); // current row count
    tableWidget->setRowCount(row+1); // add one row


    item=new QTableWidgetItem(SearchHeaderEnd->bSoftwareName);
    item->setFlags ( Qt::ItemIsUserCheckable );
    item->setFlags(Qt::ItemIsSelectable );

    if(SearchHeaderEnd->IfSelected)
    item->setCheckState ( Qt::Checked );
    else
    item->setCheckState ( Qt::Unchecked );
    tableWidget->setItem( RowCount, 0, item );

    item=new QTableWidgetItem(SearchHeaderEnd->bFileExt);
    tableWidget->setItem( RowCount, 1, item );


    FileSize= FileSize.setNum(SearchHeaderEnd->dwFileSize/1024);
    item=new QTableWidgetItem(FileSize);
    tableWidget->setItem( RowCount, 2, item );


    Size = Size - sizeof(HEADER_FILE);
    RowCount++;



    My Problem is:
    (1) Item appears as disabled of first column and rest of the two columns are editable

    How to set the item->setFlags () so that it appear checkable,selectable,not editable.


    Thanks and regards

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QTableWidgetItem's setFlags() ???

    Quote Originally Posted by darpan View Post
    My Problem is:
    (1) Item appears as disabled of first column and rest of the two columns are editable

    How to set the item->setFlags () so that it appear checkable,selectable,not editable.
    I already gave you answer to this.
    J-P Nurmi

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.