[Interest] My experience porting to Qt5 (on OS X)

morten.sorvig at nokia.com morten.sorvig at nokia.com
Mon Sep 3 13:41:16 CEST 2012


On Sep 3, 2012, at 1:09 PM, ext Till Oliver Knoll <till.oliver.knoll at gmail.com> wrote:
> That would be great! I am not sure what the implication of "playing
> according to the NSToolBar rules" would be, but as long as those would
> be "the same restrictions a Mac application has to follow anyway" then
> that would be no problem.
> 

To expand a bit on this point: the key issue is that we can't offer exactly the same API as QToolBar has, for example no setOrientation or setMovable (not a big loss if you ask me). More serious might be that addWidget() becomes harder to support.

Here's a snippet from sample code using the new toolbar class:

    QtMacUnifiedToolBar toolBar;
    toolBar.addAction(QIcon(":/qtlogo.png"), "Hello");
    toolBar.addAction(QIcon(":/qtlogo.png"), "World");
    toolBar.addStandardItem(QtMacToolButton::FlexibleSpace);
    toolBar.addStandardItem(QtMacToolButton::ShowColors);
    toolBar.addStandardItem(QtMacToolButton::ShowFonts);

    // add to the customisation list
    toolBar.addAllowedAction(QIcon(":/qtlogo.png"), "Extra Button 1");
    toolBar.addAllowedAction(QIcon(":/qtlogo.png"), "Extra Button 2");

    toolBar.showInWindow(widget.windowHandle());

Morten





More information about the Interest mailing list