Results 1 to 3 of 3

Thread: Add a dropdown menu to QListWidgetItem

  1. #1
    Join Date
    Sep 2010
    Posts
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Maemo/MeeGo

    Default Add a dropdown menu to QListWidgetItem

    I'm having some problems adding a dropdown menu to my dynamically generated QListWidgetItem.

    I subclass QListWidgetItem to my custom entry and generate my content in the subclass and finally add it to the QListWidget.

    Now i want to add a dropdown menu to every QListWidgetItem to delete the entry or modify it!

    I did some other gui programming (swing,gtk+) but it seems to be different to in qt?

    Can somebody help me?

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Add a dropdown menu to QListWidgetItem

    What I probably would do, but this is just of the top of my head and without further checking:

    If the items in the list all have the same context menu:
    Create a slot that listens to the customContextMenuRequested signal of the widget.
    Get the item at the given point, display the menu. Use either a signal mapper or clean up the connections before making new ones.

    If the items can all have different actions, I would let each item handle its own actions.
    Again from a slot connected to the customContextMenuRequested signal, create a new context menu based on the actions of the item at the given point.

  3. #3
    Join Date
    Jul 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Add a dropdown menu to QListWidgetItem

    QTableWidget is probably the class your are looking for.

Similar Threads

  1. QListWidgetItem popup menu on right mouse click
    By AcerExtensa in forum Qt Programming
    Replies: 1
    Last Post: 10th June 2010, 13:17
  2. Dropdown menu?
    By rakkar in forum Newbie
    Replies: 1
    Last Post: 9th September 2009, 17:13
  3. DropDown combo box
    By Tavit in forum Qt Programming
    Replies: 3
    Last Post: 3rd May 2008, 08:40
  4. dropdown menu(popupmenu) refreshing issue
    By Ankit in forum Qt Programming
    Replies: 12
    Last Post: 24th August 2007, 04:57
  5. dropdown menu(popupmenu) refreshing issue
    By Ankit in forum Qt Tools
    Replies: 3
    Last Post: 17th August 2007, 13:09

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.