PDA

View Full Version : QToolbar in a QDialog (OS X)



Alex Novichkov
25th August 2015, 17:52
Hello everyone. In one of my dialogs I have set QToolbar as a menu bar:



TagsEditDialog::TagsEditDialog(int type, const QString &caption,
const QStringList &list,
const QString &text, bool p,
QWidget *parent) : QDialog(parent)
{DD;
setWindowTitle(caption);
setWindowModality(Qt::WindowModal);
//...
QToolBar *operationsToolBar = new QToolBar(this);
operationsToolBar->addWidget(toggleCharsButton);
operationsToolBar->addSeparator();

operationsToolBar->setMovable(false);
operationsToolBar->setIconSize(QSize(16,16));
//...
this->layout()->setMenuBar(operationsToolBar);
}

Everything works fine in Windows and Linux, but in OS X (with Qt 5 only) toolbuttons of this toolbar don't receive mouse click events. Can anyone help me to solve this issue? I've tried not to use setMenuBar method, but QToolButtons placed into QBoxLayout are just the ugliest ones in OS X.

Thanks,
Alex.

anda_skoa
25th August 2015, 22:12
What if you just place the toolbar as first widget in a vertical box layout?

Cheers,
_

Alex Novichkov
26th August 2015, 06:21
What if you just place the toolbar as first widget in a vertical box layout?

Cheers,
_

I've tried it, but the buttons (QToolButton) in it looks quite bad in OS X.

Alex Novichkov
26th August 2015, 19:29
Actually, as I've discovered, no QToolBar in a QDialog (anywhere - as a manuBar, in a layout or elsewhere) works properly in OS X (Qt5). I've created some workaround, so I suggest to consider the topic closed.