From a659b4e56be9721389d28e212b4f4bcd393e6410 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 25 Feb 2015 12:14:52 +0100 Subject: fix default of SettingsPath when qt.conf is present it's documented to fall back to Prefix if qt.conf is present but Settings is not specified. Task-number: QTBUG-44644 Change-Id: I8ef6659cbdad51b2fb3c1075ea6f0af4997117ed Reviewed-by: Thiago Macieira --- src/corelib/global/qlibraryinfo.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index d592032c1f..d66007b2b6 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -441,8 +441,10 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) defaultValue = QLatin1String(qtConfEntries[loc].value); } #ifndef Q_OS_WIN // On Windows we use the registry - else if (loc == SettingsPath) + else if (loc == SettingsPath) { key = QLatin1String("Settings"); + defaultValue = QLatin1String("."); + } #endif if(!key.isNull()) { -- cgit v1.2.3 From 68762151dbf45fbb44e140ac2ad13dbe8d357352 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Wed, 25 Feb 2015 15:39:41 +0100 Subject: Fix crash when converting format of QImage created from buffer When doing format conversion, the optimized inplace codepath did not check if the image data was readonly, i.e. if the QImage had been created by the constructor taking an existing external buffer. Task-number: QTBUG-44610 Change-Id: I085ff8da427bc4ee392f548dffd2418b63148965 Reviewed-by: Allan Sandfeld Jensen --- src/gui/image/qimage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 887a7c29eb..6699e516a0 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4565,7 +4565,7 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla return true; // No in-place conversion if we have to detach - if (ref.load() > 1) + if (ref.load() > 1 || ro_data) return false; const InPlace_Image_Converter *const converterPtr = &qimage_inplace_converter_map[format][newFormat]; -- cgit v1.2.3 From 4054f8a5ad9388143041fe8c43ee7abaaf7b78fa Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 25 Feb 2015 22:06:07 +0100 Subject: Specific the correct mibEnum value for the 'macintosh' codec Change-Id: Ib57dd3c98a2ae3994898d7ea40baa0fed482c99a Reviewed-by: Lars Knoll --- src/corelib/codecs/qsimplecodec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/codecs/qsimplecodec.cpp b/src/corelib/codecs/qsimplecodec.cpp index aa8ba2802a..8a4ff66731 100644 --- a/src/corelib/codecs/qsimplecodec.cpp +++ b/src/corelib/codecs/qsimplecodec.cpp @@ -507,7 +507,7 @@ static const struct { 0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF} }, - { "macintosh", { "Apple Roman", "MacRoman", 0 }, -168, + { "macintosh", { "Apple Roman", "MacRoman", 0 }, 2027, { 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, -- cgit v1.2.3 From a782369071db1d89448c0b94248d31fa877bcf8c Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 25 Feb 2015 20:43:12 +0100 Subject: Delete the file that we will move to not the new file before moving In the case of Windows Embedded Compact we need to delete the destination file before doing the move if DeleteAndRenameFile has failed since MoveFile will fail if the destination file exists. Change-Id: I29d04c147bf8b6b5de850fd7da7bb3dc6a827f1d Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qfsfileengine_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index a1ab8fc0f8..ea2b1bbc63 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -544,7 +544,7 @@ bool QFSFileEngine::renameOverwrite(const QString &newName) bool ret = ::DeleteAndRenameFile((wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16(), (wchar_t*)d->fileEntry.nativeFilePath().utf16()) != 0; if (!ret) { - ret = ::DeleteFile((wchar_t*)d->fileEntry.nativeFilePath().utf16()) != 0; + ret = ::DeleteFile((wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16()) != 0; if (ret) ret = ::MoveFile((wchar_t*)d->fileEntry.nativeFilePath().utf16(), (wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16()) != 0; -- cgit v1.2.3 From e78643dc0a9e276480afa5de98006c4979fb0125 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Thu, 26 Feb 2015 16:42:10 +0100 Subject: Replace old qt-project.org wiki with wiki.qt.io Change-Id: If6c05a5b1f60e97c64f3d6b64041a84c3af82964 Reviewed-by: Oswald Buddenhagen --- src/widgets/doc/src/modelview.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/doc/src/modelview.qdoc b/src/widgets/doc/src/modelview.qdoc index 3b33e21ec2..31a24204fe 100644 --- a/src/widgets/doc/src/modelview.qdoc +++ b/src/widgets/doc/src/modelview.qdoc @@ -576,7 +576,7 @@ problem. Qt Labs provides software called - \l{http://qt-project.org/wiki/Model_Test}{ModelTest}, + \l{http://wiki.qt.io/?title=Model_Test}{ModelTest}, which checks models while your programming is running. Every time the model is changed, ModelTest scans the model and reports errors with an assert. This is especially important for tree models, since their hierarchical -- cgit v1.2.3 From 5f2f38854f20e04dbd8ae25ed0b346b85450e116 Mon Sep 17 00:00:00 2001 From: Liang Jian Date: Wed, 25 Feb 2015 15:47:07 +0800 Subject: Register font's english name as alias when populating font database Register font's english name as alias in the callback of EnumFontFamiliesEx() at the time QWindowsFontDatabase::populateFontDatabase() is being called. This will help us to resolve english font family name to its corresponding localized alias once windows font database has been populated. It will also fix an assertion in Chinese Windows. Task-number: QTBUG-44647 Change-Id: I265d93c16a1677a7f31ff56d60c24f6e90666419 Reviewed-by: Konstantin Ritt Reviewed-by: Friedemann Kleint Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/windows/qwindowsfontdatabase.cpp | 24 +++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 9c26a227b8..9d5abf0df1 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -850,7 +850,8 @@ error: static bool addFontToDatabase(const QString &familyName, uchar charSet, const TEXTMETRIC *textmetric, const FONTSIGNATURE *signature, - int type) + int type, + bool registerAlias) { // the "@family" fonts are just the same as "family". Ignore them. if (familyName.isEmpty() || familyName.at(0) == QLatin1Char('@') || familyName.startsWith(QLatin1String("WST_"))) @@ -887,7 +888,7 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet, #endif QString englishName; - if (ttf && localizedName(familyName)) + if (registerAlias && ttf && localizedName(familyName)) englishName = getEnglishName(familyName); QSupportedWritingSystems writingSystems; @@ -956,7 +957,7 @@ static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetr // NEWTEXTMETRICEX is a NEWTEXTMETRIC, which according to the documentation is // identical to a TEXTMETRIC except for the last four members, which we don't use // anyway - addFontToDatabase(familyName, charSet, (TEXTMETRIC *)textmetric, &signature, type); + addFontToDatabase(familyName, charSet, (TEXTMETRIC *)textmetric, &signature, type, false); // keep on enumerating return 1; @@ -991,7 +992,7 @@ struct PopulateFamiliesContext }; } // namespace -static int QT_WIN_CALLBACK populateFontFamilies(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *, int, LPARAM lparam) +static int QT_WIN_CALLBACK populateFontFamilies(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *tm, int, LPARAM lparam) { // the "@family" fonts are just the same as "family". Ignore them. const wchar_t *faceNameW = f->elfLogFont.lfFaceName; @@ -1001,6 +1002,19 @@ static int QT_WIN_CALLBACK populateFontFamilies(ENUMLOGFONTEX* f, NEWTEXTMETRICE PopulateFamiliesContext *context = reinterpret_cast(lparam); if (!context->seenSystemDefaultFont && faceName == context->systemDefaultFont) context->seenSystemDefaultFont = true; + + // Register current font's english name as alias + const bool ttf = (tm->ntmTm.tmPitchAndFamily & TMPF_TRUETYPE); + if (ttf && localizedName(faceName)) { + const QString englishName = getEnglishName(faceName); + if (!englishName.isEmpty()) { + QPlatformFontDatabase::registerAliasToFontFamily(faceName, englishName); + // Check whether the system default font name is an alias of the current font family name, + // as on Chinese Windows, where the system font "SimSun" is an alias to a font registered under a local name + if (!context->seenSystemDefaultFont && englishName == context->systemDefaultFont) + context->seenSystemDefaultFont = true; + } + } } return 1; // continue } @@ -1358,7 +1372,7 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData, GetTextMetrics(hdc, &textMetrics); addFontToDatabase(familyName, lf.lfCharSet, &textMetrics, &signatures.at(j), - TRUETYPE_FONTTYPE); + TRUETYPE_FONTTYPE, true); SelectObject(hdc, oldobj); DeleteObject(hfont); -- cgit v1.2.3 From fc3733cba4652f2b8930c66665103fcb20874735 Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Tue, 18 Nov 2014 14:58:34 +0200 Subject: Fix drawing of background for multipage QTextTable cells Task-number: QTBUG-31330 Change-Id: I0103919ee2864b7cd8bed41e6d6fe4ac5b84142e Reviewed-by: Lars Knoll --- src/gui/text/qtextdocumentlayout.cpp | 39 ++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 163d51aec2..1ddc9141af 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -1115,6 +1115,13 @@ void QTextDocumentLayoutPrivate::drawTableCell(const QRectF &cellRect, QPainter const QFixed leftPadding = td->leftPadding(fmt); const QFixed topPadding = td->topPadding(fmt); + qreal topMargin = (td->effectiveTopMargin + td->cellSpacing + td->border).toReal(); + qreal bottomMargin = (td->effectiveBottomMargin + td->cellSpacing + td->border).toReal(); + + const int headerRowCount = qMin(table->format().headerRowCount(), table->rows() - 1); + if (r >= headerRowCount) + topMargin += td->headerHeight.toReal(); + if (td->border != 0) { const QBrush oldBrush = painter->brush(); const QPen oldPen = painter->pen(); @@ -1142,13 +1149,6 @@ void QTextDocumentLayoutPrivate::drawTableCell(const QRectF &cellRect, QPainter break; } - qreal topMargin = (td->effectiveTopMargin + td->cellSpacing + td->border).toReal(); - qreal bottomMargin = (td->effectiveBottomMargin + td->cellSpacing + td->border).toReal(); - - const int headerRowCount = qMin(table->format().headerRowCount(), table->rows() - 1); - if (r >= headerRowCount) - topMargin += td->headerHeight.toReal(); - drawBorder(painter, borderRect, topMargin, bottomMargin, border, table->format().borderBrush(), cellBorder); @@ -1159,7 +1159,30 @@ void QTextDocumentLayoutPrivate::drawTableCell(const QRectF &cellRect, QPainter const QBrush bg = cell.format().background(); const QPointF brushOrigin = painter->brushOrigin(); if (bg.style() != Qt::NoBrush) { - fillBackground(painter, cellRect, bg, cellRect.topLeft()); + const qreal pageHeight = document->pageSize().height(); + const int topPage = pageHeight > 0 ? static_cast(cellRect.top() / pageHeight) : 0; + const int bottomPage = pageHeight > 0 ? static_cast((cellRect.bottom()) / pageHeight) : 0; + + if (topPage == bottomPage) + fillBackground(painter, cellRect, bg, cellRect.topLeft()); + else { + for (int i = topPage; i <= bottomPage; ++i) { + QRectF clipped = cellRect.toRect(); + + if (topPage != bottomPage) { + const qreal top = qMax(i * pageHeight + topMargin, cell_context.clip.top()); + const qreal bottom = qMin((i + 1) * pageHeight - bottomMargin, cell_context.clip.bottom()); + + clipped.setTop(qMax(clipped.top(), top)); + clipped.setBottom(qMin(clipped.bottom(), bottom)); + + if (clipped.bottom() <= clipped.top()) + continue; + + fillBackground(painter, clipped, bg, cellRect.topLeft()); + } + } + } if (bg.style() > Qt::SolidPattern) painter->setBrushOrigin(cellRect.topLeft()); -- cgit v1.2.3