PDA

View Full Version : QTabWidget documentMode on mac looks wrong.



strawtarget
11th February 2010, 09:30
I'm trying to use documentMode style tabs on Mac.



MainWindow::MainWindow()
: QMainWindow()
{
setDocumentMode(true);

QTabWidget *tabs = new QTabWidget();
tabs->setDocumentMode(true);

QLabel *lbl = new QLabel(tr("Titlebar and Tabs are Not Seamless"));
lbl->setAlignment(Qt::AlignCenter);
tabs->addTab(lbl, tr("Hello"));

lbl = new QLabel(tr("Bummer"));
lbl->setAlignment(Qt::AlignCenter);
tabs->addTab(lbl, tr("World"));

setCentralWidget(tabs);
setWindowTitle(tr("Test"));
}


Problem is, I'm not getting the smooth look that I'm expecting. Here's how it looks (there is not supposed to be a division between the window's titlebar and the tabs... they are supposed to be seamlessly butted up against eachother).

http://boxybutgood.com/~jeff/QTabWidget.png
This Qt Labs blog post from 2008 shows how it is supposed to look (see the apparently "merged" titlebar and tabs in the window with the foreign text). http://labs.trolltech.com/blogs/2008/07/02/some-qtabbar-qtabwidget-love/

Does anyone know what I am doing wrong?

I have also tried the following, which do not fix it...
- setUnifiedTitleAndToolBarOnMac(true)
- setMargin(0) on the labels
- using a QFrame instead of a QMainWindow
- pulling my hair out

Thanks for your help!!

wysota
19th February 2010, 10:55
I think what you get is a correct result. If it wasn't, the tabs on the tabbar would be directed upwards and not downwards. You can see the difference here: http://arorabrowser.blogspot.com/2008/07/better-tab-bar.html