Results 1 to 2 of 2

Thread: Removing same type of Widgets from QWorkspace

  1. #1
    Join Date
    Jan 2009
    Posts
    34
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Removing same type of Widgets from QWorkspace

    I have a QWorkspace.

    I can generate large amounts of the same type of widget: "DetailSummaryWdg" and add them to the workspace. I want to provide an action to this widget to close all widgets of the same type, i.e., the user wants to close all the detailsummaries with the click of a button.

    I have tried traversing the children() of the QWorkspace and compare both objectName and metaObject()->className(), but when the objectName() of the object is "DetailSummaryWdg", the className from the same widget in the workspace is QWorkspaceChild and its objectName is qt_workspacechild.

    Any suggestions on how I can remove all widgets of the same type/class?

  2. #2
    Join Date
    Jan 2006
    Location
    Netherlands
    Posts
    56
    Thanks
    10
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Removing same type of Widgets from QWorkspace

    Maybe it's an idea to subclass the class from which DetailSummaryWdg is created..

    Then adding a Type variable to that class (int or something)

    Qt Code:
    1. #define TYPE_DETAIL_SUMMARY 1010 // or something else you like
    2.  
    3. class DetailSummaryWidget : public BaseClass
    4. {
    5. public:
    6. DetailSummaryWidget(...);
    7. ~DetailSummaryWidget();
    8. ...
    9. int Type;
    10. ...
    11. };
    12.  
    13. DetailSummaryWidget::DetailSummaryWidget(...)
    14. :BaseClass(...)
    15. {
    16. Type = TYPE_DETAIL_SUMMARY;
    17. }
    To copy to clipboard, switch view to plain text mode 

    When traversing the windows in the workspace, you can check on that particular Type variable if the window needs to be closed.

    Just an idea Maybe there are more ways....
    ..:: Still Standing Strong ::..

Similar Threads

  1. Compile 4.4.0
    By LordQt in forum Installation and Deployment
    Replies: 18
    Last Post: 29th May 2008, 13:43
  2. adding and removing widgets
    By eric in forum Qt Programming
    Replies: 1
    Last Post: 30th November 2007, 01:34
  3. Replies: 5
    Last Post: 28th September 2007, 10:23
  4. dummy question(Error)
    By Masih in forum Qt Programming
    Replies: 12
    Last Post: 19th July 2007, 23:38
  5. QWorkSpace parent type optional?
    By brcain in forum Qt Programming
    Replies: 1
    Last Post: 19th September 2006, 00:45

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.