Results 1 to 2 of 2

Thread: How to use list of items?

  1. #1
    Join Date
    Feb 2011
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to use list of items?

    Hello, I am new to Qt.
    I want to use a list (maybe QListWidget) that allows the user to add, remove, rename, copy and reorder (up or down) items, but I do not know how to implement it.
    The default QListWidget has no button or context menu, it does not allow the user to add, remove and rename items.

    Will I have to create a button for each operation?
    Do the rename and add operation require a dialog box that allows the user to write the item name? It would be more user friendly to write the name of an item directly into the list, without a dialog box.

    Thanks.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,640
    Thanks
    13
    Thanked 1,592 Times in 1,520 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to use list of items?

    Quote Originally Posted by Squall View Post
    Will I have to create a button for each operation?
    Yes (a button, menu option, something), except rename which the user can do simply by editing the entry unless you have some other reason to separate the process. Add can just inert a new blank row and allow the user to edit it. Reordering and delete can be done by drag and drop, but you should walk before you try to run.
    Do the rename and add operation require a dialog box that allows the user to write the item name? It would be more user friendly to write the name of an item directly into the list, without a dialog box.
    No they don't, and yes it would. Mark a QListWidgetItem editable using setFlags() with Qt::ItemIsEditable

Similar Threads

  1. Replies: 1
    Last Post: 23rd April 2011, 17:33
  2. how to sort a list by one of its items ?! [solved]
    By gbmtoday in forum Qt Programming
    Replies: 13
    Last Post: 2nd January 2011, 20:37
  3. Qt Kinetic: adding items to list
    By Diph in forum Qt Programming
    Replies: 1
    Last Post: 10th November 2009, 08:27
  4. Comparing Items In List Box
    By kenny_isles in forum Qt Programming
    Replies: 9
    Last Post: 21st February 2007, 13:06
  5. delete items from list box
    By vvbkumar in forum Qt Programming
    Replies: 4
    Last Post: 23rd June 2006, 19:08

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.