Hacker News new | past | comments | ask | show | jobs | submit login

> In particular, many of the GUI elements don't expose their inner widgets

But you know why, right? It's because it's supposed to be both cross-platform and native, so a particular platform may not use a nested label widget in a tabbed window, so it can't give you such an object.




all the native platforms that qt supports support nested label widgets. the wx class has that member variable, it's just private with no accessor.


Maybe my information is out of date, but I didn't think Qt supports any platforms natively at all. So Qt can give you a label widget, because it's creating the controls itself. They aren't really native controls.

If you look at the Windows implementation for the wxNotebook (which I guess is the class you mean), you can see it doesn't use a nested widget for the tab label. The field may exist, but this implementation doesn't use it and instead it uses standard Windows API calls like TabCtrl_SetItem, which doesn't allow you to set a font. It only allows you to pass in a char* string.

https://github.com/wxWidgets/wxWidgets/blob/master/src/msw/n...

https://msdn.microsoft.com/en-us/library/windows/desktop/bb7...

So on Windows what do you expect it to give you if you ask for the label widget if there isn't one? Pretend there is one and give you some kind of facade object? What should happen if you try to set the font? Since the API they're using just doesn't support it.

I think the Windows API may allow you to subclass a tab to draw it yourself and use fonts, but that's asking a lot. And there still isn't really any label widget for them to return even if they did that!


Yes,you are correct: Qt uses themes and styles to configure its internally rendered widgets so they appear native.

http://doc.qt.io/qt-4.8/style-reference.html

In the case of windows, you can either use the char * methods, or you have an owner-controlled widget which is a rendering area. That's what Qt does. Combined with Qt's windows style, you get somethign that looks native by default, but is customizable.

This seems to me to be a far more productive approach that trying to come up with an API that supports only the common subset of features shared between Apple's UI toolkit, Windows UI toolkit, and Linux. Note that qt also supports embedded devices with raw frame buffers; you can make a UI that looks nearly pixel identical to Windows on that platform.


> This seems to me to be a far more productive approach that trying to come up with an API that supports only the common subset of features shared between Apple's UI toolkit, Windows UI toolkit, and Linux.

But an API with the common subset of features is the whole philosophical point of wx! If you're going to criticise them for that you might as well criticise screwdrivers for turning screws. That's what they were built for.


Well, then I disagree with wx's approach. Not only is it more inflexible, the qt solution of creating a styled UI that can be adapted to look native, while being portable and not preventing people from customization, seems to be more flexible.

Note also that Wx runs on top of Qt. Why not drop Wx and just use Qt directly?


Wx doesn't run on top of Qt, it simply has an option to use Qt as its back end engine in place of e.g. the Windows native API. You can do a Windows build that doesn't have Qt anywhere in sight.


> Yes,you are correct: Qt uses themes and styles to configure its internally rendered widgets so they appear native.

Oh wow, I have developed QT applications and never even noticed that. Sure, on Linux I know that it draws the controls, are there are no standard controls. But I figured they just had a pretty good integration and didn't bother looking under the hood.

The illusion is pretty much pixel-perfect.


You will notice it most when Microsoft updates the look and feel of the standard widgets in a new version of Windows. The Wx app will pick up the new look automatically, the Qt app will need to be updated.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: