senseiwa
senseiwa

Reputation: 2499

Qt 5 Mac toolbar woes

I am trying to make a very simple toolbar in a QMainWindow on a Mac, with Qt 5.2.1, with not a single satisfaction. I was using still Qt 4.8 but I thought I'd give Qt5 a try.

As QtMacExtras are concerned, I don't find the native toolbar class anymore, except in private headers. So I tried a simple QToolbar.

I have a very basic and stupid toolbar:

setUnifiedTitleAndToolBarOnMac(true);

toolbar_ = new QToolBar(this);

toolbar_->setMovable(false);
toolbar_->setFloatable(false);
toolbar_->addAction("h");
toolbar_->addAction("w");
toolbar_->addSeparator();
toolbar_->addAction("f");

As you can see, well, it isn't acceptable.

Is there any chance, by some arcane and weird means, that I could have a nice unified, or better "native look and feel", toolbar on a mac?

screenshot

Upvotes: 3

Views: 1036

Answers (2)

dave
dave

Reputation: 602

QMainWindow::addToolBar(QToolBar *toolbar) should do it.

The NSToolbar does not form part of the Qt widget hierarchy, so your admirably idiomatic conference of parenthood from the main window to the toolbar is working perfectly to specification, yet is obviously dissatisfying.

However, as the Trolls say in the QMainWindow documentation:

"You add a toolbar to a main window with addToolBar()."

Here is the effect as shown in rsync client for Mac. Truck.app - the rsync client for mac - uses addToolBar

Upvotes: 1

Burnt Toast
Burnt Toast

Reputation: 929

I don't have my mac with me otherwise I would give this a quick test. I was surprised when browsing how many bugs are still being reported for Mac. I did find this article, which does appear to have better looking toolbar.

Upvotes: 0

Related Questions