Merge remote branch 'origin/master' into refactor

Conflicts:
	src/modules/qt_openvg.pri
	src/widgets/to_be_moved/qlinecontrol_p.h
This commit is contained in:
Lars Knoll 2011-05-16 10:19:02 +02:00
commit 276d60a4d6
96 changed files with 769 additions and 431 deletions

View File

@ -1,8 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2011 Klarälvdalens Datakonsult AB,
** a KDAB Group company, info@kdab.com,
** author Stephen Kelly <stephen.kelly@kdab.com>
** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**

View File

@ -2647,10 +2647,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
QString out_directory_cdin, out_directory_cdout;
MAKE_CD_IN_AND_OUT(out_directory);
//don't need the makefile arg if it isn't changed
QString makefilein;
if(subtarget->makefile != "$(MAKEFILE)")
makefilein = " -f " + subtarget->makefile;
QString makefilein = " -f " + subtarget->makefile;
//write the rule/depends
if(flags & SubTargetOrdered) {

View File

@ -44,11 +44,11 @@
#include <stddef.h>
#define QT_VERSION_STR "4.8.0"
#define QT_VERSION_STR "5.0.0"
/*
QT_VERSION is (major << 16) + (minor << 8) + patch.
*/
#define QT_VERSION 0x040800
#define QT_VERSION 0x050000
/*
can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
*/

View File

@ -86,10 +86,11 @@ public:
Qt_4_5 = 11,
Qt_4_6 = 12,
Qt_4_7 = Qt_4_6,
Qt_4_8 = Qt_4_7
#if QT_VERSION >= 0x040900
Qt_4_8 = Qt_4_7,
Qt_4_9 = Qt_4_8,
Qt_5_0 = Qt_4_8
#if QT_VERSION >= 0x050100
#error Add the datastream version for this Qt version
Qt_4_9 = Qt_4_8
#endif
};

View File

@ -113,64 +113,6 @@ QListData::Data *QListData::detach_grow(int *idx, int num)
return x;
}
#if QT_VERSION >= 0x050000
# error "Remove QListData::detach(), it is only required for binary compatibility for 4.0.x to 4.2.x"
#endif
QListData::Data *QListData::detach()
{
Data *x = static_cast<Data *>(qMalloc(DataHeaderSize + d->alloc * sizeof(void *)));
Q_CHECK_PTR(x);
x->ref = 1;
x->sharable = true;
x->alloc = d->alloc;
if (!x->alloc) {
x->begin = 0;
x->end = 0;
} else {
x->begin = d->begin;
x->end = d->end;
}
qSwap(d, x);
if (!x->ref.deref())
return x;
return 0;
}
/*!
* Detaches the QListData by reallocating new memory.
* Returns the old (shared) data, it is up to the caller to deref() and free()
* For the new data node_copy needs to be called.
*
* \internal
*/
#if QT_VERSION >= 0x050000
# error "Remove QListData::detach2(), it is only required for binary compatibility for 4.3.x to 4.5.x"
#endif
QListData::Data *QListData::detach2()
{
Data *x = d;
Data* t = static_cast<Data *>(qMalloc(DataHeaderSize + x->alloc * sizeof(void *)));
Q_CHECK_PTR(t);
::memcpy(t, d, DataHeaderSize + d->alloc * sizeof(void *));
t->ref = 1;
t->sharable = true;
t->alloc = x->alloc;
if (!t->alloc) {
t->begin = 0;
t->end = 0;
} else {
t->begin = x->begin;
t->end = x->end;
}
d = t;
return x;
}
/*!
* Detaches the QListData by allocating new memory for a list which possibly
* has a different size than the copied one.
@ -200,21 +142,6 @@ QListData::Data *QListData::detach(int alloc)
return x;
}
/*!
* Detaches the QListData by reallocating new memory.
* Returns the old (shared) data, it is up to the caller to deref() and free()
* For the new data node_copy needs to be called.
*
* \internal
*/
#if QT_VERSION >= 0x050000
# error "Remove QListData::detach3(), it is only required for binary compatibility for 4.5.x to 4.6.x"
#endif
QListData::Data *QListData::detach3()
{
return detach(d->alloc);
}
void QListData::realloc(int alloc)
{
Q_ASSERT(d->ref == 1);
@ -253,24 +180,6 @@ void **QListData::append()
return append(1);
}
// ensures that enough space is available to append the list
#if QT_VERSION >= 0x050000
# error "Remove QListData::append(), it is only required for binary compatibility up to 4.5.x"
#endif
void **QListData::append(const QListData& l)
{
Q_ASSERT(d->ref == 1);
int e = d->end;
int n = l.d->end - l.d->begin;
if (n) {
if (e + n > d->alloc)
realloc(grow(e + n));
::memcpy(d->array + d->end, l.d->array + l.d->begin, n*sizeof(void*));
d->end += n;
}
return d->array + e;
}
// ensures that enough space is available to append the list
void **QListData::append2(const QListData& l)
{

View File

@ -3,6 +3,8 @@
#include <qdebug.h>
#include <math.h>
QT_BEGIN_NAMESPACE
#if 0
inline QString capString(int caps)
{
@ -148,28 +150,28 @@ static StrokeLine strokeLine(int strokeSelection)
switch (strokeSelection) {
case Aliased|Solid|RegularDraw:
stroke = &::drawLine<drawPixel, NoDasher>;
stroke = &QT_PREPEND_NAMESPACE(drawLine)<drawPixel, NoDasher>;
break;
case Aliased|Solid|FastDraw:
stroke = &::drawLine<drawPixelARGB32Opaque, NoDasher>;
stroke = &QT_PREPEND_NAMESPACE(drawLine)<drawPixelARGB32Opaque, NoDasher>;
break;
case Aliased|Dashed|RegularDraw:
stroke = &::drawLine<drawPixel, Dasher>;
stroke = &QT_PREPEND_NAMESPACE(drawLine)<drawPixel, Dasher>;
break;
case Aliased|Dashed|FastDraw:
stroke = &::drawLine<drawPixelARGB32Opaque, Dasher>;
stroke = &QT_PREPEND_NAMESPACE(drawLine)<drawPixelARGB32Opaque, Dasher>;
break;
case AntiAliased|Solid|RegularDraw:
stroke = &drawLineAA<drawPixel, NoDasher>;
stroke = &QT_PREPEND_NAMESPACE(drawLineAA)<drawPixel, NoDasher>;
break;
case AntiAliased|Solid|FastDraw:
stroke = &drawLineAA<drawPixelARGB32, NoDasher>;
stroke = &QT_PREPEND_NAMESPACE(drawLineAA)<drawPixelARGB32, NoDasher>;
break;
case AntiAliased|Dashed|RegularDraw:
stroke = &drawLineAA<drawPixel, Dasher>;
stroke = &QT_PREPEND_NAMESPACE(drawLineAA)<drawPixel, Dasher>;
break;
case AntiAliased|Dashed|FastDraw:
stroke = &drawLineAA<drawPixelARGB32, Dasher>;
stroke = &QT_PREPEND_NAMESPACE(drawLineAA)<drawPixelARGB32, Dasher>;
break;
default:
Q_ASSERT(false);
@ -952,3 +954,5 @@ static void drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx
}
}
}
QT_END_NAMESPACE

View File

@ -6,6 +6,12 @@
#include <private/qpaintengine_raster_p.h>
#include <qpen.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
class QCosmeticStroker;
@ -98,4 +104,8 @@ public:
bool clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2);
};
QT_END_NAMESPACE
QT_END_HEADER
#endif // QCOSMETICLINE_H

View File

@ -1,6 +1,6 @@
QT.core.VERSION = 4.8.0
QT.core.MAJOR_VERSION = 4
QT.core.MINOR_VERSION = 8
QT.core.VERSION = 5.0.0
QT.core.MAJOR_VERSION = 5
QT.core.MINOR_VERSION = 0
QT.core.PATCH_VERSION = 0
QT.core.name = QtCore

View File

@ -1,6 +1,6 @@
QT.dbus.VERSION = 4.8.0
QT.dbus.MAJOR_VERSION = 4
QT.dbus.MINOR_VERSION = 8
QT.dbus.VERSION = 5.0.0
QT.dbus.MAJOR_VERSION = 5
QT.dbus.MINOR_VERSION = 0
QT.dbus.PATCH_VERSION = 0
QT.dbus.name = QtDBus

View File

