From cb24903ef4df0571f8498fca6bc58f5df6dd68af Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 9 Mar 2016 10:22:43 +0100 Subject: Generate QVariant::fromValue(enum_value) for enum values Instead of just QVariant(enum_value). Task-number: QTBUG-49383 Change-Id: Id57c65b68d4328816046bc35301dc6afba47b727 Reviewed-by: Friedemann Kleint --- tests/auto/tools/uic/baseline/enumnostdset.ui | 39 ++++++++++++++++++ tests/auto/tools/uic/baseline/enumnostdset.ui.h | 55 +++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 tests/auto/tools/uic/baseline/enumnostdset.ui create mode 100644 tests/auto/tools/uic/baseline/enumnostdset.ui.h (limited to 'tests/auto/tools') diff --git a/tests/auto/tools/uic/baseline/enumnostdset.ui b/tests/auto/tools/uic/baseline/enumnostdset.ui new file mode 100644 index 0000000000..59e27b1be3 --- /dev/null +++ b/tests/auto/tools/uic/baseline/enumnostdset.ui @@ -0,0 +1,39 @@ + + + Form + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + 100 + 100 + 100 + 100 + + + + Qt::DashDotLine + + + + + + WorldTimeClock + QWidget +
worldtimeclock.h
+
+
+ + +
diff --git a/tests/auto/tools/uic/baseline/enumnostdset.ui.h b/tests/auto/tools/uic/baseline/enumnostdset.ui.h new file mode 100644 index 0000000000..89a8411b4a --- /dev/null +++ b/tests/auto/tools/uic/baseline/enumnostdset.ui.h @@ -0,0 +1,55 @@ +/******************************************************************************** +** Form generated from reading UI file 'enumnostdset.ui' +** +** Created by: Qt User Interface Compiler version 5.6.1 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef ENUMNOSTDSET_H +#define ENUMNOSTDSET_H + +#include +#include +#include +#include +#include +#include +#include "worldtimeclock.h" + +QT_BEGIN_NAMESPACE + +class Ui_Form +{ +public: + WorldTimeClock *worldTimeClock; + + void setupUi(QWidget *Form) + { + if (Form->objectName().isEmpty()) + Form->setObjectName(QStringLiteral("Form")); + Form->resize(400, 300); + worldTimeClock = new WorldTimeClock(Form); + worldTimeClock->setObjectName(QStringLiteral("worldTimeClock")); + worldTimeClock->setGeometry(QRect(100, 100, 100, 100)); + worldTimeClock->setProperty("penStyle", QVariant::fromValue(Qt::DashDotLine)); + + retranslateUi(Form); + + QMetaObject::connectSlotsByName(Form); + } // setupUi + + void retranslateUi(QWidget *Form) + { + Form->setWindowTitle(QApplication::translate("Form", "Form", 0)); + } // retranslateUi + +}; + +namespace Ui { + class Form: public Ui_Form {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // ENUMNOSTDSET_H -- cgit v1.2.3 From 2020d2cb63b851723e188c002acbe25b5f066525 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 4 Mar 2016 15:19:50 -0800 Subject: QObject: fix GCC 6 warning about qt_static_metacall's 'hidden' attribute use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This warning is triggered when we try to apply the Q_DECL_HIDDEN attribute to a class in an unnamed namespace. Such classes are already not exported. qobjectdefs.h:175:108: warning: ‘visibility’ attribute ignored [-Wattributes] qobjectdefs.h:198:108: warning: ‘visibility’ attribute ignored [-Wattributes] Added a test on gadgets (and QObjects) in unnamed namespaces, because qtbase currently does not contain such Q_GADGETs. Done-with: Thiago Macieira Change-Id: Ic747cc2ab45e4dc6bb70ffff1438c747b05c5672 Reviewed-by: Lars Knoll Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/tools/moc/tst_moc.cpp | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'tests/auto/tools') diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index c113b7cd60..5c16c7a48f 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -131,6 +131,33 @@ typedef struct { int doNotConfuseMoc; } OldStyleCStruct; +namespace { + + class GadgetInUnnamedNS + { + Q_GADGET + Q_PROPERTY(int x READ x WRITE setX) + Q_PROPERTY(int y READ y WRITE setY) + public: + explicit GadgetInUnnamedNS(int x, int y) : m_x(x), m_y(y) {} + int x() const { return m_x; } + int y() const { return m_y; } + void setX(int x) { m_x = x; } + void setY(int y) { m_y = y; } + + private: + int m_x, m_y; + }; + + class ObjectInUnnamedNS : public QObject + { + Q_OBJECT + public: + explicit ObjectInUnnamedNS(QObject *parent = Q_NULLPTR) : QObject(parent) {} + }; + +} + class Sender : public QObject { Q_OBJECT @@ -597,6 +624,7 @@ private slots: void relatedMetaObjectsNameConflict_data(); void relatedMetaObjectsNameConflict(); void strignLiteralsInMacroExtension(); + void unnamedNamespaceObjectsAndGadgets(); void veryLongStringData(); void gadgetHierarchy(); @@ -3421,6 +3449,28 @@ class VeryLongStringData : public QObject #undef repeat65534 }; +void tst_Moc::unnamedNamespaceObjectsAndGadgets() +{ + // these just test very basic functionality of gadgets and objects + // defined in unnamed namespaces. + { + GadgetInUnnamedNS gadget(21, 42); + QCOMPARE(gadget.x(), 21); + QCOMPARE(gadget.y(), 42); + gadget.staticMetaObject.property(0).writeOnGadget(&gadget, 12); + gadget.staticMetaObject.property(1).writeOnGadget(&gadget, 24); + QCOMPARE(gadget.x(), 12); + QCOMPARE(gadget.y(), 24); + } + + { + ObjectInUnnamedNS object; + QObject *qObject = &object; + QCOMPARE(static_cast(qObject), + qobject_cast(qObject)); + } +} + void tst_Moc::veryLongStringData() { const QMetaObject *mobj = &VeryLongStringData::staticMetaObject; -- cgit v1.2.3