Re: [Development] Why does Q_ENUM() need qRegisterMetaType()?
On Thursday, 4 July 2019 11:18:26 -03 Vlad Stelmahovsky wrote: > isn't Q_ENUM is deprecated and now Q_ENUMS should be used instead? or vice > versa...always forgetting Q_ENUMS is deprecated and you should use Q_ENUM. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel System Software Products ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development
Re: [Development] Why does Q_ENUM() need qRegisterMetaType()?
On 04.07.19 12:43, Tom Isaacson wrote: The problem is that moc only generates the code that calls qRegisterMetaType if it sees Q_DECLARE_METATYPE. Actually, it does a bit more than that. It could as well do it for Q_ENUM type, just not implemented yet. We should consider doing it for all the types used in signals/slots/properties. But it does not do it because that could be a potential breaking change for forward declared types. Maybe something for Qt6. It's very confusing. You said yourself on https://woboq.com/blog/q_enum.html that "These enums are automatically declared as a QMetaTypes (no need to add them in Q_DECLARE_METATYPE anymore)." So Q_ENUM replaces Q_DECLARE_METATYPE and provides additional functionality but requires you to add an additional call to qRegisterMetaType? That seems backward. I know, the whole story behind Q_DECLARE_METATYPE and qRegisterMetaType is a bit confusing. Regarding Q_ENUM specifically, it could be fixed in moc, to be in the list of the type that are declared. Can I use Q_DECLARE_METATYPE and Q_ENUM and avoid qRegisterMetaType? Yes, youu can use both Q_DECLARE_METATYPE and Q_ENUM ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development
Re: [Development] Why does Q_ENUM() need qRegisterMetaType()?
isn't Q_ENUM is deprecated and now Q_ENUMS should be used instead? or vice versa...always forgetting :) On Thu, Jul 4, 2019 at 4:14 PM Olivier Goffart wrote: > On 04.07.19 12:43, Tom Isaacson wrote: > >> The problem is that moc only generates the code that calls > qRegisterMetaType if it sees Q_DECLARE_METATYPE. Actually, it does a bit > more than that. It could as well do it for Q_ENUM type, just not > implemented yet. > >> > >> We should consider doing it for all the types used in > signals/slots/properties. > >> But it does not do it because that could be a potential breaking > change for forward declared types. > >> Maybe something for Qt6. > > > > It's very confusing. You said yourself on > https://woboq.com/blog/q_enum.html that "These enums are automatically > declared as a QMetaTypes (no need to add them in Q_DECLARE_METATYPE > anymore)." So Q_ENUM replaces Q_DECLARE_METATYPE and provides additional > functionality but requires you to add an additional call to > qRegisterMetaType? That seems backward. > > > I know, the whole story behind Q_DECLARE_METATYPE and qRegisterMetaType > is a > bit confusing. > > Regarding Q_ENUM specifically, it could be fixed in moc, to be in the list > of > the type that are declared. > > > > Can I use Q_DECLARE_METATYPE and Q_ENUM and avoid qRegisterMetaType? > > Yes, youu can use both Q_DECLARE_METATYPE and Q_ENUM > ___ > Development mailing list > Development@qt-project.org > https://lists.qt-project.org/listinfo/development > -- Best regards, Vlad ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development
Re: [Development] Moving to Gerrit 2.16.9
Am 01.07.2019 um 19:57 schrieb André Pönitz: > On Mon, Jul 01, 2019 at 02:43:43PM +, Frederik Gladhorn wrote: and I'll give Gravatar a spin: https://gerrit-review.googlesource.com/admin/repos/plugins/avatars-gravata r >> >> It's there, enjoy and put your avatar up at https://gravatar.com . > > I know it's a bit late and it won't change anything anyway. > > Still: Was there an explanation of the benefits of using gravatar somewhere, > also perhaps in the light of discussions like > > https://meta.stackexchange.com/questions/4553/can-we-use-non-gravatar-avatars/5658#5658 This is an important question I think and I'd like to get an answer to it, too. Cheers, Robert ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development
Re: [Development] Why does Q_ENUM() need qRegisterMetaType()?
On 03.07.19 22:25, Tom Isaacson wrote: No response on Qt Interest so trying here. I'm using Qt 5.12.2 on Visual Studio 2019 / Win7. I wanted to make sure Q_ENUM works the way I think it does before updating some legacy code so I wrote a unit test (we use Google Test): TestConnectEnum.h: class tColoredObjectV3 : public QObject { Q_OBJECT public: enum class eColor { Red = 1, Blue = 2, Green = 3 }; Q_ENUM(eColor) tColoredObjectV3() : m_color(tColoredObjectV3::eColor::Red) {} void EmitColor(tColoredObjectV3::eColor color); signals: void ColorSignal(tColoredObjectV3::eColor color); private: eColor m_color; }; TestEnumConnect.cpp: TEST(Connect, ConnectEnumSucceedsV3) { //qRegisterMetaType(); tColoredObjectV3 coloredObject; QSignalSpy spy(, ::ColorSignal); coloredObject.EmitColor(tColoredObjectV3::eColor::Blue); EXPECT_TRUE(spy.isValid()); EXPECT_EQ(spy.count(), 1); // make sure the signal was emitted exactly one time QList arguments = spy.takeFirst(); // take the first signal ASSERT_FALSE(arguments.isEmpty()); tColoredObjectV3::eColor color = arguments.at(0).value(); EXPECT_EQ(tColoredObjectV3::eColor::Blue, color); // verify the first argument } But this fails - I have to uncomment the qRegisterMetaType() to get it to work. If I use the old Q_DECLARE_METATYPE() this works. Am I doing something wrong or does Q_ENUM() require this? The problem is that moc only generates the code that calls qRegisterMetaType if it sees Q_DECLARE_METATYPE. Actually, it does a bit more than that. It could as well do it for Q_ENUM type, just not implemented yet. We should consider doing it for all the types used in signals/slots/properties. But it does not do it because that could be a potential breaking change for forward declared types. Maybe something for Qt6. -- Olivier Woboq - Qt services and support - https://woboq.com - https://code.woboq.org ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development
Re: [Development] Why does Q_ENUM() need qRegisterMetaType()?
> The problem is that moc only generates the code that calls qRegisterMetaType > if it sees Q_DECLARE_METATYPE. Actually, it does a bit more than that. It > could as well do it for Q_ENUM type, just not implemented yet. > > We should consider doing it for all the types used in > signals/slots/properties. > But it does not do it because that could be a potential breaking change for > forward declared types. > Maybe something for Qt6. It's very confusing. You said yourself on https://woboq.com/blog/q_enum.html that "These enums are automatically declared as a QMetaTypes (no need to add them in Q_DECLARE_METATYPE anymore)." So Q_ENUM replaces Q_DECLARE_METATYPE and provides additional functionality but requires you to add an additional call to qRegisterMetaType? That seems backward. Can I use Q_DECLARE_METATYPE and Q_ENUM and avoid qRegisterMetaType? Tom Isaacson ___ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development