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

Yup. WxWidgets was probably the least useful graphical development environment I have used. In particular, many of the GUI elements don't expose their inner widgets. For example, when I used it, I wanted to change the font of a label in a tabbed window. The tabbed window widget provided no access to the font object at the C++ level- I suppose you could subclass, but that wouldn't propagate tot he Python generated classes.

You're better off just using qt: they put a lot more work into making it a useful environment, it runs a lot more places.




> 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.


Your example kind of reflects that you aren't using wx for what it's made for. You can usually call GetHandle() and switch to platform specific stuff if you need to do something weird like that. I wouldn't really recommend that though. The point of wxWidgets isn't to be the most flexible GUI framework. It's to be as consistent and native as it can be across many platforms.

If you need to do weird things in a non-native way then wx probably isn't for you. If you want to write software that looks and feels like a native application (because it is) then wx is your best bet.

Qt is great but I've never used Qt application that felt like a native application. Also, Qt is rather expensive for commercial projects (about $4k per year per developer).


Qt is published under LGPL, you don't need to spend £4k for a commercial application.


Why would you actually want to change the font of a label on a tab? Wouldn't that make your application inconsistent with the host platform?


In my case, I wanted to bold the font when an activity occurred there, so a user would know to navigate to that tab.

I don't particularly care about the host platform; I write software that runs on all 3 major platforms, and having it behave mostly-consistently across the platforms is more important than being consistent with the host platform.




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

Search: