From 16c17f5965d8913e64698c577c26fcec9402e17a Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 19 Jul 2011 17:53:25 +0200 Subject: Fixed memory leak in the TIF handler. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iaa3093b172ddbac6597169ee4217a7f6c7867e60 Reviewed-on: http://codereview.qt.nokia.com/1952 Reviewed-by: Qt Sanity Bot Reviewed-by: Samuel Rødal --- src/gui/image/qtiffhandler.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/gui') diff --git a/src/gui/image/qtiffhandler.cpp b/src/gui/image/qtiffhandler.cpp index c753b83294..4dc9775d46 100644 --- a/src/gui/image/qtiffhandler.cpp +++ b/src/gui/image/qtiffhandler.cpp @@ -236,14 +236,14 @@ bool QTiffHandler::read(QImage *image) } } else { // create the color table - uint16 *redTable = static_cast(qMalloc(tableSize * sizeof(uint16))); - uint16 *greenTable = static_cast(qMalloc(tableSize * sizeof(uint16))); - uint16 *blueTable = static_cast(qMalloc(tableSize * sizeof(uint16))); - if (!redTable || !greenTable || !blueTable) { + uint16 *redTable = 0; + uint16 *greenTable = 0; + uint16 *blueTable = 0; + if (!TIFFGetField(tiff, TIFFTAG_COLORMAP, &redTable, &greenTable, &blueTable)) { TIFFClose(tiff); return false; } - if (!TIFFGetField(tiff, TIFFTAG_COLORMAP, &redTable, &greenTable, &blueTable)) { + if (!redTable || !greenTable || !blueTable) { TIFFClose(tiff); return false; } @@ -500,6 +500,9 @@ bool QTiffHandler::write(const QImage &image) uint16 *greenTable = static_cast(qMalloc(256 * sizeof(uint16))); uint16 *blueTable = static_cast(qMalloc(256 * sizeof(uint16))); if (!redTable || !greenTable || !blueTable) { + qFree(redTable); + qFree(greenTable); + qFree(blueTable); TIFFClose(tiff); return false; } -- cgit v1.2.3 From f74296ef7c9d58d042d7e7e10b65e32b1ff6d60e Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Tue, 19 Jul 2011 18:36:05 +0200 Subject: Add support for rawFonts loaded from data in FaceId The problem was that with an empty filename and index of 0, all raw fonts loaded from data had the same FaceId, and we wouldn't bother to load another one after doing this once. This commit introduces a uuid in FaceId to help distinguish them in that case. Change-Id: I93655ff07a7d8856af1f854024e207c519f8ed1a Reviewed-on: http://codereview.qt.nokia.com/1882 Reviewed-by: Qt Sanity Bot Reviewed-by: Jiang Jiang --- src/gui/text/qfontengine_p.h | 3 ++- src/gui/text/qrawfont_ft.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index eee2bb6bac..5570768ddb 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -155,6 +155,7 @@ public: struct FaceId { FaceId() : index(0), encoding(0) {} QByteArray filename; + QByteArray uuid; int index; int encoding; }; @@ -303,7 +304,7 @@ inline bool operator ==(const QFontEngine::FaceId &f1, const QFontEngine::FaceId inline uint qHash(const QFontEngine::FaceId &f) { - return qHash((f.index << 16) + f.encoding) + qHash(f.filename); + return qHash((f.index << 16) + f.encoding) + qHash(f.filename + f.uuid); } diff --git a/src/gui/text/qrawfont_ft.cpp b/src/gui/text/qrawfont_ft.cpp index db60459176..d9225ff896 100644 --- a/src/gui/text/qrawfont_ft.cpp +++ b/src/gui/text/qrawfont_ft.cpp @@ -45,6 +45,7 @@ #include "qrawfont_p.h" #include "qfontengine_ft_p.h" +#include "quuid.h" #if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG) # include "qfontengine_x11_p.h" @@ -87,6 +88,7 @@ public: FaceId faceId; faceId.filename = ""; faceId.index = 0; + faceId.uuid = QUuid::createUuid().toString().toAscii(); return init(faceId, true, Format_None, fontData); } -- cgit v1.2.3 From be76c09981eab137abda0e855aa0aa4e5d11a2e7 Mon Sep 17 00:00:00 2001 From: liangqi Date: Fri, 22 Jul 2011 14:19:44 +0200 Subject: Use QUuid::toByteArray() instead of QUuid::toString().toAscii() This is a cheaper way. Change-Id: Ibfc67e0ac46a77e95b2ef32cd6f28c7409c42d63 Reviewed-on: http://codereview.qt.nokia.com/2037 Reviewed-by: Qt Sanity Bot Reviewed-by: Liang Qi --- src/gui/text/qrawfont_ft.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/text/qrawfont_ft.cpp b/src/gui/text/qrawfont_ft.cpp index d9225ff896..984efdbcef 100644 --- a/src/gui/text/qrawfont_ft.cpp +++ b/src/gui/text/qrawfont_ft.cpp @@ -88,7 +88,7 @@ public: FaceId faceId; faceId.filename = ""; faceId.index = 0; - faceId.uuid = QUuid::createUuid().toString().toAscii(); + faceId.uuid = QUuid::createUuid().toByteArray(); return init(faceId, true, Format_None, fontData); } -- cgit v1.2.3 From a150880ae6ea698a2e979c93498db4f3bb66c1b0 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 25 Jul 2011 13:25:15 +1000 Subject: Delay masking the last character in Password echo mode. If QT_GUI_PASSWORD_ECHO_DELAY is defined in qplatformdefs.h with an integer value in milliseconds, QLineEdit and TextInput will display the last character entered unmasked for that delay period and then mask the character as normal. If QT_GUI_PASSWORD_ECHO_DELAY is not defined then the behaviour is unchanged. Task-number: QTBUG-17003 Reviewed-by: Martin Jones (cherry picked from commit f9e7aee2019d321edd655bfde7de43f20a106971) Conflicts: src/declarative/graphicsitems/qdeclarativetextinput.cpp tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp Change-Id: I3683223189b7176e4ef5081ee315c95a0efb9cfe Reviewed-on: http://codereview.qt.nokia.com/2060 Reviewed-by: Qt Sanity Bot Reviewed-by: Andrew den Exter --- src/gui/widgets/qlinecontrol.cpp | 54 ++++++++++++++++++++++++++++++++++++++-- src/gui/widgets/qlinecontrol_p.h | 26 ++++++++++++++++++- 2 files changed, 77 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index bf36033c08..84674a51d3 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -59,6 +59,22 @@ QT_BEGIN_NAMESPACE +#ifdef QT_GUI_PASSWORD_ECHO_DELAY +static int qt_passwordEchoDelay = QT_GUI_PASSWORD_ECHO_DELAY; +#endif + +/*! + \macro QT_GUI_PASSWORD_ECHO_DELAY + + \internal + + Defines the amount of time in milliseconds the last entered character + should be displayed unmasked in the Password echo mode. + + If not defined in qplatformdefs.h there will be no delay in masking + password characters. +*/ + /*! \internal @@ -74,9 +90,25 @@ void QLineControl::updateDisplayText(bool forceUpdate) else str = m_text; - if (m_echoMode == QLineEdit::Password || (m_echoMode == QLineEdit::PasswordEchoOnEdit - && !m_passwordEchoEditing)) + if (m_echoMode == QLineEdit::Password) { str.fill(m_passwordCharacter); +#ifdef QT_GUI_PASSWORD_ECHO_DELAY + if (m_passwordEchoTimer != 0 && !str.isEmpty()) { + int cursor = m_text.length() - 1; + QChar uc = m_text.at(cursor); + str[cursor] = uc; + if (cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) { + // second half of a surrogate, check if we have the first half as well, + // if yes restore both at once + uc = m_text.at(cursor - 1); + if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00) + str[cursor - 1] = uc; + } + } +#endif + } else if (m_echoMode == QLineEdit::PasswordEchoOnEdit && !m_passwordEchoEditing) { + str.fill(m_passwordCharacter); + } // replace certain non-printable characters with spaces (to avoid // drawing boxes when using fonts that don't have glyphs for such @@ -311,6 +343,7 @@ void QLineControl::init(const QString &txt) */ void QLineControl::updatePasswordEchoEditing(bool editing) { + cancelPasswordEchoTimer(); m_passwordEchoEditing = editing; updateDisplayText(); } @@ -640,6 +673,7 @@ bool QLineControl::finishChange(int validateFromState, bool update, bool edited) */ void QLineControl::internalSetText(const QString &txt, int pos, bool edited) { + cancelPasswordEchoTimer(); internalDeselect(); emit resetInputContext(); QString oldText = m_text; @@ -692,6 +726,13 @@ void QLineControl::addCommand(const Command &cmd) */ void QLineControl::internalInsert(const QString &s) { +#ifdef QT_GUI_PASSWORD_ECHO_DELAY + if (m_echoMode == QLineEdit::Password) { + if (m_passwordEchoTimer != 0) + killTimer(m_passwordEchoTimer); + m_passwordEchoTimer = startTimer(qt_passwordEchoDelay); + } +#endif if (hasSelectedText()) addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); if (m_maskData) { @@ -729,6 +770,7 @@ void QLineControl::internalInsert(const QString &s) void QLineControl::internalDelete(bool wasBackspace) { if (m_cursor < (int) m_text.length()) { + cancelPasswordEchoTimer(); if (hasSelectedText()) addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); addCommand(Command((CommandType)((m_maskData ? 2 : 0) + (wasBackspace ? Remove : Delete)), @@ -755,6 +797,7 @@ void QLineControl::internalDelete(bool wasBackspace) void QLineControl::removeSelectedText() { if (m_selstart < m_selend && m_selend <= (int) m_text.length()) { + cancelPasswordEchoTimer(); separate(); int i ; addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); @@ -1153,6 +1196,7 @@ void QLineControl::internalUndo(int until) { if (!isUndoAvailable()) return; + cancelPasswordEchoTimer(); internalDeselect(); while (m_undoState && m_undoState > until) { Command& cmd = m_history[--m_undoState]; @@ -1357,6 +1401,12 @@ void QLineControl::timerEvent(QTimerEvent *event) } else if (event->timerId() == m_tripleClickTimer) { killTimer(m_tripleClickTimer); m_tripleClickTimer = 0; +#ifdef QT_GUI_PASSWORD_ECHO_DELAY + } else if (event->timerId() == m_passwordEchoTimer) { + killTimer(m_passwordEchoTimer); + m_passwordEchoTimer = 0; + updateDisplayText(); +#endif } } diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index c6105f8472..44bd7214be 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -66,6 +66,8 @@ #include "QtGui/qcompleter.h" #include "QtGui/qaccessible.h" +#include "qplatformdefs.h" + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -85,6 +87,9 @@ public: m_ascent(0), m_maxLength(32767), m_lastCursorPos(-1), m_tripleClickTimer(0), m_maskData(0), m_modifiedState(0), m_undoState(0), m_selstart(0), m_selend(0), m_passwordEchoEditing(false) +#ifdef QT_GUI_PASSWORD_ECHO_DELAY + , m_passwordEchoTimer(0) +#endif { init(txt); } @@ -222,6 +227,7 @@ public: uint echoMode() const { return m_echoMode; } void setEchoMode(uint mode) { + cancelPasswordEchoTimer(); m_echoMode = mode; m_passwordEchoEditing = false; updateDisplayText(); @@ -271,7 +277,13 @@ public: QString preeditAreaText() const { return m_textLayout.preeditAreaText(); } void updatePasswordEchoEditing(bool editing); - bool passwordEchoEditing() const { return m_passwordEchoEditing; } + bool passwordEchoEditing() const { +#ifdef QT_GUI_PASSWORD_ECHO_DELAY + if (m_passwordEchoTimer != 0) + return true; +#endif + return m_passwordEchoEditing ; + } QChar passwordCharacter() const { return m_passwordCharacter; } void setPasswordCharacter(const QChar &character) { m_passwordCharacter = character; updateDisplayText(); } @@ -426,6 +438,18 @@ private: bool m_passwordEchoEditing; QChar m_passwordCharacter; +#ifdef QT_GUI_PASSWORD_ECHO_DELAY + int m_passwordEchoTimer; +#endif + void cancelPasswordEchoTimer() + { +#ifdef QT_GUI_PASSWORD_ECHO_DELAY + if (m_passwordEchoTimer != 0) { + killTimer(m_passwordEchoTimer); + m_passwordEchoTimer = 0; + } +#endif + } Q_SIGNALS: void cursorPositionChanged(int, int); -- cgit v1.2.3 From 8d762c9caea4f8b9ff589b6c23564f4e37242745 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Mon, 25 Jul 2011 10:52:48 +0200 Subject: Making cached glyphs drawing check clearer Putting the logic inside supportsTransformation() is a bit confusing and that name is misleading. Also move the same check in GL2 paint engine to the same place. Change-Id: I182500a0ff375122e6be966b7ce2495c84d113d0 Reviewed-on: http://codereview.qt.nokia.com/2096 Reviewed-by: Qt Sanity Bot Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/painting/qpaintengine_raster.cpp | 7 ++----- src/gui/painting/qpaintengineex.cpp | 10 ++++++++++ src/gui/painting/qpaintengineex_p.h | 1 + 3 files changed, 13 insertions(+), 5 deletions(-) (limited to 'src/gui') diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index e1802e6552..299f248d2b 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3011,7 +3011,7 @@ void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) ensureState(); QFontEngine *fontEngine = textItem->fontEngine(); - if (!supportsTransformations(fontEngine)) { + if (shouldDrawCachedGlyphs(fontEngine->fontDef.pixelSize, state()->matrix)) { drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions, fontEngine); } else { @@ -3385,10 +3385,7 @@ bool QRasterPaintEngine::supportsTransformations(qreal pixelSize, const QTransfo #endif return true; - if (pixelSize * pixelSize * qAbs(m.determinant()) >= 64 * 64) - return true; - - return false; + return !shouldDrawCachedGlyphs(pixelSize, m); } /*! diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 9427dd5105..5ef6900cc8 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -53,6 +53,10 @@ QT_BEGIN_NAMESPACE +#if !defined(QT_MAX_CACHED_GLYPH_SIZE) +# define QT_MAX_CACHED_GLYPH_SIZE 64 +#endif + /******************************************************************************* * * class QVectorPath @@ -1096,4 +1100,10 @@ bool QPaintEngineEx::supportsTransformations(qreal pixelSize, const QTransform & return false; } +bool QPaintEngineEx::shouldDrawCachedGlyphs(qreal pixelSize, const QTransform &m) const +{ + return (pixelSize * pixelSize * qAbs(m.determinant())) < + QT_MAX_CACHED_GLYPH_SIZE * QT_MAX_CACHED_GLYPH_SIZE; +} + QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index c6056855f0..e90d40be4d 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -228,6 +228,7 @@ public: }; virtual uint flags() const {return 0;} virtual bool supportsTransformations(qreal pixelSize, const QTransform &m) const; + virtual bool shouldDrawCachedGlyphs(qreal pixelSize, const QTransform &m) const; protected: QPaintEngineEx(QPaintEngineExPrivate &data); -- cgit v1.2.3 From b949b17c3cb7b6752bc8daf2834415163792a76c Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Thu, 21 Jul 2011 18:47:26 +0200 Subject: Changed QLibrary::resolve() to return a function pointer. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to the C++ standard, there is no guarantee that you can cast between function pointers and void pointers without data loss (section 5.2.10-6). Change-Id: I27f4d835e4c8ca8ecca0d76cfea9ce34491956bd Reviewed-on: http://codereview.qt.nokia.com/1995 Reviewed-by: Qt Sanity Bot Reviewed-by: João Abecasis --- src/gui/kernel/qapplication_x11.cpp | 6 +++--- src/gui/text/qrawfont_win.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 8bf1c70cce..8d5a0b8a50 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -467,8 +467,8 @@ extern bool qt_is_gui_used; \c XFIXES_MAJOR - it is a part of soname and may differ from the Xfixes version. */ -static void* qt_load_library_runtime(const char *library, int vernum, - int highestVernum, const char *symbol) +static QFunctionPointer qt_load_library_runtime(const char *library, int vernum, + int highestVernum, const char *symbol) { QList versions; // we try to load in the following order: @@ -483,7 +483,7 @@ static void* qt_load_library_runtime(const char *library, int vernum, Q_FOREACH(int version, versions) { QLatin1String libName(library); QLibrary xfixesLib(libName, version); - void *ptr = xfixesLib.resolve(symbol); + QFunctionPointer ptr = xfixesLib.resolve(symbol); if (ptr) return ptr; } diff --git a/src/gui/text/qrawfont_win.cpp b/src/gui/text/qrawfont_win.cpp index 6c62673b54..111439c024 100644 --- a/src/gui/text/qrawfont_win.cpp +++ b/src/gui/text/qrawfont_win.cpp @@ -529,7 +529,8 @@ void QRawFontPrivate::platformCleanUp() { if (fontHandle != NULL) { if (ptrRemoveFontMemResourceEx == NULL) { - void *func = QSystemLibrary::resolve(QLatin1String("gdi32"), "RemoveFontMemResourceEx"); + QFunctionPointer func = + QSystemLibrary::resolve(QLatin1String("gdi32"), "RemoveFontMemResourceEx"); ptrRemoveFontMemResourceEx = reinterpret_cast(func); } @@ -572,7 +573,8 @@ void QRawFontPrivate::platformLoadFromData(const QByteArray &_fontData, } if (ptrAddFontMemResourceEx == NULL || ptrRemoveFontMemResourceEx == NULL) { - void *func = QSystemLibrary::resolve(QLatin1String("gdi32"), "RemoveFontMemResourceEx"); + QFunctionPointer func = + QSystemLibrary::resolve(QLatin1String("gdi32"), "RemoveFontMemResourceEx"); ptrRemoveFontMemResourceEx = reinterpret_cast(func); -- cgit v1.2.3 From 3ef653f68166818ddd1f9df6f17c1ea94e16ff8f Mon Sep 17 00:00:00 2001 From: Ilya Konkov Date: Fri, 22 Jul 2011 13:25:46 +0200 Subject: Add initial support for bitmap version 4/5 headers. The headers are just skipped, information stored in them is ignored. Merge-request: 824 Change-Id: I48f37757114ed83cd5c92cb3d5a43eeaca4b91b3 Reviewed-on: http://codereview.qt.nokia.com/2108 Reviewed-by: Kim M. Kalland --- src/gui/image/qbmphandler.cpp | 64 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 9 deletions(-) (limited to 'src/gui') diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 07de4d349f..8840a83ff0 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -97,8 +97,10 @@ static QDataStream &operator<<(QDataStream &s, const BMP_FILEHDR &bf) const int BMP_OLD = 12; // old Windows/OS2 BMP size -const int BMP_WIN = 40; // new Windows BMP size +const int BMP_WIN = 40; // Windows BMP v3 size const int BMP_OS2 = 64; // new OS/2 BMP size +const int BMP_WIN4 = 108; // Windows BMP v4 size +const int BMP_WIN5 = 124; // Windows BMP v5 size const int BMP_RGB = 0; // no compression const int BMP_RLE8 = 1; // run-length encoded, 8 bits @@ -109,7 +111,7 @@ const int BMP_BITFIELDS = 3; // RGB values encoded in dat static QDataStream &operator>>(QDataStream &s, BMP_INFOHDR &bi) { s >> bi.biSize; - if (bi.biSize == BMP_WIN || bi.biSize == BMP_OS2) { + if (bi.biSize == BMP_WIN || bi.biSize == BMP_OS2 || bi.biSize == BMP_WIN4 || bi.biSize == BMP_WIN5) { s >> bi.biWidth >> bi.biHeight >> bi.biPlanes >> bi.biBitCount; s >> bi.biCompression >> bi.biSizeImage; s >> bi.biXPelsPerMeter >> bi.biYPelsPerMeter; @@ -255,7 +257,57 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int image.setDotsPerMeterY(bi.biYPelsPerMeter); if (!d->isSequential()) - d->seek(startpos + BMP_FILEHDR_SIZE + bi.biSize); // goto start of colormap + d->seek(startpos + BMP_FILEHDR_SIZE + (bi.biSize >= BMP_WIN4? BMP_WIN : bi.biSize)); // goto start of colormap + + if (bi.biSize >= BMP_WIN4 || (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32))) { + Q_ASSERT(ncols == 0); + + if (d->read((char *)&red_mask, sizeof(red_mask)) != sizeof(red_mask)) + return false; + if (d->read((char *)&green_mask, sizeof(green_mask)) != sizeof(green_mask)) + return false; + if (d->read((char *)&blue_mask, sizeof(blue_mask)) != sizeof(blue_mask)) + return false; + + // Read BMP v4+ header + if (bi.biSize >= BMP_WIN4) { + int alpha_mask = 0; + int CSType = 0; + int gamma_red = 0; + int gamma_green = 0; + int gamma_blue = 0; + int endpoints[9]; + + if (d->read((char *)&alpha_mask, sizeof(alpha_mask)) != sizeof(alpha_mask)) + return false; + if (d->read((char *)&CSType, sizeof(CSType)) != sizeof(CSType)) + return false; + if (d->read((char *)&endpoints, sizeof(endpoints)) != sizeof(endpoints)) + return false; + if (d->read((char *)&gamma_red, sizeof(gamma_red)) != sizeof(gamma_red)) + return false; + if (d->read((char *)&gamma_green, sizeof(gamma_green)) != sizeof(gamma_green)) + return false; + if (d->read((char *)&gamma_blue, sizeof(gamma_blue)) != sizeof(gamma_blue)) + return false; + + if (bi.biSize == BMP_WIN5) { + qint32 intent = 0; + qint32 profileData = 0; + qint32 profileSize = 0; + qint32 reserved = 0; + + if (d->read((char *)&intent, sizeof(intent)) != sizeof(intent)) + return false; + if (d->read((char *)&profileData, sizeof(profileData)) != sizeof(profileData)) + return false; + if (d->read((char *)&profileSize, sizeof(profileSize)) != sizeof(profileSize)) + return false; + if (d->read((char *)&reserved, sizeof(reserved)) != sizeof(reserved) || reserved != 0) + return false; + } + } + } if (ncols > 0) { // read color table uchar rgb[4]; @@ -268,12 +320,6 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int return false; } } else if (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32)) { - if (d->read((char *)&red_mask, sizeof(red_mask)) != sizeof(red_mask)) - return false; - if (d->read((char *)&green_mask, sizeof(green_mask)) != sizeof(green_mask)) - return false; - if (d->read((char *)&blue_mask, sizeof(blue_mask)) != sizeof(blue_mask)) - return false; red_shift = calc_shift(red_mask); red_scale = 256 / ((red_mask >> red_shift) + 1); green_shift = calc_shift(green_mask); -- cgit v1.2.3 From ef2384ad57c7e7ea40937cced6e6210fd371a978 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 25 Jul 2011 16:28:07 +1000 Subject: Update cursor position when selection is reversed. A reversed selection will have the same resolved start and end positions but a different cursor position so testing the end points alone doesn't guarantee the selection is the same. Task-number: QTBUG-19456 Reviewed-by: Martin Jones Change-Id: I516e5a501ec878d673f21e54d688fd2d21b624ef Reviewed-on: http://codereview.qt.nokia.com/2080 Reviewed-by: Qt Sanity Bot Reviewed-by: Andrew den Exter --- src/gui/widgets/qlinecontrol.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/gui') diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 84674a51d3..550b5cf947 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -281,27 +281,27 @@ void QLineControl::setSelection(int start, int length) } if (length > 0) { - if (start == m_selstart && start + length == m_selend) - return; + m_selDirty |= (start != m_selstart || start + length != m_selend); m_selstart = start; m_selend = qMin(start + length, (int)m_text.length()); m_cursor = m_selend; } else if (length < 0){ - if (start == m_selend && start + length == m_selstart) - return; + m_selDirty |= (start != m_selend || start + length != m_selstart); m_selstart = qMax(start + length, 0); m_selend = start; m_cursor = m_selstart; } else if (m_selstart != m_selend) { + m_selDirty = true; m_selstart = 0; m_selend = 0; m_cursor = start; } else { m_cursor = start; - emitCursorPositionChanged(); - return; } - emit selectionChanged(); + if (m_selDirty) { + m_selDirty = false; + emit selectionChanged(); + } emitCursorPositionChanged(); } -- cgit v1.2.3 From ac22379a75b2e252ae0fe6fe2585e3beb2096be9 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 25 Jul 2011 15:48:01 +1000 Subject: Emit selectionChanged signals when input method alters the selection. Check if the input method removes the selection and force emit selectionChanged if it sets a new selection. Task-number: QTBUG-19727 Reviewed-by: Martin Jones Change-Id: Ic8ea1044d0917aac4e52368f431ac9e5c7db7c56 Reviewed-on: http://codereview.qt.nokia.com/2076 Reviewed-by: Qt Sanity Bot Reviewed-by: Andrew den Exter --- src/gui/text/qtextcontrol.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/gui') diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index aacac0445c..424d1979b2 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1918,6 +1918,7 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) bool isGettingInput = !e->commitString().isEmpty() || e->preeditString() != cursor.block().layout()->preeditAreaText() || e->replacementLength() > 0; + bool forceSelectionChanged = false; cursor.beginEditBlock(); if (isGettingInput) { @@ -1941,6 +1942,7 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) cursor.setPosition(blockStart + a.length, QTextCursor::KeepAnchor); q->ensureCursorVisible(); repaintOldAndNewSelection(oldCursor); + forceSelectionChanged = true; } } @@ -1974,6 +1976,7 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) cursor.d->setX(); if (oldPreeditCursor != preeditCursor) emit q->microFocusChanged(); + selectionChanged(forceSelectionChanged); } QVariant QTextControl::inputMethodQuery(Qt::InputMethodQuery property) const -- cgit v1.2.3 From 750147f5c9ab892f1892fe33718fc4c402f2f73c Mon Sep 17 00:00:00 2001 From: Sarah Smith Date: Mon, 25 Jul 2011 14:38:08 +1000 Subject: Improve doc to avoid row vs col major confusion. There has been a few reports of user confusion from the fact that the constData and data functions return results in column-major format. There is nothing in the doc anywhere that states this, and nothing states that the class is especially for OpenGL which would give a clue at least. Change-Id: I3a9afde0fbeb8b9d2bcba6a387620b60a56774b9 Reviewed-on: http://codereview.qt.nokia.com/2066 Reviewed-by: Qt Sanity Bot Reviewed-by: Julian de Bhal --- src/gui/math3d/qmatrix4x4.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/gui') diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index 837bd519b8..cef92af66b 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -55,6 +55,20 @@ QT_BEGIN_NAMESPACE \since 4.6 \ingroup painting-3D + The QMatrix4x4 class in general is treated as a row-major matrix, in that the + constructors and operator() functions take data in row-major format, as is + familiar in C-style usage. + + Internally the data is stored as column-major format, so as to be optimal for + passing to OpenGL functions, which expect column-major data. + + When using these functions be aware that they return data in \bold{column-major} + format: + \list + \o data() + \o constData() + \endlist + \sa QVector3D, QGenericMatrix */ @@ -1725,6 +1739,7 @@ QRectF QMatrix4x4::mapRect(const QRectF& rect) const \fn const qreal *QMatrix4x4::data() const Returns a constant pointer to the raw data of this matrix. + This raw data is stored in column-major format. \sa constData() */ @@ -1733,6 +1748,7 @@ QRectF QMatrix4x4::mapRect(const QRectF& rect) const \fn const qreal *QMatrix4x4::constData() const Returns a constant pointer to the raw data of this matrix. + This raw data is stored in column-major format. \sa data() */ -- cgit v1.2.3 From b7064513e2b0fc51f5f68d2057047ed30bae6eba Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 26 Jul 2011 11:40:18 +0200 Subject: Make QTabWidget::tabBar() public. This is very much useful to be able to write things like myTabWidget->tabBar()->setSelectionBehaviorOnRemove( QTabBar::SelectPreviousTab ); without subclassing QTabWidget. Change-Id: Ic7c42709ea1086631d37f90f184b058c4b6e9601 Merge-request: 3 Reviewed-by: Olivier Goffart Reviewed-on: http://codereview.qt.nokia.com/2172 Reviewed-by: Qt Sanity Bot --- src/gui/widgets/qtabwidget.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/widgets/qtabwidget.h b/src/gui/widgets/qtabwidget.h index 6a026c0023..524767ecbb 100644 --- a/src/gui/widgets/qtabwidget.h +++ b/src/gui/widgets/qtabwidget.h @@ -148,6 +148,8 @@ public: void clear(); + QTabBar* tabBar() const; + public Q_SLOTS: void setCurrentIndex(int index); void setCurrentWidget(QWidget *widget); @@ -165,7 +167,6 @@ protected: void keyPressEvent(QKeyEvent *); void paintEvent(QPaintEvent *); void setTabBar(QTabBar *); - QTabBar* tabBar() const; void changeEvent(QEvent *); bool event(QEvent *); void initStyleOption(QStyleOptionTabWidgetFrame *option) const; -- cgit v1.2.3 From d692b8663c062e3b7f146529d29194ca8724f214 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 26 Jul 2011 16:11:03 +1000 Subject: Fix obsolete contact email Replace the old Trolltech contact email address with the current Qt contact email address. Task-number: QTBUG-20370 Change-Id: If5b9c3a044e1ee46264548eea456c704ced8e363 Reviewed-on: http://codereview.qt.nokia.com/2153 Reviewed-by: Qt Sanity Bot Reviewed-by: Rohan McGovern --- src/gui/kernel/qkeymapper_x11.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qkeymapper_x11.cpp b/src/gui/kernel/qkeymapper_x11.cpp index e243716f6a..455840f8b2 100644 --- a/src/gui/kernel/qkeymapper_x11.cpp +++ b/src/gui/kernel/qkeymapper_x11.cpp @@ -513,7 +513,7 @@ void QKeyMapperPrivate::clearMappings() // ### ??? // if (keyboardLayoutName.isEmpty()) - // qWarning("Qt: unable to determine keyboard layout, please talk to qt-bugs@trolltech.com"); ? + // qWarning("Qt: unable to determine keyboard layout, please talk to qt-info@nokia.com"); ? keyboardInputLocale = q_getKeyboardLocale(layoutName, variantName); keyboardInputDirection = keyboardInputLocale.textDirection(); -- cgit v1.2.3 From 4f59b5b5308011fdc4bb08bc179d5298077fd9ad Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 25 Jul 2011 16:58:46 +1000 Subject: Emit selectionChanged signals when input method alters selection. Mark the selection as dirty if an input method event contains a selection and emit selectionChanged() if it's not emitted by finishChange(). Task-number: QTBUG-19731 Change-Id: Ief6f06f40071f64dae4db0ba365676c059a39c7e Reviewed-on: http://codereview.qt.nokia.com/2081 Reviewed-by: Qt Sanity Bot Reviewed-by: Andrew den Exter --- src/gui/widgets/qlinecontrol.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/gui') diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 550b5cf947..59374466d6 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -494,6 +494,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) if (m_selend < m_selstart) { qSwap(m_selstart, m_selend); } + m_selDirty = true; } else { m_selstart = m_selend = 0; } @@ -525,12 +526,18 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) } m_textLayout.setAdditionalFormats(formats); updateDisplayText(/*force*/ true); - if (cursorPositionChanged) - emitCursorPositionChanged(); - else if (m_preeditCursor != oldPreeditCursor) - emit updateMicroFocus(); - if (isGettingInput) + if (isGettingInput) { finishChange(priorState); + } else { + if (cursorPositionChanged) + emitCursorPositionChanged(); + else if (m_preeditCursor != oldPreeditCursor) + emit updateMicroFocus(); + if (m_selDirty) { + m_selDirty = false; + emit selectionChanged(); + } + } } /*! -- cgit v1.2.3 From a2c0390468b91a3f8a97a3bbabc2f9c98e0d105a Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Tue, 26 Jul 2011 13:46:54 +1000 Subject: Add notify signals for QIntvalidator, QDoubleValidator, QRegExpValidator Task-number:QTBUG-19956 Change-Id: I5ab5e4494189ece5b0eb1f63e73e49cb2c4e9656 Reviewed-by:Michael Brasser Reviewed-on: http://codereview.qt.nokia.com/2147 Reviewed-by: Qt Sanity Bot Reviewed-by: Michael Brasser --- src/gui/widgets/qvalidator.cpp | 101 ++++++++++++++++++++++++++++++++++++++--- src/gui/widgets/qvalidator.h | 27 +++++++---- 2 files changed, 112 insertions(+), 16 deletions(-) (limited to 'src/gui') diff --git a/src/gui/widgets/qvalidator.cpp b/src/gui/widgets/qvalidator.cpp index b32bea8b7a..43251a8829 100644 --- a/src/gui/widgets/qvalidator.cpp +++ b/src/gui/widgets/qvalidator.cpp @@ -131,6 +131,69 @@ QT_BEGIN_NAMESPACE \omitvalue Valid */ + +/*! + \fn void QIntValidator::topChanged(int top) + + This signal is emitted after the top property changed. + + \sa QIntValidator::top(), QIntValidator::setTop(), QIntValidator::bottom(), QIntValidator::setBottom() + \internal +*/ + +/*! + \fn void QIntValidator::bottomChanged(int bottom) + + This signal is emitted after the bottom property changed. + + \sa QIntValidator::top(), QIntValidator::setTop(), QIntValidator::bottom(), QIntValidator::setBottom() + \internal +*/ + +/*! + \fn void QDoubleValidator::topChanged(int top) + + This signal is emitted after the top property changed. + + \sa QDoubleValidator::top(), QDoubleValidator::setTop(), QDoubleValidator::bottom(), QDoubleValidator::setBottom() + \internal +*/ + +/*! + \fn void QDoubleValidator::bottomChanged(int bottom) + + This signal is emitted after the bottom property changed. + + \sa QDoubleValidator::top(), QDoubleValidator::setTop(), QDoubleValidator::bottom(), QDoubleValidator::setBottom() + \internal +*/ + +/*! + \fn void QDoubleValidator::decimalsChanged(int decimals) + + This signal is emitted after the decimals property changed. + + \internal +*/ + +/*! + \fn void QDoubleValidator::notationChanged(QDoubleValidator::Notation notation) + + This signal is emitted after the notation property changed. + + QDoubleValidator::Notation is not a registered metatype, so for queued connections, + you will have to register it with Q_DECLARE_METATYPE() and qRegisterMetaType(). + + \internal +*/ + +/*! + \fn void QRegExpValidator::regExpChanged(const QRegExp ®Exp) + + This signal is emitted after the regExp property changed. + \internal +*/ + class QValidatorPrivate : public QObjectPrivate{ Q_DECLARE_PUBLIC(QValidator) public: @@ -436,8 +499,15 @@ void QIntValidator::fixup(QString &input) const void QIntValidator::setRange(int bottom, int top) { - b = bottom; - t = top; + if (b != bottom) { + b = bottom; + emit bottomChanged(b); + } + + if (t != top) { + t = top; + emit topChanged(t); + } } @@ -710,9 +780,20 @@ QValidator::State QDoubleValidatorPrivate::validateWithLocale(QString &input, QL void QDoubleValidator::setRange(double minimum, double maximum, int decimals) { - b = minimum; - t = maximum; - dec = decimals; + if (b != minimum) { + b = minimum; + emit bottomChanged(b); + } + + if (t != maximum) { + t = maximum; + emit topChanged(t); + } + + if (dec != decimals) { + dec = decimals; + emit decimalsChanged(dec); + } } /*! @@ -771,7 +852,10 @@ void QDoubleValidator::setDecimals(int decimals) void QDoubleValidator::setNotation(Notation newNotation) { Q_D(QDoubleValidator); - d->notation = newNotation; + if (d->notation != newNotation) { + d->notation = newNotation; + emit notationChanged(d->notation); + } } QDoubleValidator::Notation QDoubleValidator::notation() const @@ -915,7 +999,10 @@ QValidator::State QRegExpValidator::validate(QString &input, int& pos) const void QRegExpValidator::setRegExp(const QRegExp& rx) { - r = rx; + if (r != rx) { + r = rx; + emit regExpChanged(r); + } } #endif diff --git a/src/gui/widgets/qvalidator.h b/src/gui/widgets/qvalidator.h index 70f656e6a8..cb0436cc3e 100644 --- a/src/gui/widgets/qvalidator.h +++ b/src/gui/widgets/qvalidator.h @@ -96,8 +96,8 @@ private: class Q_GUI_EXPORT QIntValidator : public QValidator { Q_OBJECT - Q_PROPERTY(int bottom READ bottom WRITE setBottom) - Q_PROPERTY(int top READ top WRITE setTop) + Q_PROPERTY(int bottom READ bottom WRITE setBottom NOTIFY bottomChanged) + Q_PROPERTY(int top READ top WRITE setTop NOTIFY topChanged) public: explicit QIntValidator(QObject * parent = 0); @@ -113,7 +113,9 @@ public: int bottom() const { return b; } int top() const { return t; } - +Q_SIGNALS: + void bottomChanged(int bottom); + void topChanged(int top); #ifdef QT3_SUPPORT public: QT3_SUPPORT_CONSTRUCTOR QIntValidator(QObject * parent, const char *name); @@ -134,11 +136,11 @@ class QDoubleValidatorPrivate; class Q_GUI_EXPORT QDoubleValidator : public QValidator { Q_OBJECT - Q_PROPERTY(double bottom READ bottom WRITE setBottom) - Q_PROPERTY(double top READ top WRITE setTop) - Q_PROPERTY(int decimals READ decimals WRITE setDecimals) + Q_PROPERTY(double bottom READ bottom WRITE setBottom NOTIFY bottomChanged) + Q_PROPERTY(double top READ top WRITE setTop NOTIFY topChanged) + Q_PROPERTY(int decimals READ decimals WRITE setDecimals NOTIFY decimalsChanged) Q_ENUMS(Notation) - Q_PROPERTY(Notation notation READ notation WRITE setNotation) + Q_PROPERTY(Notation notation READ notation WRITE setNotation NOTIFY notationChanged) public: explicit QDoubleValidator(QObject * parent = 0); @@ -149,7 +151,6 @@ public: StandardNotation, ScientificNotation }; - QValidator::State validate(QString &, int &) const; virtual void setRange(double bottom, double top, int decimals = 0); @@ -163,6 +164,12 @@ public: int decimals() const { return dec; } Notation notation() const; +Q_SIGNALS: + void bottomChanged(double bottom); + void topChanged(double top); + void decimalsChanged(int decimals); + void notationChanged(QDoubleValidator::Notation notation); + #ifdef QT3_SUPPORT public: QT3_SUPPORT_CONSTRUCTOR QDoubleValidator(QObject * parent, const char *name); @@ -182,7 +189,7 @@ private: class Q_GUI_EXPORT QRegExpValidator : public QValidator { Q_OBJECT - Q_PROPERTY(QRegExp regExp READ regExp WRITE setRegExp) + Q_PROPERTY(QRegExp regExp READ regExp WRITE setRegExp NOTIFY regExpChanged) public: explicit QRegExpValidator(QObject *parent = 0); @@ -194,6 +201,8 @@ public: void setRegExp(const QRegExp& rx); const QRegExp& regExp() const { return r; } // ### make inline for 5.0 +Q_SIGNALS: + void regExpChanged(const QRegExp& regExp); #ifdef QT3_SUPPORT public: QT3_SUPPORT_CONSTRUCTOR QRegExpValidator(QObject *parent, const char *name); -- cgit v1.2.3 From 487583459ea7958f24cd579888a662bcce26caf3 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Thu, 28 Jul 2011 14:51:54 +0200 Subject: Fix off-by-one error in binary search This one-line change makes the binary search in QTextEngine::findItem behave consistently with the linear search that it replaced in commit acf678e57ed088f3e56a551cac6c7c3322005750. The new behavior seems to cause crashes in kword (and perhaps other applications) by triggering a logClusters assert, although I have been unable to create a unit test that reproduces this. Task-number: QTBUG-17209 Done-by: Dr. Robert Marmorstein Change-Id: I68b79f024e9836e1cc8b0f3514889120541eb2ea Reviewed-on: http://codereview.qt.nokia.com/2343 Reviewed-by: Qt Sanity Bot Reviewed-by: Jiang Jiang --- src/gui/text/qtextengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 41ea56a23a..cca30e6e20 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1632,7 +1632,7 @@ bool QTextEngine::isRightToLeft() const int QTextEngine::findItem(int strPos) const { itemize(); - int left = 0; + int left = 1; int right = layoutData->items.size()-1; while(left <= right) { int middle = ((right-left)/2)+left; -- cgit v1.2.3 From 23bf50432b27c544690922652d13d3a537c47d2f Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Thu, 21 Jul 2011 15:09:24 +0200 Subject: Switch to use floating point pixelSize in QRawFont completely Reviewed-by: Eskil (cherry picked from commit 500f8a4368be85a0ae8b7c46012deb0ab0c844ad) Change-Id: I6cfebcbb68697c9bf7a5634e98a09a26928467d7 Reviewed-on: http://codereview.qt.nokia.com/2386 Reviewed-by: Qt Sanity Bot Reviewed-by: Jiang Jiang --- src/gui/text/qrawfont.cpp | 8 ++++---- src/gui/text/qrawfont.h | 8 ++++---- src/gui/text/qrawfont_ft.cpp | 2 +- src/gui/text/qrawfont_mac.cpp | 2 +- src/gui/text/qrawfont_p.h | 2 +- src/gui/text/qrawfont_qpa.cpp | 2 +- src/gui/text/qrawfont_win.cpp | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 4c65ad5de0..26b6a8aad7 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -139,7 +139,7 @@ QRawFont::QRawFont() \note The referenced file must contain a TrueType or OpenType font. */ QRawFont::QRawFont(const QString &fileName, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference) : d(new QRawFontPrivate) { @@ -154,7 +154,7 @@ QRawFont::QRawFont(const QString &fileName, \note The data must contain a TrueType or OpenType font. */ QRawFont::QRawFont(const QByteArray &fontData, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference) : d(new QRawFontPrivate) { @@ -204,7 +204,7 @@ bool QRawFont::isValid() const \sa loadFromData() */ void QRawFont::loadFromFile(const QString &fileName, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference) { QFile file(fileName); @@ -222,7 +222,7 @@ void QRawFont::loadFromFile(const QString &fileName, \sa loadFromFile() */ void QRawFont::loadFromData(const QByteArray &fontData, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference) { detach(); diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h index e94bd99b8c..f7d7494f0b 100644 --- a/src/gui/text/qrawfont.h +++ b/src/gui/text/qrawfont.h @@ -70,10 +70,10 @@ public: QRawFont(); QRawFont(const QString &fileName, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference = QFont::PreferDefaultHinting); QRawFont(const QByteArray &fontData, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference = QFont::PreferDefaultHinting); QRawFont(const QRawFont &other); ~QRawFont(); @@ -117,11 +117,11 @@ public: qreal unitsPerEm() const; void loadFromFile(const QString &fileName, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference); void loadFromData(const QByteArray &fontData, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference); bool supportsCharacter(quint32 ucs4) const; diff --git a/src/gui/text/qrawfont_ft.cpp b/src/gui/text/qrawfont_ft.cpp index 984efdbcef..1666df3fdf 100644 --- a/src/gui/text/qrawfont_ft.cpp +++ b/src/gui/text/qrawfont_ft.cpp @@ -100,7 +100,7 @@ void QRawFontPrivate::platformCleanUp() // Font engine handles all resources } -void QRawFontPrivate::platformLoadFromData(const QByteArray &fontData, int pixelSize, +void QRawFontPrivate::platformLoadFromData(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) { Q_ASSERT(fontEngine == 0); diff --git a/src/gui/text/qrawfont_mac.cpp b/src/gui/text/qrawfont_mac.cpp index df68eb7e7a..40c719a1af 100644 --- a/src/gui/text/qrawfont_mac.cpp +++ b/src/gui/text/qrawfont_mac.cpp @@ -55,7 +55,7 @@ void QRawFontPrivate::platformCleanUp() extern int qt_defaultDpi(); void QRawFontPrivate::platformLoadFromData(const QByteArray &fontData, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference) { // Mac OS X ignores it diff --git a/src/gui/text/qrawfont_p.h b/src/gui/text/qrawfont_p.h index 56ea6a031d..4a4ed56223 100644 --- a/src/gui/text/qrawfont_p.h +++ b/src/gui/text/qrawfont_p.h @@ -99,7 +99,7 @@ public: void cleanUp(); void platformCleanUp(); void platformLoadFromData(const QByteArray &fontData, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference); static QRawFontPrivate *get(const QRawFont &font) { return font.d.data(); } diff --git a/src/gui/text/qrawfont_qpa.cpp b/src/gui/text/qrawfont_qpa.cpp index 3492946c1c..6a69804fac 100644 --- a/src/gui/text/qrawfont_qpa.cpp +++ b/src/gui/text/qrawfont_qpa.cpp @@ -53,7 +53,7 @@ void QRawFontPrivate::platformCleanUp() { } -void QRawFontPrivate::platformLoadFromData(const QByteArray &fontData, int pixelSize, +void QRawFontPrivate::platformLoadFromData(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) { Q_ASSERT(fontEngine == 0); diff --git a/src/gui/text/qrawfont_win.cpp b/src/gui/text/qrawfont_win.cpp index 111439c024..d8aa557975 100644 --- a/src/gui/text/qrawfont_win.cpp +++ b/src/gui/text/qrawfont_win.cpp @@ -546,7 +546,7 @@ void QRawFontPrivate::platformCleanUp() } void QRawFontPrivate::platformLoadFromData(const QByteArray &_fontData, - int pixelSize, + qreal pixelSize, QFont::HintingPreference hintingPreference) { QByteArray fontData(_fontData); -- cgit v1.2.3