Results 1 to 10 of 10

Thread: Removing min/max etc buttons from titlebar of an MDI child ( QWorkspaceChild ) object

  1. #1
    Join Date
    May 2006
    Posts
    58
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Removing min/max etc buttons from titlebar of an MDI child ( QWorkspaceChild ) object

    This is in QT4. I have implemented an MDI application and am trying to remove the top left icon, min, max, and close buttons off of the titlebar of a MDI child window.

    When I call AddWindow on my QWorkspace, a QWorkspaceChild object is "wrapped" around my wiget. This enclosing window has min/max/and close buttons as well as an icon on the top left. How do I get rid of them while keeping the titlebar? I tried SetWindowFlags, but that did not do anything. I tried digging through the actual QT code for the class, but everything I need is private.

  2. #2
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Removing min/max etc buttons from titlebar of an MDI child ( QWorkspaceChild ) object

    did u try Qt::WindowTitleHint ?

  3. #3
    Join Date
    May 2006
    Posts
    58
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Removing min/max etc buttons from titlebar of an MDI child ( QWorkspaceChild ) ob

    Quote Originally Posted by munna
    did u try Qt::WindowTitleHint ?
    I tried:

    pParent->setWindowFlags( pParent->windowFlags() & Qt::WindowTitleHint );

    Tried:

    pParent->setWindowFlags( pParent->windowFlags() ^ Qt::WindowTitleHint );

    Tried:

    pParent->setWindowFlags( pParent->windowFlags() | Qt::WindowTitleHint );


    None of it had any effect at all.

  4. #4
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Removing min/max etc buttons from titlebar of an MDI child ( QWorkspaceChild ) object

    try

    pParent->setWindowFlags( Qt::WindowTitleHint )

  5. #5
    Join Date
    May 2006
    Posts
    58
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Removing min/max etc buttons from titlebar of an MDI child ( QWorkspaceChild ) ob

    Quote Originally Posted by munna
    try

    pParent->setWindowFlags( Qt::WindowTitleHint )
    Still nothing.

  6. #6
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Removing min/max etc buttons from titlebar of an MDI child ( QWorkspaceChild ) object

    Its workinig for me. I got only the title bar, without any icon and any button.

    Can you please show ur code?

  7. #7
    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: Removing min/max etc buttons from titlebar of an MDI child ( QWorkspaceChild ) ob

    You can at least get rid if min/max buttons by passing Qt::Tool as window flags:
    Qt Code:
    1. workspace->addWindow(widget, Qt::Tool);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  8. #8
    Join Date
    May 2006
    Posts
    58
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Removing min/max etc buttons from titlebar of an MDI child ( QWorkspaceChild ) ob

    Quote Originally Posted by munna
    Its workinig for me. I got only the title bar, without any icon and any button.

    Can you please show ur code?

    Qt Code:
    1. CJonTable *MainWindow::createTable() {
    2. CJonTable *child = new CJonTable;
    3. m_pWorkspace->addWindow(child);
    4.  
    5. connect(child, SIGNAL(TableDirty()), this, SLOT(OnDirty()));
    6.  
    7. QWidget *pParent = child->parentWidget();
    8.  
    9. pParent->setWindowFlags( Qt::WindowTitleHint );
    10. pParent->installEventFilter( child );
    11.  
    12. return child;
    13. } //createTable
    To copy to clipboard, switch view to plain text mode 

  9. #9
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Removing min/max etc buttons from titlebar of an MDI child ( QWorkspaceChild ) object

    Try

    Qt Code:
    1. CJonTable *child = new CJonTable;
    2. QWidget *pParent = m_pWorkspace->addWindow(child,Qt::WindowTitleHint);
    3.  
    4. connect(child, SIGNAL(TableDirty()), this, SLOT(OnDirty()));
    5.  
    6. //QWidget *pParent = child->parentWidget();
    7. //pParent->setWindowFlags( Qt::WindowTitleHint );
    8. pParent->installEventFilter( child );
    9.  
    10. return child;
    To copy to clipboard, switch view to plain text mode 

  10. The following 2 users say thank you to munna for this useful post:

    hardgeus (9th May 2006), moltkestr19 (6th April 2010)

  11. #10
    Join Date
    May 2006
    Posts
    58
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Removing min/max etc buttons from titlebar of an MDI child ( QWorkspaceChild ) ob

    That did it! Thanks.

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.