@ -1,6 +1,6 @@
QT.gui.VERSION = 4.8.0
QT.gui.MAJOR_VERSION = 4
QT.gui.MINOR_VERSION = 8
QT.gui.VERSION = 5.0.0
QT.gui.MAJOR_VERSION = 5
QT.gui.MINOR_VERSION = 0
QT.gui.PATCH_VERSION = 0
QT.gui.name = QtGui

View File

@ -1,6 +1,6 @@
QT.network.VERSION = 4.8.0
QT.network.MAJOR_VERSION = 4
QT.network.MINOR_VERSION = 8
QT.network.VERSION = 5.0.0
QT.network.MAJOR_VERSION = 5
QT.network.MINOR_VERSION = 0
QT.network.PATCH_VERSION = 0
QT.network.name = QtNetwork

View File

@ -1,6 +1,6 @@
QT.opengl.VERSION = 4.8.0
QT.opengl.MAJOR_VERSION = 4
QT.opengl.MINOR_VERSION = 8
QT.opengl.VERSION = 5.0.0
QT.opengl.MAJOR_VERSION = 5
QT.opengl.MINOR_VERSION = 0
QT.opengl.PATCH_VERSION = 0
QT.opengl.name = QtOpenGL

View File

@ -1,6 +1,6 @@
QT.sql.VERSION = 4.8.0
QT.sql.MAJOR_VERSION = 4
QT.sql.MINOR_VERSION = 8
QT.sql.VERSION = 5.0.0
QT.sql.MAJOR_VERSION = 5
QT.sql.MINOR_VERSION = 0
QT.sql.PATCH_VERSION = 0
QT.sql.name = QtSql

View File

@ -1,6 +1,6 @@
QT.testlib.VERSION = 4.8.0
QT.testlib.MAJOR_VERSION = 4
QT.testlib.MINOR_VERSION = 8
QT.testlib.VERSION = 5.0.0
QT.testlib.MAJOR_VERSION = 5
QT.testlib.MINOR_VERSION = 0
QT.testlib.PATCH_VERSION = 0
QT.testlib.name = QtTest

View File

@ -1,6 +1,6 @@
QT.uilib.VERSION = 4.8.0
QT.uilib.MAJOR_VERSION = 4
QT.uilib.MINOR_VERSION = 8
QT.uilib.VERSION = 5.0.0
QT.uilib.MAJOR_VERSION = 5
QT.uilib.MINOR_VERSION = 0
QT.uilib.PATCH_VERSION = 0
QT.uilib.name = QtUiLib

View File

@ -1,6 +1,6 @@
QT.uitools.VERSION = 4.8.0
QT.uitools.MAJOR_VERSION = 4
QT.uitools.MINOR_VERSION = 8
QT.uitools.VERSION = 5.0.0
QT.uitools.MAJOR_VERSION = 5
QT.uitools.MINOR_VERSION = 0
QT.uitools.PATCH_VERSION = 0
QT.uitools.name = QtUiTools

View File

@ -1,6 +1,6 @@
QT.xml.VERSION = 4.8.0
QT.xml.MAJOR_VERSION = 4
QT.xml.MINOR_VERSION = 8
QT.xml.VERSION = 5.0.0
QT.xml.MAJOR_VERSION = 5
QT.xml.MINOR_VERSION = 0
QT.xml.PATCH_VERSION = 0
QT.xml.name = QtXml

View File

