Merge "Merge branch 'stable' into dev" into refs/staging/dev

This commit is contained in:
Jędrzej Nowacki 2013-01-07 16:57:32 +01:00 committed by The Qt Project
commit ae2359d49e
179 changed files with 59590 additions and 522 deletions

4
configure vendored
View File

@ -2844,7 +2844,7 @@ if [ -z "$QT_INSTALL_SETTINGS" ]; then #default
if [ "$BUILD_ON_MAC" = "yes" ]; then if [ "$BUILD_ON_MAC" = "yes" ]; then
QT_INSTALL_SETTINGS=/Library/Preferences/Qt QT_INSTALL_SETTINGS=/Library/Preferences/Qt
else else
QT_INSTALL_SETTINGS=/etc/xdg QT_INSTALL_SETTINGS=$QT_INSTALL_PREFIX/etc/xdg
fi fi
fi fi
QT_INSTALL_SETTINGS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_SETTINGS"` QT_INSTALL_SETTINGS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_SETTINGS"`
@ -3044,7 +3044,7 @@ Installation options:
-translationdir <dir> . Translations of Qt programs will be installed to <dir> -translationdir <dir> . Translations of Qt programs will be installed to <dir>
(default DATADIR/translations) (default DATADIR/translations)
-sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir> -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir>
(default PREFIX/etc/settings) (default PREFIX/etc/xdg)
-examplesdir <dir> .... Examples will be installed to <dir> -examplesdir <dir> .... Examples will be installed to <dir>
(default PREFIX/examples) (default PREFIX/examples)
-testsdir <dir> ....... Tests will be installed to <dir> -testsdir <dir> ....... Tests will be installed to <dir>

View File

@ -65,7 +65,6 @@ MandelbrotWidget::MandelbrotWidget(QWidget *parent)
pixmapScale = DefaultScale; pixmapScale = DefaultScale;
curScale = DefaultScale; curScale = DefaultScale;
qRegisterMetaType<QImage>("QImage");
connect(&thread, SIGNAL(renderedImage(QImage,double)), this, SLOT(updatePixmap(QImage,double))); connect(&thread, SIGNAL(renderedImage(QImage,double)), this, SLOT(updatePixmap(QImage,double)));
setWindowTitle(tr("Mandelbrot")); setWindowTitle(tr("Mandelbrot"));

View File

@ -143,6 +143,8 @@ QDateTime dateTime = QDateTime::fromString("130", "Mm"); // invalid
//! [14] //! [14]
QDateTime dateTime = QDateTime::fromString("1.30.1", "M.d.s"); QDateTime dateTime = QDateTime::fromString("1.30.1", "M.d.s");
// dateTime is January 30 in 1900 at 00:00:01. // dateTime is January 30 in 1900 at 00:00:01.
dateTime = QDateTime::fromString("12", "yy");
// dateTime is January 1 in 1912 at 00:00:00.
//! [14] //! [14]
//! [15] //! [15]
@ -192,3 +194,15 @@ qDebug() << "UTC time is:" << UTC;
qDebug() << "There are" << local.secsTo(UTC) << "seconds difference between the datetimes."; qDebug() << "There are" << local.secsTo(UTC) << "seconds difference between the datetimes.";
//! [19] //! [19]
//! [20]
QString string = "Monday, 23 April 12 22:51:41";
QString format = "dddd, d MMMM yy hh:mm:ss";
QDateTime invalid = QDateTime::fromString(string, format);
//! [20]
//! [21]
QString string = "Tuesday, 23 April 12 22:51:41";
QString format = "dddd, d MMMM yy hh:mm:ss";
QDateTime valid = QDateTime::fromString(string, format);
//! [21]

View File

@ -693,7 +693,7 @@
#endif /* Q_CC_MSVC */ #endif /* Q_CC_MSVC */
#ifdef __cplusplus #ifdef __cplusplus
# if defined(Q_OS_BLACKBERRY) || defined(Q_OS_QNX) # if defined(Q_OS_QNX)
# include <utility> # include <utility>
# if defined(_YVALS) || defined(_LIBCPP_VER) # if defined(_YVALS) || defined(_LIBCPP_VER)
// QNX: libcpp (Dinkumware-based) doesn't have the <initializer_list> // QNX: libcpp (Dinkumware-based) doesn't have the <initializer_list>
@ -702,9 +702,12 @@
# ifdef Q_COMPILER_INITIALIZER_LISTS # ifdef Q_COMPILER_INITIALIZER_LISTS
# undef Q_COMPILER_INITIALIZER_LISTS # undef Q_COMPILER_INITIALIZER_LISTS
# endif # endif
# ifdef Q_COMPILER_RVALUE_REFS
# undef Q_COMPILER_RVALUE_REFS
# endif # endif
# endif # endif
#endif // Q_OS_BLACKBERRY || Q_OS_QNX # endif
#endif // Q_OS_QNX
/* /*
* C++11 keywords and expressions * C++11 keywords and expressions

View File

@ -271,6 +271,11 @@ void QEventDispatcherBlackberry::unregisterSocketNotifier(QSocketNotifier *notif
} }
} }
static inline int timevalToMillisecs(const timeval &tv)
{
return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
}
int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
timeval *timeout) timeval *timeout)
{ {
@ -279,9 +284,6 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef
BpsChannelScopeSwitcher channelSwitcher(d->bps_channel); BpsChannelScopeSwitcher channelSwitcher(d->bps_channel);
// Make a note of the start time
timeval startTime = qt_gettime();
// prepare file sets for bps callback // prepare file sets for bps callback
d->ioData->count = 0; d->ioData->count = 0;
d->ioData->readfds = readfds; d->ioData->readfds = readfds;
@ -298,15 +300,15 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef
if (exceptfds) if (exceptfds)
FD_ZERO(exceptfds); FD_ZERO(exceptfds);
bps_event_t *event = 0;
unsigned int eventCount = 0;
// Convert timeout to milliseconds // Convert timeout to milliseconds
int timeoutTotal = -1; int timeoutTotal = -1;
if (timeout) if (timeout)
timeoutTotal = (timeout->tv_sec * 1000) + (timeout->tv_usec / 1000); timeoutTotal = timevalToMillisecs(*timeout);
int timeoutLeft = timeoutTotal; int timeoutLeft = timeoutTotal;
timeval startTime = qt_gettime();
bps_event_t *event = 0;
unsigned int eventCount = 0;
// This loop exists such that we can drain the bps event queue of all native events // This loop exists such that we can drain the bps event queue of all native events
// more efficiently than if we were to return control to Qt after each event. This // more efficiently than if we were to return control to Qt after each event. This
@ -331,11 +333,20 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef
// Clock source is monotonic, so we can recalculate how much timeout is left // Clock source is monotonic, so we can recalculate how much timeout is left
if (timeoutTotal != -1) { if (timeoutTotal != -1) {
timeval t2 = qt_gettime(); timeval t2 = qt_gettime();
timeoutLeft = timeoutTotal - ((t2.tv_sec * 1000 + t2.tv_usec / 1000) timeoutLeft = timeoutTotal
- (startTime.tv_sec * 1000 + startTime.tv_usec / 1000)); - (timevalToMillisecs(t2) - timevalToMillisecs(startTime));
if (timeoutLeft < 0) if (timeoutLeft < 0)
timeoutLeft = 0; timeoutLeft = 0;
} }
timeval tnext;
if (d->timerList.timerWait(tnext)) {
int timeoutNext = timevalToMillisecs(tnext);
if (timeoutNext < timeoutLeft || timeoutTotal == -1) {
timeoutTotal = timeoutLeft = timeoutNext;
startTime = qt_gettime();
}
}
} }
// Wait for event or file to be ready // Wait for event or file to be ready

View File

@ -472,7 +472,7 @@ int QMetaObject::constructorCount() const
/*! /*!
Returns the number of methods in this class, including the number of Returns the number of methods in this class, including the number of
properties provided by each base class. These include signals and slots methods provided by each base class. These include signals and slots
as well as normal member functions. as well as normal member functions.
Use code like the following to obtain a QStringList containing the methods Use code like the following to obtain a QStringList containing the methods

View File

@ -240,6 +240,7 @@ struct DefinedTypesFilter {
\omitvalue PointerToQObject \omitvalue PointerToQObject
\omitvalue WeakPointerToQObject \omitvalue WeakPointerToQObject
\omitvalue TrackingPointerToQObject \omitvalue TrackingPointerToQObject
\omitvalue WasDeclaredAsMetaType
*/ */
/*! /*!

View File

@ -3533,6 +3533,18 @@ QDateTime QDateTime::fromString(const QString& s, Qt::DateFormat f)
This could have meant 1 January 00:30.00 but the M will grab This could have meant 1 January 00:30.00 but the M will grab
two digits. two digits.
Incorrectly specified fields of the \a string will cause an invalid
QDateTime to be returned. For example, consider the following code,
where the two digit year 12 is read as 1912 (see the table below for all
field defaults); the resulting datetime is invalid because 23 April 1912
was a Tuesday, not a Monday:
\snippet code/src_corelib_tools_qdatetime.cpp 20
The correct code is:
\snippet code/src_corelib_tools_qdatetime.cpp 21
For any field that is not represented in the format, the following For any field that is not represented in the format, the following
defaults are used: defaults are used:

View File

@ -113,8 +113,6 @@ struct QSystemLocalePrivate
void update(); void update();
private: private:
QByteArray langEnvVar;
enum SubstitutionType { enum SubstitutionType {
SUnknown, SUnknown,
SContext, SContext,
@ -142,7 +140,6 @@ Q_GLOBAL_STATIC(QSystemLocalePrivate, systemLocalePrivate)
QSystemLocalePrivate::QSystemLocalePrivate() QSystemLocalePrivate::QSystemLocalePrivate()
: substitutionType(SUnknown) : substitutionType(SUnknown)
{ {
langEnvVar = qgetenv("LANG");
lcid = GetUserDefaultLCID(); lcid = GetUserDefaultLCID();
} }

View File

@ -813,6 +813,8 @@ template <class X, class T>
Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerDynamicCast(const QSharedPointer<T> &src) Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerDynamicCast(const QSharedPointer<T> &src)
{ {
register X *ptr = dynamic_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid register X *ptr = dynamic_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid
if (!ptr)
return QSharedPointer<X>();
return QtSharedPointer::copyAndSetPointer(ptr, src); return QtSharedPointer::copyAndSetPointer(ptr, src);
} }
template <class X, class T> template <class X, class T>

View File

@ -56,8 +56,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
/*! /*!
\class QAccessible \class QAccessible
\brief The QAccessible class provides enums and static functions \brief The QAccessible class provides enums and static functions
@ -442,19 +440,23 @@ QAccessible::RootObjectHandler QAccessible::rootObjectHandler = 0;
static bool accessibility_active = false; static bool accessibility_active = false;
static bool cleanupAdded = false; static bool cleanupAdded = false;
#ifndef QT_NO_ACCESSIBILITY
static QPlatformAccessibility *platformAccessibility() static QPlatformAccessibility *platformAccessibility()
{ {
QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration(); QPlatformIntegration *pfIntegration = QGuiApplicationPrivate::platformIntegration();
return pfIntegration ? pfIntegration->accessibility() : 0; return pfIntegration ? pfIntegration->accessibility() : 0;
} }
#endif
/*! /*!
\internal \internal
*/ */
void QAccessible::cleanup() void QAccessible::cleanup()
{ {
#ifndef QT_NO_ACCESSIBILITY
if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
pfAccessibility->cleanup(); pfAccessibility->cleanup();
#endif
} }
static void qAccessibleCleanup() static void qAccessibleCleanup()
@ -615,8 +617,10 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
mo = mo->superClass(); mo = mo->superClass();
} }
#ifndef QT_NO_ACCESSIBILITY
if (object == qApp) if (object == qApp)
return new QAccessibleApplication; return new QAccessibleApplication;
#endif
return 0; return 0;
} }
@ -656,8 +660,10 @@ void QAccessible::setRootObject(QObject *object)
return; return;
} }
#ifndef QT_NO_ACCESSIBILITY
if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
pfAccessibility->setRootObject(object); pfAccessibility->setRootObject(object);
#endif
} }
/*! /*!
@ -689,8 +695,10 @@ void QAccessible::updateAccessibility(QAccessibleEvent *event)
if (!isActive()) if (!isActive())
return; return;
#ifndef QT_NO_ACCESSIBILITY
if (QPlatformAccessibility *pfAccessibility = platformAccessibility()) if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
pfAccessibility->notifyAccessibilityUpdate(event); pfAccessibility->notifyAccessibilityUpdate(event);
#endif
} }
#if QT_DEPRECATED_SINCE(5, 0) #if QT_DEPRECATED_SINCE(5, 0)
@ -1544,7 +1552,5 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev)
#endif #endif
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -57,7 +57,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
class QAccessibleInterface; class QAccessibleInterface;
class QAccessibleEvent; class QAccessibleEvent;
@ -677,8 +676,6 @@ inline void QAccessible::updateAccessibility(QObject *object, int child, Event r
} }
#endif #endif
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE QT_END_NAMESPACE
QT_END_HEADER QT_END_HEADER

View File

@ -1392,7 +1392,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
// Ignore mouse events that don't change the current state. // Ignore mouse events that don't change the current state.
return; return;
} }
buttons = e->buttons; mouse_buttons = buttons = e->buttons;
if (button & e->buttons) { if (button & e->buttons) {
ulong doubleClickInterval = static_cast<ulong>(qApp->styleHints()->mouseDoubleClickInterval()); ulong doubleClickInterval = static_cast<ulong>(qApp->styleHints()->mouseDoubleClickInterval());
doubleClick = e->timestamp - mousePressTime < doubleClickInterval && button == mousePressButton; doubleClick = e->timestamp - mousePressTime < doubleClickInterval && button == mousePressButton;
@ -1688,7 +1688,10 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
type = e->down ? QEvent::TabletPress : QEvent::TabletRelease; type = e->down ? QEvent::TabletPress : QEvent::TabletRelease;
tabletState = e->down; tabletState = e->down;
} }
QWindow *window = e->window.data(); QWindow *window = e->window.data();
modifier_buttons = e->modifiers;
bool localValid = true; bool localValid = true;
// If window is null, pick one based on the global position and make sure all // If window is null, pick one based on the global position and make sure all
// subsequent events up to the release are delivered to that same window. // subsequent events up to the release are delivered to that same window.
@ -1719,7 +1722,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
QTabletEvent ev(type, local, e->global, QTabletEvent ev(type, local, e->global,
e->device, e->pointerType, e->pressure, e->xTilt, e->yTilt, e->device, e->pointerType, e->pressure, e->xTilt, e->yTilt,
e->tangentialPressure, e->rotation, e->z, e->tangentialPressure, e->rotation, e->z,
e->mods, e->uid); e->modifiers, e->uid);
ev.setTimestamp(e->timestamp); ev.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(window, &ev); QGuiApplication::sendSpontaneousEvent(window, &ev);
#else #else

View File

@ -1105,7 +1105,6 @@ void QWindow::setGeometry(const QRect &rect)
d->platformWindow->setGeometry(rect); d->platformWindow->setGeometry(rect);
} else { } else {
d->geometry = rect; d->geometry = rect;
}
if (rect.x() != oldRect.x()) if (rect.x() != oldRect.x())
emit xChanged(rect.x()); emit xChanged(rect.x());
@ -1116,6 +1115,7 @@ void QWindow::setGeometry(const QRect &rect)
if (rect.height() != oldRect.height()) if (rect.height() != oldRect.height())
emit heightChanged(rect.height()); emit heightChanged(rect.height());
} }
}
/*! /*!
Returns the geometry of the window, excluding its window frame. Returns the geometry of the window, excluding its window frame.

View File

@ -302,10 +302,10 @@ public:
TabletEvent(QWindow *w, ulong time, bool down, const QPointF &local, const QPointF &global, TabletEvent(QWindow *w, ulong time, bool down, const QPointF &local, const QPointF &global,
int device, int pointerType, qreal pressure, int xTilt, int yTilt, qreal tpressure, int device, int pointerType, qreal pressure, int xTilt, int yTilt, qreal tpressure,
qreal rotation, int z, qint64 uid, Qt::KeyboardModifiers mods) qreal rotation, int z, qint64 uid, Qt::KeyboardModifiers mods)
: InputEvent(w, time, Tablet, Qt::NoModifier), : InputEvent(w, time, Tablet, mods),
down(down), local(local), global(global), device(device), pointerType(pointerType), down(down), local(local), global(global), device(device), pointerType(pointerType),
pressure(pressure), xTilt(xTilt), yTilt(yTilt), tangentialPressure(tpressure), pressure(pressure), xTilt(xTilt), yTilt(yTilt), tangentialPressure(tpressure),
rotation(rotation), z(z), uid(uid), mods(mods) { } rotation(rotation), z(z), uid(uid) { }
bool down; bool down;
QPointF local; QPointF local;
QPointF global; QPointF global;
@ -318,7 +318,6 @@ public:
qreal rotation; qreal rotation;
int z; int z;
qint64 uid; qint64 uid;
Qt::KeyboardModifiers mods;
}; };
class TabletEnterProximityEvent : public InputEvent { class TabletEnterProximityEvent : public InputEvent {

View File

@ -220,23 +220,6 @@ static inline bool qPointIsLeftOfLine(const QPodPoint &p, const QPodPoint &v1, c
return QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(p, v1, v2) < 0; return QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(p, v1, v2) < 0;
} }
// Return:
// -1 if u < v
// 0 if u == v
// 1 if u > v
static int comparePoints(const QPodPoint &u, const QPodPoint &v)
{
if (u.y < v.y)
return -1;
if (u.y > v.y)
return 1;
if (u.x < v.x)
return -1;
if (u.x > v.x)
return 1;
return 0;
}
//============================================================================// //============================================================================//
// QIntersectionPoint // // QIntersectionPoint //
//============================================================================// //============================================================================//
@ -632,16 +615,6 @@ public:
bool pointingUp, originallyPointingUp; bool pointingUp, originallyPointingUp;
}; };
friend class CompareEdges;
class CompareEdges
{
public:
inline CompareEdges(ComplexToSimple *parent) : m_parent(parent) { }
bool operator () (int i, int j) const;
private:
ComplexToSimple *m_parent;
};
struct Intersection struct Intersection
{ {
bool operator < (const Intersection &other) const {return other.intersectionPoint < intersectionPoint;} bool operator < (const Intersection &other) const {return other.intersectionPoint < intersectionPoint;}
@ -1653,18 +1626,6 @@ void QTriangulator<T>::ComplexToSimple::removeUnusedPoints() {
} }
} }
template <typename T>
bool QTriangulator<T>::ComplexToSimple::CompareEdges::operator () (int i, int j) const
{
int cmp = comparePoints(m_parent->m_parent->m_vertices.at(m_parent->m_edges.at(i).from),
m_parent->m_parent->m_vertices.at(m_parent->m_edges.at(j).from));
if (cmp == 0) {
cmp = comparePoints(m_parent->m_parent->m_vertices.at(m_parent->m_edges.at(i).to),
m_parent->m_parent->m_vertices.at(m_parent->m_edges.at(j).to));
}
return cmp > 0;
}
template <typename T> template <typename T>
inline bool QTriangulator<T>::ComplexToSimple::Event::operator < (const Event &other) const inline bool QTriangulator<T>::ComplexToSimple::Event::operator < (const Event &other) const
{ {

View File

@ -1853,7 +1853,7 @@ void QTextEngine::justify(const QScriptLine &line)
itemize(); itemize();
if (!forceJustification) { if (!forceJustification) {
int end = line.from + (int)line.length; int end = line.from + (int)line.length + line.trailingSpaces;
if (end == layoutData->string.length()) if (end == layoutData->string.length())
return; // no justification at end of paragraph return; // no justification at end of paragraph
if (end && layoutData->items[findItem(end-1)].analysis.flags == QScriptAnalysis::LineOrParagraphSeparator) if (end && layoutData->items[findItem(end-1)].analysis.flags == QScriptAnalysis::LineOrParagraphSeparator)
@ -1908,6 +1908,8 @@ void QTextEngine::justify(const QScriptLine &line)
int gs = log_clusters[start]; int gs = log_clusters[start];
int ge = (end == length(firstItem+i) ? si.num_glyphs : log_clusters[end]); int ge = (end == length(firstItem+i) ? si.num_glyphs : log_clusters[end]);
Q_ASSERT(ge <= si.num_glyphs);
const QGlyphLayout g = shapedGlyphs(&si); const QGlyphLayout g = shapedGlyphs(&si);
for (int i = gs; i < ge; ++i) { for (int i = gs; i < ge; ++i) {

View File

@ -1205,6 +1205,9 @@ static const char *certificate_blacklist[] = {
"4c:0e:63:6a", "Digisign Server ID - (Enrich)", // (Malaysian) Digicert Sdn. Bhd. cross-signed by Entrust "4c:0e:63:6a", "Digisign Server ID - (Enrich)", // (Malaysian) Digicert Sdn. Bhd. cross-signed by Entrust
"72:03:21:05:c5:0c:08:57:3d:8e:a5:30:4e:fe:e8:b0", "UTN-USERFirst-Hardware", // comodogate test certificate "72:03:21:05:c5:0c:08:57:3d:8e:a5:30:4e:fe:e8:b0", "UTN-USERFirst-Hardware", // comodogate test certificate
"41", "MD5 Collisions Inc. (http://www.phreedom.org/md5)", // http://www.phreedom.org/research/rogue-ca/ "41", "MD5 Collisions Inc. (http://www.phreedom.org/md5)", // http://www.phreedom.org/research/rogue-ca/
"08:27", "*.EGO.GOV.TR", // Turktrust mis-issued intermediate certificate
"08:64", "e-islem.kktcmerkezbankasi.org", // Turktrust mis-issued intermediate certificate
0 0
}; };

View File

@ -52,8 +52,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
/*! /*!
\class QSpiApplicationAdaptor \class QSpiApplicationAdaptor
\internal \internal
@ -219,6 +217,4 @@ void QSpiApplicationAdaptor::notifyKeyboardListenerError(const QDBusError& error
} }
} }
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -49,8 +49,6 @@
QT_BEGIN_HEADER QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
/* /*
* Used for the root object. * Used for the root object.
* *
@ -82,8 +80,6 @@ private:
QDBusConnection dbusConnection; QDBusConnection dbusConnection;
}; };
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE QT_END_NAMESPACE
QT_END_HEADER QT_END_HEADER

View File

@ -65,8 +65,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
static bool isDebugging = false; static bool isDebugging = false;
#define qAtspiDebug if (!::isDebugging); else qDebug #define qAtspiDebug if (!::isDebugging); else qDebug
@ -2359,6 +2357,4 @@ bool AtSpiAdaptor::tableInterface(const QAIPointer &interface, const QString &fu
return true; return true;
} }
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -56,8 +56,6 @@
QT_BEGIN_HEADER QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
class QAccessibleInterface; class QAccessibleInterface;
class QSpiAccessibleInterface; class QSpiAccessibleInterface;
class QSpiApplicationAdaptor; class QSpiApplicationAdaptor;
@ -218,8 +216,6 @@ private:
uint sendWindow_unshade : 1; uint sendWindow_unshade : 1;
}; };
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE QT_END_NAMESPACE
QT_END_HEADER QT_END_HEADER

View File

@ -56,8 +56,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
/*! /*!
\class QSpiAccessibleBridge \class QSpiAccessibleBridge
\internal \internal
@ -184,6 +182,4 @@ void QSpiAccessibleBridge::initializeConstantMappings()
qSpiRoleMapping.insert(map[i].role, RoleNames(map[i].spiRole, QLatin1String(map[i].name), tr(map[i].name))); qSpiRoleMapping.insert(map[i].role, RoleNames(map[i].spiRole, QLatin1String(map[i].name), tr(map[i].name)));
} }
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -51,8 +51,6 @@ class DeviceEventControllerAdaptor;
QT_BEGIN_HEADER QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
class DBusConnection; class DBusConnection;
class QSpiDBusCache; class QSpiDBusCache;
class AtSpiAdaptor; class AtSpiAdaptor;
@ -81,8 +79,6 @@ private:
bool initialized; bool initialized;
}; };
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE QT_END_NAMESPACE
QT_END_HEADER QT_END_HEADER

View File

@ -49,8 +49,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
/*! /*!
\class QSpiDBusCache \class QSpiDBusCache
\internal \internal
@ -91,6 +89,4 @@ QSpiAccessibleCacheArray QSpiDBusCache::GetItems()
return cacheArray; return cacheArray;
} }
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -49,8 +49,6 @@
QT_BEGIN_HEADER QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
class QSpiDBusCache : public QObject class QSpiDBusCache : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -68,8 +66,6 @@ public Q_SLOTS:
QSpiAccessibleCacheArray GetItems(); QSpiAccessibleCacheArray GetItems();
}; };
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE QT_END_NAMESPACE
QT_END_HEADER QT_END_HEADER

View File

@ -55,8 +55,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
QHash <QAccessible::Role, RoleNames> qSpiRoleMapping; QHash <QAccessible::Role, RoleNames> qSpiRoleMapping;
quint64 spiStatesFromQState(QAccessible::State state) quint64 spiStatesFromQState(QAccessible::State state)
@ -156,6 +154,4 @@ AtspiRelationType qAccessibleRelationToAtSpiRelation(QAccessible::Relation relat
return ATSPI_RELATION_NULL; return ATSPI_RELATION_NULL;
} }
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -53,7 +53,6 @@
#include <QtGui/QAccessible> #include <QtGui/QAccessible>
#include <atspi/atspi-constants.h> #include <atspi/atspi-constants.h>
#ifndef QT_NO_ACCESSIBILITY
// interface names from at-spi2-core/atspi/atspi-misc-private.h // interface names from at-spi2-core/atspi/atspi-misc-private.h
#define ATSPI_DBUS_NAME_REGISTRY "org.a11y.atspi.Registry" #define ATSPI_DBUS_NAME_REGISTRY "org.a11y.atspi.Registry"
@ -136,6 +135,4 @@ AtspiRelationType qAccessibleRelationToAtSpiRelation(QAccessible::Relation relat
QT_END_NAMESPACE QT_END_NAMESPACE
QT_END_HEADER QT_END_HEADER
#endif // QT_NO_ACCESSIBILITY
#endif /* Q_SPI_CONSTANT_MAPPINGS_H */ #endif /* Q_SPI_CONSTANT_MAPPINGS_H */

View File

@ -48,8 +48,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
/*! /*!
\class DBusConnection \class DBusConnection
\internal \internal
@ -106,6 +104,4 @@ QDBusConnection DBusConnection::connection() const
return dbusConnection; return dbusConnection;
} }
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -49,8 +49,6 @@
QT_BEGIN_HEADER QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
class DBusConnection class DBusConnection
{ {
public: public:
@ -64,8 +62,6 @@ private:
QDBusConnection dbusConnection; QDBusConnection dbusConnection;
}; };
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE QT_END_NAMESPACE
QT_END_HEADER QT_END_HEADER

View File

@ -50,8 +50,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
QSpiObjectReference::QSpiObjectReference() QSpiObjectReference::QSpiObjectReference()
: path(QDBusObjectPath(ATSPI_DBUS_PATH_NULL)) : path(QDBusObjectPath(ATSPI_DBUS_PATH_NULL))
{} {}
@ -236,6 +234,4 @@ void qSpiInitializeStructTypes()
qDBusRegisterMetaType<QSpiRelationArray>(); qDBusRegisterMetaType<QSpiRelationArray>();
} }
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -80,11 +80,11 @@ public:
// ---------------------------------------------------- // ----------------------------------------------------
// Additional methods // Additional methods
void setVirtualSiblings(QList<QPlatformScreen *> siblings) { m_siblings = siblings; } void setVirtualSiblings(QList<QPlatformScreen *> siblings) { m_siblings = siblings; }
NSScreen *osScreen() const { return m_screen; } NSScreen *osScreen() const;
void updateGeometry(); void updateGeometry();
public: public:
NSScreen *m_screen; int m_screenIndex;
QRect m_geometry; QRect m_geometry;
QRect m_availableGeometry; QRect m_availableGeometry;
QDpi m_logicalDpi; QDpi m_logicalDpi;

View File

@ -70,9 +70,8 @@ static void initResources()
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QCocoaScreen::QCocoaScreen(int screenIndex) : QCocoaScreen::QCocoaScreen(int screenIndex) :
QPlatformScreen(), m_refreshRate(60.0) QPlatformScreen(), m_screenIndex(screenIndex), m_refreshRate(60.0)
{ {
m_screen = [[NSScreen screens] objectAtIndex:screenIndex];
updateGeometry(); updateGeometry();
m_cursor = new QCocoaCursor; m_cursor = new QCocoaCursor;
} }
@ -82,19 +81,25 @@ QCocoaScreen::~QCocoaScreen()
delete m_cursor; delete m_cursor;
} }
NSScreen *QCocoaScreen::osScreen() const
{
return [[NSScreen screens] objectAtIndex:m_screenIndex];
}
void QCocoaScreen::updateGeometry() void QCocoaScreen::updateGeometry()
{ {
NSRect frameRect = [m_screen frame]; NSScreen *nsScreen = osScreen();
NSRect frameRect = [nsScreen frame];
m_geometry = QRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width, frameRect.size.height); m_geometry = QRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width, frameRect.size.height);
NSRect visibleRect = [m_screen visibleFrame]; NSRect visibleRect = [nsScreen visibleFrame];
m_availableGeometry = QRect(visibleRect.origin.x, m_availableGeometry = QRect(visibleRect.origin.x,
frameRect.size.height - (visibleRect.origin.y + visibleRect.size.height), // invert y frameRect.size.height - (visibleRect.origin.y + visibleRect.size.height), // invert y
visibleRect.size.width, visibleRect.size.height); visibleRect.size.width, visibleRect.size.height);
m_format = QImage::Format_RGB32; m_format = QImage::Format_RGB32;
m_depth = NSBitsPerPixelFromDepth([m_screen depth]); m_depth = NSBitsPerPixelFromDepth([nsScreen depth]);
NSDictionary *devDesc = [m_screen deviceDescription]; NSDictionary *devDesc = [nsScreen deviceDescription];
CGDirectDisplayID dpy = [[devDesc objectForKey:@"NSScreenNumber"] unsignedIntValue]; CGDirectDisplayID dpy = [[devDesc objectForKey:@"NSScreenNumber"] unsignedIntValue];
CGSize size = CGDisplayScreenSize(dpy); CGSize size = CGDisplayScreenSize(dpy);
m_physicalSize = QSizeF(size.width, size.height); m_physicalSize = QSizeF(size.width, size.height);
@ -119,7 +124,7 @@ qreal QCocoaScreen::devicePixelRatio() const
{ {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) { if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
return qreal([m_screen backingScaleFactor]); return qreal([osScreen() backingScaleFactor]);
} else } else
#endif #endif
{ {

View File

@ -60,8 +60,7 @@ QQnxRasterBackingStore::QQnxRasterBackingStore(QWindow *window)
{ {
qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window; qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window;
// save platform window associated with widget m_window = window;
m_platformWindow = static_cast<QQnxWindow*>(window->handle());
} }
QQnxRasterBackingStore::~QQnxRasterBackingStore() QQnxRasterBackingStore::~QQnxRasterBackingStore()
@ -71,8 +70,9 @@ QQnxRasterBackingStore::~QQnxRasterBackingStore()
QPaintDevice *QQnxRasterBackingStore::paintDevice() QPaintDevice *QQnxRasterBackingStore::paintDevice()
{ {
if (m_platformWindow->hasBuffers()) QQnxWindow *platformWindow = this->platformWindow();
return m_platformWindow->renderBuffer().image(); if (platformWindow->hasBuffers())
return platformWindow->renderBuffer().image();
return 0; return 0;
} }
@ -85,7 +85,8 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion &region, const
if (window) if (window)
targetWindow = static_cast<QQnxWindow *>(window->handle()); targetWindow = static_cast<QQnxWindow *>(window->handle());
if (!targetWindow || targetWindow == m_platformWindow) { QQnxWindow *platformWindow = this->platformWindow();
if (!targetWindow || targetWindow == platformWindow) {
// visit all pending scroll operations // visit all pending scroll operations
for (int i = m_scrollOpList.size() - 1; i >= 0; i--) { for (int i = m_scrollOpList.size() - 1; i >= 0; i--) {
@ -93,14 +94,14 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion &region, const
// do the scroll operation // do the scroll operation
ScrollOp &op = m_scrollOpList[i]; ScrollOp &op = m_scrollOpList[i];
QRegion srcArea = op.totalArea.intersected( op.totalArea.translated(-op.dx, -op.dy) ); QRegion srcArea = op.totalArea.intersected( op.totalArea.translated(-op.dx, -op.dy) );
m_platformWindow->scroll(srcArea, op.dx, op.dy); platformWindow->scroll(srcArea, op.dx, op.dy);
} }
// clear all pending scroll operations // clear all pending scroll operations
m_scrollOpList.clear(); m_scrollOpList.clear();
// update the display with newly rendered content // update the display with newly rendered content
m_platformWindow->post(region); platformWindow->post(region);
} else if (targetWindow) { } else if (targetWindow) {
// The contents of the backing store should be flushed to a different window than the // The contents of the backing store should be flushed to a different window than the
@ -119,7 +120,7 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion &region, const
Q_ASSERT(!m_hasUnflushedPaintOperations); Q_ASSERT(!m_hasUnflushedPaintOperations);
targetWindow->adjustBufferSize(); targetWindow->adjustBufferSize();
targetWindow->blitFrom(m_platformWindow, offset, region); targetWindow->blitFrom(platformWindow, offset, region);
targetWindow->post(region); targetWindow->post(region);
} else { } else {
@ -177,7 +178,7 @@ void QQnxRasterBackingStore::beginPaint(const QRegion &region)
qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window(); qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window();
m_hasUnflushedPaintOperations = true; m_hasUnflushedPaintOperations = true;
m_platformWindow->adjustBufferSize(); platformWindow()->adjustBufferSize();
} }
void QQnxRasterBackingStore::endPaint(const QRegion &region) void QQnxRasterBackingStore::endPaint(const QRegion &region)
@ -186,4 +187,10 @@ void QQnxRasterBackingStore::endPaint(const QRegion &region)
qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window(); qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window();
} }
QQnxWindow *QQnxRasterBackingStore::platformWindow() const
{
Q_ASSERT(m_window->handle());
return static_cast<QQnxWindow*>(m_window->handle());
}
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -72,7 +72,9 @@ private:
int dy; int dy;
}; };
QQnxWindow *m_platformWindow; QQnxWindow *platformWindow() const;
QWindow *m_window;
QList<ScrollOp> m_scrollOpList; QList<ScrollOp> m_scrollOpList;
bool m_hasUnflushedPaintOperations; bool m_hasUnflushedPaintOperations;
}; };

View File

@ -767,9 +767,11 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accChild(VARIANT varChildI
// actually ask for the same object. As a consequence, we need to clone ourselves: // actually ask for the same object. As a consequence, we need to clone ourselves:
if (QAccessibleInterface *par = accessible->parent()) { if (QAccessibleInterface *par = accessible->parent()) {
const int indexOf = par->indexOfChild(accessible); const int indexOf = par->indexOfChild(accessible);
QAccessibleInterface *clone = par->child(indexOf); if (indexOf == -1)
qWarning() << "inconsistent hierarchy, parent:" << par << "child:" << accessible;
else
acc = par->child(indexOf);
delete par; delete par;
acc = clone;
} }
} }
} }

View File

@ -100,11 +100,16 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion &region,
POINT ptDst = {r.x(), r.y()}; POINT ptDst = {r.x(), r.y()};
POINT ptSrc = {0, 0}; POINT ptSrc = {0, 0};
BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * rw->opacity()), AC_SRC_ALPHA}; BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * rw->opacity()), AC_SRC_ALPHA};
if (QWindowsContext::user32dll.updateLayeredWindowIndirect) {
RECT dirty = {dirtyRect.x(), dirtyRect.y(), RECT dirty = {dirtyRect.x(), dirtyRect.y(),
dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()}; dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()};
UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty}; UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty};
QWindowsContext::user32dll.updateLayeredWindowIndirect(rw->handle(), &info); QWindowsContext::user32dll.updateLayeredWindowIndirect(rw->handle(), &info);
} else { } else {
QWindowsContext::user32dll.updateLayeredWindow(rw->handle(), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA);
}
} else {
#endif #endif
const HDC dc = rw->getDC(); const HDC dc = rw->getDC();
if (!dc) { if (!dc) {

View File

@ -419,9 +419,9 @@ inline bool isQMLApplication()
{ {
// check if the QtQuick library is loaded // check if the QtQuick library is loaded
#ifdef _DEBUG #ifdef _DEBUG
HMODULE handle = GetModuleHandle(L"QtQuick" QT_LIBINFIX L"d5.dll"); HMODULE handle = GetModuleHandle(L"Qt5Quick" QT_LIBINFIX L"d.dll");
#else #else
HMODULE handle = GetModuleHandle(L"QtQuick" QT_LIBINFIX L"5.dll"); HMODULE handle = GetModuleHandle(L"Qt5Quick" QT_LIBINFIX L".dll");
#endif #endif
return (handle != NULL); return (handle != NULL);
} }

View File

@ -545,7 +545,7 @@ QPoint QXcbCursor::pos() const
void QXcbCursor::setPos(const QPoint &pos) void QXcbCursor::setPos(const QPoint &pos)
{ {
xcb_window_t root; xcb_window_t root = 0;
queryPointer(connection(), &root, 0); queryPointer(connection(), &root, 0);
xcb_warp_pointer(xcb_connection(), XCB_NONE, root, 0, 0, 0, 0, pos.x(), pos.y()); xcb_warp_pointer(xcb_connection(), XCB_NONE, root, 0, 0, 0, 0, pos.x(), pos.y());
xcb_flush(xcb_connection()); xcb_flush(xcb_connection());

View File

@ -250,6 +250,7 @@ void * QXcbNativeInterface::eglContextForContext(QOpenGLContext *context)
QEGLPlatformContext *eglPlatformContext = static_cast<QEGLPlatformContext *>(context->handle()); QEGLPlatformContext *eglPlatformContext = static_cast<QEGLPlatformContext *>(context->handle());
return eglPlatformContext->eglContext(); return eglPlatformContext->eglContext();
#else #else
Q_UNUSED(context);
return 0; return 0;
#endif #endif
} }

View File

@ -65,14 +65,14 @@ QVERIFY(arguments.at(2).type() == QVariant::double);
//! [2] //! [2]
qRegisterMetaType<QModelIndex>("QModelIndex"); qRegisterMetaType<SomeStruct>();
QSignalSpy spy(&model, SIGNAL(whatever(QModelIndex))); QSignalSpy spy(&model, SIGNAL(whatever(SomeStruct)));
//! [2] //! [2]
//! [3] //! [3]
// get the first argument from the first received signal: // get the first argument from the first received signal:
QModelIndex result = qvariant_cast<QModelIndex>(spy.at(0).at(0)); SomeStruct result = qvariant_cast<SomeStruct>(spy.at(0).at(0));
//! [3] //! [3]

View File

@ -54,7 +54,7 @@
\snippet code/doc_src_qsignalspy.cpp 2 \snippet code/doc_src_qsignalspy.cpp 2
To retrieve the \c QModelIndex, you can use qvariant_cast: To retrieve the instance, you can use qvariant_cast:
\snippet code/doc_src_qsignalspy.cpp 3 \snippet code/doc_src_qsignalspy.cpp 3
*/ */

View File

@ -2709,15 +2709,47 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
if (receiver->isWindowType()) if (receiver->isWindowType())
QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(static_cast<QWindow *>(receiver), e); QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(static_cast<QWindow *>(receiver), e);
// capture the current mouse/keyboard state
if(e->spontaneous()) { if(e->spontaneous()) {
if (e->type() == QEvent::MouseButtonPress // Capture the current mouse and keyboard states. Doing so here is
|| e->type() == QEvent::MouseButtonRelease) { // required in order to support QTestLib synthesized events. Real mouse
// and keyboard state updates from the platform plugin are managed by
// QGuiApplicationPrivate::process(Mouse|Wheel|Key|Touch|Tablet)Event();
switch (e->type()) {
case QEvent::MouseButtonPress:
{
QMouseEvent *me = static_cast<QMouseEvent*>(e); QMouseEvent *me = static_cast<QMouseEvent*>(e);
if(me->type() == QEvent::MouseButtonPress) QApplicationPrivate::modifier_buttons = me->modifiers();
QApplicationPrivate::mouse_buttons |= me->button(); QApplicationPrivate::mouse_buttons |= me->button();
else break;
}
case QEvent::MouseButtonRelease:
{
QMouseEvent *me = static_cast<QMouseEvent*>(e);
QApplicationPrivate::modifier_buttons = me->modifiers();
QApplicationPrivate::mouse_buttons &= ~me->button(); QApplicationPrivate::mouse_buttons &= ~me->button();
break;
}
case QEvent::KeyPress:
case QEvent::KeyRelease:
case QEvent::MouseMove:
#ifndef QT_NO_WHEELEVENT
case QEvent::Wheel:
#endif
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
#ifndef QT_NO_TABLETEVENT
case QEvent::TabletMove:
case QEvent::TabletPress:
case QEvent::TabletRelease:
#endif
{
QInputEvent *ie = static_cast<QInputEvent*>(e);
QApplicationPrivate::modifier_buttons = ie->modifiers();
break;
}
default:
break;
} }
} }

View File

@ -75,6 +75,7 @@
#include <QtWidgets/QToolBar> #include <QtWidgets/QToolBar>
#include <QtWidgets/QToolButton> #include <QtWidgets/QToolButton>
#ifndef Q_OS_MAC
// X11 Includes: // X11 Includes:
// the following is necessary to work around breakage in many versions // the following is necessary to work around breakage in many versions
@ -90,6 +91,7 @@
#undef XRegisterIMInstantiateCallback #undef XRegisterIMInstantiateCallback
#undef XUnregisterIMInstantiateCallback #undef XUnregisterIMInstantiateCallback
#undef XSetIMValues #undef XSetIMValues
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -210,7 +212,9 @@ Ptr_gconf_client_get_bool QGtkStylePrivate::gconf_client_get_bool = 0;
Ptr_gnome_icon_lookup_sync QGtkStylePrivate::gnome_icon_lookup_sync = 0; Ptr_gnome_icon_lookup_sync QGtkStylePrivate::gnome_icon_lookup_sync = 0;
Ptr_gnome_vfs_init QGtkStylePrivate::gnome_vfs_init = 0; Ptr_gnome_vfs_init QGtkStylePrivate::gnome_vfs_init = 0;
#ifndef Q_OS_MAC
typedef int (*x11ErrorHandler)(Display*, XErrorEvent*); typedef int (*x11ErrorHandler)(Display*, XErrorEvent*);
#endif
QT_END_NAMESPACE QT_END_NAMESPACE
@ -540,10 +544,14 @@ void QGtkStylePrivate::initGtkWidgets() const
} }
if (QGtkStylePrivate::gtk_init) { if (QGtkStylePrivate::gtk_init) {
#ifndef Q_OS_MAC
// Gtk will set the Qt error handler so we have to reset it afterwards // Gtk will set the Qt error handler so we have to reset it afterwards
x11ErrorHandler qt_x_errhandler = XSetErrorHandler(0); x11ErrorHandler qt_x_errhandler = XSetErrorHandler(0);
#endif
QGtkStylePrivate::gtk_init (NULL, NULL); QGtkStylePrivate::gtk_init (NULL, NULL);
#ifndef Q_OS_MAC
XSetErrorHandler(qt_x_errhandler); XSetErrorHandler(qt_x_errhandler);
#endif
// make a window // make a window
GtkWidget* gtkWindow = QGtkStylePrivate::gtk_window_new(GTK_WINDOW_POPUP); GtkWidget* gtkWindow = QGtkStylePrivate::gtk_window_new(GTK_WINDOW_POPUP);
@ -967,13 +975,14 @@ void QGtkStylePrivate::setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *p
QWidget *modalFor = parent ? parent->window() : qApp->activeWindow(); QWidget *modalFor = parent ? parent->window() : qApp->activeWindow();
if (modalFor) { if (modalFor) {
QGtkStylePrivate::gtk_widget_realize(gtkFileChooser); // Creates X window QGtkStylePrivate::gtk_widget_realize(gtkFileChooser); // Creates X window
#ifndef Q_OS_MAC
XSetTransientForHint(QGtkStylePrivate::gdk_x11_drawable_get_xdisplay(gtkFileChooser->window), XSetTransientForHint(QGtkStylePrivate::gdk_x11_drawable_get_xdisplay(gtkFileChooser->window),
QGtkStylePrivate::gdk_x11_drawable_get_xid(gtkFileChooser->window), QGtkStylePrivate::gdk_x11_drawable_get_xid(gtkFileChooser->window),
modalFor->winId()); modalFor->winId());
#ifdef Q_WS_X11 #ifdef Q_WS_X11
QGtkStylePrivate::gdk_x11_window_set_user_time (gtkFileChooser->window, QX11Info::appUserTime()); QGtkStylePrivate::gdk_x11_window_set_user_time (gtkFileChooser->window, QX11Info::appUserTime());
#endif #endif
#endif
} }
QFileInfo fileinfo(dir); QFileInfo fileinfo(dir);

View File

@ -1182,9 +1182,11 @@ void QTabBar::setCurrentIndex(int index)
d->layoutTab(index); d->layoutTab(index);
#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive()) { if (QAccessible::isActive()) {
if (hasFocus()) {
QAccessibleEvent focusEvent(this, QAccessible::Focus); QAccessibleEvent focusEvent(this, QAccessible::Focus);
focusEvent.setChild(index); focusEvent.setChild(index);
QAccessible::updateAccessibility(&focusEvent); QAccessible::updateAccessibility(&focusEvent);
}
QAccessibleEvent selectionEvent(this, QAccessible::Selection); QAccessibleEvent selectionEvent(this, QAccessible::Selection);
selectionEvent.setChild(index); selectionEvent.setChild(index);
QAccessible::updateAccessibility(&selectionEvent); QAccessible::updateAccessibility(&selectionEvent);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -49,13 +49,6 @@
#include "functions.h" #include "functions.h"
Q_DECLARE_METATYPE(QVector<int>);
Q_DECLARE_METATYPE(QVector<double>);
Q_DECLARE_METATYPE(QVector<QString>);
Q_DECLARE_METATYPE(QList<int>);
Q_DECLARE_METATYPE(QList<double>);
Q_DECLARE_METATYPE(QList<QString>);
class tst_QtConcurrentMap: public QObject class tst_QtConcurrentMap: public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -774,7 +774,6 @@ void tst_QPropertyAnimation::interpolated()
} }
} }
Q_DECLARE_METATYPE(QVariant)
void tst_QPropertyAnimation::setStartEndValues_data() void tst_QPropertyAnimation::setStartEndValues_data()
{ {
@ -1125,7 +1124,6 @@ void tst_QPropertyAnimation::restart()
void tst_QPropertyAnimation::valueChanged() void tst_QPropertyAnimation::valueChanged()
{ {
qRegisterMetaType<QVariant>("QVariant");
//we check that we receive the valueChanged signal //we check that we receive the valueChanged signal
MyErrorObject o; MyErrorObject o;

View File

@ -50,9 +50,6 @@
#include "../../../qtest-config.h" #include "../../../qtest-config.h"
Q_DECLARE_METATYPE(QBitArray)
Q_DECLARE_METATYPE(qint64)
class tst_QDataStream : public QObject class tst_QDataStream : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -56,7 +56,6 @@
# include <windows.h> # include <windows.h>
# endif # endif
Q_DECLARE_METATYPE(QList<QProcess::ExitStatus>);
Q_DECLARE_METATYPE(QProcess::ExitStatus); Q_DECLARE_METATYPE(QProcess::ExitStatus);
Q_DECLARE_METATYPE(QProcess::ProcessState); Q_DECLARE_METATYPE(QProcess::ProcessState);
#endif #endif

View File

@ -61,8 +61,6 @@ private slots:
void setLocale(); void setLocale();
}; };
Q_DECLARE_METATYPE(QLocale)
Q_DECLARE_METATYPE(qlonglong)
void tst_QResourceEngine::initTestCase() void tst_QResourceEngine::initTestCase()
{ {

View File

@ -758,7 +758,6 @@ void tst_QSettings::testErrorHandling()
#endif // !Q_OS_WIN #endif // !Q_OS_WIN
} }
Q_DECLARE_METATYPE(QVariant)
Q_DECLARE_METATYPE(QSettings::Status) Q_DECLARE_METATYPE(QSettings::Status)
#ifdef QT_BUILD_INTERNAL #ifdef QT_BUILD_INTERNAL
@ -804,7 +803,6 @@ void tst_QSettings::testIniParsing_data()
#ifdef QT_BUILD_INTERNAL #ifdef QT_BUILD_INTERNAL
void tst_QSettings::testIniParsing() void tst_QSettings::testIniParsing()
{ {
qRegisterMetaType<QVariant>("QVariant");
qRegisterMetaType<QSettings::Status>("QSettings::Status"); qRegisterMetaType<QSettings::Status>("QSettings::Status");
QDir dir(settingsPath()); QDir dir(settingsPath());

View File

@ -57,9 +57,6 @@
#include "../../../network-settings.h" #include "../../../network-settings.h"
Q_DECLARE_METATYPE(qlonglong)
Q_DECLARE_METATYPE(qulonglong)
Q_DECLARE_METATYPE(QList<int>)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
template<> struct QMetaTypeId<QIODevice::OpenModeFlag> template<> struct QMetaTypeId<QIODevice::OpenModeFlag>

View File

@ -123,8 +123,6 @@ void tst_QAbstractProxyModel::qabstractproxymodel()
model.submit(); model.submit();
} }
Q_DECLARE_METATYPE(QVariant)
Q_DECLARE_METATYPE(QModelIndex)
void tst_QAbstractProxyModel::data_data() void tst_QAbstractProxyModel::data_data()
{ {
QTest::addColumn<QModelIndex>("proxyIndex"); QTest::addColumn<QModelIndex>("proxyIndex");

View File

@ -114,10 +114,6 @@ typedef QList<int> IntList;
typedef QPair<int, int> IntPair; typedef QPair<int, int> IntPair;
typedef QList<IntPair> PairList; typedef QList<IntPair> PairList;
Q_DECLARE_METATYPE(PairList)
Q_DECLARE_METATYPE(QModelIndex)
Q_DECLARE_METATYPE(QModelIndexList)
Q_DECLARE_METATYPE(IntList)
Q_DECLARE_METATYPE(QItemSelection) Q_DECLARE_METATYPE(QItemSelection)
class QStreamHelper: public QAbstractItemModel class QStreamHelper: public QAbstractItemModel
@ -1683,9 +1679,6 @@ void tst_QItemSelectionModel::removeColumns()
typedef QList<IntList> IntListList; typedef QList<IntList> IntListList;
typedef QPair<IntPair, IntPair> IntPairPair; typedef QPair<IntPair, IntPair> IntPairPair;
typedef QList<IntPairPair> IntPairPairList; typedef QList<IntPairPair> IntPairPairList;
Q_DECLARE_METATYPE(IntListList)
Q_DECLARE_METATYPE(IntPairPair)
Q_DECLARE_METATYPE(IntPairPairList)
void tst_QItemSelectionModel::modelLayoutChanged_data() void tst_QItemSelectionModel::modelLayoutChanged_data()
{ {

View File

@ -54,11 +54,6 @@ typedef QList<int> IntList;
typedef QPair<int, int> IntPair; typedef QPair<int, int> IntPair;
typedef QList<IntPair> IntPairList; typedef QList<IntPair> IntPairList;
Q_DECLARE_METATYPE(IntList)
Q_DECLARE_METATYPE(IntPair)
Q_DECLARE_METATYPE(IntPairList)
Q_DECLARE_METATYPE(QModelIndex)
class tst_QSortFilterProxyModel : public QObject class tst_QSortFilterProxyModel : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -179,7 +174,6 @@ tst_QSortFilterProxyModel::tst_QSortFilterProxyModel()
void tst_QSortFilterProxyModel::initTestCase() void tst_QSortFilterProxyModel::initTestCase()
{ {
qRegisterMetaType<QModelIndex>("QModelIndex");
qRegisterMetaType<IntList>("IntList"); qRegisterMetaType<IntList>("IntList");
qRegisterMetaType<IntPair>("IntPair"); qRegisterMetaType<IntPair>("IntPair");
qRegisterMetaType<IntPairList>("IntPairList"); qRegisterMetaType<IntPairList>("IntPairList");

View File

@ -572,8 +572,6 @@ void tst_QEventLoop::processEventsExcludeTimers()
timerReceiver.gotTimerEvent = -1; timerReceiver.gotTimerEvent = -1;
} }
Q_DECLARE_METATYPE(QThread*)
namespace DeliverInDefinedOrder { namespace DeliverInDefinedOrder {
enum { NbThread = 3, NbObject = 500, NbEventQueue = 5, NbEvent = 50 }; enum { NbThread = 3, NbObject = 500, NbEventQueue = 5, NbEvent = 50 };

View File

@ -396,7 +396,6 @@ void tst_QAlgorithms::sortedList()
QCOMPARE(list.at(5), 8); QCOMPARE(list.at(5), 8);
} }
Q_DECLARE_METATYPE(QList<int>)
void tst_QAlgorithms::test_qLowerBound_data() void tst_QAlgorithms::test_qLowerBound_data()
{ {
@ -615,7 +614,6 @@ void tst_QAlgorithms::stableSortTest()
} }
} }
Q_DECLARE_METATYPE(QVector<int>)
void tst_QAlgorithms::stableSortCorrectnessTest_data() void tst_QAlgorithms::stableSortCorrectnessTest_data()
{ {

View File

@ -99,8 +99,6 @@ private slots:
void resize(); void resize();
}; };
Q_DECLARE_METATYPE(QBitArray)
void tst_QBitArray::size_data() void tst_QBitArray::size_data()
{ {
//create the testtable instance and define the elements //create the testtable instance and define the elements

View File

@ -245,7 +245,6 @@ QByteArray verifyZeroTermination(const QByteArray &ba)
tst_QByteArray::tst_QByteArray() tst_QByteArray::tst_QByteArray()
{ {
qRegisterMetaType<qulonglong>("qulonglong");
} }
void tst_QByteArray::qCompress_data() void tst_QByteArray::qCompress_data()
@ -1235,7 +1234,6 @@ void tst_QByteArray::toInt()
QCOMPARE( number, expectednumber ); QCOMPARE( number, expectednumber );
} }
Q_DECLARE_METATYPE(qulonglong)
void tst_QByteArray::toULong_data() void tst_QByteArray::toULong_data()
{ {
QTest::addColumn<QByteArray>("str"); QTest::addColumn<QByteArray>("str");

View File

@ -109,7 +109,6 @@ private:
QDate invalidDate() const { return QDate(); } QDate invalidDate() const { return QDate(); }
}; };
Q_DECLARE_METATYPE(QDate)
Q_DECLARE_METATYPE(Qt::DateFormat) Q_DECLARE_METATYPE(Qt::DateFormat)
void tst_QDate::isNull_data() void tst_QDate::isNull_data()

View File

@ -147,9 +147,6 @@ private:
QTime invalidTime() const { return QTime(-1, -1, -1); } QTime invalidTime() const { return QTime(-1, -1, -1); }
}; };
Q_DECLARE_METATYPE(QDateTime)
Q_DECLARE_METATYPE(QDate)
Q_DECLARE_METATYPE(QTime)
Q_DECLARE_METATYPE(Qt::TimeSpec) Q_DECLARE_METATYPE(Qt::TimeSpec)
Q_DECLARE_METATYPE(Qt::DateFormat) Q_DECLARE_METATYPE(Qt::DateFormat)

View File

@ -158,8 +158,6 @@ void tst_QEasingCurve::propertyDefaults()
typedef QList<int> IntList; typedef QList<int> IntList;
typedef QList<qreal> RealList; typedef QList<qreal> RealList;
Q_DECLARE_METATYPE(IntList)
Q_DECLARE_METATYPE(RealList)
void tst_QEasingCurve::valueForProgress_data() void tst_QEasingCurve::valueForProgress_data()
{ {

View File

@ -1546,9 +1546,6 @@ void tst_QList::constSharedNullComplex() const
QCOMPARE(liveCount, Complex::getLiveCount()); QCOMPARE(liveCount, Complex::getLiveCount());
} }
Q_DECLARE_METATYPE(QList<int>);
Q_DECLARE_METATYPE(QList<Complex>);
template <class T> template <class T>
void generateSetSharableData() void generateSetSharableData()
{ {

View File

@ -74,8 +74,6 @@ extern "C" DWORD GetThreadLocale(void) {
# include <stdlib.h> # include <stdlib.h>
#endif #endif
Q_DECLARE_METATYPE(qlonglong)
Q_DECLARE_METATYPE(QDate)
Q_DECLARE_METATYPE(QLocale::FormatType) Q_DECLARE_METATYPE(QLocale::FormatType)
class tst_QLocale : public QObject class tst_QLocale : public QObject
@ -135,6 +133,8 @@ private slots:
void monthName(); void monthName();
void standaloneMonthName(); void standaloneMonthName();
void defaultNumeringSystem();
void ampm(); void ampm();
void currency(); void currency();
void quoteString(); void quoteString();
@ -957,7 +957,6 @@ void tst_QLocale::formatDate()
QCOMPARE(l.toString(date, format), result); QCOMPARE(l.toString(date, format), result);
} }
Q_DECLARE_METATYPE(QTime)
void tst_QLocale::formatTime_data() void tst_QLocale::formatTime_data()
{ {
@ -1530,6 +1529,10 @@ void tst_QLocale::dayName()
QLocale l(locale_name); QLocale l(locale_name);
QCOMPARE(l.dayName(day, format), dayName); QCOMPARE(l.dayName(day, format), dayName);
QLocale ir("ga_IE");
QCOMPARE(ir.dayName(1, QLocale::ShortFormat), QLatin1String("Luan"));
QCOMPARE(ir.dayName(7, QLocale::ShortFormat), QLatin1String("Domh"));
} }
void tst_QLocale::standaloneDayName_data() void tst_QLocale::standaloneDayName_data()
@ -1589,6 +1592,42 @@ a(QLatin1String("0.0000000000000000000000000000000000000000000000000000000000000
QVERIFY(!ok); QVERIFY(!ok);
} }
void tst_QLocale::defaultNumeringSystem()
{
QLocale sk("sk_SK");
QCOMPARE(sk.toString(123), QLatin1String("123"));
QLocale ta("ta_IN");
QCOMPARE(ta.toString(123), QLatin1String("123"));
QLocale te("te_IN");
QCOMPARE(te.toString(123), QLatin1String("123"));
QLocale hi("hi_IN");
QCOMPARE(hi.toString(123), QLatin1String("123"));
QLocale gu("gu_IN");
QCOMPARE(gu.toString(123), QLatin1String("123"));
QLocale kn("kn_IN");
QCOMPARE(kn.toString(123), QLatin1String("123"));
QLocale pa("pa_IN");
QCOMPARE(pa.toString(123), QLatin1String("123"));
QLocale ne("ne_IN");
QCOMPARE(ne.toString(123), QLatin1String("123"));
QLocale mr("mr_IN");
QCOMPARE(mr.toString(123), QLatin1String("123"));
QLocale ml("ml_IN");
QCOMPARE(ml.toString(123), QLatin1String("123"));
QLocale kok("kok_IN");
QCOMPARE(kok.toString(123), QLatin1String("123"));
}
void tst_QLocale::ampm() void tst_QLocale::ampm()
{ {
QLocale c(QLocale::C); QLocale c(QLocale::C);
@ -1610,6 +1649,10 @@ void tst_QLocale::ampm()
QLocale ua("uk_UA"); QLocale ua("uk_UA");
QCOMPARE(ua.amText(), QString::fromUtf8("\320\264\320\277")); QCOMPARE(ua.amText(), QString::fromUtf8("\320\264\320\277"));
QCOMPARE(ua.pmText(), QString::fromUtf8("\320\277\320\277")); QCOMPARE(ua.pmText(), QString::fromUtf8("\320\277\320\277"));
QLocale tr("tr_TR");
QCOMPARE(tr.amText(), QString::fromUtf8("\303\226\303\226"));
QCOMPARE(tr.pmText(), QString::fromUtf8("\303\226\123"));
} }
void tst_QLocale::dateFormat() void tst_QLocale::dateFormat()
@ -1676,6 +1719,10 @@ void tst_QLocale::monthName()
// check that our CLDR scripts handle surrogate pairs correctly // check that our CLDR scripts handle surrogate pairs correctly
QLocale dsrt("en-Dsrt-US"); QLocale dsrt("en-Dsrt-US");
QCOMPARE(dsrt.monthName(1, QLocale::LongFormat), QString::fromUtf8("\xf0\x90\x90\x96\xf0\x90\x90\xb0\xf0\x90\x91\x8c\xf0\x90\x90\xb7\xf0\x90\x90\xad\xf0\x90\x90\xaf\xf0\x90\x91\x89\xf0\x90\x90\xa8")); QCOMPARE(dsrt.monthName(1, QLocale::LongFormat), QString::fromUtf8("\xf0\x90\x90\x96\xf0\x90\x90\xb0\xf0\x90\x91\x8c\xf0\x90\x90\xb7\xf0\x90\x90\xad\xf0\x90\x90\xaf\xf0\x90\x91\x89\xf0\x90\x90\xa8"));
QLocale ir("ga_IE");
QCOMPARE(ir.monthName(1, QLocale::ShortFormat), QLatin1String("Ean"));
QCOMPARE(ir.monthName(12, QLocale::ShortFormat), QLatin1String("Noll"));
} }
void tst_QLocale::standaloneMonthName() void tst_QLocale::standaloneMonthName()

View File

@ -45,10 +45,6 @@
#include <limits.h> #include <limits.h>
#include <qdebug.h> #include <qdebug.h>
Q_DECLARE_METATYPE(QRectF)
Q_DECLARE_METATYPE(QPointF)
Q_DECLARE_METATYPE(QRect)
Q_DECLARE_METATYPE(QPoint)
class tst_QRect : public QObject class tst_QRect : public QObject
{ {

View File

@ -71,7 +71,6 @@ struct Match
}; };
Q_DECLARE_METATYPE(Match) Q_DECLARE_METATYPE(Match)
Q_DECLARE_METATYPE(QList<Match>)
bool operator==(const QRegularExpressionMatch &rem, const Match &m) bool operator==(const QRegularExpressionMatch &rem, const Match &m)
{ {

View File

@ -0,0 +1,116 @@
/****************************************************************************
**
** Copyright (C) 2013 Intel Corporation.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
/*
* This file exists because tst_qsharedpointer.cpp is compiled with
* QT_SHAREDPOINTER_TRACK_POINTERS. That changes some behavior.
*
* Note that most of these tests may yield false-positives in debug mode, but
* they should not yield false negatives. That is, they may report PASS when
* they are failing, but they should not produce FAILs.
*
* The reason for that is because of C++'s One Definition Rule: the macro
* changes some functions and, in debug mode, they will not be inlined. At link
* time, the two functions would be merged.
*/
#include <qsharedpointer.h>
#include <QtTest>
#include "nontracked.h"
// We can't name our classes Data and DerivedData: those are in tst_qsharedpointer.cpp
namespace NonTracked {
class Data
{
public:
static int destructorCounter;
static int generationCounter;
int generation;
Data() : generation(++generationCounter)
{ }
virtual ~Data()
{
if (generation <= 0)
qFatal("tst_qsharedpointer: Double deletion!");
generation = 0;
++destructorCounter;
}
};
int Data::generationCounter = 0;
int Data::destructorCounter = 0;
class DerivedData: public Data
{
public:
static int derivedDestructorCounter;
int moreData;
DerivedData() : moreData(0) { }
~DerivedData() { ++derivedDestructorCounter; }
};
int DerivedData::derivedDestructorCounter = 0;
#ifndef QTEST_NO_RTTI
void dynamicCastFailureNoLeak()
{
Data::destructorCounter = DerivedData::derivedDestructorCounter = 0;
// see QTBUG-28924
QSharedPointer<Data> a(new Data);
QSharedPointer<DerivedData> b = a.dynamicCast<DerivedData>();
QVERIFY(!a.isNull());
QVERIFY(b.isNull());
a.clear();
b.clear();
QVERIFY(a.isNull());
// verify that the destructors were called
QCOMPARE(Data::destructorCounter, 1);
QCOMPARE(DerivedData::derivedDestructorCounter, 0);
}
#endif
} // namespace NonTracked

View File

@ -0,0 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2013 Intel Corporation.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef NONTRACKED_H
#define NONTRACKED_H
namespace NonTracked {
void dynamicCastFailureNoLeak();
}
#endif // NONTRACKED_H

View File

@ -5,9 +5,11 @@ QT = core testlib
SOURCES = tst_qsharedpointer.cpp \ SOURCES = tst_qsharedpointer.cpp \
forwarddeclared.cpp \ forwarddeclared.cpp \
nontracked.cpp \
wrapper.cpp wrapper.cpp
HEADERS = forwarddeclared.h \ HEADERS = forwarddeclared.h \
nontracked.h \
wrapper.h wrapper.h
TESTDATA += forwarddeclared.cpp forwarddeclared.h TESTDATA += forwarddeclared.cpp forwarddeclared.h

View File

@ -50,6 +50,7 @@
#include "externaltests.h" #include "externaltests.h"
#include "forwarddeclared.h" #include "forwarddeclared.h"
#include "nontracked.h"
#include "wrapper.h" #include "wrapper.h"
#include <stdlib.h> #include <stdlib.h>
@ -88,6 +89,7 @@ private slots:
void dynamicCastDifferentPointers(); void dynamicCastDifferentPointers();
void dynamicCastVirtualBase(); void dynamicCastVirtualBase();
void dynamicCastFailure(); void dynamicCastFailure();
void dynamicCastFailureNoLeak();
#endif #endif
void constCorrectness(); void constCorrectness();
void customDeleter(); void customDeleter();
@ -1110,6 +1112,11 @@ void tst_QSharedPointer::dynamicCastFailure()
QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1); QCOMPARE(int(refCountData(baseptr)->weakref.load()), 1);
QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1); QCOMPARE(int(refCountData(baseptr)->strongref.load()), 1);
} }
void tst_QSharedPointer::dynamicCastFailureNoLeak()
{
NonTracked::dynamicCastFailureNoLeak();
}
#endif #endif
void tst_QSharedPointer::constCorrectness() void tst_QSharedPointer::constCorrectness()

View File

@ -42,7 +42,6 @@
#include <QtTest/QtTest> #include <QtTest/QtTest>
#include <qsize.h> #include <qsize.h>
Q_DECLARE_METATYPE(QSize)
class tst_QSize : public QObject class tst_QSize : public QObject
{ {

View File

@ -42,7 +42,6 @@
#include <QtTest/QtTest> #include <QtTest/QtTest>
#include <qsize.h> #include <qsize.h>
Q_DECLARE_METATYPE(QSizeF)
class tst_QSizeF : public QObject class tst_QSizeF : public QObject
{ {

View File

@ -67,7 +67,6 @@
#include <locale.h> #include <locale.h>
#include <qhash.h> #include <qhash.h>
Q_DECLARE_METATYPE(qlonglong)
#define CREATE_REF(string) \ #define CREATE_REF(string) \
const QString padded = QString::fromLatin1(" %1 ").arg(string); \ const QString padded = QString::fromLatin1(" %1 ").arg(string); \
@ -316,9 +315,6 @@ QString verifyZeroTermination(const QString &str)
typedef QList<int> IntList; typedef QList<int> IntList;
Q_DECLARE_METATYPE(QList<QVariant>)
Q_DECLARE_METATYPE(IntList)
// This next bit is needed for the NAN and INF in string -> number conversion tests // This next bit is needed for the NAN and INF in string -> number conversion tests
#include <float.h> #include <float.h>
#include <limits.h> #include <limits.h>

View File

@ -46,7 +46,6 @@
#include <qlocale.h> #include <qlocale.h>
#include <locale.h> #include <locale.h>
Q_DECLARE_METATYPE(qlonglong)
class tst_QStringRef : public QObject class tst_QStringRef : public QObject
{ {
@ -84,9 +83,6 @@ static QStringRef emptyRef()
typedef QList<int> IntList; typedef QList<int> IntList;
Q_DECLARE_METATYPE(QList<QVariant>)
Q_DECLARE_METATYPE(IntList)
// This next bit is needed for the NAN and INF in string -> number conversion tests // This next bit is needed for the NAN and INF in string -> number conversion tests
#include <float.h> #include <float.h>
#include <limits.h> #include <limits.h>

View File

@ -78,7 +78,6 @@ private slots:
void thaiLineBreak(); void thaiLineBreak();
}; };
Q_DECLARE_METATYPE(QList<int>)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace QTest { namespace QTest {

View File

@ -80,7 +80,6 @@ private:
QTime invalidTime() { return QTime(-1, -1, -1); } QTime invalidTime() { return QTime(-1, -1, -1); }
}; };
Q_DECLARE_METATYPE(QTime)
Q_DECLARE_METATYPE(Qt::DateFormat) Q_DECLARE_METATYPE(Qt::DateFormat)
void tst_QTime::addSecs_data() void tst_QTime::addSecs_data()

View File

@ -130,7 +130,6 @@ void tst_QTimeLine::currentTime()
{ {
QTimeLine timeLine(2000); QTimeLine timeLine(2000);
timeLine.setUpdateInterval((timeLine.duration()/2) / 33); timeLine.setUpdateInterval((timeLine.duration()/2) / 33);
qRegisterMetaType<qreal>("qreal");
QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal))); QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal)));
QVERIFY(spy.isValid()); QVERIFY(spy.isValid());
timeLine.setFrameRange(10, 20); timeLine.setFrameRange(10, 20);
@ -225,7 +224,6 @@ void tst_QTimeLine::value()
QVERIFY(timeLine.currentValue() == 0.0); QVERIFY(timeLine.currentValue() == 0.0);
// Default speed // Default speed
qRegisterMetaType<qreal>("qreal");
QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal))); QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal)));
QVERIFY(spy.isValid()); QVERIFY(spy.isValid());
timeLine.start(); timeLine.start();

View File

@ -296,7 +296,6 @@ private:
template<typename T> void detach() const; template<typename T> void detach() const;
}; };
Q_DECLARE_METATYPE(QVector<int>);
template<typename T> struct SimpleValue template<typename T> struct SimpleValue
{ {

View File

@ -45,7 +45,6 @@
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtDBus/QtDBus> #include <QtDBus/QtDBus>
Q_DECLARE_METATYPE(QVariantList)
class MyObject: public QObject class MyObject: public QObject
{ {

View File

@ -45,9 +45,6 @@
#include <QtTest/QtTest> #include <QtTest/QtTest>
#include <QtDBus> #include <QtDBus>
Q_DECLARE_METATYPE(QVariant)
Q_DECLARE_METATYPE(QList<int>)
Q_DECLARE_METATYPE(QVector<int>)
class tst_QDBusLocalCalls: public QObject class tst_QDBusLocalCalls: public QObject
{ {

View File

@ -56,42 +56,13 @@ static bool compareFileDescriptors(int fd1, int fd2)
} }
#endif #endif
Q_DECLARE_METATYPE(QVariant)
Q_DECLARE_METATYPE(QList<bool>)
Q_DECLARE_METATYPE(QList<short>)
Q_DECLARE_METATYPE(QList<ushort>)
Q_DECLARE_METATYPE(QList<int>)
Q_DECLARE_METATYPE(QList<uint>)
Q_DECLARE_METATYPE(QList<qlonglong>)
Q_DECLARE_METATYPE(QList<qulonglong>)
Q_DECLARE_METATYPE(QList<double>)
Q_DECLARE_METATYPE(QList<QDBusVariant>)
Q_DECLARE_METATYPE(QList<QDateTime>)
Q_DECLARE_METATYPE(QList<QByteArray>)
Q_DECLARE_METATYPE(QList<QVariantList>)
Q_DECLARE_METATYPE(QList<QStringList>)
Q_DECLARE_METATYPE(QList<QList<bool> >)
Q_DECLARE_METATYPE(QList<QList<short> >)
Q_DECLARE_METATYPE(QList<QList<ushort> >)
Q_DECLARE_METATYPE(QList<QList<int> >)
Q_DECLARE_METATYPE(QList<QList<uint> >)
Q_DECLARE_METATYPE(QList<QList<qlonglong> >)
Q_DECLARE_METATYPE(QList<QList<qulonglong> >)
Q_DECLARE_METATYPE(QList<QList<double> >)
Q_DECLARE_METATYPE(QList<QList<QDBusObjectPath> >)
Q_DECLARE_METATYPE(QList<QList<QDBusSignature> >)
typedef QMap<int, QString> IntStringMap; typedef QMap<int, QString> IntStringMap;
typedef QMap<QString, QString> StringStringMap; typedef QMap<QString, QString> StringStringMap;
typedef QMap<QDBusObjectPath, QString> ObjectPathStringMap; typedef QMap<QDBusObjectPath, QString> ObjectPathStringMap;
typedef QMap<qlonglong, QDateTime> LLDateTimeMap; typedef QMap<qlonglong, QDateTime> LLDateTimeMap;
typedef QMap<QDBusSignature, QString> SignatureStringMap; typedef QMap<QDBusSignature, QString> SignatureStringMap;
Q_DECLARE_METATYPE(IntStringMap)
Q_DECLARE_METATYPE(StringStringMap) Q_DECLARE_METATYPE(StringStringMap)
Q_DECLARE_METATYPE(ObjectPathStringMap)
Q_DECLARE_METATYPE(LLDateTimeMap) Q_DECLARE_METATYPE(LLDateTimeMap)
Q_DECLARE_METATYPE(SignatureStringMap)
static bool compare(const QDBusUnixFileDescriptor &t1, const QDBusUnixFileDescriptor &t2) static bool compare(const QDBusUnixFileDescriptor &t1, const QDBusUnixFileDescriptor &t2)
{ {
@ -144,7 +115,6 @@ struct MyVariantMapStruct
{ return s == other.s && map == other.map; } { return s == other.s && map == other.map; }
}; };
Q_DECLARE_METATYPE(MyVariantMapStruct) Q_DECLARE_METATYPE(MyVariantMapStruct)
Q_DECLARE_METATYPE(QList<MyVariantMapStruct>)
QDBusArgument &operator<<(QDBusArgument &arg, const MyVariantMapStruct &ms) QDBusArgument &operator<<(QDBusArgument &arg, const MyVariantMapStruct &ms)
{ {
@ -170,7 +140,6 @@ struct MyFileDescriptorStruct
{ return compare(fd, other.fd); } { return compare(fd, other.fd); }
}; };
Q_DECLARE_METATYPE(MyFileDescriptorStruct) Q_DECLARE_METATYPE(MyFileDescriptorStruct)
Q_DECLARE_METATYPE(QList<MyFileDescriptorStruct>)
QDBusArgument &operator<<(QDBusArgument &arg, const MyFileDescriptorStruct &ms) QDBusArgument &operator<<(QDBusArgument &arg, const MyFileDescriptorStruct &ms)
{ {

View File

@ -83,9 +83,6 @@ Q_DECLARE_METATYPE(Struct1)
Q_DECLARE_METATYPE(Struct4) Q_DECLARE_METATYPE(Struct4)
Q_DECLARE_METATYPE(StringPair) Q_DECLARE_METATYPE(StringPair)
Q_DECLARE_METATYPE(QList<Struct1>)
Q_DECLARE_METATYPE(QList<Struct4>)
Q_DECLARE_METATYPE(const QMetaObject*) Q_DECLARE_METATYPE(const QMetaObject*)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -93,11 +93,6 @@ Q_DECLARE_METATYPE(Struct3)
Q_DECLARE_METATYPE(Struct4) Q_DECLARE_METATYPE(Struct4)
Q_DECLARE_METATYPE(StringPair) Q_DECLARE_METATYPE(StringPair)
Q_DECLARE_METATYPE(QList<Struct1>)
Q_DECLARE_METATYPE(QList<Struct2>)
Q_DECLARE_METATYPE(QList<Struct3>)
Q_DECLARE_METATYPE(QList<Struct4>)
Q_DECLARE_METATYPE(Invalid0) Q_DECLARE_METATYPE(Invalid0)
Q_DECLARE_METATYPE(Invalid1) Q_DECLARE_METATYPE(Invalid1)
Q_DECLARE_METATYPE(Invalid2) Q_DECLARE_METATYPE(Invalid2)
@ -107,14 +102,9 @@ Q_DECLARE_METATYPE(Invalid5)
Q_DECLARE_METATYPE(Invalid6) Q_DECLARE_METATYPE(Invalid6)
Q_DECLARE_METATYPE(Invalid7) Q_DECLARE_METATYPE(Invalid7)
Q_DECLARE_METATYPE(QList<Invalid0>)
typedef QMap<int, QString> IntStringMap; typedef QMap<int, QString> IntStringMap;
typedef QMap<QString, QString> StringStringMap; typedef QMap<QString, QString> StringStringMap;
typedef QMap<QString, Struct1> StringStruct1Map; typedef QMap<QString, Struct1> StringStruct1Map;
Q_DECLARE_METATYPE(IntStringMap)
Q_DECLARE_METATYPE(StringStringMap)
Q_DECLARE_METATYPE(StringStruct1Map)
Q_DECLARE_METATYPE(QVariant::Type) Q_DECLARE_METATYPE(QVariant::Type)

View File

@ -45,7 +45,6 @@
#include <qicon.h> #include <qicon.h>
#include <qiconengine.h> #include <qiconengine.h>
Q_DECLARE_METATYPE(QSize)
class tst_QIcon : public QObject class tst_QIcon : public QObject
{ {

View File

@ -57,13 +57,6 @@
typedef QMap<QString, QString> QStringMap; typedef QMap<QString, QString> QStringMap;
typedef QList<int> QIntList; typedef QList<int> QIntList;
Q_DECLARE_METATYPE(QImage)
Q_DECLARE_METATYPE(QRect)
Q_DECLARE_METATYPE(QSize)
Q_DECLARE_METATYPE(QColor)
Q_DECLARE_METATYPE(QStringMap)
Q_DECLARE_METATYPE(QIntList)
Q_DECLARE_METATYPE(QIODevice *)
Q_DECLARE_METATYPE(QImage::Format) Q_DECLARE_METATYPE(QImage::Format)
class tst_QImageReader : public QObject class tst_QImageReader : public QObject

View File

@ -58,11 +58,7 @@
typedef QMap<QString, QString> QStringMap; typedef QMap<QString, QString> QStringMap;
typedef QList<int> QIntList; typedef QList<int> QIntList;
Q_DECLARE_METATYPE(QImage)
Q_DECLARE_METATYPE(QStringMap)
Q_DECLARE_METATYPE(QIntList)
Q_DECLARE_METATYPE(QImageWriter::ImageWriterError) Q_DECLARE_METATYPE(QImageWriter::ImageWriterError)
Q_DECLARE_METATYPE(QIODevice *)
Q_DECLARE_METATYPE(QImage::Format) Q_DECLARE_METATYPE(QImage::Format)
class tst_QImageWriter : public QObject class tst_QImageWriter : public QObject

View File

@ -200,10 +200,6 @@ static bool lenientCompare(const QPixmap &actual, const QPixmap &expected)
return true; return true;
} }
Q_DECLARE_METATYPE(QImage)
Q_DECLARE_METATYPE(QPixmap)
Q_DECLARE_METATYPE(QMatrix)
Q_DECLARE_METATYPE(QBitmap)
tst_QPixmap::tst_QPixmap() tst_QPixmap::tst_QPixmap()
{ {

View File

@ -153,10 +153,8 @@ private:
static const int defaultSize = 3; static const int defaultSize = 3;
Q_DECLARE_METATYPE(QModelIndex)
Q_DECLARE_METATYPE(QStandardItem*) Q_DECLARE_METATYPE(QStandardItem*)
Q_DECLARE_METATYPE(Qt::Orientation) Q_DECLARE_METATYPE(Qt::Orientation)
Q_DECLARE_METATYPE(QVariantList)
tst_QStandardItemModel::tst_QStandardItemModel() : m_model(0), rcParent(8), rcFirst(8,0), rcLast(8,0) tst_QStandardItemModel::tst_QStandardItemModel() : m_model(0), rcParent(8), rcFirst(8,0), rcLast(8,0)
{ {
@ -178,7 +176,6 @@ tst_QStandardItemModel::~tst_QStandardItemModel()
*/ */
void tst_QStandardItemModel::init() void tst_QStandardItemModel::init()
{ {
qRegisterMetaType<QModelIndex>("QModelIndex");
qRegisterMetaType<QStandardItem*>("QStandardItem*"); qRegisterMetaType<QStandardItem*>("QStandardItem*");
qRegisterMetaType<Qt::Orientation>("Qt::Orientation"); qRegisterMetaType<Qt::Orientation>("Qt::Orientation");

View File

@ -79,7 +79,6 @@ private slots:
void debug(); void debug();
}; };
Q_DECLARE_METATYPE(QBrush)
tst_QBrush::tst_QBrush() tst_QBrush::tst_QBrush()
{ {

View File

@ -224,7 +224,6 @@ void tst_QColor::getSetCheck()
QCOMPARE(obj1.rgb(), qRgb(0, 0, 0)); QCOMPARE(obj1.rgb(), qRgb(0, 0, 0));
} }
Q_DECLARE_METATYPE(QColor)
tst_QColor::tst_QColor() tst_QColor::tst_QColor()

View File

@ -81,10 +81,6 @@
#include <qfontdatabase.h> #include <qfontdatabase.h>
Q_DECLARE_METATYPE(QGradientStops) Q_DECLARE_METATYPE(QGradientStops)
Q_DECLARE_METATYPE(QLine)
Q_DECLARE_METATYPE(QRect)
Q_DECLARE_METATYPE(QSize)
Q_DECLARE_METATYPE(QPoint)
Q_DECLARE_METATYPE(QPainterPath) Q_DECLARE_METATYPE(QPainterPath)
class tst_QPainter : public QObject class tst_QPainter : public QObject
@ -365,13 +361,6 @@ void tst_QPainter::getSetCheck()
QCOMPARE(true, obj1.viewTransformEnabled()); QCOMPARE(true, obj1.viewTransformEnabled());
} }
Q_DECLARE_METATYPE(QPixmap)
Q_DECLARE_METATYPE(QPolygon)
Q_DECLARE_METATYPE(QBrush)
Q_DECLARE_METATYPE(QPen)
Q_DECLARE_METATYPE(QFont)
Q_DECLARE_METATYPE(QColor)
Q_DECLARE_METATYPE(QRegion)
tst_QPainter::tst_QPainter() tst_QPainter::tst_QPainter()
{ {

View File

@ -161,8 +161,6 @@ void tst_QPainterPath::swap()
} }
Q_DECLARE_METATYPE(QPainterPath) Q_DECLARE_METATYPE(QPainterPath)
Q_DECLARE_METATYPE(QPointF)
Q_DECLARE_METATYPE(QRectF)
void tst_QPainterPath::currentPosition() void tst_QPainterPath::currentPosition()
{ {

Some files were not shown because too many files have changed in this diff Show More