For typedefs, which is CAmount, qRegisterMetaType(const char*) only is required.
qt, refactor: Drop unneeded Q_DECLARE_METATYPE #19108
pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:200529-metatype changing 2 files +5 −2-
hebasto commented at 5:32 PM on May 29, 2020: member
-
ad113aeb29
qt, refactor: Drop unneeded Q_DECLARE_METATYPE
For typedefs, which is CAmount, qRegisterMetaType(const char*) only is required.
- jonasschnelli added the label GUI on May 29, 2020
-
promag commented at 10:26 AM on June 3, 2020: member
I think you could also drop
--- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -23,8 +23,6 @@ #define DECORATION_SIZE 54 #define NUM_ITEMS 5 -Q_DECLARE_METATYPE(interfaces::WalletBalances) - class TxViewDelegate : public QAbstractItemDelegate { Q_OBJECTcc @ryanofsky
-
hebasto commented at 9:47 AM on June 4, 2020: member
I think you could also drop
--- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -23,8 +23,6 @@ #define DECORATION_SIZE 54 #define NUM_ITEMS 5 -Q_DECLARE_METATYPE(interfaces::WalletBalances) - class TxViewDelegate : public QAbstractItemDelegate { Q_OBJECTcc @ryanofsky
-
promag commented at 10:03 AM on June 4, 2020: member
That doesn't matter with Qt5 connection style. We also don't use
QVariant::fromValuewithinterfaces::WalletBalances. FWIW I've tested without and it worked withQT_FATAL_WARNINGS=1. Maybe I missed something? -
hebasto commented at 10:14 AM on June 4, 2020: member
That doesn't matter with Qt5 connection style. We also don't use
QVariant::fromValuewithinterfaces::WalletBalances. FWIW I've tested without and it worked withQT_FATAL_WARNINGS=1. Maybe I missed something?I'm totally agree with you. I mentioned
balanceChanged()signal with idea: if it would useQt::QueuedConnectionit will requireqRegisterMetaType()andQ_DECLARE_METATYPE().The alone
Q_DECLARE_METATYPE()(without pairedqRegisterMetaType()) only matters for usage withQVariant. -
promag commented at 10:16 AM on June 4, 2020: member
if it would use
Qt::QueuedConnectionit will requireqRegisterMetaType()andQ_DECLARE_METATYPE().Are you sure about this?
-
hebasto commented at 10:19 AM on June 4, 2020: member
if it would use
Qt::QueuedConnectionit will requireqRegisterMetaType()andQ_DECLARE_METATYPE().Are you sure about this?
https://doc.qt.io/qt-5/qt.html#ConnectionType-enum:
With queued connections, the parameters must be of types that are known to Qt's meta-object system, because Qt needs to copy the arguments to store them in an event behind the scenes.
Call
qRegisterMetaType()to register the data type before you establish the connection.https://doc.qt.io/qt-5/qmetatype.html#qRegisterMetaType-1:
Call this function to register the type
T.Tmust be declared withQ_DECLARE_METATYPE().To use the type
TinQVariant, usingQ_DECLARE_METATYPE()is sufficient. To use the typeTin queued signal and slot connections,qRegisterMetaType<T>()must be called before the first connection is established. -
luke-jr commented at 4:53 PM on June 5, 2020: member
Is not needing it for typedefs considered defined behaviour?
-
hebasto commented at 6:22 PM on June 5, 2020: member
Is not needing it for typedefs considered defined behaviour?
Sorry, mind re-wording your question to be clear for me, please?
-
promag commented at 11:11 AM on June 11, 2020: member
ACK ad113aeb29c7db6df94cebd784c0c6b668bfd9a5.
-
DrahtBot commented at 8:46 PM on July 8, 2020: member
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
Reviewers, this pull request conflicts with the following ones:
- #19471 (util: Make default arg values more specific by hebasto)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
-
fanquake commented at 3:21 PM on July 9, 2020: member
@laanwj or @jonasschnelli can you weigh in here?
- fanquake closed this on Aug 10, 2020
-
hebasto commented at 12:50 PM on August 14, 2020: member
- DrahtBot locked this on Feb 15, 2022