Proposal to use Qocoa to support native-look widgets on different platform

Jaroslaw Staniek staniek at kde.org
Sun Mar 10 22:29:11 GMT 2013


On 10 March 2013 17:49, Yuƫ Liu <yue.liu at mail.com> wrote:
> Hi,
>
> Currently Calligra looks ugly on OS X because many qt widgets don't
> have good styles for OS X, to get pixel perfection, we have to wrap
> native widgets in Qt codes. But adding ifdefs is uglier than this, so
> we better use small library who has done the wrapping work. Qocoa is
> for this.
> https://github.com/mikemcquaid/Qocoa#readme
>
> Qocoa wrapped mac native widgets into qt widgets like qbutton,
> qsearchfield, then we use these widgets instead of QToolButton, etc.,
> and for non-mac platform these widgets will fallback to normal qt
> widgets, for example qbutton fallback to qpushbutton or qtoolbutton
> depending on whether the button is inside toolbar.
>
> If we change all the qt widgets having bad look on mac with qocoa
> widgets, we'll have perfect osx look and feel, and other platform
> won't be hampered since there are fallbacks. Many qt applications
> already using Qocoa for better mac integration, such as Clementine
> player.
>
> To use Qocoa widgets, first we have to check what qt widgets need to
> be replaced by qocoa widgets, what mac native widgets is needed but
> not included in Qocoa, what homebrew widgets (such as KoGroupButton)
> can be ported to Qocoa; then we can extend Qocoa to add more needed
> mac native widgets and our homebrew widgets; finally we include
> modified Qocoa and replace uses of normal qt widgets with uses of
> qocoa widgets.
>
> What's your opinion on this? At leaset we need all the application
> maintainers' support.


Truly native look&feel is always a great value. Similar applies to
Windows (RT and classic), Unity (increasingly even despite they're
dropping GTK+ for Qt!), other desktops.


Isn't there API for use in QStyle? There was quite a bit.

I have not investigated it a lot, questions:
- is it maintained?
- it would needs change for two reasons: license (not LGPL), naming
(uses Q prefix reserved for the Qt Project);
- the solution would be to wrap mac implementation within the
KPushButton, etc. The current wrapping does not even use
QAbstractButton
- no matter how we wrap, out code would have to be changed deeply,
what's killing readability; without wrapping, ifdefs are better
because they concentrate the changes in one place; even .ui files
could be adjusted this way, e.g. via using dynamic Qt properties,
where we can set QButton::BezelStyle hints for the buttons (but IIRC
there's no ifdef for .ui format so for non-Mac builds the code would
be still generated)
- the upcoming mix of QWidgets with QML and Qt Quick Controls for
Desktop would rather ignore the Qocoa effort
- finally, not to demotivate, but the main window to be fully in
Mac-style would have to be designed from ground up; this applies to
menus, floating windows, etc. This is doable if we get truly dedicated
contributors that are willing to maintain that long-term; the question
is there so large community on the Mac side

-- 
regards / pozdrawiam, Jaroslaw Staniek
 Kexi & Calligra & KDE | http://calligra.org/kexi | http://kde.org
 Qt Certified Specialist | http://qt-project.org
 http://www.linkedin.com/in/jstaniek



More information about the calligra-devel mailing list