How usable is Qt without its preprocessing step?

后端 未结 12 802
自闭症患者
自闭症患者 2021-02-02 05:21

I think it\'s unreasonable for a library to require preprocessing of my source code with a special tool. That said, several people have recommended the Qt library to me for cros

12条回答
  •  攒了一身酷
    2021-02-02 05:48

    I'm currently in the position of needing to find alternatives to MOC. So far I use GLib for text translation and I'm in the middle of reengineering a signals/slots library I found on the web (sigslot) using C++ templates and C macros combined. The boring and exhausting part is redoing the GUI for my app and replacing normal Qt widgets with my own widgets (i.e. QPushButton -> MyPushButton) through widget promotion (a feature of Qt Designer). This way I can have my widgets emit templated signals instead of Qt's. There's a catch, tho. My "modified" widget classes MUST be run through the preprocessor, but that's a once-in-a-lifetime step. After that, I can move on.

    I can afford to do all of this only because I have already written an Application Framework library with its own event loop (well, it's a wrapper that piggybacks on Qt's event loop code), multithreading and string classes, etc. My project will only need Qt to display the nice and nifty widgets.

    But if you don't have these tools at your disposal - which I'm sure you don't - trust me, trying to get rid of Qt's preprocessor is going to be a royal pain in the arse.

    Here's my message to you: If you can use QMake or moc, just use them.

提交回复
热议问题