summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qglobal.h2
-rw-r--r--src/corelib/thread/qreadwritelock.cpp4
-rw-r--r--src/corelib/thread/qwaitcondition_unix.cpp3
-rw-r--r--src/corelib/tools/qchar.cpp38
-rw-r--r--src/corelib/tools/qstring.cpp12
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp208
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp20
-rw-r--r--src/gui/image/qicon.cpp3
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp2
-rw-r--r--src/gui/styles/qcommonstyle.cpp3
-rw-r--r--src/gui/styles/qmacstyle_mac.mm2
-rw-r--r--src/gui/styles/qplastiquestyle.cpp2
-rw-r--r--src/gui/styles/qproxystyle.cpp2
-rw-r--r--src/gui/styles/qstyle_p.h1
-rw-r--r--src/gui/styles/qstylehelper.cpp3
-rw-r--r--src/gui/styles/qwindowsmobilestyle.cpp2
-rw-r--r--src/gui/styles/qwindowsstyle.cpp8
-rw-r--r--src/gui/text/qfontdatabase_x11.cpp7
-rw-r--r--src/gui/widgets/qmenu.cpp12
-rw-r--r--src/imports/folderlistmodel/plugin.cpp53
-rw-r--r--src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp14
21 files changed, 164 insertions, 237 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 3118f8f..31f8b85 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -2425,8 +2425,6 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf();
#if defined(Q_OS_SYMBIAN)
#ifdef SYMBIAN_BUILD_GCE
-//RWsPointerCursor is fixed, so don't use low performance sprites
-#define Q_SYMBIAN_FIXED_POINTER_CURSORS
#define Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE
#define Q_SYMBIAN_WINDOW_SIZE_CACHE
#define QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
diff --git a/src/corelib/thread/qreadwritelock.cpp b/src/corelib/thread/qreadwritelock.cpp
index bd07a97..1a9eb0b 100644
--- a/src/corelib/thread/qreadwritelock.cpp
+++ b/src/corelib/thread/qreadwritelock.cpp
@@ -252,7 +252,7 @@ bool QReadWriteLock::tryLockForRead(int timeout)
while (d->accessCount < 0 || d->waitingWriters) {
++d->waitingReaders;
- bool success = d->readerWait.wait(&d->mutex, timeout < 0 ? ULONG_MAX : timeout);
+ bool success = d->readerWait.wait(&d->mutex, timeout < 0 ? ULONG_MAX : ulong(timeout));
--d->waitingReaders;
if (!success)
return false;
@@ -374,7 +374,7 @@ bool QReadWriteLock::tryLockForWrite(int timeout)
while (d->accessCount != 0) {
++d->waitingWriters;
- bool success = d->writerWait.wait(&d->mutex, timeout < 0 ? ULONG_MAX : timeout);
+ bool success = d->writerWait.wait(&d->mutex, timeout < 0 ? ULONG_MAX : ulong(timeout));
--d->waitingWriters;
if (!success)
diff --git a/src/corelib/thread/qwaitcondition_unix.cpp b/src/corelib/thread/qwaitcondition_unix.cpp
index 4a05dd8..b371b0e 100644
--- a/src/corelib/thread/qwaitcondition_unix.cpp
+++ b/src/corelib/thread/qwaitcondition_unix.cpp
@@ -63,7 +63,8 @@ static void report_error(int code, const char *where, const char *what)
-struct QWaitConditionPrivate {
+class QWaitConditionPrivate {
+public:
pthread_mutex_t mutex;
pthread_cond_t cond;
int waiters;
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index ddb1516..ed0af4e 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -1480,9 +1480,9 @@ static void decomposeHelper(QString *str, bool canonical, QChar::UnicodeVersion
if (!d || (canonical && tag != QChar::Canonical))
continue;
- s.replace(uc - utf16, ucs4 > 0x10000 ? 2 : 1, (const QChar *)d, length);
- // since the insert invalidates the pointers and we do decomposition recursive
int pos = uc - utf16;
+ s.replace(pos, QChar::requiresSurrogates(ucs4) ? 2 : 1, reinterpret_cast<const QChar *>(d), length);
+ // since the insert invalidates the pointers and we do decomposition recursive
utf16 = reinterpret_cast<unsigned short *>(s.data());
uc = utf16 + pos + length;
}
@@ -1567,46 +1567,52 @@ static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, in
int p2 = pos+1;
uint u1 = s.at(pos).unicode();
if (QChar(u1).isHighSurrogate()) {
- ushort low = s.at(pos+1).unicode();
+ ushort low = s.at(p2).unicode();
if (QChar(low).isLowSurrogate()) {
- p2++;
u1 = QChar::surrogateToUcs4(u1, low);
if (p2 >= l)
break;
+ ++p2;
}
}
uint u2 = s.at(p2).unicode();
- if (QChar(u2).isHighSurrogate() && p2 < l-1) {
+ if (QChar(u2).isHighSurrogate() && p2 < l) {
ushort low = s.at(p2+1).unicode();
if (QChar(low).isLowSurrogate()) {
- p2++;
u2 = QChar::surrogateToUcs4(u2, low);
+ ++p2;
}
}
- int c2 = QChar::combiningClass(u2);
- if (QChar::unicodeVersion(u2) > version)
- c2 = 0;
-
+ ushort c2 = 0;
+ {
+ const QUnicodeTables::Properties *p = qGetProp(u2);
+ if ((QChar::UnicodeVersion)p->unicodeVersion <= version)
+ c2 = p->combiningClass;
+ }
if (c2 == 0) {
pos = p2+1;
continue;
}
- int c1 = QChar::combiningClass(u1);
- if (QChar::unicodeVersion(u1) > version)
- c1 = 0;
+
+ ushort c1 = 0;
+ {
+ const QUnicodeTables::Properties *p = qGetProp(u1);
+ if ((QChar::UnicodeVersion)p->unicodeVersion <= version)
+ c1 = p->combiningClass;
+ }
if (c1 > c2) {
QChar *uc = s.data();
int p = pos;
// exchange characters
- if (u2 < 0x10000) {
+ if (!QChar::requiresSurrogates(u2)) {
uc[p++] = u2;
} else {
uc[p++] = QChar::highSurrogate(u2);
uc[p++] = QChar::lowSurrogate(u2);
}
- if (u1 < 0x10000) {
+ if (!QChar::requiresSurrogates(u1)) {
uc[p++] = u1;
} else {
uc[p++] = QChar::highSurrogate(u1);
@@ -1618,7 +1624,7 @@ static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, in
--pos;
} else {
++pos;
- if (u1 > 0x10000)
+ if (QChar::requiresSurrogates(u1))
++pos;
}
}
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 612c492..6acbcec 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -939,11 +939,11 @@ int QString::toWCharArray(wchar_t *array) const
const unsigned short *uc = utf16();
for (int i = 0; i < length(); ++i) {
uint u = uc[i];
- if (u >= 0xd800 && u < 0xdc00 && i < length()-1) {
+ if (QChar::isHighSurrogate(u) && i + 1 < length()) {
ushort low = uc[i+1];
- if (low >= 0xdc00 && low < 0xe000) {
+ if (QChar::isLowSurrogate(low)) {
+ u = QChar::surrogateToUcs4(u, low);
++i;
- u = (u - 0xd800)*0x400 + (low - 0xdc00) + 0x10000;
}
}
*a = wchar_t(u);
@@ -6195,8 +6195,10 @@ void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar::
if (simple)
return;
- QString &s = *data;
- if (version != UNICODE_DATA_VERSION) {
+ if (version == QChar::Unicode_Unassigned) {
+ version = UNICODE_DATA_VERSION;
+ } else if (version != UNICODE_DATA_VERSION) {
+ QString &s = *data;
for (int i = 0; i < NumNormalizationCorrections; ++i) {
const NormalizationCorrection &n = uc_normalization_corrections[i];
if (n.version > version) {
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index dfd58b3..db6c4c5 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -5643,6 +5643,14 @@ void QGraphicsItem::update(const QRectF &rect)
viewport, which does not benefit from scroll optimizations), this function
is equivalent to calling update(\a rect).
+ \bold{Note:} Scrolling is only supported when QGraphicsItem::ItemCoordinateCache
+ is enabled; in all other cases calling this function is equivalent to calling
+ update(\a rect). If you for sure know that the item is opaque and not overlapped
+ by other items, you can map the \a rect to viewport coordinates and scroll the
+ viewport.
+
+ \snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 19
+
\sa boundingRect()
*/
void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect)
@@ -5652,153 +5660,73 @@ void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect)
return;
if (!d->scene)
return;
- if (d->cacheMode != NoCache) {
- QGraphicsItemCache *c;
- bool scrollCache = qFuzzyIsNull(dx - int(dx)) && qFuzzyIsNull(dy - int(dy))
- && (c = (QGraphicsItemCache *)qVariantValue<void *>(d_ptr->extra(QGraphicsItemPrivate::ExtraCacheData)))
- && (d->cacheMode == ItemCoordinateCache && !c->fixedSize.isValid());
- if (scrollCache) {
- QPixmap pix;
- if (QPixmapCache::find(c->key, &pix)) {
- // Adjust with 2 pixel margin. Notice the loss of precision
- // when converting to QRect.
- int adjust = 2;
- QRectF scrollRect = !rect.isNull() ? rect : boundingRect();
- QRectF br = boundingRect().adjusted(-adjust, -adjust, adjust, adjust);
- QRect irect = scrollRect.toRect().translated(-br.x(), -br.y());
-
- pix.scroll(dx, dy, irect);
-
- QPixmapCache::replace(c->key, pix);
-
- // Translate the existing expose.
- foreach (QRectF exposedRect, c->exposed)
- c->exposed += exposedRect.translated(dx, dy) & scrollRect;
-
- // Calculate exposure.
- QRegion exposed;
- QRect r = scrollRect.toRect();
- exposed += r;
- exposed -= r.translated(dx, dy);
- foreach (QRect rect, exposed.rects())
- update(rect);
- d->scene->d_func()->markDirty(this);
- } else {
- update(rect);
- }
- } else {
- // ### This is very slow, and can be done much better. If the cache is
- // local and matches the below criteria for rotation and scaling, we
- // can easily scroll. And if the cache is in device coordinates, we
- // can scroll both the viewport and the cache.
- update(rect);
- }
+
+ // Accelerated scrolling means moving pixels from one location to another
+ // and only redraw the newly exposed area. The following requirements must
+ // be fulfilled in order to do that:
+ //
+ // 1) Item is opaque.
+ // 2) Item is not overlapped by other items.
+ //
+ // There's (yet) no way to detect whether an item is opaque or not, which means
+ // we cannot do accelerated scrolling unless the cache is enabled. In case of using
+ // DeviceCoordinate cache we also have to take the device transform into account in
+ // order to determine whether we can do accelerated scrolling or not. That's left out
+ // for simplicity here, but it is definitely something we can consider in the future
+ // as a performance improvement.
+ if (d->cacheMode != QGraphicsItem::ItemCoordinateCache
+ || !qFuzzyIsNull(dx - int(dx)) || !qFuzzyIsNull(dy - int(dy))) {
+ update(rect);
return;
}
- QRectF scrollRect = !rect.isNull() ? rect : boundingRect();
- int couldntScroll = d->scene->views().size();
- foreach (QGraphicsView *view, d->scene->views()) {
- if (view->viewport()->inherits("QGLWidget")) {
- // ### Please replace with a widget attribute; any widget that
- // doesn't support partial updates / doesn't support scrolling
- // should be skipped in this code. Qt::WA_NoPartialUpdates or so.
- continue;
- }
+ QGraphicsItemCache *cache = d->extraItemCache();
+ if (cache->allExposed || cache->fixedSize.isValid()) {
+ // Cache is either invalidated or item is scaled (see QGraphicsItem::setCacheMode).
+ update(rect);
+ return;
+ }
- static const QLineF up(0, 0, 0, -1);
- static const QLineF down(0, 0, 0, 1);
- static const QLineF left(0, 0, -1, 0);
- static const QLineF right(0, 0, 1, 0);
-
- QTransform deviceTr = deviceTransform(view->viewportTransform());
- QRect deviceScrollRect = deviceTr.mapRect(scrollRect).toRect();
- QLineF v1 = deviceTr.map(right);
- QLineF v2 = deviceTr.map(down);
- QLineF u1 = v1.unitVector(); u1.translate(-v1.p1());
- QLineF u2 = v2.unitVector(); u2.translate(-v2.p1());
- bool noScroll = false;
-
- // Check if the delta resolves to ints in device space.
- QPointF deviceDelta = deviceTr.map(QPointF(dx, dy));
- if ((deviceDelta.x() - int(deviceDelta.x()))
- || (deviceDelta.y() - int(deviceDelta.y()))) {
- noScroll = true;
- } else {
- // Check if the unit vectors have no fraction in device space.
- qreal v1l = v1.length();
- if (v1l - int(v1l)) {
- noScroll = true;
- } else {
- dx *= v1.length();
- }
- qreal v2l = v2.length();
- if (v2l - int(v2l)) {
- noScroll = true;
- } else {
- dy *= v2.length();
- }
- }
+ QPixmap cachedPixmap;
+ if (!QPixmapCache::find(cache->key, &cachedPixmap)) {
+ update(rect);
+ return;
+ }
- if (!noScroll) {
- if (u1 == right) {
- if (u2 == up) {
- // flipped
- dy = -dy;
- } else if (u2 == down) {
- // normal
- } else {
- noScroll = true;
- }
- } else if (u1 == left) {
- if (u2 == up) {
- // mirrored & flipped / rotated 180 degrees
- dx = -dx;
- dy = -dy;
- } else if (u2 == down) {
- // mirrored
- dx = -dx;
- } else {
- noScroll = true;
- }
- } else if (u1 == up) {
- if (u2 == left) {
- // rotated -90 & mirrored
- qreal tmp = dy;
- dy = -dx;
- dx = -tmp;
- } else if (u2 == right) {
- // rotated -90
- qreal tmp = dy;
- dy = -dx;
- dx = tmp;
- } else {
- noScroll = true;
- }
- } else if (u1 == down) {
- if (u2 == left) {
- // rotated 90
- qreal tmp = dy;
- dy = dx;
- dx = -tmp;
- } else if (u2 == right) {
- // rotated 90 & mirrored
- qreal tmp = dy;
- dy = dx;
- dx = tmp;
- } else {
- noScroll = true;
- }
- }
- }
+ QRegion exposed;
+ const bool scrollEntirePixmap = rect.isNull();
+ if (scrollEntirePixmap) {
+ // Scroll entire pixmap.
+ cachedPixmap.scroll(dx, dy, cachedPixmap.rect(), &exposed);
+ } else {
+ if (!rect.intersects(cache->boundingRect))
+ return; // Nothing to scroll.
+ // Scroll sub-rect of pixmap. The rect is in item coordinates
+ // so we have to translate it to pixmap coordinates.
+ QRect scrollRect = rect.toAlignedRect();
+ cachedPixmap.scroll(dx, dy, scrollRect.translated(-cache->boundingRect.topLeft()), &exposed);
+ }
- if (!noScroll) {
- view->viewport()->scroll(int(dx), int(dy), deviceScrollRect);
- --couldntScroll;
- }
+ QPixmapCache::replace(cache->key, cachedPixmap);
+
+ // Translate the existing expose.
+ for (int i = 0; i < cache->exposed.size(); ++i) {
+ QRectF &e = cache->exposed[i];
+ if (!scrollEntirePixmap && !e.intersects(rect))
+ continue;
+ e.translate(dx, dy);
}
- if (couldntScroll)
- update(rect);
+
+ // Append newly exposed areas. Note that the exposed region is currently
+ // in pixmap coordinates, so we have to translate it to item coordinates.
+ exposed.translate(cache->boundingRect.topLeft());
+ const QVector<QRect> exposedRects = exposed.rects();
+ for (int i = 0; i < exposedRects.size(); ++i)
+ cache->exposed += exposedRects.at(i);
+
+ // Trigger update. This will redraw the newly exposed area and make sure
+ // the pixmap is re-blitted in case there are overlapping items.
+ d->scene->d_func()->markDirty(this, rect);
}
/*!
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 4b09a7e..344df30 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4372,11 +4372,6 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
bool pixmapFound;
QGraphicsItemCache *itemCache = itemd->extraItemCache();
if (cacheMode == QGraphicsItem::ItemCoordinateCache) {
- if (itemCache->boundingRect != brect.toRect()) {
- itemCache->boundingRect = brect.toRect();
- itemCache->allExposed = true;
- itemCache->exposed.clear();
- }
pixmapKey = itemCache->key;
} else {
pixmapKey = itemCache->deviceData.value(widget).key;
@@ -4389,19 +4384,24 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
if (cacheMode == QGraphicsItem::ItemCoordinateCache) {
QSize pixmapSize;
bool fixedCacheSize = false;
- QRectF brectAligned = brect.toAlignedRect();
+ QRect br = brect.toAlignedRect();
if ((fixedCacheSize = itemCache->fixedSize.isValid())) {
pixmapSize = itemCache->fixedSize;
} else {
- pixmapSize = brectAligned.size().toSize();
+ pixmapSize = br.size();
}
// Create or recreate the pixmap.
int adjust = itemCache->fixedSize.isValid() ? 0 : 2;
QSize adjustSize(adjust*2, adjust*2);
- QRectF br = brectAligned.adjusted(-adjust, -adjust, adjust, adjust);
+ br.adjust(-adjust, -adjust, adjust, adjust);
if (pix.isNull() || (!fixedCacheSize && (pixmapSize + adjustSize) != pix.size())) {
pix = QPixmap(pixmapSize + adjustSize);
+ itemCache->boundingRect = br;
+ itemCache->exposed.clear();
+ itemCache->allExposed = true;
+ } else if (itemCache->boundingRect != br) {
+ itemCache->boundingRect = br;
itemCache->exposed.clear();
itemCache->allExposed = true;
}
@@ -4455,10 +4455,10 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
// qpixmap-image-transform-pixmap roundtrip.
if (newPainterOpacity != oldPainterOpacity) {
painter->setOpacity(newPainterOpacity);
- painter->drawPixmap(br, pix, QRectF(QPointF(), pix.size()));
+ painter->drawPixmap(br.topLeft(), pix);
painter->setOpacity(oldPainterOpacity);
} else {
- painter->drawPixmap(br, pix, QRectF(QPointF(), pix.size()));
+ painter->drawPixmap(br.topLeft(), pix);
}
return;
}
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 7696632..a2f429a 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -55,7 +55,6 @@
#include "qcache.h"
#include "qdebug.h"
#include "private/qguiplatformplugin_p.h"
-#include "private/qstylehelper_p.h"
#ifdef Q_WS_MAC
#include <private/qt_mac_p.h>
@@ -67,6 +66,8 @@
#include "private/qkde_p.h"
#endif
+#include "private/qstylehelper_p.h"
+
#ifndef QT_NO_ICON
QT_BEGIN_NAMESPACE
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index d9f7df0..883f511 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -44,7 +44,6 @@
#if !defined(QT_NO_STYLE_CLEANLOOKS) || defined(QT_PLUGIN)
-#include <private/qstylehelper_p.h>
#include "qwindowsstyle_p.h"
#include <qcombobox.h>
#include <qpushbutton.h>
@@ -67,6 +66,7 @@
#include <qtoolbar.h>
#include <qwizard.h>
#include <qlibrary.h>
+#include <private/qstylehelper_p.h>
#define CL_MAX(a,b) (a)>(b) ? (a):(b) // ### qMin/qMax does not work for vc6
#define CL_MIN(a,b) (a)<(b) ? (a):(b) // remove this when it is working
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index 8036728..4978565 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -65,7 +65,6 @@
#include <qrubberband.h>
#include <private/qcommonstylepixmaps_p.h>
#include <private/qmath_p.h>
-#include <private/qstylehelper_p.h>
#include <qdebug.h>
#include <qtextformat.h>
#include <qwizard.h>
@@ -88,6 +87,8 @@
# include <private/qt_cocoa_helpers_mac_p.h>
#endif
+#include <private/qstylehelper_p.h>
+
QT_BEGIN_NAMESPACE
/*!
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index e065bcc..2e2f374 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -56,7 +56,6 @@
#include <private/qpaintengine_mac_p.h>
#include <private/qpainter_p.h>
#include <private/qprintengine_mac_p.h>
-#include <private/qstylehelper_p.h>
#include <qapplication.h>
#include <qbitmap.h>
#include <qcheckbox.h>
@@ -101,6 +100,7 @@
#include <QtGui/qgraphicsproxywidget.h>
#include <QtGui/qgraphicsview.h>
#include <private/qt_cocoa_helpers_mac_p.h>
+#include <private/qstylehelper_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp
index fbb5e4d..c8711f6 100644
--- a/src/gui/styles/qplastiquestyle.cpp
+++ b/src/gui/styles/qplastiquestyle.cpp
@@ -50,7 +50,6 @@ static const int ProgressBarFps = 25;
static const int blueFrameWidth = 2; // with of line edit focus frame
#include "qwindowsstyle_p.h"
-#include <private/qstylehelper_p.h>
#include <qapplication.h>
#include <qbitmap.h>
#include <qabstractitemview.h>
@@ -88,6 +87,7 @@ static const int blueFrameWidth = 2; // with of line edit focus frame
#include <qprocess.h>
#include <qvarlengtharray.h>
#include <limits.h>
+#include <private/qstylehelper_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/styles/qproxystyle.cpp b/src/gui/styles/qproxystyle.cpp
index 5235350..511c025 100644
--- a/src/gui/styles/qproxystyle.cpp
+++ b/src/gui/styles/qproxystyle.cpp
@@ -40,11 +40,11 @@
****************************************************************************/
#include <qstyle.h>
-#include <private/qstyle_p.h>
#include <private/qproxystyle_p.h>
#include <private/qapplication_p.h>
#include "qproxystyle.h"
#include "qstylefactory.h"
+#include <private/qstyle_p.h>
#if !defined(QT_NO_STYLE_PROXY) || defined(QT_PLUGIN)
diff --git a/src/gui/styles/qstyle_p.h b/src/gui/styles/qstyle_p.h
index 4729032..745092f 100644
--- a/src/gui/styles/qstyle_p.h
+++ b/src/gui/styles/qstyle_p.h
@@ -43,7 +43,6 @@
#define QSTYLE_P_H
#include "private/qobject_p.h"
-#include "private/qstylehelper_p.h"
#include <QtGui/qstyle.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp
index d09d7fa..ccdbf8c 100644
--- a/src/gui/styles/qstylehelper.cpp
+++ b/src/gui/styles/qstylehelper.cpp
@@ -39,8 +39,6 @@
**
****************************************************************************/
-#include "qstylehelper_p.h"
-
#include <qstyleoption.h>
#include <qpainter.h>
#include <qpixmapcache.h>
@@ -54,6 +52,7 @@
#include <private/qt_cocoa_helpers_mac_p.h>
#endif
+#include "qstylehelper_p.h"
#include <qstringbuilder.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/styles/qwindowsmobilestyle.cpp b/src/gui/styles/qwindowsmobilestyle.cpp
index 67eb1ef..4e7b92c 100644
--- a/src/gui/styles/qwindowsmobilestyle.cpp
+++ b/src/gui/styles/qwindowsmobilestyle.cpp
@@ -80,6 +80,8 @@ extern bool qt_wince_is_smartphone(); //defined in qguifunctions_wince.cp
extern bool qt_wince_is_windows_mobile_65(); //defined in qguifunctions_wince.cpp
#endif // Q_WS_WINCE
+#include "qstylehelper_p.h"
+
QT_BEGIN_NAMESPACE
static const int windowsItemFrame = 1; // menu item frame width
diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp
index 1653baa..0314c6f 100644
--- a/src/gui/styles/qwindowsstyle.cpp
+++ b/src/gui/styles/qwindowsstyle.cpp
@@ -41,7 +41,6 @@
#include "qwindowsstyle.h"
#include "qwindowsstyle_p.h"
-#include <private/qstylehelper_p.h>
#if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN)
@@ -70,13 +69,14 @@
#include <private/qmath_p.h>
#include <qmath.h>
-
#ifdef Q_WS_X11
#include "qfileinfo.h"
#include "qdir.h"
#include <private/qt_x11_p.h>
#endif
+#include <private/qstylehelper_p.h>
+
QT_BEGIN_NAMESPACE
#if defined(Q_WS_WIN)
@@ -1911,7 +1911,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
p->setPen(discol);
}
- int xm = QWindowsStylePrivate::windowsItemFrame + checkcol + QWindowsStylePrivate::windowsItemHMargin;
+ int xm = int(QWindowsStylePrivate::windowsItemFrame) + checkcol + int(QWindowsStylePrivate::windowsItemHMargin);
int xpos = menuitem->rect.x() + xm;
QRect textRect(xpos, y + QWindowsStylePrivate::windowsItemVMargin,
w - xm - QWindowsStylePrivate::windowsRightBorder - tab + 1, h - 2 * QWindowsStylePrivate::windowsItemVMargin);
@@ -3223,7 +3223,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
int checkcol = qMax<int>(maxpmw, QWindowsStylePrivate::windowsCheckMarkWidth); // Windows always shows a check column
w += checkcol;
- w += QWindowsStylePrivate::windowsRightBorder + 10;
+ w += int(QWindowsStylePrivate::windowsRightBorder) + 10;
sz.setWidth(w);
}
break;
diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp
index 3b2e4e9..a7aa2ce 100644
--- a/src/gui/text/qfontdatabase_x11.cpp
+++ b/src/gui/text/qfontdatabase_x11.cpp
@@ -78,6 +78,9 @@ QT_BEGIN_NAMESPACE
extern double qt_pointSize(double pixelSize, int dpi);
extern double qt_pixelSize(double pointSize, int dpi);
+// from qapplication.cpp
+extern bool qt_is_gui_used;
+
static inline void capitalize (char *s)
{
bool space = true;
@@ -1938,7 +1941,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
} else if (X11->has_fontconfig) {
fe = loadFc(d, script, req);
- if (fe != 0 && fe->fontDef.pixelSize != req.pixelSize) {
+ if (fe != 0 && fe->fontDef.pixelSize != req.pixelSize && mainThread && qt_is_gui_used) {
QFontEngine *xlfdFontEngine = loadXlfd(d->screen, script, req);
if (xlfdFontEngine->fontDef.family == fe->fontDef.family) {
delete fe;
@@ -1950,7 +1953,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
#endif
- } else if (mainThread) {
+ } else if (mainThread && qt_is_gui_used) {
fe = loadXlfd(d->screen, script, req);
}
if (!fe) {
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index f84059d..7941c4e 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -983,19 +983,9 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e)
return false;
}
-class ExceptionGuard
-{
-public:
- inline ExceptionGuard(bool *w = 0) : watched(w) { Q_ASSERT(!(*watched)); *watched = true; }
- inline ~ExceptionGuard() { *watched = false; }
- inline operator bool() { return *watched; }
-private:
- bool *watched;
-};
-
void QMenuPrivate::activateCausedStack(const QList<QPointer<QWidget> > &causedStack, QAction *action, QAction::ActionEvent action_e, bool self)
{
- ExceptionGuard guard(&activationRecursionGuard);
+ QBoolBlocker guard(activationRecursionGuard);
#ifdef QT3_SUPPORT
const int actionId = q_func()->findIdForAction(action);
#endif
diff --git a/src/imports/folderlistmodel/plugin.cpp b/src/imports/folderlistmodel/plugin.cpp
index d4569f7..555df3c 100644
--- a/src/imports/folderlistmodel/plugin.cpp
+++ b/src/imports/folderlistmodel/plugin.cpp
@@ -6,35 +6,34 @@
**
** This file is part of the plugins 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
-** 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, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
index 6a7383a..fccb9d4 100644
--- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
@@ -179,7 +179,8 @@ void QDeclarativeFolderListModel::setFolder(const QUrl &folder)
if (folder == d->folder)
return;
QModelIndex index = d->model.index(folder.toLocalFile());
- if (index.isValid() && d->model.isDir(index)) {
+ if ((index.isValid() && d->model.isDir(index)) || folder.toLocalFile().isEmpty()) {
+
d->folder = folder;
QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection);
emit folderChanged();
@@ -188,26 +189,23 @@ void QDeclarativeFolderListModel::setFolder(const QUrl &folder)
QUrl QDeclarativeFolderListModel::parentFolder() const
{
- QUrl r;
QString localFile = d->folder.toLocalFile();
if (!localFile.isEmpty()) {
QDir dir(localFile);
-#if defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_SYMBIAN) || defined(Q_OS_WIN)
if (dir.isRoot())
dir.setPath("");
else
#endif
dir.cdUp();
- r = d->folder;
- r.setPath(dir.path());
+ localFile = dir.path();
} else {
int pos = d->folder.path().lastIndexOf(QLatin1Char('/'));
if (pos == -1)
return QUrl();
- r = d->folder;
- r.setPath(d->folder.path().left(pos));
+ localFile = d->folder.path().left(pos);
}
- return r;
+ return QUrl::fromLocalFile(localFile);
}
/*!