Changeset View
Standalone View
src/kactioncollection.h
Show First 20 Lines • Show All 264 Lines • ▼ Show 20 Line(s) | 67 | public: | |||
---|---|---|---|---|---|
265 | const KXMLGUIClient *parentGUIClient() const; | 265 | const KXMLGUIClient *parentGUIClient() const; | ||
266 | 266 | | |||
267 | Q_SIGNALS: | 267 | Q_SIGNALS: | ||
268 | /** | 268 | /** | ||
269 | * Indicates that @p action was inserted into this action collection. | 269 | * Indicates that @p action was inserted into this action collection. | ||
270 | */ | 270 | */ | ||
271 | void inserted(QAction *action); | 271 | void inserted(QAction *action); | ||
272 | 272 | | |||
273 | #if KXMLGUI_ENABLE_DEPRECATED_SINCE(5, 0) | ||||
273 | /** | 274 | /** | ||
274 | * Indicates that @p action was removed from this action collection. | 275 | * Indicates that @p action was removed from this action collection. | ||
275 | * @deprecated | 276 | * @deprecated Since 5.0 | ||
276 | */ | 277 | */ | ||
278 | KXMLGUI_DEPRECATED_VERSION(5, 0, "Do not rely on") | ||||
dfaure: Does this work? It's a signal. Won't this only warn at emit time? (while QT_MOC_COMPAT is what… | |||||
This being one of my experimental repos chance is I forgot to remove the KXMLGUI_DEPRECATED_VERSION here, and was blind when I checked the patch before uploading. kossebau: This being one of my experimental repos chance is I forgot to remove the… | |||||
277 | QT_MOC_COMPAT void removed(QAction *action); | 279 | QT_MOC_COMPAT void removed(QAction *action); | ||
280 | #endif | ||||
278 | 281 | | |||
282 | #if KXMLGUI_ENABLE_DEPRECATED_SINCE(5, 0) | ||||
279 | /** | 283 | /** | ||
280 | * Indicates that @p action was highlighted (hovered over). | 284 | * Indicates that @p action was highlighted (hovered over). | ||
281 | * @deprecated Replaced by actionHovered(QAction* action); | 285 | * @deprecated Since 5.0. Replaced by actionHovered(QAction* action); | ||
282 | */ | 286 | */ | ||
287 | KXMLGUI_DEPRECATED_VERSION(5, 0, "Use KActionCollection::actionHovered(QAction* action)") | ||||
283 | QT_MOC_COMPAT void actionHighlighted(QAction *action); | 288 | QT_MOC_COMPAT void actionHighlighted(QAction *action); | ||
289 | #endif | ||||
284 | 290 | | |||
285 | /** | 291 | /** | ||
286 | * Indicates that @p action was hovered. | 292 | * Indicates that @p action was hovered. | ||
287 | */ | 293 | */ | ||
288 | void actionHovered(QAction *action); | 294 | void actionHovered(QAction *action); | ||
289 | 295 | | |||
290 | /** | 296 | /** | ||
291 | * Indicates that @p action was triggered | 297 | * Indicates that @p action was triggered | ||
292 | */ | 298 | */ | ||
293 | void actionTriggered(QAction *action); | 299 | void actionTriggered(QAction *action); | ||
294 | 300 | | |||
295 | protected: | 301 | protected: | ||
296 | /// Overridden to perform connections when someone wants to know whether an action was highlighted or triggered | 302 | /// Overridden to perform connections when someone wants to know whether an action was highlighted or triggered | ||
297 | void connectNotify(const QMetaMethod &signal) override; | 303 | void connectNotify(const QMetaMethod &signal) override; | ||
298 | 304 | | |||
299 | protected Q_SLOTS: | 305 | protected Q_SLOTS: | ||
300 | virtual void slotActionTriggered(); | 306 | virtual void slotActionTriggered(); | ||
301 | 307 | | |||
308 | #if KXMLGUI_ENABLE_DEPRECATED_SINCE(5, 0) | ||||
Fixed to KXMLGUI_ENABLE_DEPRECATED_SINCE, as slotActionHighlighted is a virtual method, which the compiler needs to always know about. kossebau: Fixed to `KXMLGUI_ENABLE_DEPRECATED_SINCE`, as `slotActionHighlighted` is a virtual method… | |||||
kossebau: Eh, fixed to KXMLGUI_BUILD_DEPRECATED_SINCE actually :) | |||||
302 | /** | 309 | /** | ||
303 | * @internal | 310 | * @internal | ||
304 | * @deprecated Replaced by slotActionHovered(); | 311 | * @deprecated Since 5.0. Replaced by slotActionHovered(); | ||
305 | */ | 312 | */ | ||
313 | KXMLGUI_DEPRECATED_VERSION(5, 0, "Use KActionCollection::slotActionHovered()") | ||||
306 | QT_MOC_COMPAT virtual void slotActionHighlighted(); | 314 | QT_MOC_COMPAT virtual void slotActionHighlighted(); | ||
315 | #endif | ||||
dfaure: (pre-existing) QT_MOC_COMPAT for a slot? Any idea what this might do? | |||||
No idea. I started a few times to look up what QT_MOC_COMPAT actually is about, but never had quick results, so delayed into the future. Just had a look again, but as before stranding with MethodCompatibility from qmetaobject_p.h, which seems though nowhere really used. So far my guess has been this is some relict from Qt3 times no-one ever properly cleaned up? kossebau: No idea. I started a few times to look up what QT_MOC_COMPAT actually is about, but never had… | |||||
Taking this from the other side: warnings when connecting to deprecated signals actually work. They happen in check_and_warn_compat in qobject.cpp ... this does support warning about connecting to compat slots, so my comment was bogus, this is fine. For the usual case, compat signals, the code checks signal.attributes() & QMetaMethod::Compatibility. Ah and I found where MethodCompatibility (which has the value 0x10) is actually set... 6, 2, 89, 2, 0x06 /* Public */, 8, 2, 94, 2, 0x16 /* Public | MethodCompatibility */, See the second line, it has the 0x10 value in there, which means MethodCompatibility is set.... by value, not by name. I'm just still a bit confused about the relation between the 0x10 metaobject flag and the signal attribute which has value 0x1... enum Attributes { Compatibility = 0x1, Cloned = 0x2, Scriptable = 0x4 }; But it must work, tst_qobject.cpp tests that QT_MOC_COMPAT ends up setting QMetaMethod::Compatibility in attributes(). Anyhow, I still believe that using the *_DEPRECATED macro on a signal only makes sense if we want to prevent subclasses from emitting the signal. Theoretical possibility, extremely unlikely for KActionCollection, but... why not. We can do this consistently everywhere without the need to consider the likeliness of subclasses, I suppose. dfaure: Taking this from the other side: warnings when connecting to deprecated signals actually work. | |||||
Okay, so "QT_MOC_COMPAT" is still a (just undocumented) thing, and thus something we should use for deprecated signal/slots then as before, right? Had now another look based on your info, and found that the magic to map 0x10 onto 0x1 happens in the getter of the method attributes: int QMetaMethod::attributes() const { if (!mobj) return false; return ((mobj->d.data[handle + 4])>>4); } So that mystery seems solved :) For adding deprecation attributes via _DEPRECATED to signals, yes, would agree to do this consistently then, following your argumentation. Will add this to the howtodeprecateallkindsofapi text I yet have to write, so far delayed to first gather experience. kossebau: Okay, so "QT_MOC_COMPAT" is still a (just undocumented) thing, and thus something we should use… | |||||
Just remembered though: seems that Qt code itself no longer uses QT_MOC_COMPAT? At least I had no hits for actual usages in Qt classes when searching in my local Qt headers, via code.woboq.org or github search, there only for the old unsplit qt repo (which once made me think this is a Qt3 relict). And given the #ifndef QT_NO_DEBUG does this warning land in normal Qt builds? (sorry, not build Qt in a decade). kossebau: Just remembered though: seems that Qt code itself no longer uses QT_MOC_COMPAT? At least I had… | |||||
307 | 316 | | |||
308 | private Q_SLOTS: | 317 | private Q_SLOTS: | ||
309 | void slotActionHovered(); | 318 | void slotActionHovered(); | ||
310 | 319 | | |||
311 | public: | 320 | public: | ||
312 | /** | 321 | /** | ||
313 | * Add an action under the given name to the collection. | 322 | * Add an action under the given name to the collection. | ||
314 | * | 323 | * | ||
▲ Show 20 Lines • Show All 274 Lines • Show Last 20 Lines |
Does this work? It's a signal. Won't this only warn at emit time? (while QT_MOC_COMPAT is what leads to a warning at connect time)
Asking because you didn't do this in D24465 for the windowChanged() signals, so something seems inconsistent.