Merge branch 'stable' into dev

Conflicts:
	tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp

Change-Id: I6b8d505fc22f052c307ca27f58f7d16f98965f47
This commit is contained in:
Frederik Gladhorn 2013-01-07 15:18:16 +01:00
commit cdf13ce286
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
QT_INSTALL_SETTINGS=/Library/Preferences/Qt
else
QT_INSTALL_SETTINGS=/etc/xdg
QT_INSTALL_SETTINGS=$QT_INSTALL_PREFIX/etc/xdg
fi
fi
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>
(default DATADIR/translations)
-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>
(default PREFIX/examples)
-testsdir <dir> ....... Tests will be installed to <dir>

View File

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

View File

@ -143,6 +143,8 @@ QDateTime dateTime = QDateTime::fromString("130", "Mm"); // invalid
//! [14]
QDateTime dateTime = QDateTime::fromString("1.30.1", "M.d.s");
// 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]
//! [15]
@ -191,4 +193,16 @@ UTC.setTimeSpec(Qt::UTC);
qDebug() << "UTC time is:" << UTC;
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 */
#ifdef __cplusplus
# if defined(Q_OS_BLACKBERRY) || defined(Q_OS_QNX)
# if defined(Q_OS_QNX)
# include <utility>
# if defined(_YVALS) || defined(_LIBCPP_VER)
// QNX: libcpp (Dinkumware-based) doesn't have the <initializer_list>
@ -702,9 +702,12 @@
# ifdef Q_COMPILER_INITIALIZER_LISTS
# undef Q_COMPILER_INITIALIZER_LISTS
# endif
# ifdef Q_COMPILER_RVALUE_REFS
# undef Q_COMPILER_RVALUE_REFS
# endif
# endif
# endif
#endif // Q_OS_BLACKBERRY || Q_OS_QNX
#endif // Q_OS_QNX
/*
* 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,
timeval *timeout)
{
@ -279,9 +284,6 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef
BpsChannelScopeSwitcher channelSwitcher(d->bps_channel);
// Make a note of the start time
timeval startTime = qt_gettime();
// prepare file sets for bps callback
d->ioData->count = 0;
d->ioData->readfds = readfds;
@ -298,15 +300,15 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef
if (exceptfds)
FD_ZERO(exceptfds);
bps_event_t *event = 0;
unsigned int eventCount = 0;
// Convert timeout to milliseconds
int timeoutTotal = -1;
if (timeout)
timeoutTotal = (timeout->tv_sec * 1000) + (timeout->tv_usec / 1000);
timeoutTotal = timevalToMillisecs(*timeout);
int timeoutLeft = timeoutTotal;
bps_event_t *event = 0;
unsigned int eventCount = 0;
timeval startTime = qt_gettime();
// 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
@ -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
if (timeoutTotal != -1) {
timeval t2 = qt_gettime();
timeoutLeft = timeoutTotal - ((t2.tv_sec * 1000 + t2.tv_usec / 1000)
- (startTime.tv_sec * 1000 + startTime.tv_usec / 1000));
timeoutLeft = timeoutTotal
- (timevalToMillisecs(t2) - timevalToMillisecs(startTime));
if (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

View File

@ -472,7 +472,7 @@ int QMetaObject::constructorCount() const
/*!
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.
Use code like the following to obtain a QStringList containing the methods

View File

@ -240,6 +240,7 @@ struct DefinedTypesFilter {
\omitvalue PointerToQObject
\omitvalue WeakPointerToQObject
\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
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
defaults are used:

View File

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

View File

@ -813,6 +813,8 @@ template <class X, class T>
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
if (!ptr)
return QSharedPointer<X>();
return QtSharedPointer::copyAndSetPointer(ptr, src);
}
template <class X, class T>

View File

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

View File

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

View File

@ -1392,7 +1392,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
// Ignore mouse events that don't change the current state.
return;
}
buttons = e->buttons;
mouse_buttons = buttons = e->buttons;
if (button & e->buttons) {
ulong doubleClickInterval = static_cast<ulong>(qApp->styleHints()->mouseDoubleClickInterval());
doubleClick = e->timestamp - mousePressTime < doubleClickInterval && button == mousePressButton;
@ -1688,7 +1688,10 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
type = e->down ? QEvent::TabletPress : QEvent::TabletRelease;
tabletState = e->down;
}
QWindow *window = e->window.data();
modifier_buttons = e->modifiers;
bool localValid = true;
// 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.
@ -1719,7 +1722,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
QTabletEvent ev(type, local, e->global,
e->device, e->pointerType, e->pressure, e->xTilt, e->yTilt,
e->tangentialPressure, e->rotation, e->z,
e->mods, e->uid);
e->modifiers, e->uid);
ev.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(window, &ev);
#else

View File

@ -1105,16 +1105,16 @@ void QWindow::setGeometry(const QRect &rect)
d->platformWindow->setGeometry(rect);
} else {
d->geometry = rect;
}
if (rect.x() != oldRect.x())
emit xChanged(rect.x());
if (rect.y() != oldRect.y())
emit yChanged(rect.y());
if (rect.width() != oldRect.width())
emit widthChanged(rect.width());
if (rect.height() != oldRect.height())
emit heightChanged(rect.height());
if (rect.x() != oldRect.x())
emit xChanged(rect.x());
if (rect.y() != oldRect.y())
emit yChanged(rect.y());
if (rect.width() != oldRect.width())
emit widthChanged(rect.width());
if (rect.height() != oldRect.height())
emit heightChanged(rect.height());
}
}
/*!

View File

@ -302,10 +302,10 @@ public:
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,
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),
pressure(pressure), xTilt(xTilt), yTilt(yTilt), tangentialPressure(tpressure),
rotation(rotation), z(z), uid(uid), mods(mods) { }
rotation(rotation), z(z), uid(uid) { }
bool down;
QPointF local;
QPointF global;
@ -318,7 +318,6 @@ public:
qreal rotation;
int z;
qint64 uid;
Qt::KeyboardModifiers mods;
};
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:
// -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 //
//============================================================================//
@ -632,16 +615,6 @@ public:
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
{
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>
inline bool QTriangulator<T>::ComplexToSimple::Event::operator < (const Event &other) const
{

View File

@ -1853,7 +1853,7 @@ void QTextEngine::justify(const QScriptLine &line)
itemize();
if (!forceJustification) {
int end = line.from + (int)line.length;
int end = line.from + (int)line.length + line.trailingSpaces;
if (end == layoutData->string.length())
return; // no justification at end of paragraph
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 ge = (end == length(firstItem+i) ? si.num_glyphs : log_clusters[end]);
Q_ASSERT(ge <= si.num_glyphs);
const QGlyphLayout g = shapedGlyphs(&si);
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
"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/
"08:27", "*.EGO.GOV.TR", // Turktrust mis-issued intermediate certificate
"08:64", "e-islem.kktcmerkezbankasi.org", // Turktrust mis-issued intermediate certificate
0
};

View File

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

View File

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

View File

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

View File

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

View File

@ -56,8 +56,6 @@
QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
/*!
\class QSpiAccessibleBridge
\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)));
}
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -70,9 +70,8 @@ static void initResources()
QT_BEGIN_NAMESPACE
QCocoaScreen::QCocoaScreen(int screenIndex) :
QPlatformScreen(), m_refreshRate(60.0)
QPlatformScreen(), m_screenIndex(screenIndex), m_refreshRate(60.0)
{
m_screen = [[NSScreen screens] objectAtIndex:screenIndex];
updateGeometry();
m_cursor = new QCocoaCursor;
}
@ -82,19 +81,25 @@ QCocoaScreen::~QCocoaScreen()
delete m_cursor;
}
NSScreen *QCocoaScreen::osScreen() const
{
return [[NSScreen screens] objectAtIndex:m_screenIndex];
}
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);
NSRect visibleRect = [m_screen visibleFrame];
NSRect visibleRect = [nsScreen visibleFrame];
m_availableGeometry = QRect(visibleRect.origin.x,
frameRect.size.height - (visibleRect.origin.y + visibleRect.size.height), // invert y
visibleRect.size.width, visibleRect.size.height);
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];
CGSize size = CGDisplayScreenSize(dpy);
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 (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
return qreal([m_screen backingScaleFactor]);
return qreal([osScreen() backingScaleFactor]);
} else
#endif
{

View File

@ -60,8 +60,7 @@ QQnxRasterBackingStore::QQnxRasterBackingStore(QWindow *window)
{
qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window;
// save platform window associated with widget
m_platformWindow = static_cast<QQnxWindow*>(window->handle());
m_window = window;
}
QQnxRasterBackingStore::~QQnxRasterBackingStore()
@ -71,8 +70,9 @@ QQnxRasterBackingStore::~QQnxRasterBackingStore()
QPaintDevice *QQnxRasterBackingStore::paintDevice()
{
if (m_platformWindow->hasBuffers())
return m_platformWindow->renderBuffer().image();
QQnxWindow *platformWindow = this->platformWindow();
if (platformWindow->hasBuffers())
return platformWindow->renderBuffer().image();
return 0;
}
@ -85,7 +85,8 @@ void QQnxRasterBackingStore::flush(QWindow *window, const QRegion &region, const
if (window)
targetWindow = static_cast<QQnxWindow *>(window->handle());
if (!targetWindow || targetWindow == m_platformWindow) {
QQnxWindow *platformWindow = this->platformWindow();
if (!targetWindow || targetWindow == platformWindow) {
// visit all pending scroll operations
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
ScrollOp &op = m_scrollOpList[i];
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
m_scrollOpList.clear();
// update the display with newly rendered content
m_platformWindow->post(region);
platformWindow->post(region);
} else if (targetWindow) {
// 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);
targetWindow->adjustBufferSize();
targetWindow->blitFrom(m_platformWindow, offset, region);
targetWindow->blitFrom(platformWindow, offset, region);
targetWindow->post(region);
} else {
@ -177,7 +178,7 @@ void QQnxRasterBackingStore::beginPaint(const QRegion &region)
qRasterBackingStoreDebug() << Q_FUNC_INFO << "w =" << window();
m_hasUnflushedPaintOperations = true;
m_platformWindow->adjustBufferSize();
platformWindow()->adjustBufferSize();
}
void QQnxRasterBackingStore::endPaint(const QRegion &region)
@ -186,4 +187,10 @@ void QQnxRasterBackingStore::endPaint(const QRegion &region)
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

View File

@ -72,7 +72,9 @@ private:
int dy;
};
QQnxWindow *m_platformWindow;
QQnxWindow *platformWindow() const;
QWindow *m_window;
QList<ScrollOp> m_scrollOpList;
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:
if (QAccessibleInterface *par = accessible->parent()) {
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;
acc = clone;
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -65,14 +65,14 @@ QVERIFY(arguments.at(2).type() == QVariant::double);
//! [2]
qRegisterMetaType<QModelIndex>("QModelIndex");
QSignalSpy spy(&model, SIGNAL(whatever(QModelIndex)));
qRegisterMetaType<SomeStruct>();
QSignalSpy spy(&model, SIGNAL(whatever(SomeStruct)));
//! [2]
//! [3]
// 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]

View File

@ -54,7 +54,7 @@
\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
*/

