summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-12-06 15:43:57 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-12-06 15:43:57 (GMT)
commit9888fa259875d82bf08a28cac134fe6f71f371f0 (patch)
treea58a6ab673888d5c352d2cfe98b22fb1c11c40e9 /src/gui
parenta70ccc4aaad74dbf28569c78479d4668781bb0fe (diff)
parent9327490ad51b737211c26cae53a095a8485e2dad (diff)
downloadQt-9888fa259875d82bf08a28cac134fe6f71f371f0.zip
Qt-9888fa259875d82bf08a28cac134fe6f71f371f0.tar.gz
Qt-9888fa259875d82bf08a28cac134fe6f71f371f0.tar.bz2
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts: configure qmake/generators/win32/msbuild_objectmodel.cpp src/gui/image/qpnghandler.cpp src/network/access/qnetworkaccessdatabackend.cpp src/opengl/qgl_x11egl.cpp tests/auto/qnetworkreply/tst_qnetworkreply.cpp
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qdialog.cpp4
-rw-r--r--src/gui/egl/qegl_x11.cpp4
-rw-r--r--src/gui/image/qpnghandler.cpp84
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp4
-rw-r--r--src/gui/itemviews/qstandarditemmodel.cpp2
-rw-r--r--src/gui/painting/qemulationpaintengine.cpp9
-rw-r--r--src/gui/painting/qemulationpaintengine_p.h3
-rw-r--r--src/gui/painting/qpdf.cpp4
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp2
-rw-r--r--src/gui/styles/qs60style_s60.cpp5
-rw-r--r--src/gui/text/qtextformat.cpp10
11 files changed, 82 insertions, 49 deletions
diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp
index 6970b76..90a15b0 100644
--- a/src/gui/dialogs/qdialog.cpp
+++ b/src/gui/dialogs/qdialog.cpp
@@ -282,8 +282,8 @@ QDialog::QDialog(QWidget *parent, Qt::WindowFlags f)
QDialog::QDialog(QWidget *parent, const char *name, bool modal, Qt::WindowFlags f)
: QWidget(*new QDialogPrivate, parent,
f
- | QFlag(modal ? Qt::WShowModal : 0)
- | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : 0)
+ | QFlag(modal ? Qt::WShowModal : Qt::WindowType(0))
+ | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0))
)
{
setObjectName(QString::fromAscii(name));
diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp
index 15cc109..29415ed 100644
--- a/src/gui/egl/qegl_x11.cpp
+++ b/src/gui/egl/qegl_x11.cpp
@@ -165,8 +165,10 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config)
if (chosenVisualInfo) {
// Skip size checks if implementation supports non-matching visual
// and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444).
- if (QEgl::hasExtension("EGL_NV_post_convert_rounding"))
+ if (QEgl::hasExtension("EGL_NV_post_convert_rounding")) {
+ XFree(chosenVisualInfo);
return visualId;
+ }
int visualRedSize = countBits(chosenVisualInfo->red_mask);
int visualGreenSize = countBits(chosenVisualInfo->green_mask);
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index ea62cf8..5ee59c8 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -82,6 +82,42 @@ QT_BEGIN_NAMESPACE
Never to grayscale.
*/
+class QPngHandlerPrivate
+{
+public:
+ enum State {
+ Ready,
+ ReadHeader,
+ ReadingEnd,
+ Error
+ };
+
+ QPngHandlerPrivate(QPngHandler *qq)
+ : gamma(0.0), quality(2), png_ptr(0), info_ptr(0),
+ end_info(0), row_pointers(0), state(Ready), q(qq)
+ { }
+
+ float gamma;
+ int quality;
+ QString description;
+ QStringList readTexts;
+
+ png_struct *png_ptr;
+ png_info *info_ptr;
+ png_info *end_info;
+ png_byte **row_pointers;
+
+ bool readPngHeader();
+ bool readPngImage(QImage *image);
+
+ QImage::Format readImageFormat();
+
+ State state;
+
+ QPngHandler *q;
+};
+
+
#if defined(Q_C_CALLBACKS)
extern "C" {
#endif
@@ -118,7 +154,16 @@ private:
static
void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length)
{
- QIODevice *in = (QIODevice *)png_get_io_ptr(png_ptr);
+ QPngHandlerPrivate *d = (QPngHandlerPrivate *)png_get_io_ptr(png_ptr);
+ QIODevice *in = d->q->device();
+
+ if (d->state == QPngHandlerPrivate::ReadingEnd && !in->isSequential() && (in->size() - in->pos()) < 4 && length == 4) {
+ // Workaround for certain malformed PNGs that lack the final crc bytes
+ uchar endcrc[4] = { 0xae, 0x42, 0x60, 0x82 };
+ qMemCopy(data, endcrc, 4);
+ in->seek(in->size());
+ return;
+ }
while (length) {
int nr = in->read((char*)data, length);
@@ -314,40 +359,6 @@ static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const
}
#endif
-class QPngHandlerPrivate
-{
-public:
- enum State {
- Ready,
- ReadHeader,
- Error
- };
-
- QPngHandlerPrivate(QPngHandler *qq)
- : gamma(0.0), quality(2), png_ptr(0), info_ptr(0),
- end_info(0), row_pointers(0), state(Ready), q(qq)
- { }
-
- float gamma;
- int quality;
- QString description;
- QStringList readTexts;
-
- png_struct *png_ptr;
- png_info *info_ptr;
- png_info *end_info;
- png_byte **row_pointers;
-
- bool readPngHeader();
- bool readPngImage(QImage *image);
-
- QImage::Format readImageFormat();
-
- State state;
-
- QPngHandler *q;
-};
-
/*!
\internal
*/
@@ -380,7 +391,7 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngHeader()
return false;
}
- png_set_read_fn(png_ptr, q->device(), iod_read_fn);
+ png_set_read_fn(png_ptr, this, iod_read_fn);
png_read_info(png_ptr, info_ptr);
#ifndef QT_NO_IMAGE_TEXT
@@ -484,6 +495,7 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage)
for (int i = 0; i < readTexts.size()-1; i+=2)
outImage->setText(readTexts.at(i), readTexts.at(i+1));
+ state = ReadingEnd;
png_read_end(png_ptr, end_info);
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
delete [] row_pointers;
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index f2d8303..f7122d6 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -862,7 +862,7 @@ QVariant QAbstractItemView::inputMethodQuery(Qt::InputMethodQuery query) const
deleted. QAbstractItemView does not take ownership of \a delegate.
\note If a delegate has been assigned to both a row and a column, the row
- delegate (i.e., this delegate) will take presedence and manage the
+ delegate (i.e., this delegate) will take precedence and manage the
intersecting cell index.
\warning You should not share the same instance of a delegate between views.
@@ -920,7 +920,7 @@ QAbstractItemDelegate *QAbstractItemView::itemDelegateForRow(int row) const
deleted. QAbstractItemView does not take ownership of \a delegate.
\note If a delegate has been assigned to both a row and a column, the row
- delegate will take presedence and manage the intersecting cell index.
+ delegate will take precedence and manage the intersecting cell index.
\warning You should not share the same instance of a delegate between views.
Doing so can cause incorrect or unintuitive editing behavior since each
diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/gui/itemviews/qstandarditemmodel.cpp
index 767b5a9..7d20bbb 100644
--- a/src/gui/itemviews/qstandarditemmodel.cpp
+++ b/src/gui/itemviews/qstandarditemmodel.cpp
@@ -1130,7 +1130,7 @@ Qt::ItemFlags QStandardItem::flags() const
meaning that the user can interact with the item; if \a enabled is false, the
user cannot interact with the item.
- This flag takes presedence over the other item flags; e.g. if an item is not
+ This flag takes precedence over the other item flags; e.g. if an item is not
enabled, it cannot be selected by the user, even if the Qt::ItemIsSelectable
flag has been set.
diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp
index 0510b10..714d5de 100644
--- a/src/gui/painting/qemulationpaintengine.cpp
+++ b/src/gui/painting/qemulationpaintengine.cpp
@@ -268,6 +268,15 @@ void QEmulationPaintEngine::setState(QPainterState *s)
real_engine->setState(s);
}
+void QEmulationPaintEngine::beginNativePainting()
+{
+ real_engine->beginNativePainting();
+}
+
+void QEmulationPaintEngine::endNativePainting()
+{
+ real_engine->endNativePainting();
+}
void QEmulationPaintEngine::fillBGRect(const QRectF &r)
{
diff --git a/src/gui/painting/qemulationpaintengine_p.h b/src/gui/painting/qemulationpaintengine_p.h
index 5835f10..e283645 100644
--- a/src/gui/painting/qemulationpaintengine_p.h
+++ b/src/gui/painting/qemulationpaintengine_p.h
@@ -93,6 +93,9 @@ public:
virtual void setState(QPainterState *s);
+ virtual void beginNativePainting();
+ virtual void endNativePainting();
+
virtual uint flags() const {return QPaintEngineEx::IsEmulationEngine | QPaintEngineEx::DoNotEmulate;}
inline QPainterState *state() { return (QPainterState *)QPaintEngine::state; }
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 45af03a..f5f7c3c 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1389,7 +1389,7 @@ int QPdfBaseEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const
void QPdfBaseEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value)
{
Q_D(QPdfBaseEngine);
- switch (key) {
+ switch (int(key)) {
case PPK_CollateCopies:
d->collate = value.toBool();
break;
@@ -1479,7 +1479,7 @@ QVariant QPdfBaseEngine::property(PrintEnginePropertyKey key) const
Q_D(const QPdfBaseEngine);
QVariant ret;
- switch (key) {
+ switch (int(key)) {
case PPK_CollateCopies:
ret = d->collate;
break;
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index de59524..3cacc20 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -225,7 +225,7 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
// no room on the current line, start new glyph strip
m_cx = 0;
m_cy += m_currentRowHeight + paddingDoubled;
- m_currentRowHeight = 0; // New row
+ m_currentRowHeight = c.h + margin * 2; // New row
}
}
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index 7b75d40..92f53ff 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -698,7 +698,7 @@ void QS60StylePrivate::deleteStoredSettings()
{
QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
settings.beginGroup(QLatin1String("QS60Style"));
- settings.remove("");
+ settings.remove(QString());
settings.endGroup();
}
@@ -717,7 +717,6 @@ QColor QS60StylePrivate::colorFromFrameGraphics(SkinFrameElements frame) const
QT_TRAP_THROWING(
CRepository *themeRepository = CRepository::NewLC(personalisationUID);
if (themeRepository) {
- static const TInt KThemePkgIDDesSize = 23; //size of the stored theme package ID
TBuf<32> value; //themeID is currently max of 8 + 1 + 8 characters, but lets have some extra space
const TUint32 key = 0x00000002; //active theme key in the repository
error = themeRepository->Get(key, value);
@@ -747,7 +746,7 @@ QColor QS60StylePrivate::colorFromFrameGraphics(SkinFrameElements frame) const
return storedColor;
}
}
- settings.remove(""); //if color was invalid, or theme has been changed, just delete all stored settings
+ settings.remove(QString()); //if color was invalid, or theme has been changed, just delete all stored settings
}
}
#endif
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index ffa0ebc..945b012 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -265,10 +265,18 @@ private:
friend QDataStream &operator>>(QDataStream &, QTextFormat &);
};
-// this is only safe if sizeof(int) == sizeof(float)
+// this is only safe because sizeof(int) == sizeof(float)
static inline uint hash(float d)
{
+#ifdef Q_CC_GNU
+ // this is a GCC extension and isn't guaranteed to work in other compilers
+ // the reinterpret_cast below generates a strict-aliasing warning with GCC
+ union { float f; uint u; } cvt;
+ cvt.f = d;
+ return cvt.u;
+#else
return reinterpret_cast<uint&>(d);
+#endif
}
static inline uint hash(const QColor &color)