@ -96,7 +96,6 @@ public:
QWaylandSelection(QWaylandDisplay *display, QMimeData *data);
~QWaylandSelection();
private:
static uint32_t getTime();
static void send(void *data, struct wl_selection *selection, const char *mime_type, int fd);
static void cancelled(void *data, struct wl_selection *selection);
@ -164,7 +163,7 @@ void QWaylandSelection::cancelled(void *data, struct wl_selection *selection)
}
QWaylandClipboard::QWaylandClipboard(QWaylandDisplay *display)
: mDisplay(display), mSelection(0), mMimeDataIn(0), mOffer(0)
: mDisplay(display), mMimeDataIn(0), mOffer(0)
{
clipboard = this;
}
@ -222,6 +221,8 @@ QVariant QWaylandClipboard::retrieveData(const QString &mimeType, QVariant::Type
QMimeData *QWaylandClipboard::mimeData(QClipboard::Mode mode)
{
Q_ASSERT(mode == QClipboard::Clipboard);
if (!mSelections.isEmpty())
return mSelections.last()->mMimeData;
if (!mMimeDataIn)
mMimeDataIn = new QWaylandMimeData;
mMimeDataIn->clearAll();
@ -236,7 +237,7 @@ void QWaylandClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
if (!mDisplay->inputDevices().isEmpty()) {
if (!data)
data = new QMimeData;
mSelection = new QWaylandSelection(mDisplay, data);
mSelections.append(new QWaylandSelection(mDisplay, data));
} else {
qWarning("QWaylandClipboard::setMimeData: No input devices");
}
@ -266,21 +267,27 @@ void QWaylandClipboard::offer(void *data,
struct wl_selection_offer *selection_offer,
const char *type)
{
Q_UNUSED(data);
Q_UNUSED(selection_offer);
QWaylandClipboard *self = static_cast<QWaylandClipboard *>(data);
self->mOfferedMimeTypes.append(QString::fromLatin1(type));
clipboard->mOfferedMimeTypes.append(QString::fromLatin1(type));
}
void QWaylandClipboard::keyboardFocus(void *data,
struct wl_selection_offer *selection_offer,
wl_input_device *input_device)
{
QWaylandClipboard *self = static_cast<QWaylandClipboard *>(data);
Q_UNUSED(data);
if (!input_device) {
wl_selection_offer_destroy(selection_offer);
self->mOffer = 0;
clipboard->mOffer = 0;
return;
}
self->mOffer = selection_offer;
self->emitChanged(QClipboard::Clipboard);
clipboard->mOffer = selection_offer;
if (clipboard->mSelections.isEmpty())
QMetaObject::invokeMethod(&clipboard->mEmitter, "emitChanged", Qt::QueuedConnection);
}
void QWaylandClipboardSignalEmitter::emitChanged()
{
clipboard->emitChanged(QClipboard::Clipboard);
}

View File

@ -51,6 +51,13 @@ class QWaylandSelection;
class QWaylandMimeData;
struct wl_selection_offer;
class QWaylandClipboardSignalEmitter : public QObject
{
Q_OBJECT
public slots:
void emitChanged();
};
class QWaylandClipboard : public QPlatformClipboard
{
public:
@ -80,11 +87,11 @@ private:
static void forceRoundtrip(struct wl_display *display);
QWaylandDisplay *mDisplay;
QWaylandSelection *mSelection;
QWaylandMimeData *mMimeDataIn;
QList<QWaylandSelection *> mSelections;
QStringList mOfferedMimeTypes;
struct wl_selection_offer *mOffer;
QWaylandClipboardSignalEmitter mEmitter;
};
#endif // QWAYLANDCLIPBOARD_H

View File

@ -5,8 +5,6 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms
QT += core-private gui-private
QT+=gui-private core-private
SOURCES = \
qxcbconnection.cpp \
qxcbintegration.cpp \

View File

@ -1,6 +1,6 @@
TEMPLATE = lib
isEmpty(QT_MAJOR_VERSION) {
VERSION=4.8.0
VERSION=5.0.0
} else {
VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
}

View File

@ -12,7 +12,7 @@ INCLUDEPATH *= $$MODULE_INCLUDES $$MODULE_INCLUDES/.. #just for today to have so
isEmpty(QT_ARCH):!isEmpty(ARCH):QT_ARCH=$$ARCH #another compat that will rot for change #215700
TEMPLATE = lib
isEmpty(QT_MAJOR_VERSION) {
VERSION=4.8.0
VERSION=5.0.0
} else {
VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
}

View File

@ -68,8 +68,15 @@ public:
#else
static const int memberOffset = QObject::staticMetaObject.methodCount();
#endif
Q_ASSERT(obj);
Q_ASSERT(aSignal);
if (!obj) {
qWarning("QSignalSpy: Cannot spy on a null object");
return;
}
if (!aSignal) {
qWarning("QSignalSpy: Null signal name is not valid");
return;
}
if (((aSignal[0] - '0') & 0x03) != QSIGNAL_CODE) {
qWarning("QSignalSpy: Not a valid signal, use the SIGNAL macro");

View File

@ -62,7 +62,11 @@
/*! \fn QSignalSpy::QSignalSpy(QObject *object, const char *signal)
Constructs a new QSignalSpy that listens for emissions of the \a signal
from the QObject \a object. Neither \a signal nor \a object can be null.
from the QObject \a object. If QSignalSpy is not able to listen for a
valid signal (for example, because \a object is null or \a signal does
not denote a valid signal of \a object), an explanatory warning message
will be output using qWarning() and subsequent calls to \c isValid() will
return false.
Example:
\snippet doc/src/snippets/code/doc_src_qsignalspy.cpp 4

View File

@ -111,8 +111,8 @@ public:
TableSummaryChanged,
TextAttributeChanged,
TextCaretMoved,
TextChanged,
TextColumnChanged,
// TextChanged, deprecated, use TextUpdated
TextColumnChanged = TextCaretMoved + 2,
TextInserted,
TextRemoved,
TextUpdated,

View File

@ -269,12 +269,20 @@ void QGraphicsLayout::activate()
return;
Q_ASSERT(!parentItem->isLayout());
setGeometry(parentItem->contentsRect()); // relayout children
if (QGraphicsLayout::instantInvalidatePropagation()) {
QGraphicsWidget *parentWidget = static_cast<QGraphicsWidget*>(parentItem);
if (!parentWidget->parentLayoutItem()) {
// we've reached the topmost widget, resize it
bool wasResized = parentWidget->testAttribute(Qt::WA_Resized);
parentWidget->resize(parentWidget->size());
parentWidget->setAttribute(Qt::WA_Resized, wasResized);
}
// ### bug, should be parentItem ?
parentLayoutItem()->updateGeometry(); // bubble up; will set activated to false
// ### too many resizes? maybe we should walk up the chain to the
// ### top-level layouted layoutItem and call activate there.
setGeometry(parentItem->contentsRect()); // relayout children
} else {
setGeometry(parentItem->contentsRect()); // relayout children
parentLayoutItem()->updateGeometry();
}
}
/*!
@ -300,32 +308,36 @@ bool QGraphicsLayout::isActivated() const
*/
void QGraphicsLayout::invalidate()
{
// only mark layouts as invalid (activated = false) if we can post a LayoutRequest event.
QGraphicsLayoutItem *layoutItem = this;
while (layoutItem && layoutItem->isLayout()) {
// we could call updateGeometry(), but what if that method
// does not call the base implementation? In addition, updateGeometry()
// does more than we need.
layoutItem->d_func()->sizeHintCacheDirty = true;
layoutItem->d_func()->sizeHintWithConstraintCacheDirty = true;
layoutItem = layoutItem->parentLayoutItem();
}
if (layoutItem) {
layoutItem->d_func()->sizeHintCacheDirty = true;
layoutItem->d_func()->sizeHintWithConstraintCacheDirty = true;
}
bool postIt = layoutItem ? !layoutItem->isLayout() : false;
if (postIt) {
layoutItem = this;
while (layoutItem && layoutItem->isLayout()
&& static_cast<QGraphicsLayout*>(layoutItem)->d_func()->activated) {
static_cast<QGraphicsLayout*>(layoutItem)->d_func()->activated = false;
if (QGraphicsLayout::instantInvalidatePropagation()) {
updateGeometry();
} else {
// only mark layouts as invalid (activated = false) if we can post a LayoutRequest event.
QGraphicsLayoutItem *layoutItem = this;
while (layoutItem && layoutItem->isLayout()) {
// we could call updateGeometry(), but what if that method
// does not call the base implementation? In addition, updateGeometry()
// does more than we need.
layoutItem->d_func()->sizeHintCacheDirty = true;
layoutItem->d_func()->sizeHintWithConstraintCacheDirty = true;
layoutItem = layoutItem->parentLayoutItem();
}
if (layoutItem && !layoutItem->isLayout()) {
// If a layout has a parent that is not a layout it must be a QGraphicsWidget.
QApplication::postEvent(static_cast<QGraphicsWidget *>(layoutItem), new QEvent(QEvent::LayoutRequest));
if (layoutItem) {
layoutItem->d_func()->sizeHintCacheDirty = true;
layoutItem->d_func()->sizeHintWithConstraintCacheDirty = true;
}
bool postIt = layoutItem ? !layoutItem->isLayout() : false;
if (postIt) {
layoutItem = this;
while (layoutItem && layoutItem->isLayout()
&& static_cast<QGraphicsLayout*>(layoutItem)->d_func()->activated) {
static_cast<QGraphicsLayout*>(layoutItem)->d_func()->activated = false;
layoutItem = layoutItem->parentLayoutItem();
}
if (layoutItem && !layoutItem->isLayout()) {
// If a layout has a parent that is not a layout it must be a QGraphicsWidget.
QApplication::postEvent(static_cast<QGraphicsWidget *>(layoutItem), new QEvent(QEvent::LayoutRequest));
}
}
}
}
@ -335,12 +347,27 @@ void QGraphicsLayout::invalidate()
*/
void QGraphicsLayout::updateGeometry()
{
QGraphicsLayoutItem::updateGeometry();
if (QGraphicsLayoutItem *parentItem = parentLayoutItem()) {
if (parentItem->isLayout()) {
Q_D(QGraphicsLayout);
if (QGraphicsLayout::instantInvalidatePropagation()) {
d->activated = false;
QGraphicsLayoutItem::updateGeometry();
QGraphicsLayoutItem *parentItem = parentLayoutItem();
if (!parentItem)
return;
if (parentItem->isLayout())
static_cast<QGraphicsLayout *>(parentItem)->invalidate();
else
parentItem->updateGeometry();
} else {
invalidate();
} else {
QGraphicsLayoutItem::updateGeometry();
if (QGraphicsLayoutItem *parentItem = parentLayoutItem()) {
if (parentItem->isLayout()) {
parentItem->updateGeometry();
} else {
invalidate();
}
}
}
}
@ -446,6 +473,50 @@ void QGraphicsLayout::addChildLayoutItem(QGraphicsLayoutItem *layoutItem)
d->addChildLayoutItem(layoutItem);
}
static bool g_instantInvalidatePropagation = false;
/*!
\internal
\since 4.8
\see instantInvalidatePropagation
Calling this function with \a enable set to true will enable a feature that
makes propagation of invalidation up to ancestor layout items to be done in
one go. It will propagate up the parentLayoutItem() hierarchy until it has
reached the root. If the root item is a QGraphicsWidget, it will *post* a
layout request to it. When the layout request is consumed it will traverse
down the hierarchy of layouts and widgets and activate all layouts that is
invalid (not activated). This is the recommended behaviour.
If not set it will also propagate up the parentLayoutItem() hierarchy, but
it will stop at the \i first \i widget it encounters, and post a layout
request to the widget. When the layout request is consumed, this might
cause it to continue propagation up to the parentLayoutItem() of the
widget. It will continue in this fashion until it has reached a widget with
no parentLayoutItem(). This strategy might cause drawing artifacts, since
it is not done in one go, and the consumption of layout requests might be
interleaved by consumption of paint events, which might cause significant
flicker.
Note, this is not the recommended behavior, but for compatibility reasons
this is the default behaviour.
*/
void QGraphicsLayout::setInstantInvalidatePropagation(bool enable)
{
g_instantInvalidatePropagation = enable;
}
/*!
\internal
\since 4.8
\see setInstantInvalidatePropagation
returns true if the complete widget/layout hierarchy is rearranged in one go.
*/
bool QGraphicsLayout::instantInvalidatePropagation()
{
return g_instantInvalidatePropagation;
}
QT_END_NAMESPACE
#endif //QT_NO_GRAPHICSVIEW

View File

@ -76,6 +76,8 @@ public:
virtual QGraphicsLayoutItem *itemAt(int i) const = 0;
virtual void removeAt(int index) = 0;
static void setInstantInvalidatePropagation(bool enable);
static bool instantInvalidatePropagation();
protected:
QGraphicsLayout(QGraphicsLayoutPrivate &, QGraphicsLayoutItem *);
void addChildLayoutItem(QGraphicsLayoutItem *layoutItem);

View File

@ -180,9 +180,14 @@ void QGraphicsLayoutPrivate::activateRecursive(QGraphicsLayoutItem *item)
{
if (item->isLayout()) {
QGraphicsLayout *layout = static_cast<QGraphicsLayout *>(item);
if (layout->d_func()->activated)
layout->invalidate();
if (layout->d_func()->activated) {
if (QGraphicsLayout::instantInvalidatePropagation()) {
return;
} else {
layout->invalidate(); // ### LOOKS SUSPICIOUSLY WRONG!!???
}
}
for (int i = layout->count() - 1; i >= 0; --i) {
QGraphicsLayoutItem *childItem = layout->itemAt(i);
if (childItem)

View File

@ -275,17 +275,13 @@ void QGraphicsLinearLayout::insertItem(int index, QGraphicsLayoutItem *item)
qWarning("QGraphicsLinearLayout::insertItem: cannot insert itself");
return;
}
Q_ASSERT(item);
//the order of the following instructions is very important because
//invalidating the layout before adding the child item will make the layout happen
//before we try to paint the item
invalidate();
d->addChildLayoutItem(item);
Q_ASSERT(item);
d->fixIndex(&index);
d->engine.insertRow(index, d->orientation);
new QGridLayoutItem(&d->engine, item, d->gridRow(index), d->gridColumn(index), 1, 1, 0, index);
invalidate();
}
/*!

View File

@ -354,8 +354,10 @@ void QGraphicsWidget::setGeometry(const QRectF &rect)
newGeom = rect;
newGeom.setSize(rect.size().expandedTo(effectiveSizeHint(Qt::MinimumSize))
.boundedTo(effectiveSizeHint(Qt::MaximumSize)));
if (newGeom == d->geom)
return;
if (newGeom == d->geom) {
goto relayoutChildrenAndReturn;
}
// setPos triggers ItemPositionChange, which can adjust position
wd->inSetGeometry = 1;
@ -363,8 +365,9 @@ void QGraphicsWidget::setGeometry(const QRectF &rect)
wd->inSetGeometry = 0;
newGeom.moveTopLeft(pos());
if (newGeom == d->geom)
return;
if (newGeom == d->geom) {
goto relayoutChildrenAndReturn;
}
// Update and prepare to change the geometry (remove from index) if the size has changed.
if (wd->scene) {
@ -375,35 +378,54 @@ void QGraphicsWidget::setGeometry(const QRectF &rect)
}
// Update the layout item geometry
bool moved = oldPos != pos();
if (moved) {
// Send move event.
QGraphicsSceneMoveEvent event;
event.setOldPos(oldPos);
event.setNewPos(pos());
QApplication::sendEvent(this, &event);
if (wd->inSetPos) {
//set the new pos
d->geom.moveTopLeft(pos());
emit geometryChanged();
return;
{
bool moved = oldPos != pos();
if (moved) {
// Send move event.
QGraphicsSceneMoveEvent event;
event.setOldPos(oldPos);
event.setNewPos(pos());
QApplication::sendEvent(this, &event);
if (wd->inSetPos) {
//set the new pos
d->geom.moveTopLeft(pos());
emit geometryChanged();
goto relayoutChildrenAndReturn;
}
}
QSizeF oldSize = size();
QGraphicsLayoutItem::setGeometry(newGeom);
// Send resize event
bool resized = newGeom.size() != oldSize;
if (resized) {
QGraphicsSceneResizeEvent re;
re.setOldSize(oldSize);
re.setNewSize(newGeom.size());
if (oldSize.width() != newGeom.size().width())
emit widthChanged();
if (oldSize.height() != newGeom.size().height())
emit heightChanged();
QGraphicsLayout *lay = wd->layout;
if (QGraphicsLayout::instantInvalidatePropagation()) {
if (!lay || lay->isActivated()) {
QApplication::sendEvent(this, &re);
}
} else {
QApplication::sendEvent(this, &re);
}
}
}
QSizeF oldSize = size();
QGraphicsLayoutItem::setGeometry(newGeom);
// Send resize event
bool resized = newGeom.size() != oldSize;
if (resized) {
QGraphicsSceneResizeEvent re;
re.setOldSize(oldSize);
re.setNewSize(newGeom.size());
if (oldSize.width() != newGeom.size().width())
emit widthChanged();
if (oldSize.height() != newGeom.size().height())
emit heightChanged();
QApplication::sendEvent(this, &re);
}
emit geometryChanged();
relayoutChildrenAndReturn:
if (QGraphicsLayout::instantInvalidatePropagation()) {
if (QGraphicsLayout *lay = wd->layout) {
if (!lay->isActivated()) {
QEvent layoutRequest(QEvent::LayoutRequest);
QApplication::sendEvent(this, &layoutRequest);
}
}
}
}
/*!
@ -1052,16 +1074,31 @@ void QGraphicsWidget::updateGeometry()
QGraphicsLayoutItem *parentItem = parentLayoutItem();
if (parentItem && parentItem->isLayout()) {
parentItem->updateGeometry();
if (QGraphicsLayout::instantInvalidatePropagation()) {
static_cast<QGraphicsLayout *>(parentItem)->invalidate();
} else {
parentItem->updateGeometry();
}
} else {
if (parentItem) {
// This is for custom layouting
QGraphicsWidget *parentWid = parentWidget(); //###
if (parentWid->isVisible())
QApplication::postEvent(parentWid, new QEvent(QEvent::LayoutRequest));
} else {
/**
* If this is the topmost widget, post a LayoutRequest event to the widget.
* When the event is received, it will start flowing all the way down to the leaf
* widgets in one go. This will make a relayout flicker-free.
*/
if (QGraphicsLayout::instantInvalidatePropagation())
QApplication::postEvent(static_cast<QGraphicsWidget *>(this), new QEvent(QEvent::LayoutRequest));
}
if (!QGraphicsLayout::instantInvalidatePropagation()) {
bool wasResized = testAttribute(Qt::WA_Resized);
resize(size()); // this will restrict the size
setAttribute(Qt::WA_Resized, wasResized);
}
bool wasResized = testAttribute(Qt::WA_Resized);
resize(size()); // this will restrict the size
setAttribute(Qt::WA_Resized, wasResized);
}
}

View File

@ -1,13 +1,18 @@
/****************************************************************************
**
** Copyright (C) 2011 Klarälvdalens Datakonsult AB,
** a KDAB Group company, info@kdab.com,
** author Stephen Kelly <stephen.kelly@kdab.com>
** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
** All rights reserved.
** Contact: Nokia Corporation (info@qt.nokia.com)
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** 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
@ -20,17 +25,17 @@
** rights. These rights are described in the Nokia 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.
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

View File

@ -1,13 +1,18 @@
/****************************************************************************
**
** Copyright (C) 2011 Klarälvdalens Datakonsult AB,
** a KDAB Group company, info@kdab.com,
** author Stephen Kelly <stephen.kelly@kdab.com>
** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
** All rights reserved.
** Contact: Nokia Corporation (info@qt.nokia.com)
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** 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
@ -20,17 +25,17 @@
** rights. These rights are described in the Nokia 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.
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

View File

@ -651,7 +651,12 @@ void QLineControl::internalSetText(const QString &txt, int pos, bool edited)
m_modifiedState = m_undoState = 0;
m_cursor = (pos < 0 || pos > m_text.length()) ? m_text.length() : pos;
m_textDirty = (oldText != m_text);
finishChange(-1, true, edited);
bool changed = finishChange(-1, true, edited);
#ifndef QT_NO_ACCESSIBILITY
if (changed)
QAccessible::updateAccessibility(parent(), 0, QAccessible::TextUpdated);
#endif
}
@ -1238,6 +1243,9 @@ void QLineControl::emitCursorPositionChanged()
const int oldLast = m_lastCursorPos;
m_lastCursorPos = m_cursor;
cursorPositionChanged(oldLast, m_cursor);
#ifndef QT_NO_ACCESSIBILITY
QAccessible::updateAccessibility(parent(), 0, QAccessible::TextCaretMoved);
#endif
}
}

View File

@ -61,7 +61,6 @@
#include "QtGui/qtextlayout.h"
#include "QtWidgets/qstyleoption.h"
#include "QtCore/qpointer.h"
#include "QtWidgets/qlineedit.h"
#include "QtGui/qclipboard.h"
#include "QtCore/qpoint.h"
#include "QtWidgets/qcompleter.h"

View File

@ -154,6 +154,7 @@ void QLineEditPrivate::init(const QString& txt)
{
Q_Q(QLineEdit);
control = new QLineControl(txt);
control->setParent(q);
control->setFont(q->font());
QObject::connect(control, SIGNAL(textChanged(QString)),
q, SIGNAL(textChanged(QString)));

View File

@ -84,7 +84,6 @@ public:
~QLineEditPrivate()
{
delete control;
}
QLineControl *control;

View File

@ -512,7 +512,7 @@ void BaselineHandler::testPathMapping()
item.imageChecksums << 0x0123456789abcdefULL;
item.itemChecksum = 0x0123;
plat.insert(PI_QtVersion, QLS("4.8.0"));
plat.insert(PI_QtVersion, QLS("5.0.0"));
plat.insert(PI_BuildKey, QLS("(nobuildkey)"));
plat.insert(PI_QMakeSpec, QLS("linux-g++"));
plat.insert(PI_PulseGitBranch, QLS("somebranch"));

View File

@ -9,7 +9,6 @@ DEFINES += SRCDIR=\\\"$$PWD\\\"
QT += xml svg network
contains(QT_CONFIG, qt3support): QT += qt3support
contains(QT_CONFIG, opengl):QT += opengl
include($$ARTHUR/datagenerator/datagenerator.pri)

View File

@ -103,7 +103,7 @@ SUBDIRS=\
qlistview \
qlistwidget \
qlocale \
#qlocalsocket \ # FIXME: uses qtscript, shouldn't be in qtbase
#qlocalsocket \ # FIXME: uses qtscript (QTBUG-19242)
qmacstyle \
qmainwindow \
qmatrixnxn \

View File

@ -3,12 +3,10 @@ SUBDIRS=\
compiler \
headersclean \
maketestselftest \
#moc \ # FIXME: cannot be built as part of qtbase, since it depends on qtsvg
moc \
uic \
qmake \
rcc \
#atwrapper \ # These tests need significant updating,
#uiloader \ # they have hardcoded machine names etc.
#contains(QT_CONFIG,qt3support):SUBDIRS+=uic3

View File

@ -20,9 +20,7 @@ HEADERS += using-namespaces.h no-keywords.h task87883.h c-comments.h backslash-n
if(*-g++*|*-icc*|*-clang|*-llvm):!irix-*:!win32-*: HEADERS += os9-newlines.h win-newlines.h
SOURCES += tst_moc.cpp
QT += sql network svg
contains(QT_CONFIG, script): QT += script
contains(QT_CONFIG, qt3support): QT += qt3support
QT += sql network
contains(QT_CONFIG, dbus){
DEFINES += WITH_DBUS
QT += dbus

View File

@ -51,7 +51,7 @@
#include <QtCore>
#include <QtNetwork/QtNetwork>
#include <QtSql/QtSql>
#include <QtSvg>
//#include <QtSvg>
#if defined(QT3_SUPPORT)
#include <Qt3Support>
#endif

View File

@ -10,8 +10,7 @@ SUBDIRS=\
qalgorithms \
qcombobox \
qcssparser \
#qdatastream \ # FIXME: cannot be enabled by default in qtbase,
# since it depends on qtsvg
#qdatastream \ # FIXME: uses qtsvg (QTBUG-19244)
qdir \
qfocusevent \
qimage \

View File

@ -2,10 +2,9 @@ load(qttest_p4)
SOURCES += tst_qaccessibility.cpp
unix:!mac:LIBS+=-lm
contains(QT_CONFIG, qt3support): QT += qt3support
wince*: {
accessneeded.files = $$QT_BUILD_TREE\\plugins\\accessible\\*.dll
accessneeded.path = accessible
DEPLOYMENT += accessneeded
}
}

View File

@ -2,4 +2,3 @@ load(qttest_p4)
SOURCES += tst_qalgorithms.cpp
QT = core
contains(QT_CONFIG, qt3support): QT += qt3support

View File

@ -1,4 +1,3 @@
load(qttest_p4)
SOURCES += tst_qcombobox.cpp
contains(QT_CONFIG, qt3support): QT += qt3support

View File

@ -7,7 +7,6 @@ else: DEFINES += SVGFILE=\\\"gearflowers.svg\\\"
}
# for qpaintdevicemetrics.h
contains(QT_CONFIG, qt3support):QT += qt3support
QT += svg

View File

@ -18,7 +18,6 @@ wince* {
LIBS += -lefsrv
INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
} else {
contains(QT_CONFIG, qt3support):QT += qt3support
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}

View File

@ -30,6 +30,4 @@ wince* {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
contains(QT_CONFIG, qt3support): QT += qt3support
CONFIG += parallel_test

View File

@ -1,6 +1,2 @@
load(qttest_p4)
SOURCES += tst_qfocusevent.cpp
contains(QT_CONFIG, qt3support): QT += qt3support

View File

@ -1091,6 +1091,9 @@ void tst_QGraphicsAnchorLayout::setSpacing()
#ifdef Q_WS_MAC
QTest::qWait(200);
#endif
// 21x21
QCOMPARE(p->size(), QSizeF(41, 41));
QCOMPARE(a->geometry(), QRectF(0, 0, 20, 20));
QCOMPARE(b->geometry(), QRectF(21, 0, 20, 20));
QCOMPARE(c->geometry(), QRectF(0, 21, 41, 20));

View File

@ -62,6 +62,7 @@ private slots:
void compressLayoutRequest();
void automaticReparenting();
void verifyActivate();
void invalidate();
void constructors();
void alternativeLayoutItems();
void ownership();
@ -95,6 +96,14 @@ void tst_QGraphicsLayout::sizeHints()
}
enum FunctionType {
SetGeometry = 0,
Invalidate,
NumFunctionTypes
};
class TestGraphicsWidget : public QGraphicsWidget {
public:
TestGraphicsWidget(QGraphicsWidget *parent = 0) : QGraphicsWidget(parent)
@ -108,9 +117,28 @@ public:
int eventCount(QEvent::Type type) {
return m_eventCount.value(int(type));
}
void clearEventCount() {
m_eventCount.clear();
}
void clearCounters() {
m_eventCount.clear();
functionCount.clear();
}
void setGeometry(const QRectF &rect)
{
QGraphicsWidget::setGeometry(rect);
++(functionCount[SetGeometry]);
}
void callUpdateGeometry()
{
// updateGeometry() is protected
QGraphicsWidget::updateGeometry();
}
QMap<FunctionType, int> functionCount;
private:
QMap<int, int> m_eventCount;
};
@ -122,6 +150,8 @@ void tst_QGraphicsLayout::compressLayoutRequest()
TestGraphicsWidget *tw = new TestGraphicsWidget();
scene.addItem(tw);
view.show();
QTest::qWaitForWindowShown(&view);
QGraphicsLinearLayout *lout = new QGraphicsLinearLayout(tw);
for (int i = 0; i < 4; ++i) {
QGraphicsWidget *gw = new QGraphicsWidget(tw);
@ -217,17 +247,27 @@ class TestLayout : public QGraphicsLinearLayout
TestLayout(QGraphicsLayoutItem *parent = 0)
: QGraphicsLinearLayout(parent)
{
m_count = 0;
setContentsMargins(0,0,0,0);
setSpacing(0);
}
void setGeometry(const QRectF &rect) {
++m_count;
void setGeometry(const QRectF &rect)
{
++(functionCount[SetGeometry]);
QGraphicsLinearLayout::setGeometry(rect);
}
void invalidate()
{
++(functionCount[Invalidate]);
QGraphicsLinearLayout::invalidate();
}
int m_count;
void clearCounters() {
functionCount.clear();
}
QMap<FunctionType, int> functionCount;
};
void tst_QGraphicsLayout::verifyActivate()
@ -242,15 +282,280 @@ void tst_QGraphicsLayout::verifyActivate()
lout->addItem(w);
window->setLayout(lout);
QCOMPARE(lout->m_count, 0);
QCOMPARE(lout->functionCount[SetGeometry], 0);
window->setVisible(false);
QCOMPARE(lout->m_count, 0);
QCOMPARE(lout->functionCount[SetGeometry], 0);
window->setVisible(true);
// on polish or the first time a widget is shown, the widget is resized.
QCOMPARE(lout->m_count, 1);
QCOMPARE(lout->functionCount[SetGeometry], 1);
}
static void clearAllCounters(TestGraphicsWidget *widget)
{
if (!widget)
return;
widget->clearCounters();
TestLayout *layout = static_cast<TestLayout *>(widget->layout());
if (layout) {
layout->clearCounters();
for (int i = layout->count() - 1; i >=0; --i) {
QGraphicsLayoutItem *item = layout->itemAt(i);
if (item->isLayout()) {
// ### Not used ATM
//TestLayout *lay = static_cast<TestLayout*>(static_cast<QGraphicsLayout*>(item));
//clearAllCounters(lay);
} else {
TestGraphicsWidget *wid = static_cast<TestGraphicsWidget *>(item);
clearAllCounters(wid);
}
}
}
}
static void activateAndReset(TestGraphicsWidget *widget)
{
QApplication::sendPostedEvents();
QApplication::processEvents();
if (widget->layout())
widget->layout()->activate();
clearAllCounters(widget);
}
void tst_QGraphicsLayout::invalidate()
{
QGraphicsLayout::setInstantInvalidatePropagation(true);
QGraphicsScene scene;
QGraphicsView view(&scene);
TestGraphicsWidget *a = new TestGraphicsWidget;
a->setData(0, QString("a"));
scene.addItem(a);
TestLayout *alay = new TestLayout(a);
TestGraphicsWidget *b = new TestGraphicsWidget;
b->setData(0, QString("b"));
alay->addItem(b);
TestLayout *blay = new TestLayout(b);
TestGraphicsWidget *e = new TestGraphicsWidget;
e->setData(0, QString("e"));
blay->addItem(e);
TestGraphicsWidget *c = new TestGraphicsWidget;
c->setData(0, QString("c"));
alay->addItem(c);
TestLayout *clay = new TestLayout(c);
TestGraphicsWidget *f = new TestGraphicsWidget;
f->setData(0, QString("f"));
clay->addItem(f);
TestGraphicsWidget *d = new TestGraphicsWidget;
d->setData(0, QString("d"));
alay->addItem(d);
TestLayout *dlay = new TestLayout(d);
TestGraphicsWidget *g = new TestGraphicsWidget;
g->setData(0, QString("g"));
dlay->addItem(g);
view.show();
{
clearAllCounters(a);
QCoreApplication::sendPostedEvents();
QCoreApplication::processEvents();
alay->activate();
QCOMPARE(alay->isActivated(), true);
QCOMPARE(blay->isActivated(), true);
QCOMPARE(clay->isActivated(), true);
QCOMPARE(dlay->isActivated(), true);
}
{
clearAllCounters(a);
e->callUpdateGeometry();
QCOMPARE(alay->isActivated(), false);
QCOMPARE(blay->isActivated(), false);
QCOMPARE(clay->isActivated(), true);
QCOMPARE(dlay->isActivated(), true);
QCOMPARE(a->eventCount(QEvent::LayoutRequest), 0);
QCOMPARE(b->eventCount(QEvent::LayoutRequest), 0);
QCOMPARE(c->eventCount(QEvent::LayoutRequest), 0);
QCOMPARE(d->eventCount(QEvent::LayoutRequest), 0);
// should only invalidate ascendants of e
QCOMPARE(blay->functionCount[Invalidate], 1);
QCOMPARE(alay->functionCount[Invalidate], 1);
// not siblings
QCOMPARE(clay->functionCount[Invalidate], 0);
QCOMPARE(dlay->functionCount[Invalidate], 0);
QApplication::sendPostedEvents();
QCOMPARE(a->eventCount(QEvent::LayoutRequest), 1);
QCOMPARE(b->eventCount(QEvent::LayoutRequest), 1);
QCOMPARE(c->eventCount(QEvent::LayoutRequest), 0);
QCOMPARE(d->eventCount(QEvent::LayoutRequest), 0);
}
{
activateAndReset(a);
f->callUpdateGeometry();
QCOMPARE(alay->isActivated(), false);
QCOMPARE(blay->isActivated(), true);
QCOMPARE(clay->isActivated(), false);
QCOMPARE(dlay->isActivated(), true);
QCoreApplication::sendPostedEvents();
QCOMPARE(a->eventCount(QEvent::LayoutRequest), 1);
QCOMPARE(b->eventCount(QEvent::LayoutRequest), 0);
QCOMPARE(c->eventCount(QEvent::LayoutRequest), 1);
QCOMPARE(d->eventCount(QEvent::LayoutRequest), 0);
QCOMPARE(a->functionCount[SetGeometry], 1);
QCOMPARE(alay->functionCount[SetGeometry], 1);
QCOMPARE(b->functionCount[SetGeometry], 1);
QCOMPARE(c->functionCount[SetGeometry], 1);
QCOMPARE(d->functionCount[SetGeometry], 1);
// Since nothing really changed, blay and dlay don't need
// to be resized.
QCOMPARE(blay->functionCount[SetGeometry], 0);
QCOMPARE(clay->functionCount[SetGeometry], 1);
QCOMPARE(dlay->functionCount[SetGeometry], 0);
QCOMPARE(f->functionCount[SetGeometry], 1);
QCOMPARE(a->size(), QSizeF(150, 50));
}
{
activateAndReset(a);
f->setPreferredSize(QSizeF(60,50));
QCOMPARE(alay->isActivated(), false);
QCOMPARE(blay->isActivated(), true);
QCOMPARE(clay->isActivated(), false);
QCOMPARE(dlay->isActivated(), true);
QCOMPARE(c->eventCount(QEvent::LayoutRequest), 0);
QCoreApplication::sendPostedEvents();
QCOMPARE(a->eventCount(QEvent::LayoutRequest), 1);
QCOMPARE(b->eventCount(QEvent::LayoutRequest), 0);
QCOMPARE(c->eventCount(QEvent::LayoutRequest), 1);
QCOMPARE(d->eventCount(QEvent::LayoutRequest), 0);
QCOMPARE(a->functionCount[SetGeometry], 1);
QCOMPARE(alay->functionCount[SetGeometry], 1);
QCOMPARE(b->functionCount[SetGeometry], 1);
QCOMPARE(c->functionCount[SetGeometry], 1);
QCOMPARE(d->functionCount[SetGeometry], 1);
// f actually got wider, need to rearrange its siblings
QCOMPARE(blay->functionCount[SetGeometry], 1);
QCOMPARE(clay->functionCount[SetGeometry], 1);
QCOMPARE(dlay->functionCount[SetGeometry], 1);
QCOMPARE(e->functionCount[SetGeometry], 1);
QCOMPARE(f->functionCount[SetGeometry], 1);
QCOMPARE(g->functionCount[SetGeometry], 1);
QVERIFY(e->size().width() < f->size().width());
QVERIFY(g->size().width() < f->size().width());
}
{
// resize f so much that it'll force a resize of the top widget
// this will currently generate two setGeometry() calls on the child layout
// of the top widget.
activateAndReset(a);
f->setPreferredSize(QSizeF());
f->setMinimumSize(QSizeF(200,50));
QCOMPARE(alay->isActivated(), false);
QCOMPARE(blay->isActivated(), true);
QCOMPARE(clay->isActivated(), false);
QCOMPARE(dlay->isActivated(), true);
QCOMPARE(c->eventCount(QEvent::LayoutRequest), 0);
QCoreApplication::sendPostedEvents();
QCOMPARE(a->eventCount(QEvent::LayoutRequest), 1);
QCOMPARE(b->eventCount(QEvent::LayoutRequest), 0);
QCOMPARE(c->eventCount(QEvent::LayoutRequest), 1);
QCOMPARE(d->eventCount(QEvent::LayoutRequest), 0);
QCOMPARE(a->functionCount[SetGeometry], 1);
/* well, ideally one call to setGeometry(), but it will currently
* get two calls to setGeometry():
* 1. The first LayoutRequest will call activate() - that will call
* setGeometry() on the layout. This geometry will be based on
* the widget geometry which is not correct at this moment.
* (it is still 150 wide)
* 2. Next, we check if the widget is top level, and then we call
* parentWidget->resize(parentWidget->size());
* This will be adjusted to be minimum 200 pixels wide.
* The new size will then be propagated down to the layout
*
*/
QCOMPARE(alay->functionCount[SetGeometry], 2);
QCOMPARE(b->functionCount[SetGeometry], 2);
QCOMPARE(c->functionCount[SetGeometry], 2);
QCOMPARE(d->functionCount[SetGeometry], 2);
// f actually got wider, need to rearrange its siblings
QCOMPARE(blay->functionCount[SetGeometry], 1);
QCOMPARE(clay->functionCount[SetGeometry], 1);
QCOMPARE(dlay->functionCount[SetGeometry], 1);
QCOMPARE(e->functionCount[SetGeometry], 1);
QCOMPARE(f->functionCount[SetGeometry], 1);
QCOMPARE(g->functionCount[SetGeometry], 1);
QVERIFY(e->size().width() < f->size().width());
QVERIFY(g->size().width() < f->size().width());
}
{
f->setPreferredSize(QSizeF());
f->setMinimumSize(QSizeF());
a->adjustSize();
activateAndReset(a);
// update two different leaf widgets,
// eventCount and functionCount should never be >= 2
e->callUpdateGeometry();
g->callUpdateGeometry();
QCOMPARE(alay->isActivated(), false);
QCOMPARE(blay->isActivated(), false);
QCOMPARE(clay->isActivated(), true);
QCOMPARE(dlay->isActivated(), false);
QCoreApplication::sendPostedEvents();
QCOMPARE(a->eventCount(QEvent::LayoutRequest), 1);
QCOMPARE(b->eventCount(QEvent::LayoutRequest), 1);
QCOMPARE(c->eventCount(QEvent::LayoutRequest), 0);
QCOMPARE(d->eventCount(QEvent::LayoutRequest), 1);
QCOMPARE(a->functionCount[SetGeometry], 1);
QCOMPARE(alay->functionCount[SetGeometry], 1);
QCOMPARE(b->functionCount[SetGeometry], 1);
QCOMPARE(c->functionCount[SetGeometry], 1);
QCOMPARE(d->functionCount[SetGeometry], 1);
// f actually got wider, need to rearrange its siblings
QCOMPARE(blay->functionCount[SetGeometry], 1);
QCOMPARE(clay->functionCount[SetGeometry], 0);
QCOMPARE(dlay->functionCount[SetGeometry], 1);
QCOMPARE(e->functionCount[SetGeometry], 1);
QCOMPARE(f->functionCount[SetGeometry], 0);
QCOMPARE(g->functionCount[SetGeometry], 1);
}
QGraphicsLayout::setInstantInvalidatePropagation(false);
}
class Layout : public QGraphicsLayout
{
public:

View File

@ -94,6 +94,7 @@ private slots:
void itemSpacing();
void setStretchFactor_data();
void setStretchFactor();
void testStretch();
void defaultStretchFactors_data();
void defaultStretchFactors();
void sizeHint_data();
@ -667,6 +668,10 @@ void tst_QGraphicsLinearLayout::invalidate()
layout.setContentsMargins(0, 0, 0, 0);
view.show();
widget->show();
//QTest::qWait(1000);
QTest::qWaitForWindowShown(&view);
qApp->processEvents();
layout.layoutRequest = 0;
layout.setContentsMargins(1, 2, 3, 4);
QApplication::sendPostedEvents(0, 0);
@ -1130,6 +1135,41 @@ void tst_QGraphicsLinearLayout::setStretchFactor()
delete widget;
}
void tst_QGraphicsLinearLayout::testStretch()
{
QGraphicsScene scene;
QGraphicsView *view = new QGraphicsView(&scene);
QGraphicsWidget *form = new QGraphicsWidget(0, Qt::Window);
scene.addItem(form);
form->setMinimumSize(600, 600);
form->setMaximumSize(600, 600);
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal, form);
QGraphicsWidget *w1 = new RectWidget;
w1->setPreferredSize(100,100);
w1->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QGraphicsWidget *w2 = new RectWidget;
w2->setPreferredSize(200,200);
w2->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
layout->setSpacing(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->addItem(w1);
layout->addStretch(2);
layout->addItem(w2);
QCOMPARE(layout->count(), 2);
QVERIFY(layout->itemAt(0) == w1);
QVERIFY(layout->itemAt(1) == w2);
layout->activate();
//view->setSceneRect(-50, -50, 800, 800);
//view->show();
//QTest::qWaitForWindowShown(view);
//QTest::qWait(5000);
QCOMPARE(form->geometry().size(), QSizeF(600,600));
QCOMPARE(w1->geometry(), QRectF(0, 0, 100, 100));
QCOMPARE(w2->geometry(), QRectF(400, 0, 200, 200));
}
void tst_QGraphicsLinearLayout::defaultStretchFactors_data()
{
QTest::addColumn<Qt::Orientation>("orientation");

View File

@ -186,7 +186,6 @@ private slots:
void task250119_shortcutContext();
void QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems();
void QT_BUG_12056_tabFocusFirstUnsetWhenRemovingItems();
void QT_BUG_13865_doublePaintWhenAddingASubItem();
};
@ -3367,46 +3366,6 @@ void tst_QGraphicsWidget::QT_BUG_12056_tabFocusFirstUnsetWhenRemovingItems()
//This should not crash
}
struct GreenWidget : public QGraphicsWidget
{
GreenWidget() : count(0)
{
}
void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * )
{
count++;
painter->setPen(Qt::green);
painter->drawRect(option->rect.adjusted(0,0,-1,-1));
}
int count;
};
void tst_QGraphicsWidget::QT_BUG_13865_doublePaintWhenAddingASubItem()
{
QGraphicsScene scene;
QGraphicsView view(&scene);
QGraphicsWidget *widget = new QGraphicsWidget;
widget->resize(100, 100);
scene.addItem(widget);
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(widget);
view.show();
QTest::qWaitForWindowShown(&view);
QApplication::processEvents();
GreenWidget *sub = new GreenWidget;
layout->addItem(sub);
QTest::qWait(100);
QCOMPARE(sub->count, 1); //it should only be painted once
}
QTEST_MAIN(tst_QGraphicsWidget)
#include "tst_qgraphicswidget.moc"

View File

@ -1,13 +1,18 @@
/****************************************************************************
**
** Copyright (C) 2011 Klarälvdalens Datakonsult AB,
** a KDAB Group company, info@kdab.com,
** author Stephen Kelly <stephen.kelly@kdab.com>
** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
** All rights reserved.
** Contact: Nokia Corporation (info@qt.nokia.com)
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** 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
@ -20,17 +25,17 @@
** rights. These rights are described in the Nokia 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.
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

View File

@ -19,6 +19,5 @@ wince*: {
DEPLOYMENT += imagePlugins
}
} else {
contains(QT_CONFIG, qt3support): QT += qt3support
DEFINES += SRCDIR=\\\"$$PWD\\\"
}

View File

@ -1,8 +1,6 @@
load(qttest_p4)
SOURCES += tst_qinputcontext.cpp
contains(QT_CONFIG, webkit):QT += webkit
symbian {
LIBS += -lws32 -lcone
}

View File

@ -17,7 +17,6 @@ wince*: {
TARGET.CAPABILITY = NetworkServices
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
contains(QT_CONFIG, qt3support):QT += qt3support
}
MOC_DIR=tmp

View File

@ -3,7 +3,6 @@ load(qttest_p4)
QT += gui-private
SOURCES += tst_qlayout.cpp
contains(QT_CONFIG, qt3support): QT += qt3support
wince*|symbian: {
addFiles.files = baseline
addFiles.path = .

View File

@ -1,6 +1,2 @@
load(qttest_p4)
contains(QT_CONFIG,qt3support) QT += qt3support
SOURCES += tst_qlineedit.cpp

View File

@ -17,4 +17,4 @@ DEFINES += QLOCALSOCKET_DEBUG
SOURCES += main.cpp
TARGET = lackey
symbian:TARGET.CAPABILITY = ALL -TCB
symbian:TARGET.CAPABILITY = ALL -TCB

View File

@ -0,0 +1,3 @@
int main(int,char**)
{
}

View File

@ -0,0 +1,5 @@
TEMPLATE = app
SOURCES = main.cpp
extratarget.commands = @echo extra target worked OK
QMAKE_EXTRA_TARGETS += extratarget

View File

@ -0,0 +1,7 @@
TEMPLATE = subdirs
SUBDIRS = simple
extratarget.CONFIG = recursive
extratarget.recurse = $$SUBDIRS
extratarget.recurse_target = extratarget
QMAKE_EXTRA_TARGETS += extratarget

View File

@ -0,0 +1,7 @@
TEMPLATE = subdirs
SUBDIRS = subdir.pro
extratarget.CONFIG = recursive
extratarget.recurse = $$SUBDIRS
extratarget.recurse_target = extratarget
QMAKE_EXTRA_TARGETS += extratarget

View File

@ -69,6 +69,7 @@ private slots:
void simple_lib();
void simple_dll();
void subdirs();
void subdir_via_pro_file_extra_target();
void functions();
void operators();
void variables();
@ -234,6 +235,19 @@ void tst_qmake::subdirs()
QVERIFY( test_compiler.removeMakefile( workDir ) );
}
void tst_qmake::subdir_via_pro_file_extra_target()
{
QString workDir = base_path + "/testdata/subdir_via_pro_file_extra_target";
QDir D;
D.remove( workDir + "/Makefile");
D.remove( workDir + "/Makefile.subdir");
D.remove( workDir + "/simple/Makefile");
D.remove( workDir + "/simple/Makefile.subdir");
QVERIFY( test_compiler.qmake( workDir, "subdir_via_pro_file_extra_target" ));
QVERIFY( test_compiler.make( workDir, "extratarget" ));
}
void tst_qmake::functions()
{
QString workDir = base_path + "/testdata/functions";

View File

@ -1,7 +1,2 @@
load(qttest_p4)
SOURCES += tst_qmenu.cpp
contains(QT_CONFIG, qt3support): QT += qt3support

View File

@ -1,6 +1,2 @@
load(qttest_p4)
HEADERS +=
SOURCES += tst_qmenubar.cpp
contains(QT_CONFIG, qt3support):!symbian:QT += qt3support

View File

@ -1,5 +1,2 @@
load(qttest_p4)
SOURCES += tst_qmouseevent.cpp
contains(QT_CONFIG, qt3support): QT += qt3support

View File

@ -8,7 +8,6 @@ SOURCES += moc_oldnormalizeobject.cpp
QT = core \
network \
gui
contains(QT_CONFIG, qt3support):DEFINES += QT_HAS_QT3SUPPORT
wince*: {
addFiles.files = signalbug.exe
addFiles.path = .

View File

@ -2,7 +2,6 @@ load(qttest_p4)
QT += gui-private
contains(QT_CONFIG, qt3support): QT += qt3support
SOURCES += tst_qpainter.cpp
wince*|symbian: {
addFiles.files = drawEllipse drawLine_rop_bitmap drawPixmap_rop drawPixmap_rop_bitmap task217400.png

View File

@ -3,7 +3,6 @@ load(qttest_p4)
QT += core-private gui-private
SOURCES += tst_qpixmap.cpp
contains(QT_CONFIG, qt3support): QT += qt3support
wince*|symbian: {
task31722_0.files = convertFromImage/task31722_0/*.png

View File

@ -1,8 +1,2 @@
load(qttest_p4)
SOURCES += tst_qprinter.cpp
contains(QT_CONFIG, qt3support): QT += qt3support

View File

@ -715,12 +715,12 @@ void tst_QSet::stlMutableIterator()
QVERIFY(set2.isEmpty());
QVERIFY(set3.isEmpty());
#if QT_VERSION >= 0x050000
i = set2.insert("foo");
#else
// #if QT_VERSION >= 0x050000
// i = set2.insert("foo");
// #else
QSet<QString>::const_iterator k = set2.insert("foo");
i = reinterpret_cast<QSet<QString>::iterator &>(k);
#endif
// #endif
QVERIFY(*i == "foo");
}
}

View File

@ -5,7 +5,6 @@ QT += core-private
SOURCES += tst_qsettings.cpp
RESOURCES += qsettings.qrc
contains(QT_CONFIG, qt3support):QT += qt3support
CONFIG -= debug
CONFIG += release
win32-msvc*:LIBS += advapi32.lib

View File

@ -2,8 +2,6 @@ load(qttest_p4)
SOURCES += tst_qsplitter.cpp
contains(QT_CONFIG, qt3support): QT += qt3support
wince*|symbian: {
addFiles.files = extradata.txt setSizes3.dat
addFiles.path = .

View File

@ -3,8 +3,6 @@ SOURCES += tst_qsql.cpp
QT += sql sql-private
contains(QT_CONFIG, qt3support): QT += qt3support
wince*: {
DEPLOYMENT_PLUGIN += qsqlite
}

View File

@ -3,8 +3,6 @@ SOURCES += tst_qsqldatabase.cpp
QT += sql
contains(QT_CONFIG, qt3support): QT += qt3support
win32: {
!wince*: LIBS += -lws2_32
else: LIBS += -lws2

View File

@ -6,7 +6,6 @@ INCLUDEPATH += ../
HEADERS +=
SOURCES += tst_qtabwidget.cpp
contains(QT_CONFIG, qt3support): QT += qt3support
win32:!wince*:LIBS += -luser32

View File

@ -1,7 +1,6 @@
HEADERS += Test.h
SOURCES += main.cpp Test.cpp
QT += network
contains(QT_CONFIG, qt3support): QT += qt3support
CONFIG -= app_bundle
CONFIG += console

View File

@ -2,8 +2,6 @@ load(qttest_p4)
SOURCES += tst_qtextbrowser.cpp
!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\"
contains(QT_CONFIG, qt3support): QT += qt3support
wince*|symbian: {
addFiles.files = *.html

View File

@ -16,5 +16,3 @@ wince* {
} else:!symbian {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
contains(QT_CONFIG, qt3support): QT += qt3support

View File

@ -13,7 +13,6 @@ win32 {
RESOURCES += ../qtextstream.qrc
contains(QT_CONFIG, qt3support):QT += qt3support
QT = core network

View File

@ -1,11 +1,2 @@
############################################################
# Project file for autotest for file qtoolbutton.h
############################################################
load(qttest_p4)
SOURCES += tst_qtoolbutton.cpp
contains(QT_CONFIG, qt3support): QT += qt3support

View File

@ -1,5 +1,3 @@
load(qttest_p4)
SOURCES += tst_qvariant.cpp
QT += network
contains(QT_CONFIG, qt3support): QT += qt3support

View File

@ -5,9 +5,6 @@ QT += core-private gui-private
SOURCES += tst_qwidget.cpp
RESOURCES = qwidget.qrc
contains(QT_CONFIG, qt3support): QT += qt3support
contains(QT_CONFIG, qt3support):DEFINES+=QT_HAS_QT3SUPPORT
aix-g++*:QMAKE_CXXFLAGS+=-fpermissive
CONFIG += x11inc

View File

@ -1,6 +1,2 @@
load(qttest_p4)
SOURCES += tst_qworkspace.cpp
contains(QT_CONFIG, qt3support): QT += qt3support

View File

@ -1,5 +1,5 @@
********* Start testing of tst_Cmptest *********
Config: Using QTest library 4.8.0, Qt 4.8.0
Config: Using QTest library 5.0.0, Qt 5.0.0
PASS : tst_Cmptest::initTestCase()
PASS : tst_Cmptest::compare_boolfuncs()
PASS : tst_Cmptest::compare_pointerfuncs()

View File

@ -1,5 +1,5 @@
********* Start testing of tst_Crashes *********
Config: Using QTest library 4.8.0, Qt 4.8.0
Config: Using QTest library 5.0.0, Qt 5.0.0
PASS : tst_Crashes::initTestCase()
QFATAL : tst_Crashes::crash() Received signal 11
FAIL! : tst_Crashes::crash() Received a fatal error.

View File

@ -1,5 +1,5 @@
********* Start testing of tst_LongString *********
Config: Using QTest library 4.8.0, Qt 4.8.0
Config: Using QTest library 5.0.0, Qt 5.0.0
PASS : tst_LongString::initTestCase()
FAIL! : tst_LongString::failWithLongString() Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui.

View File

@ -1,5 +1,5 @@
********* Start testing of MaxWarnings *********
Config: Using QTest library 4.8.0, Qt 4.8.0
Config: Using QTest library 5.0.0, Qt 5.0.0
PASS : MaxWarnings::initTestCase()
QWARN : MaxWarnings::warn() 0
QWARN : MaxWarnings::warn() 1

View File

@ -1,5 +1,5 @@
********* Start testing of tst_Skip *********
Config: Using QTest library 4.8.0, Qt 4.8.0
Config: Using QTest library 5.0.0, Qt 5.0.0
PASS : tst_Skip::initTestCase()
SKIP : tst_Skip::test() skipping all
Loc: [/home/user/depot/qt-git/mainline/tests/auto/selftests/skip/tst_skip.cpp(68)]

View File

@ -2,7 +2,7 @@
** Form generated from reading UI file 'gridalignment.ui'
**
** Created: Fri Oct 22 14:33:59 2010
** by: Qt User Interface Compiler version 4.8.0
** by: Qt User Interface Compiler version 5.0.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/

View File

@ -2,7 +2,7 @@
** Form generated from reading UI file 'icontheme.ui'
**
** Created: Thu Sep 2 10:28:19 2010
** by: Qt User Interface Compiler version 4.8.0
** by: Qt User Interface Compiler version 5.0.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/

View File

@ -14,7 +14,6 @@ win32 {
}
QT += xml svg network
contains(QT_CONFIG, qt3support): QT += qt3support
wince*|symbian: {
configuration.files = ../*.ini

View File

@ -51,7 +51,7 @@ string is a good idea.
////////////////////////////////////////////////////////////////////
********* Start testing of tst_QHash *********
Config: Using QTest library 4.8.0, Qt 4.8.0
Config: Using QTest library 5.0.0, Qt 5.0.0
PASS : tst_QHash::initTestCase()
RESULT : tst_QHash::qhash_qt4():
0.041 msecs per iteration (total: 85, iterations: 2048)