D21655: KSelectionOwner usage in ApplicationX11 and Compositor classes

Roman Gilg noreply at phabricator.kde.org
Tue Jun 18 16:23:23 BST 2019


romangg added inline comments.

INLINE COMMENTS

> zzag wrote in composite.cpp:71-89
> It's perfectly fine to keep declaration of CompositorSelectionOwner class in the header file. It's also worth to point out that KSelectionOwner is a QObject, which means CompositorSelectionOwner needs to have a Q_OBJECT macro.

It's a scope question. CompositorSelectionOwner is only used internally by Compositor class while the header is included in many other source files. When CompositorSelectionOwner in the header this is not obvious, when it's in the source file it is.

In regards to the macro: according to docs <https://doc.qt.io/qt-5/qobject.html#Q_OBJECT> it is only needed when the class uses slots and signals. Well it does so why does it compile? Would it just fail at runtime?

Alternatives are to put the CompositorSelectionOwner class in a separate file or include the moc in the composite.cpp file.

REPOSITORY
  R108 KWin

REVISION DETAIL
  https://phabricator.kde.org/D21655

To: romangg, #kwin, zzag
Cc: sbergeron, zzag, kwin, LeGast00n, jraleigh, fbampaloukas, GB_2, mkulinski, ragreen, jackyalcine, Pitel, iodelay, bwowk, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwin/attachments/20190618/951af350/attachment.html>


More information about the kwin mailing list