Results 1 to 10 of 10

Thread: QComboBox Item Right Click

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2012
    Posts
    123
    Thanks
    4
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QComboBox Item Right Click

    ok i solved it.
    Solution: in QItemDelegate isn't mousePressEvent or something like that this are events from Qobject but this don't work for QItemDelegate you need implement editorEvent:
    Qt Code:
    1. bool Item::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
    2. {
    3.  
    4. if (event->type() == QEvent::MouseButtonPress)
    5. {
    6. QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
    7. if(mouseEvent->button() == Qt::LeftButton)
    8. qDebug() << "leftButton";
    9.  
    10.  
    11.  
    12. if(mouseEvent->button() == Qt::RightButton)
    13. qDebug() << "rightButton";
    14. }
    15. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by Viper666; 13th January 2013 at 21:30.

  2. The following user says thank you to Viper666 for this useful post:

    wirasto (13th January 2013)

Similar Threads

  1. Replies: 0
    Last Post: 10th March 2011, 11:44
  2. Searching an item in QCombobox
    By ramarolahyangelo in forum Newbie
    Replies: 2
    Last Post: 21st December 2010, 08:51
  3. QComboBox item disable?
    By Equilibrium in forum Qt Programming
    Replies: 8
    Last Post: 28th November 2007, 17:41
  4. QComboBox and item
    By drow in forum Qt Programming
    Replies: 4
    Last Post: 14th June 2006, 09:04
  5. TreeView click item not connecting
    By Big Duck in forum Qt Programming
    Replies: 2
    Last Post: 9th June 2006, 19:38

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.