Results 1 to 2 of 2

Thread: How to return elements from a ListView

  1. #1
    Join Date
    Jan 2007
    Posts
    8
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Question How to return elements from a ListView

    I know this is very simple but I havn't been able to get it to work yet!

    I've been following this tutorial but hit a wall when trying to solve the last excercise in chapter 5!!
    I have created an application that takes input from a "lineedit" and displays it in a "ListView" Widget upon pressing an "Add" button.. I have two columns in the listview. One for the lineedit text and one for a counter (counting the number of entries added to the list)This works
    Now I would like to change things so that when I select an Item in ListView, the text content of that item is displayed in a lineedit widget!
    What is the command for doing this?? I've tried the following but no gain!

    lineedit->insert(QListViewItem(listview->currentItem(),column1)->text());

    lineedit and listview are the names of my widgets!

    I hope someone out there will thake the time to help a poor disturbed QT Noob

    Regards Nikau

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to return elements from a ListView

    You want to do something like lineEdit->setText( listView->currentItem()->text(0) );

  3. The following user says thank you to e8johan for this useful post:

    nikau (23rd January 2007)

Similar Threads

  1. [SOLVED] DirectShow Video Player Inside Qt
    By ToddAtWSU in forum Qt Programming
    Replies: 16
    Last Post: 3rd November 2011, 07:47
  2. Carriage Return in QString
    By incapacitant in forum Newbie
    Replies: 7
    Last Post: 2nd December 2010, 09:18
  3. ListView Dynamic Popup menu
    By raphaelf in forum Newbie
    Replies: 3
    Last Post: 14th October 2006, 19:26
  4. Version 4.1.3 and QTreeView
    By greencastor in forum Qt Programming
    Replies: 2
    Last Post: 13th June 2006, 10:37
  5. filtering big listview causes slowdown
    By soul_rebel in forum KDE Forum
    Replies: 1
    Last Post: 24th May 2006, 13:31

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.