Results 1 to 2 of 2

Thread: making up a QTableWidgetItem

  1. #1
    Join Date
    Nov 2006
    Posts
    41
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default making up a QTableWidgetItem

    Hi, i want to customize a QTableWidgetItem after created but i get segmentation faults when retrieving the currentItem from a QTableWidget like this

    Qt Code:
    1. aList->setItem(aList->rowCount()-2,
    2. 1,
    3. new QTableWidgetItem(tr("TOTAL :: ")));
    4. aList->currentItem()->setForeground(QBrush(Qt::darkRed));
    To copy to clipboard, switch view to plain text mode 
    why i can't use the QTWI returned by currentItem()? is there any way to do what im pretending the short way instead of creating the QTWI pointer and defining it before calling setItem()?

    thanks

  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: making up a QTableWidgetItem

    Does the QTableWidget contain focus by the time retrieving the current item?
    There's a difference between a "selected item" and a "current item". See this post. It discusses about a tree widget but the same thing goes with a table widget.
    J-P Nurmi

Similar Threads

  1. making new project qt4
    By !Ci in forum Qt Programming
    Replies: 1
    Last Post: 18th June 2009, 13:32
  2. making help file
    By deekayt in forum Qt Programming
    Replies: 1
    Last Post: 30th October 2006, 17:38
  3. Replies: 3
    Last Post: 26th September 2006, 12:16
  4. Interesting little Segfault w/r to signal/slot connection
    By Hydragyrum in forum Qt Programming
    Replies: 24
    Last Post: 12th September 2006, 19:22
  5. 3 Different Color for in QTablewidgetItem
    By jnana in forum Qt Programming
    Replies: 3
    Last Post: 21st March 2006, 11:38

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.