Results 1 to 20 of 20

Thread: Problem in updating listwidget of friend class

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Location
    New Delhi, India
    Posts
    31
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60

    Unhappy Problem in updating listwidget of friend class

    I am unable to update (addItem) to the private data member (i.e a listwidget) of friend class (here Spam_MessagesWidget).

    I am trying to implement a feature in my application by which the selected message can be moved from Inbox Tab to Other Tab i.e removing from one listwidget and adding to other list widget.

    To help me, just check the recentmessageswidget.cpp file and reportAsSpam() method in it.

    The code is running and i am able to remove the selected item but unable to add it other tab listwidget. (Tested on Nokia QT SDK V1.0)

    Qt Code:
    1. QListWidgetItem* RecentMessagesWidget::removeitemI()
    2. {
    3. int cr = m_messageListWidget->currentRow();
    4. QListWidgetItem *temp = new QListWidgetItem(m_messageListWidget);
    5. temp = m_messageListWidget->takeItem(cr);
    6. m_messageListWidget->update();
    7.  
    8. return(temp);
    9. }
    10.  
    11.  
    12. //This function is called from a slot rspam() , in tabmain.cpp
    13. void RecentMessagesWidget :: reportAsSpam()
    14. {
    15. QListWidgetItem *temp = removeitemI();
    16.  
    17. // trying to add the removed item from "RecentMessagesWidget Class" Listwidget to "Spam_MessagesWidget friend class Listwidget"
    18.  
    19. spm = new Spam_MessagesWidget(this, SpamMessagesCount);
    20. spm->additemS(temp);
    21.  
    22. }
    To copy to clipboard, switch view to plain text mode 

    Your help will be appreciated and acknowledged.
    Attached Files Attached Files

Similar Threads

  1. Problem in updating XML file
    By Qt_Kid in forum Qt Programming
    Replies: 11
    Last Post: 27th February 2011, 10:54
  2. Replies: 7
    Last Post: 2nd September 2010, 19:42
  3. Problem with QListWidget Updating
    By flob in forum Qt Programming
    Replies: 2
    Last Post: 21st November 2009, 17:05
  4. friend class in TC++ book
    By mickey in forum General Programming
    Replies: 11
    Last Post: 25th August 2008, 22:08
  5. ListWidget itemClicked problem
    By Keemosabi in forum Newbie
    Replies: 2
    Last Post: 11th August 2008, 22:29

Tags for this Thread

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.