PDA

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



hardgeus
9th May 2006, 19:21
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.

munna
9th May 2006, 20:16
did u try Qt::WindowTitleHint ?

hardgeus
9th May 2006, 20:21
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.

munna
9th May 2006, 20:33
try

pParent->setWindowFlags( Qt::WindowTitleHint )

hardgeus
9th May 2006, 20:36
try

pParent->setWindowFlags( Qt::WindowTitleHint )

Still nothing.

munna
9th May 2006, 20:39
Its workinig for me. I got only the title bar, without any icon and any button.

Can you please show ur code?

jpn
9th May 2006, 20:40
You can at least get rid if min/max buttons by passing Qt::Tool as window flags:


workspace->addWindow(widget, Qt::Tool);

hardgeus
9th May 2006, 20:43
Its workinig for me. I got only the title bar, without any icon and any button.

Can you please show ur code?




CJonTable *MainWindow::createTable() {
CJonTable *child = new CJonTable;
m_pWorkspace->addWindow(child);

connect(child, SIGNAL(TableDirty()), this, SLOT(OnDirty()));

QWidget *pParent = child->parentWidget();

pParent->setWindowFlags( Qt::WindowTitleHint );
pParent->installEventFilter( child );

return child;
} //createTable

munna
9th May 2006, 20:50
Try



CJonTable *child = new CJonTable;
QWidget *pParent = m_pWorkspace->addWindow(child,Qt::WindowTitleHint);

connect(child, SIGNAL(TableDirty()), this, SLOT(OnDirty()));

//QWidget *pParent = child->parentWidget();
//pParent->setWindowFlags( Qt::WindowTitleHint );
pParent->installEventFilter( child );

return child;

hardgeus
9th May 2006, 20:53
That did it! Thanks.