Results 1 to 3 of 3

Thread: hideEvent not propagated to tabified dock widgets

  1. #1
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default hideEvent not propagated to tabified dock widgets

    I am trying to catch the hide/show events in a widget which has been placed in a QDockWidget. The problem is that after I tabify the Dockwidget, it doesn't get those notifications anymore when I switch tabs. This behaviour differs from that of an ordinary QTabWidget.

    I am using Qt 4.3.0 at the moment and I would like to know if this is wanted behaviour, or if it has been fixed in the 4.4 branch, otherwise I'll file a bug report.

    Here is an example to test the behaviour:

    Qt Code:
    1. #include <QtGui>
    2.  
    3. class MyLabel : public QLabel
    4. {
    5. public:
    6. MyLabel()
    7. : timesHidden(0)
    8. , timesShown(0)
    9. {
    10. }
    11. void showEvent(QShowEvent*)
    12. {
    13. timesShown++;
    14. QString text;
    15. text.sprintf("Times hidden: %d\nTimes Shown: %d", timesHidden, timesShown);
    16. setText(text);
    17. }
    18. void hideEvent(QHideEvent*)
    19. {
    20. timesHidden++;
    21. }
    22. int timesHidden;
    23. int timesShown;
    24. };
    25.  
    26. int main(int argc, char* argv[])
    27. {
    28. QApplication app(argc, argv);
    29. QMainWindow window;
    30. window.setCentralWidget(new QTextEdit(&window));
    31.  
    32. QList<QDockWidget*> dockWidgets;
    33. for (int i=1;i<=3;i++){
    34. QDockWidget* dock = new QDockWidget(QString::number(i), &window);
    35. dock->setWidget(new MyLabel);
    36. window.addDockWidget(Qt::BottomDockWidgetArea, dock);
    37. dockWidgets << dock;
    38. }
    39. window.tabifyDockWidget(dockWidgets[1], dockWidgets[2]);
    40.  
    41. window.show();
    42. return app.exec();
    43. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: hideEvent not propagated to tabified dock widgets

    So, should I consider this a bug? I would really appreciate if somebody would test it.

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: hideEvent not propagated to tabified dock widgets

    I haven't had time to look into it, but perhaps you could use QDockWidget::visibilityChanged()?
    J-P Nurmi

Similar Threads

  1. How to movable dock widgets?
    By becond in forum Qt Tools
    Replies: 3
    Last Post: 21st February 2006, 19:57

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.