Results 1 to 5 of 5

Thread: The delegated widgets become hidden

  1. #1
    Join Date
    Oct 2010
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default The delegated widgets become hidden

    Hello,

    I have some delegated items on a tree widget. When I assign installEventFilter() function to those delegated items, they become invisible Might it be a bug or is there a way to overcome this problem?

    Thanks a lot for your help...

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: The delegated widgets become hidden

    Most likely your event filter is buggy. Did you call the base class implementation if you don't react on a specific event?

  3. #3
    Join Date
    Oct 2010
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: The delegated widgets become hidden

    A part of my implementation is as the following:

    Qt Code:
    1. bool Mission::eventFilter(QObject *obj, QEvent *event)
    2. {
    3.  
    4. if (event->type() == QEvent::MouseButtonPress)
    5. {
    6. QComboBox *comboBox = dynamic_cast<QComboBox*>(obj);
    7. if(comboBox != NULL)
    8. {
    9. t = findComboBox(comboBox);
    10. if(t->parent() == treeWidgetItemName) // route
    11. {
    12. dynamic_cast<QComboBox*>(treeWidgetMission->itemWidget(t, 1))->setStyleSheet(QString::fromUtf8("background-color: rgb(160, 160, 160);\n"));
    13. dynamic_cast<QLineEdit*>(treeWidgetMission->itemWidget(t, 0))->setStyleSheet(QString::fromUtf8("background-color: rgb(160, 160, 160);\n"));
    14. }
    15. t->setSelected(true);
    16. treeWidgetMission->setCurrentItem(t);
    17. }
    18. //else ...
    19. }
    20. }
    To copy to clipboard, switch view to plain text mode 

    Is there a bug?

    Thanks a lot...

    Note: Even if I comment out the code in eventFilter(), the same problem exists. If I comment out the code where I assign installEventFilter() method to the delegated widgets, there is no problem, but, of course, eventFilter() is not caught by those widgets then.
    Last edited by Lykurg; 20th December 2010 at 12:33. Reason: missing [code] tags

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: The delegated widgets become hidden

    Quote Originally Posted by fulbay View Post
    Is there a bug?
    Yes, you need to call the base class impelemtation. Something like:
    Qt Code:
    1. return QObject::eventFilter(obj, event);
    To copy to clipboard, switch view to plain text mode 
    It is also described in QObject::installEventFilter().

  5. The following user says thank you to Lykurg for this useful post:

    fulbay (20th December 2010)

  6. #5
    Join Date
    Oct 2010
    Posts
    21
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: The delegated widgets become hidden

    Oh, yes! Thanks! This help is great to me

Similar Threads

  1. Replies: 6
    Last Post: 10th March 2015, 12:34
  2. hidden a QTreeWidgetItem
    By mattia in forum Newbie
    Replies: 6
    Last Post: 19th February 2014, 14:04
  3. Replies: 5
    Last Post: 6th December 2007, 14:43
  4. widgets behind hidden widgets not working
    By bpetty in forum Newbie
    Replies: 13
    Last Post: 7th September 2007, 20:23
  5. Hidden field in QTreeView
    By YuriyRusinov in forum Qt Programming
    Replies: 4
    Last Post: 30th June 2006, 12:00

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.