Get rid of QMetaObject::invokeMethod() with 'const char *member' arg
AbandonedPublic

Authored by volkov on Oct 10 2018, 3:58 PM.

Details

Reviewers
rkflx
ngraham
Group Reviewers
Gwenview
Summary

It prevents compile-time checking, use QTimer::singleShot(0, ...)
instead.

Diff Detail

Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 3798
Build 3816: arc lint + arc unit
volkov created this revision.Oct 10 2018, 3:58 PM
Restricted Application added a project: Gwenview. · View Herald TranscriptOct 10 2018, 3:58 PM
volkov requested review of this revision.Oct 10 2018, 3:58 PM

QMetaObject::invokeMethod takes function pointers since Qt 5.10

Yes, but gwenview requires at least 5.9.
And code is longer with QMetaObject::invokeMethod, compare:
QTimer::singleShot(0, this, &FileOpsContextManagerItem::updateActions);
and
QMetaObject::invokeMethod(this, &FileOpsContextManagerItem::updateActions, Qt::QueuedConnection);

volkov updated this revision to Diff 43467.Oct 12 2018, 2:55 PM

simplify, leave only invokeMethod() -> QTimer::singleShot() change

volkov edited the summary of this revision. (Show Details)Oct 12 2018, 2:56 PM
aacid added a subscriber: aacid.Jun 9 2019, 10:39 PM

Honestly i'd prefer if we wait for 5.10 and then use QMetaObject::invokeMethod instead of QTimer::singleShot.

AFAIR they're not exactly the same, even if they are 99% similar, so in trying to make we don't break stuff just to have nicer code i'd delay this until we decide to depend on 5.10 for gwenview.

Which IMHO we could right now, but OTOH Ubuntu LTS (that is used by quite some people) has Qt 5.9 so maybe it's not the best of the ideas to break "buildability" in a "popular" distro just for "nicer code"