Results 1 to 2 of 2

Thread: QTableWidget - items selection

  1. #1
    Join Date
    Aug 2009
    Posts
    92
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QTableWidget - items selection

    I would like to permit the user to be in the following situation:

    select.png

    So he understands that he is editing the name of ONE item but he will change the name of all the selected ones (where "enter name" is written).
    I've created the situation with the mouse but I cannot do it via software but I guess that, if I can do it with the mouse, it should be possible also via code.

    I'm at the point where I have a vector of items that will be selected (QVector<QTableWidgetItem*>) before I call ui->tableWidget->editItem(editItem);
    I've tried going through the vector and call
    Qt Code:
    1. m_ItemsToEdit.at(i)->setSelected(true)
    To copy to clipboard, switch view to plain text mode 
    but it doesn't work (it crashes indeed).
    I've seen that I should use a selectModel but I cannot find an example...

    Somebody knows how to solve the problem ?

  2. #2
    Join Date
    Aug 2009
    Posts
    92
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTableWidget - items selection

    I have another problem:
    how can I sort the QTableWidget by the index 0 (the combobox cells) ?


    Added after 26 minutes:


    Ok, solved the second problem.
    I don't know if there's another way, but I've inserted a QTableWidgetItem where the combox item is, with the same text and the order by works.
    Last edited by trallallero; 10th November 2011 at 13:03.

Similar Threads

  1. Replies: 2
    Last Post: 20th August 2010, 05:18
  2. QGraphicsScene and Extended Selection of items
    By totem in forum Qt Programming
    Replies: 2
    Last Post: 7th May 2010, 08:37
  3. Custom items selection in qgraphicsscene
    By yonnak in forum Qt Programming
    Replies: 7
    Last Post: 28th March 2009, 11:32
  4. Adding items to a QGraphicsScene's selection list?
    By mooreaa in forum Qt Programming
    Replies: 2
    Last Post: 1st July 2008, 20:01
  5. multiple selection of list view items
    By samirg in forum Qt Programming
    Replies: 2
    Last Post: 30th October 2007, 19:05

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
  •  
Qt is a trademark of The Qt Company.