View File

@ -2709,16 +2709,48 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
if (receiver->isWindowType())
QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(static_cast<QWindow *>(receiver), e);
// capture the current mouse/keyboard state
if(e->spontaneous()) {
if (e->type() == QEvent::MouseButtonPress
|| e->type() == QEvent::MouseButtonRelease) {
// Capture the current mouse and keyboard states. Doing so here is
// 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);
if(me->type() == QEvent::MouseButtonPress)
QApplicationPrivate::mouse_buttons |= me->button();
else
QApplicationPrivate::mouse_buttons &= ~me->button();
QApplicationPrivate::modifier_buttons = me->modifiers();
QApplicationPrivate::mouse_buttons |= me->button();
break;
}
case QEvent::MouseButtonRelease:
{
QMouseEvent *me = static_cast<QMouseEvent*>(e);
QApplicationPrivate::modifier_buttons = me->modifiers();
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;
}
}
#ifndef QT_NO_GESTURES

View File

@ -75,6 +75,7 @@
#include <QtWidgets/QToolBar>
#include <QtWidgets/QToolButton>
#ifndef Q_OS_MAC
// X11 Includes:
// the following is necessary to work around breakage in many versions
@ -90,6 +91,7 @@
#undef XRegisterIMInstantiateCallback
#undef XUnregisterIMInstantiateCallback
#undef XSetIMValues
#endif
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_vfs_init QGtkStylePrivate::gnome_vfs_init = 0;
#ifndef Q_OS_MAC
typedef int (*x11ErrorHandler)(Display*, XErrorEvent*);
#endif
QT_END_NAMESPACE
@ -540,10 +544,14 @@ void QGtkStylePrivate::initGtkWidgets() const
}
if (QGtkStylePrivate::gtk_init) {
#ifndef Q_OS_MAC
// Gtk will set the Qt error handler so we have to reset it afterwards
x11ErrorHandler qt_x_errhandler = XSetErrorHandler(0);
#endif
QGtkStylePrivate::gtk_init (NULL, NULL);
#ifndef Q_OS_MAC
XSetErrorHandler(qt_x_errhandler);
#endif
// make a window
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();
if (modalFor) {
QGtkStylePrivate::gtk_widget_realize(gtkFileChooser); // Creates X window
#ifndef Q_OS_MAC
XSetTransientForHint(QGtkStylePrivate::gdk_x11_drawable_get_xdisplay(gtkFileChooser->window),
QGtkStylePrivate::gdk_x11_drawable_get_xid(gtkFileChooser->window),
modalFor->winId());
#ifdef Q_WS_X11
QGtkStylePrivate::gdk_x11_window_set_user_time (gtkFileChooser->window, QX11Info::appUserTime());
#endif
#endif
}
QFileInfo fileinfo(dir);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -54,11 +54,6 @@ typedef QList<int> IntList;
typedef QPair<int, int> IntPair;
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
{
Q_OBJECT
@ -179,7 +174,6 @@ tst_QSortFilterProxyModel::tst_QSortFilterProxyModel()
void tst_QSortFilterProxyModel::initTestCase()
{
qRegisterMetaType<QModelIndex>("QModelIndex");
qRegisterMetaType<IntList>("IntList");
qRegisterMetaType<IntPair>("IntPair");
qRegisterMetaType<IntPairList>("IntPairList");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -147,9 +147,6 @@ private:
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::DateFormat)

View File

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

View File

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

View File

@ -74,8 +74,6 @@ extern "C" DWORD GetThreadLocale(void) {
# include <stdlib.h>
#endif
Q_DECLARE_METATYPE(qlonglong)
Q_DECLARE_METATYPE(QDate)
Q_DECLARE_METATYPE(QLocale::FormatType)
class tst_QLocale : public QObject
@ -135,6 +133,8 @@ private slots:
void monthName();
void standaloneMonthName();
void defaultNumeringSystem();
void ampm();
void currency();
void quoteString();
@ -957,7 +957,6 @@ void tst_QLocale::formatDate()
QCOMPARE(l.toString(date, format), result);
}
Q_DECLARE_METATYPE(QTime)
void tst_QLocale::formatTime_data()
{
@ -1530,6 +1529,10 @@ void tst_QLocale::dayName()
QLocale l(locale_name);
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()
@ -1589,6 +1592,42 @@ a(QLatin1String("0.0000000000000000000000000000000000000000000000000000000000000
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()
{
QLocale c(QLocale::C);
@ -1610,6 +1649,10 @@ void tst_QLocale::ampm()
QLocale ua("uk_UA");
QCOMPARE(ua.amText(), QString::fromUtf8("\320\264\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()
@ -1676,6 +1719,10 @@ void tst_QLocale::monthName()
// check that our CLDR scripts handle surrogate pairs correctly
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"));
QLocale ir("ga_IE");
QCOMPARE(ir.monthName(1, QLocale::ShortFormat), QLatin1String("Ean"));
QCOMPARE(ir.monthName(12, QLocale::ShortFormat), QLatin1String("Noll"));
}
void tst_QLocale::standaloneMonthName()

View File

@ -44,10 +44,6 @@
#include <limits.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
{

View File

@ -71,7 +71,6 @@ struct Match
};
Q_DECLARE_METATYPE(Match)
Q_DECLARE_METATYPE(QList<Match>)
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 \
forwarddeclared.cpp \
nontracked.cpp \
wrapper.cpp
HEADERS = forwarddeclared.h \
nontracked.h \
wrapper.h
TESTDATA += forwarddeclared.cpp forwarddeclared.h

View File

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

View File

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

View File

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

View File

@ -67,7 +67,6 @@
#include <locale.h>
#include <qhash.h>
Q_DECLARE_METATYPE(qlonglong)
#define CREATE_REF(string) \
const QString padded = QString::fromLatin1(" %1 ").arg(string); \
@ -316,9 +315,6 @@ QString verifyZeroTermination(const QString &str)
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
#include <float.h>
#include <limits.h>

View File

@ -46,7 +46,6 @@
#include <qlocale.h>
#include <locale.h>
Q_DECLARE_METATYPE(qlonglong)
class tst_QStringRef : public QObject
{
@ -84,9 +83,6 @@ static QStringRef emptyRef()
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
#include <float.h>
#include <limits.h>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -57,13 +57,6 @@
typedef QMap<QString, QString> QStringMap;
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)
class tst_QImageReader : public QObject

View File

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

View File

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

View File

@ -153,10 +153,8 @@ private:
static const int defaultSize = 3;
Q_DECLARE_METATYPE(QModelIndex)
Q_DECLARE_METATYPE(QStandardItem*)
Q_DECLARE_METATYPE(Qt::Orientation)
Q_DECLARE_METATYPE(QVariantList)
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()
{
qRegisterMetaType<QModelIndex>("QModelIndex");
qRegisterMetaType<QStandardItem*>("QStandardItem*");
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");

View File

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

View File

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

View File

@ -81,10 +81,6 @@
#include <qfontdatabase.h>
Q_DECLARE_METATYPE(QGradientStops)
Q_DECLARE_METATYPE(QLine)
Q_DECLARE_METATYPE(QRect)
Q_DECLARE_METATYPE(QSize)
Q_DECLARE_METATYPE(QPoint)
Q_DECLARE_METATYPE(QPainterPath)
class tst_QPainter : public QObject
@ -365,13 +361,6 @@ void tst_QPainter::getSetCheck()
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()
{

View File

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

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