On Monday 01 December 2014 12:38:02 Jędrzej Nowacki wrote: > Hi, > > Personally, I think Q_OBJECT should not change access level and so > Q_GADGET.
I agree. But it's not possible since we have to declare public and private stuff, so we must change the access. So unless you find a way to declare public members in a private section, I don't think we can do anything. At best, we can change the convention to put the keyword at the end. > Now, we can not change Q_OBJECT, at least up to Qt6, then should we follow > it's practice? Q_OBJECT is the only macro, we ship, that changes access > level, so from these perspective it is an outsider, but I agree that > Q_GADGET is it's a twin brother. So keeping them in sync is not bad either. Q_GADGET exists since Qt 4.0 and was always changing the access level. And again, it is technically not possible not to change the access level. (Also, you forgot about "signals" which also change the access level.) > > > Notice that in our code we recommend to always use class and almost > > > never struct. All the Q_GADGET today are class. > > Do you know why (and where) we recommend that? There was discussion on the mailing list before. The reason is that it is important that the forward declarations are always the same keyword as the definition or you get compiler warnings. So it's just about being consistent and use the same keyword everywhere. It was not written in the Qt coding style, but it is there for example: http://doc-snapshot.qt-project.org/qtcreator-extending/coding-style.html#declarations -- Olivier Woboq - Qt services and support - http://woboq.com - http://code.woboq.org _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
