summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2015-03-02 09:23:07 +0100
committerOswald Buddenhagen <oswald.buddenhagen@digia.com>2015-03-02 09:23:07 +0100
commit2b5982aac8ad103443e33379fe5654f5bd419c87 (patch)
tree8cc1d4e00029a6c0f5a23d87e9c97cdfc4619538 /src
parentefe3f631f232e6cc3966de59b9237653bf7fa96e (diff)
parentfc3733cba4652f2b8930c66665103fcb20874735 (diff)
Merge remote-tracking branch 'origin/5.4' into 5.5
Diffstat (limited to 'src')
-rw-r--r--src/corelib/codecs/qsimplecodec.cpp2
-rw-r--r--src/corelib/global/qlibraryinfo.cpp4
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp2
-rw-r--r--src/gui/image/qimage.cpp2
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp39
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp24
-rw-r--r--src/widgets/doc/src/modelview.qdoc2
7 files changed, 57 insertions, 18 deletions
diff --git a/src/corelib/codecs/qsimplecodec.cpp b/src/corelib/codecs/qsimplecodec.cpp
index c0c1d6d906..9defa3d015 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,
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index d9cda29e66..322fc2f651 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -457,8 +457,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()) {
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index a1a00016fd..5b18a85dd4 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;
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index e6f86fceaa..e33ab24243 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -4596,7 +4596,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];
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index a00dac61fb..3a86a454ac 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<int>(cellRect.top() / pageHeight) : 0;
+ const int bottomPage = pageHeight > 0 ? static_cast<int>((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());
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index 56adae8ffb..287ee4c46e 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -836,7 +836,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_")))
@@ -873,7 +874,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;
@@ -942,7 +943,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;
@@ -977,7 +978,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;
@@ -987,6 +988,19 @@ static int QT_WIN_CALLBACK populateFontFamilies(ENUMLOGFONTEX* f, NEWTEXTMETRICE
PopulateFamiliesContext *context = reinterpret_cast<PopulateFamiliesContext *>(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
}
@@ -1344,7 +1358,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);
diff --git a/src/widgets/doc/src/modelview.qdoc b/src/widgets/doc/src/modelview.qdoc
index 153b94bbdd..e3a569e8ac 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