summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-06-26 08:29:27 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-06-26 08:29:27 (GMT)
commite9e2baccfcfc48926414b0f18885140312470cae (patch)
tree289fd7825c7d4efc67fabfbee1a4b6d363c544b8 /src
parent7484a16ffeaf2c7640fc35b424a66cdd8695841c (diff)
parent7278c142089d46946d1ad2558eae949220dfe0c4 (diff)
downloadQt-e9e2baccfcfc48926414b0f18885140312470cae.zip
Qt-e9e2baccfcfc48926414b0f18885140312470cae.tar.gz
Qt-e9e2baccfcfc48926414b0f18885140312470cae.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src')
-rw-r--r--src/corelib/codecs/qtextcodec.cpp2
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h6
-rw-r--r--src/corelib/tools/tools.pri2
-rw-r--r--src/gui/kernel/qapplication_win.cpp19
-rw-r--r--src/gui/kernel/qmime_mac.cpp7
-rw-r--r--src/gui/painting/qpaintengine_mac.cpp9
-rw-r--r--src/gui/styles/qcommonstyle.cpp82
-rw-r--r--src/gui/styles/qstylehelper.cpp27
-rw-r--r--src/gui/styles/qstylehelper_p.h1
-rw-r--r--src/gui/styles/qwindowsstyle.cpp26
-rw-r--r--src/gui/styles/qwindowsvistastyle.cpp79
-rw-r--r--src/gui/styles/qwindowsxpstyle.cpp12
-rw-r--r--src/gui/widgets/qmenu.cpp10
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp55
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h12
-rw-r--r--src/network/access/qhttpnetworkreply.cpp13
-rw-r--r--src/network/access/qhttpnetworkreply_p.h6
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadersource_p.h18
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp12
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp25
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp5
-rw-r--r--src/script/qscriptecmafunction.cpp2
-rw-r--r--src/script/qscriptecmaglobal.cpp3
-rw-r--r--src/script/qscriptengine.cpp3
-rw-r--r--src/script/qscriptengine_p.cpp15
-rw-r--r--src/script/qscriptenginefwd_p.h9
-rw-r--r--src/script/qscriptextqobject.cpp13
-rw-r--r--src/script/qscriptextqobject_p.h3
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.cpp4
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp2
31 files changed, 322 insertions, 162 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 32c6aef..d4e5d44 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -1560,7 +1560,7 @@ QTextCodec *QTextCodec::codecForHtml(const QByteArray &ba)
*/
QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba, QTextCodec *defaultCodec)
{
- const uint arraySize = ba.size();
+ const int arraySize = ba.size();
if (arraySize > 3) {
if ((uchar)ba[0] == 0x00
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index 928805a..0471a1b 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -48,6 +48,8 @@
#pragma qt_sync_stop_processing
#endif
+#include <QtCore/qatomic.h>
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -138,14 +140,14 @@ namespace QtSharedPointer {
inline void internalConstruct(T *ptr)
{
-#ifndef QT_NO_DEBUG
+#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
if (ptr) internalSafetyCheckAdd(ptr);
#endif
value = ptr;
}
inline void internalDestroy()
{
-#ifndef QT_NO_DEBUG
+#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
if (value) internalSafetyCheckRemove(value);
#endif
}
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index aea0c6c..c93a065 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -28,6 +28,8 @@ HEADERS += \
tools/qregexp.h \
tools/qringbuffer_p.h \
tools/qshareddata.h \
+ tools/qsharedpointer.h \
+ tools/qsharedpointer_impl.h \
tools/qset.h \
tools/qsize.h \
tools/qstack.h \
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 0daabde..bb7d931 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -752,7 +752,11 @@ void QApplicationPrivate::initializeWidgetPaletteHash()
typedef BOOL (WINAPI *PtrUpdateLayeredWindow)(HWND hwnd, HDC hdcDst, const POINT *pptDst,
const SIZE *psize, HDC hdcSrc, const POINT *pptSrc, COLORREF crKey,
const Q_BLENDFUNCTION *pblend, DWORD dwflags);
+
+typedef BOOL (WINAPI *PtrSetProcessDPIAware) (VOID);
+
static PtrUpdateLayeredWindow ptrUpdateLayeredWindow = 0;
+static PtrSetProcessDPIAware ptrSetProcessDPIAware = 0;
static BOOL WINAPI qt_updateLayeredWindowIndirect(HWND hwnd, const Q_UPDATELAYEREDWINDOWINFO *info)
{
@@ -878,6 +882,11 @@ void qt_init(QApplicationPrivate *priv, int)
if (ptrUpdateLayeredWindow && !ptrUpdateLayeredWindowIndirect)
ptrUpdateLayeredWindowIndirect = qt_updateLayeredWindowIndirect;
+
+ // Notify Vista and Windows 7 that we support highter DPI settings
+ if (ptrSetProcessDPIAware = (PtrSetProcessDPIAware)
+ QLibrary::resolve(QLatin1String("user32"), "SetProcessDPIAware"))
+ ptrSetProcessDPIAware();
#endif
}
@@ -1940,10 +1949,14 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
// don't show resize-cursors for fixed-size widgets
QRect fs = widget->frameStrut();
if (!widget->isMinimized()) {
+ if (widget->minimumHeight() == widget->maximumHeight()) {
+ if (pos.y() < -(fs.top() - fs.left()))
+ return HTCAPTION;
+ if (pos.y() >= widget->height())
+ return HTBORDER;
+ }
if (widget->minimumWidth() == widget->maximumWidth() && (pos.x() < 0 || pos.x() >= widget->width()))
- break;
- if (widget->minimumHeight() == widget->maximumHeight() && (pos.y() < -(fs.top() - fs.left()) || pos.y() >= widget->height()))
- break;
+ return HTBORDER;
}
}
diff --git a/src/gui/kernel/qmime_mac.cpp b/src/gui/kernel/qmime_mac.cpp
index 31c66e4..903b677 100644
--- a/src/gui/kernel/qmime_mac.cpp
+++ b/src/gui/kernel/qmime_mac.cpp
@@ -502,6 +502,8 @@ QList<QByteArray> QMacPasteboardMimeHTMLText::convertFromMime(const QString &mim
#ifdef Q_WS_MAC32
+// This can be removed once 10.6 is the minimum (or we have to require 64-bit) whichever comes first.
+
#include <QuickTime/QuickTime.h>
#include <qlibrary.h>
@@ -1099,7 +1101,10 @@ void QMacPasteboardMime::initialize()
//standard types that we wrap
new QMacPasteboardMimeTiff;
#ifdef Q_WS_MAC32
- new QMacPasteboardMimePict;
+ // 10.6 does automatic synthesis to and from PICT to standard image types (like TIFF),
+ // so don't bother doing it ourselves, especially since it's not available in 64-bit.
+ if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_6)
+ new QMacPasteboardMimePict;
#endif
new QMacPasteboardMimeUnicodeText;
new QMacPasteboardMimePlainText;
diff --git a/src/gui/painting/qpaintengine_mac.cpp b/src/gui/painting/qpaintengine_mac.cpp
index 793460f..f5f1bba 100644
--- a/src/gui/painting/qpaintengine_mac.cpp
+++ b/src/gui/painting/qpaintengine_mac.cpp
@@ -1381,8 +1381,13 @@ QCoreGraphicsPaintEngine::updateRenderHints(QPainter::RenderHints hints)
{
Q_D(QCoreGraphicsPaintEngine);
CGContextSetShouldAntialias(d->hd, hints & QPainter::Antialiasing);
- CGContextSetInterpolationQuality(d->hd, (hints & QPainter::SmoothPixmapTransform) ?
- kCGInterpolationHigh : kCGInterpolationNone);
+ static const CGFloat ScaleFactor = qt_mac_get_scalefactor();
+ if (ScaleFactor > 1.) {
+ CGContextSetInterpolationQuality(d->hd, kCGInterpolationHigh);
+ } else {
+ CGContextSetInterpolationQuality(d->hd, (hints & QPainter::SmoothPixmapTransform) ?
+ kCGInterpolationHigh : kCGInterpolationNone);
+ }
CGContextSetShouldSmoothFonts(d->hd, hints & QPainter::TextAntialiasing);
}
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index 24ff792..7b8b75e 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -3197,7 +3197,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
//have all the information we need (ie. the layout's margin)
const QToolBar *tb = qobject_cast<const QToolBar*>(widget);
const int margin = tb && tb->layout() ? tb->layout()->margin() : 2;
- const int handleExtent = pixelMetric(QStyle::PM_ToolBarExtensionExtent, opt, tb);
+ const int handleExtent = pixelMetric(QStyle::PM_ToolBarHandleExtent, opt, tb);
if (tbopt->state & QStyle::State_Horizontal) {
r = QRect(margin, margin, handleExtent, tbopt->rect.height() - 2*margin);
r = QStyle::visualRect(tbopt->direction, tbopt->rect, r);
@@ -4535,17 +4535,17 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = 0;
break;
case PM_DialogButtonsSeparator:
- ret = 5;
+ ret = int(QStyleHelper::dpiScaled(5.));
break;
case PM_DialogButtonsButtonWidth:
- ret = 70;
+ ret = int(QStyleHelper::dpiScaled(70.));
break;
case PM_DialogButtonsButtonHeight:
- ret = 30;
+ ret = int(QStyleHelper::dpiScaled(30.));
break;
case PM_CheckListControllerSize:
case PM_CheckListButtonSize:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_TitleBarHeight: {
if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
@@ -4553,26 +4553,26 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = qMax(widget ? widget->fontMetrics().lineSpacing() : opt->fontMetrics.lineSpacing(), 16);
#ifndef QT_NO_DOCKWIDGET
} else if (qobject_cast<const QDockWidget*>(widget)) {
- ret = qMax(widget->fontMetrics().lineSpacing(), 13);
+ ret = qMax(widget->fontMetrics().lineSpacing(), int(QStyleHelper::dpiScaled(13)));
#endif
} else {
ret = qMax(widget ? widget->fontMetrics().lineSpacing() : opt->fontMetrics.lineSpacing(), 18);
}
} else {
- ret = 18;
+ ret = int(QStyleHelper::dpiScaled(18.));
}
break; }
case PM_ScrollBarSliderMin:
- ret = 9;
+ ret = int(QStyleHelper::dpiScaled(9.));
break;
case PM_ButtonMargin:
- ret = 6;
+ ret = int(QStyleHelper::dpiScaled(6.));
break;
case PM_DockWidgetTitleBarButtonMargin:
- ret = 2;
+ ret = int(QStyleHelper::dpiScaled(2.));
break;
case PM_ButtonDefaultIndicator:
@@ -4580,7 +4580,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_MenuButtonIndicator:
- ret = 12;
+ ret = int(QStyleHelper::dpiScaled(12.));
break;
case PM_ButtonShiftHorizontal:
@@ -4599,11 +4599,11 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_MdiSubWindowFrameWidth:
- ret = 4;
+ ret = int(QStyleHelper::dpiScaled(4.));
break;
case PM_MdiSubWindowMinimizedWidth:
- ret = 196;
+ ret = int(QStyleHelper::dpiScaled(196.));
break;
#ifndef QT_NO_SCROLLBAR
@@ -4614,7 +4614,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
: QApplication::globalStrut().width();
ret = qMax(16, s);
} else {
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
}
break;
#endif
@@ -4624,7 +4624,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
#ifndef QT_NO_SLIDER
case PM_SliderThickness:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_SliderTickmarkOffset:
@@ -4658,11 +4658,11 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
#endif // QT_NO_SLIDER
#ifndef QT_NO_DOCKWIDGET
case PM_DockWidgetSeparatorExtent:
- ret = 6;
+ ret = int(QStyleHelper::dpiScaled(6.));
break;
case PM_DockWidgetHandleExtent:
- ret = 8;
+ ret = int(QStyleHelper::dpiScaled(8.));
break;
case PM_DockWidgetTitleMargin:
ret = 0;
@@ -4691,19 +4691,19 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_ToolBarItemSpacing:
- ret = 4;
+ ret = int(QStyleHelper::dpiScaled(4.));
break;
case PM_ToolBarHandleExtent:
- ret = 8;
+ ret = int(QStyleHelper::dpiScaled(8.));
break;
case PM_ToolBarSeparatorExtent:
- ret = 6;
+ ret = int(QStyleHelper::dpiScaled(6.));
break;
case PM_ToolBarExtensionExtent:
- ret = 12;
+ ret = int(QStyleHelper::dpiScaled(12.));
break;
#endif // QT_NO_TOOLBAR
@@ -4713,7 +4713,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_TabBarTabHSpace:
- ret = 24;
+ ret = int(QStyleHelper::dpiScaled(24.));
break;
case PM_TabBarTabShiftHorizontal:
@@ -4742,27 +4742,27 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_IndicatorWidth:
- ret = 13;
+ ret = int(QStyleHelper::dpiScaled(13.));
break;
case PM_IndicatorHeight:
- ret = 13;
+ ret = int(QStyleHelper::dpiScaled(13.));
break;
case PM_ExclusiveIndicatorWidth:
- ret = 12;
+ ret = int(QStyleHelper::dpiScaled(12.));
break;
case PM_ExclusiveIndicatorHeight:
- ret = 12;
+ ret = int(QStyleHelper::dpiScaled(12.));
break;
case PM_MenuTearoffHeight:
- ret = 10;
+ ret = int(QStyleHelper::dpiScaled(10.));
break;
case PM_MenuScrollerHeight:
- ret = 10;
+ ret = int(QStyleHelper::dpiScaled(10.));
break;
case PM_MenuDesktopFrameWidth:
@@ -4772,16 +4772,16 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_HeaderMargin:
- ret = 4;
+ ret = int(QStyleHelper::dpiScaled(4.));
break;
case PM_HeaderMarkSize:
- ret = 32;
+ ret = int(QStyleHelper::dpiScaled(32.));
break;
case PM_HeaderGripMargin:
- ret = 4;
+ ret = int(QStyleHelper::dpiScaled(4.));
break;
case PM_TabBarScrollButtonWidth:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_LayoutLeftMargin:
case PM_LayoutTopMargin:
@@ -4803,13 +4803,13 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_DefaultTopLevelMargin:
- ret = 11;
+ ret = int(QStyleHelper::dpiScaled(11.));
break;
case PM_DefaultChildMargin:
- ret = 9;
+ ret = int(QStyleHelper::dpiScaled(9.));
break;
case PM_DefaultLayoutSpacing:
- ret = 6;
+ ret = int(QStyleHelper::dpiScaled(6.));
break;
case PM_TabBarIconSize:
@@ -4820,14 +4820,14 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
case PM_ButtonIconSize:
case PM_SmallIconSize:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_IconViewIconSize:
ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget);
break;
case PM_LargeIconSize:
- ret = 32;
+ ret = int(QStyleHelper::dpiScaled(32.));
break;
case PM_ToolTipLabelFrameWidth:
@@ -4835,13 +4835,13 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_CheckBoxLabelSpacing:
case PM_RadioButtonLabelSpacing:
- ret = 6;
+ ret = int(QStyleHelper::dpiScaled(6.));
break;
case PM_SizeGripSize:
- ret = 13;
+ ret = int(QStyleHelper::dpiScaled(13.));
break;
case PM_MessageBoxIconSize:
- ret = 32;
+ ret = int(QStyleHelper::dpiScaled(32.));
break;
case PM_TextCursorWidth:
ret = 1;
@@ -4851,7 +4851,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_TabCloseIndicatorWidth:
case PM_TabCloseIndicatorHeight:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_ScrollView_ScrollBarSpacing:
ret = 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp
index 997bd68..f9010e8 100644
--- a/src/gui/styles/qstylehelper.cpp
+++ b/src/gui/styles/qstylehelper.cpp
@@ -48,6 +48,12 @@
#include <private/qstyle_p.h>
#include <qmath.h>
+#if defined(Q_WS_WIN)
+#include "qt_windows.h"
+#elif defined(Q_WS_MAC)
+#include <private/qt_cocoa_helpers_mac_p.h>
+#endif
+
QT_BEGIN_NAMESPACE
namespace QStyleHelper {
@@ -72,6 +78,26 @@ QString uniqueName(const QString &key, const QStyleOption *option, const QSize &
return tmp;
}
+qreal dpiScaled(qreal value)
+{
+ static qreal scale = -1;
+ if (scale < 0) {
+ scale = 1.0;
+#if defined(Q_WS_WIN)
+ {
+ HDC hdcScreen = GetDC(0);
+ int dpi = GetDeviceCaps(hdcScreen, LOGPIXELSX);
+ ReleaseDC(0, hdcScreen);
+ scale = dpi/96.0;
+ }
+#elif defined(Q_WS_MAC)
+ scale = qt_mac_get_scalefactor();
+#endif
+ }
+ return value * scale;
+}
+
+
#ifndef QT_NO_DIAL
int calcBigLineSize(int radius)
@@ -178,7 +204,6 @@ QPolygonF calcLines(const QStyleOptionSlider *dial)
return poly;
}
-
// This will draw a nice and shiny QDial for us. We don't want
// all the shinyness in QWindowsStyle, hence we place it here
diff --git a/src/gui/styles/qstylehelper_p.h b/src/gui/styles/qstylehelper_p.h
index 7099e87..cac88e2 100644
--- a/src/gui/styles/qstylehelper_p.h
+++ b/src/gui/styles/qstylehelper_p.h
@@ -67,6 +67,7 @@ class QStyleOption;
namespace QStyleHelper
{
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size);
+ qreal dpiScaled(qreal value);
#ifndef QT_NO_DIAL
qreal angle(const QPointF &p1, const QPointF &p2);
QPolygonF calcLines(const QStyleOptionSlider *dial);
diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp
index 39743b0..997c2ce 100644
--- a/src/gui/styles/qwindowsstyle.cpp
+++ b/src/gui/styles/qwindowsstyle.cpp
@@ -42,6 +42,7 @@
#include "qwindowsstyle.h"
#include "qwindowsstyle_p.h"
#include <private/qpixmapdata_p.h>
+#include <private/qstylehelper_p.h>
#if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN)
@@ -405,7 +406,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
#ifndef QT_NO_SLIDER
case PM_SliderLength:
- ret = 11;
+ ret = int(QStyleHelper::dpiScaled(11.));
break;
// Returns the number of pixels to use for the business part of the
@@ -453,11 +454,11 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
break;
case PM_SmallIconSize:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_LargeIconSize:
- ret = 32;
+ ret = int(QStyleHelper::dpiScaled(32.));
break;
case PM_IconViewIconSize:
@@ -465,13 +466,13 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
break;
case PM_ToolBarIconSize:
- ret = 24;
+ ret = int(QStyleHelper::dpiScaled(24.));
break;
case PM_DockWidgetTitleMargin:
- ret = 2;
+ ret = int(QStyleHelper::dpiScaled(2.));
break;
case PM_DockWidgetTitleBarButtonMargin:
- ret = 4;
+ ret = int(QStyleHelper::dpiScaled(4.));
break;
#if defined(Q_WS_WIN)
case PM_DockWidgetFrameWidth:
@@ -553,7 +554,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
ret = 0;
break;
case PM_ToolBarHandleExtent:
- ret = 10;
+ ret = int(QStyleHelper::dpiScaled(10.));
break;
default:
ret = QCommonStyle::pixelMetric(pm, opt, widget);
@@ -3200,11 +3201,14 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
int defwidth = 0;
if (btn->features & QStyleOptionButton::AutoDefaultButton)
defwidth = 2 * proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
+ int minwidth = int(QStyleHelper::dpiScaled(75.));
+ int minheight = int(QStyleHelper::dpiScaled(23.));
+
#ifndef QT_QWS_SMALL_PUSHBUTTON
- if (w < 75 + defwidth && !btn->text.isEmpty())
- w = 75 + defwidth;
- if (h < 23 + defwidth)
- h = 23 + defwidth;
+ if (w < minwidth + defwidth && !btn->text.isEmpty())
+ w = minwidth + defwidth;
+ if (h < minheight + defwidth)
+ h = minheight + defwidth;
#endif
sz = QSize(w, h);
}
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp
index 7a75a7d..5f0f053 100644
--- a/src/gui/styles/qwindowsvistastyle.cpp
+++ b/src/gui/styles/qwindowsvistastyle.cpp
@@ -41,6 +41,7 @@
#include "qwindowsvistastyle.h"
#include "qwindowsvistastyle_p.h"
+#include <private/qstylehelper_p.h>
#if !defined(QT_NO_STYLE_WINDOWSVISTA) || defined(QT_PLUGIN)
@@ -487,7 +488,12 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
case PE_IndicatorBranch:
{
XPThemeData theme(d->treeViewHelper(), painter, QLatin1String("TREEVIEW"));
- static const int decoration_size = 16;
+ static int decoration_size = 0;
+ if (theme.isValid() && !decoration_size) {
+ SIZE size;
+ pGetThemePartSize(theme.handle(), 0, TVP_HOTGLYPH, GLPS_OPENED, 0, TS_TRUE, &size);
+ decoration_size = qMax(size.cx, size.cy);
+ }
int mid_h = option->rect.x() + option->rect.width() / 2;
int mid_v = option->rect.y() + option->rect.height() / 2;
int bef_h = mid_h;
@@ -535,17 +541,6 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
}
break;
- case PE_IndicatorToolBarHandle:
- {
- XPThemeData theme;
- if (option->state & State_Horizontal)
- theme = XPThemeData(widget, painter, QLatin1String("REBAR"), RP_GRIPPER, ETS_NORMAL, option->rect.adjusted(0, 1, -2, -2));
- else
- theme = XPThemeData(widget, painter, QLatin1String("REBAR"), RP_GRIPPERVERT, ETS_NORMAL, option->rect.adjusted(0, 1, -2, -2));
- d->drawBackground(theme);
- }
- break;
-
case PE_FrameMenu:
{
int stateId = option->state & State_Active ? MB_ACTIVE : MB_INACTIVE;
@@ -694,6 +689,24 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
}
break;
+ case PE_IndicatorToolBarHandle:
+ {
+ XPThemeData theme;
+ QRect rect;
+ if (option->state & State_Horizontal) {
+ theme = XPThemeData(widget, painter, QLatin1String("REBAR"), RP_GRIPPER, ETS_NORMAL, option->rect.adjusted(0, 1, -2, -2));
+ rect = option->rect.adjusted(0, 1, 0, -2);
+ rect.setWidth(4);
+ } else {
+ theme = XPThemeData(widget, painter, QLatin1String("REBAR"), RP_GRIPPERVERT, ETS_NORMAL, option->rect.adjusted(0, 1, -2, -2));
+ rect = option->rect.adjusted(1, 0, -1, 0);
+ rect.setHeight(4);
+ }
+ theme.rect = rect;
+ d->drawBackground(theme);
+ }
+ break;
+
case PE_IndicatorToolBarSeparator:
{
QPen pen = painter->pen();
@@ -1230,7 +1243,15 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
case CE_MenuItem:
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
// windows always has a check column, regardless whether we have an icon or not
- int checkcol = qMax(menuitem->maxIconWidth, 28);
+ int checkcol = 28;
+ {
+ SIZE size;
+ MARGINS margins;
+ XPThemeData theme(widget, 0, QLatin1String("MENU"), MENU_POPUPCHECKBACKGROUND, MBI_HOT);
+ pGetThemePartSize(theme.handle(), NULL, MENU_POPUPCHECK, 0, NULL,TS_TRUE, &size);
+ pGetThemeMargins(theme.handle(), NULL, MENU_POPUPCHECK, 0, TMT_CONTENTMARGINS, NULL, &margins);
+ checkcol = qMax(menuitem->maxIconWidth, int(6 + size.cx + margins.cxLeftWidth + margins.cxRightWidth));
+ }
QColor darkLine = option->palette.background().color().darker(108);
QColor lightLine = option->palette.background().color().lighter(107);
QRect rect = option->rect;
@@ -1275,8 +1296,23 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
if (checked) {
XPThemeData theme(widget, painter, QLatin1String("MENU"), MENU_POPUPCHECKBACKGROUND,
menuitem->icon.isNull() ? MBI_HOT : MBI_PUSHED, vCheckRect);
+ SIZE size;
+ MARGINS margins;
+ pGetThemePartSize(theme.handle(), NULL, MENU_POPUPCHECK, 0, NULL,TS_TRUE, &size);
+ pGetThemeMargins(theme.handle(), NULL, MENU_POPUPCHECK, 0,
+ TMT_CONTENTMARGINS, NULL, &margins);
+ QRect checkRect(0, 0, size.cx + margins.cxLeftWidth + margins.cxRightWidth ,
+ size.cy + margins.cyBottomHeight + margins.cyTopHeight);
+ checkRect.moveCenter(vCheckRect.center());
+ theme.rect = checkRect;
+
d->drawBackground(theme);
+
if (menuitem->icon.isNull()) {
+ checkRect = QRect(0, 0, size.cx, size.cy);
+ checkRect.moveCenter(theme.rect.center());
+ theme.rect = checkRect;
+
theme.partId = MENU_POPUPCHECK;
bool bullet = menuitem->checkType & QStyleOptionMenuItem::Exclusive;
if (dis)
@@ -1926,9 +1962,18 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption
return sz;
case CT_MenuItem:
sz = QWindowsXPStyle::sizeFromContents(type, option, size, widget);
- sz.rwidth() += 28;
+ int minimumHeight;
+ {
+ SIZE size;
+ MARGINS margins;
+ XPThemeData theme(widget, 0, QLatin1String("MENU"), MENU_POPUPCHECKBACKGROUND, MBI_HOT);
+ pGetThemePartSize(theme.handle(), NULL, MENU_POPUPCHECK, 0, NULL,TS_TRUE, &size);
+ pGetThemeMargins(theme.handle(), NULL, MENU_POPUPCHECK, 0, TMT_CONTENTMARGINS, NULL, &margins);
+ minimumHeight = qMax<qint32>(size.cy + margins.cyBottomHeight+ margins.cyTopHeight, sz.height());
+ sz.rwidth() += size.cx + margins.cxLeftWidth + margins.cxRightWidth;
+ }
+
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
- int minimumHeight = qMax<qint32>(22, sz.height());
if (menuitem->menuItemType != QStyleOptionMenuItem::Separator)
sz.setHeight(minimumHeight);
}
@@ -2318,9 +2363,9 @@ int QWindowsVistaStyle::pixelMetric(PixelMetric metric, const QStyleOption *opti
switch (metric) {
case PM_DockWidgetTitleBarButtonMargin:
- return 5;
+ return int(QStyleHelper::dpiScaled(5.));
case PM_ScrollBarSliderMin:
- return 18;
+ return int(QStyleHelper::dpiScaled(18.));
case PM_MenuHMargin:
case PM_MenuVMargin:
return 0;
diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp
index b0eae1f..322bfac 100644
--- a/src/gui/styles/qwindowsxpstyle.cpp
+++ b/src/gui/styles/qwindowsxpstyle.cpp
@@ -3235,7 +3235,7 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
break;
case PM_SplitterWidth:
- res = qMax(5, QApplication::globalStrut().width());
+ res = qMax(int(QStyleHelper::dpiScaled(5.)), QApplication::globalStrut().width());
break;
case PM_IndicatorWidth:
@@ -3245,7 +3245,7 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
if (theme.isValid()) {
SIZE size;
pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
- res = (pm == PM_IndicatorWidth ? size.cx+2 : res = size.cy+2);
+ res = (pm == PM_IndicatorWidth ? size.cx : res = size.cy);
}
}
break;
@@ -3257,7 +3257,7 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
if (theme.isValid()) {
SIZE size;
pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
- res = (pm == PM_ExclusiveIndicatorWidth ? size.cx+2 : res = size.cy+2);
+ res = (pm == PM_ExclusiveIndicatorWidth ? size.cx : res = size.cy);
}
}
break;
@@ -3329,7 +3329,7 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
#ifndef QT_NO_TOOLBAR
case PM_ToolBarHandleExtent:
- res = 8;
+ res = int(QStyleHelper::dpiScaled(8.));
break;
#endif // QT_NO_TOOLBAR
@@ -3344,10 +3344,10 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
}
break;
case PM_DockWidgetSeparatorExtent:
- res = 4;
+ res = int(QStyleHelper::dpiScaled(4.));
break;
case PM_DockWidgetTitleMargin:
- res = 4;
+ res = int(QStyleHelper::dpiScaled(4.));
break;
case PM_ButtonShiftHorizontal:
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index fc55a2c..15eeb09 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -235,16 +235,15 @@ void QMenuPrivate::calcActionRects(QMap<QAction*, QRect> &actionRects, QList<QAc
for(int i = 0; i < items.count(); i++) {
QAction *action = items.at(i);
- QFontMetrics fm(action->font().resolve(q->font()));
- QSize sz;
-
//let the style modify the above size..
QStyleOptionMenuItem opt;
q->initStyleOption(&opt, action);
opt.rect = q->rect();
+ const QFontMetrics &fm = opt.fontMetrics;
+ QSize sz;
if (QWidget *w = widgetItems.value(action)) {
- sz=w->sizeHint().expandedTo(w->minimumSize()).expandedTo(w->minimumSizeHint()).boundedTo(w->maximumSize());
+ sz = w->sizeHint().expandedTo(w->minimumSize()).expandedTo(w->minimumSizeHint()).boundedTo(w->maximumSize());
} else {
//calc what I think the size is..
if (action->isSeparator()) {
@@ -1178,7 +1177,8 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action)
else
option->palette.setCurrentColorGroup(QPalette::Disabled);
- option->font = action->font();
+ option->font = action->font().resolve(font());
+ option->fontMetrics = QFontMetrics(option->font);
if (d->currentAction && d->currentAction == action && !d->currentAction->isSeparator()) {
option->state |= QStyle::State_Selected
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index f0c694d..8409660 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -174,30 +174,43 @@ bool QHttpNetworkConnectionPrivate::isSocketReading(QAbstractSocket *socket) con
}
-void QHttpNetworkConnectionPrivate::appendData(QHttpNetworkReply &reply, const QByteArray &fragment, bool compressed)
+void QHttpNetworkConnectionPrivate::appendUncompressedData(QHttpNetworkReply &reply, const QByteArray &fragment)
{
- QByteArray *ba = (compressed) ? &reply.d_func()->compressedData : &reply.d_func()->responseData;
- ba->append(fragment);
- return;
+ char *dst = reply.d_func()->responseData.reserve(fragment.size());
+ qMemCopy(dst, fragment.constData(), fragment.size());
}
-qint64 QHttpNetworkConnectionPrivate::bytesAvailable(const QHttpNetworkReply &reply, bool compressed) const
+void QHttpNetworkConnectionPrivate::appendCompressedData(QHttpNetworkReply &reply, const QByteArray &fragment)
{
- const QByteArray *ba = (compressed) ? &reply.d_func()->compressedData : &reply.d_func()->responseData;
- return ba->size();
+ reply.d_func()->compressedData.append(fragment);
}
-qint64 QHttpNetworkConnectionPrivate::read(QHttpNetworkReply &reply, QByteArray &data, qint64 maxSize, bool compressed)
+qint64 QHttpNetworkConnectionPrivate::uncompressedBytesAvailable(const QHttpNetworkReply &reply) const
{
- QByteArray *ba = (compressed) ? &reply.d_func()->compressedData : &reply.d_func()->responseData;
- if (maxSize == -1 || maxSize >= ba->size()) {
+ return reply.d_func()->responseData.size();
+}
+
+qint64 QHttpNetworkConnectionPrivate::uncompressedBytesAvailableNextBlock(const QHttpNetworkReply &reply) const
+{
+ return reply.d_func()->responseData.nextDataBlockSize();
+}
+
+qint64 QHttpNetworkConnectionPrivate::compressedBytesAvailable(const QHttpNetworkReply &reply) const
+{
+ return reply.d_func()->compressedData.size();
+}
+
+qint64 QHttpNetworkConnectionPrivate::read(QHttpNetworkReply &reply, QByteArray &data, qint64 maxSize)
+{
+ QRingBuffer *rb = &reply.d_func()->responseData;
+ if (maxSize == -1 || maxSize >= rb->size()) {
// read the whole data
- data = *ba;
- ba->clear();
+ data = rb->readAll();
+ rb->clear();
} else {
// read only the requested length
- data = ba->mid(0, maxSize);
- ba->remove(0, maxSize);
+ data.resize(maxSize);
+ rb->read(data.data(), maxSize);
}
return data.size();
}
@@ -524,12 +537,14 @@ bool QHttpNetworkConnectionPrivate::expand(QAbstractSocket *socket, QHttpNetwork
Q_ASSERT(socket);
Q_ASSERT(reply);
- qint64 total = bytesAvailable(*reply, true);
+ qint64 total = compressedBytesAvailable(*reply);
if (total >= CHUNK || dataComplete) {
int i = indexOf(socket);
// uncompress the data
QByteArray content, inflated;
- read(*reply, content, -1, true);
+ content = reply->d_func()->compressedData;
+ reply->d_func()->compressedData.clear();
+
int ret = Z_OK;
if (content.size())
ret = reply->d_func()->gunzipBodyPartially(content, inflated);
@@ -537,7 +552,7 @@ bool QHttpNetworkConnectionPrivate::expand(QAbstractSocket *socket, QHttpNetwork
if (ret >= retCheck) {
if (inflated.size()) {
reply->d_func()->totalProgress += inflated.size();
- appendData(*reply, inflated, false);
+ appendUncompressedData(*reply, inflated);
if (shouldEmitSignals(reply)) {
emit reply->readyRead();
// make sure that the reply is valid
@@ -638,7 +653,11 @@ void QHttpNetworkConnectionPrivate::receiveReply(QAbstractSocket *socket, QHttpN
fragment.open(QIODevice::WriteOnly);
bytes = reply->d_func()->readBody(socket, &fragment);
if (bytes) {
- appendData(*reply, fragment.data(), reply->d_func()->autoDecompress);
+ if (reply->d_func()->autoDecompress)
+ appendCompressedData(*reply, fragment.data());
+ else
+ appendUncompressedData(*reply, fragment.data());
+
if (!reply->d_func()->autoDecompress) {
reply->d_func()->totalProgress += fragment.size();
if (shouldEmitSignals(reply)) {
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index 64a6faa..3eb8ffe 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -254,9 +254,15 @@ public:
bool pendingAuthSignal; // there is an incomplete authentication signal
bool pendingProxyAuthSignal; // there is an incomplete proxy authentication signal
- void appendData(QHttpNetworkReply &reply, const QByteArray &fragment, bool compressed);
- qint64 bytesAvailable(const QHttpNetworkReply &reply, bool compressed = false) const;
- qint64 read(QHttpNetworkReply &reply, QByteArray &data, qint64 maxSize, bool compressed);
+ void appendUncompressedData(QHttpNetworkReply &reply, const QByteArray &fragment);
+ void appendCompressedData(QHttpNetworkReply &reply, const QByteArray &fragment);
+
+ qint64 uncompressedBytesAvailable(const QHttpNetworkReply &reply) const;
+ qint64 uncompressedBytesAvailableNextBlock(const QHttpNetworkReply &reply) const;
+ qint64 compressedBytesAvailable(const QHttpNetworkReply &reply) const;
+
+ qint64 read(QHttpNetworkReply &reply, QByteArray &data, qint64 maxSize);
+
void emitReplyError(QAbstractSocket *socket, QHttpNetworkReply *reply, QNetworkReply::NetworkError errorCode);
bool handleAuthenticateChallenge(QAbstractSocket *socket, QHttpNetworkReply *reply, bool isProxy, bool &resend);
void allDone(QAbstractSocket *socket, QHttpNetworkReply *reply);
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index c4d4a9c..202bdea 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -162,7 +162,16 @@ qint64 QHttpNetworkReply::bytesAvailable() const
{
Q_D(const QHttpNetworkReply);
if (d->connection)
- return d->connection->d_func()->bytesAvailable(*this);
+ return d->connection->d_func()->uncompressedBytesAvailable(*this);
+ else
+ return -1;
+}
+
+qint64 QHttpNetworkReply::bytesAvailableNextBlock() const
+{
+ Q_D(const QHttpNetworkReply);
+ if (d->connection)
+ return d->connection->d_func()->uncompressedBytesAvailableNextBlock(*this);
else
return -1;
}
@@ -172,7 +181,7 @@ QByteArray QHttpNetworkReply::read(qint64 maxSize)
Q_D(QHttpNetworkReply);
QByteArray data;
if (d->connection)
- d->connection->d_func()->read(*this, data, maxSize, false);
+ d->connection->d_func()->read(*this, data, maxSize);
return data;
}
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index 08bd886..69c9158 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -79,6 +79,7 @@ static const unsigned char gz_magic[2] = {0x1f, 0x8b}; // gzip magic header
#include <private/qhttpnetworkheader_p.h>
#include <private/qhttpnetworkrequest_p.h>
#include <private/qauthenticator_p.h>
+#include <private/qringbuffer_p.h>
QT_BEGIN_NAMESPACE
@@ -120,6 +121,7 @@ public:
QString reasonPhrase() const;
qint64 bytesAvailable() const;
+ qint64 bytesAvailableNextBlock() const;
QByteArray read(qint64 maxSize = -1);
bool isFinished() const;
@@ -193,7 +195,7 @@ public:
qint64 bodyLength;
qint64 contentRead;
qint64 totalProgress;
- QByteArray fragment;
+ QByteArray fragment; // used for header, status, chunk header etc, not for reply data
qint64 currentChunkSize;
qint64 currentChunkRead;
QPointer<QHttpNetworkConnection> connection;
@@ -204,7 +206,7 @@ public:
#endif
bool autoDecompress;
- QByteArray responseData; // uncompressed body
+ QRingBuffer responseData; // uncompressed body
QByteArray compressedData; // compressed body (temporary)
bool requestIsPrepared;
};
diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
index 4959b60..4e32f91 100644
--- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
@@ -64,19 +64,23 @@ QT_MODULE(OpenGL)
static const char* const qglslMainVertexShader = "\
+ uniform highp float depth;\
void setPosition();\
void main(void)\
{\
setPosition();\
+ gl_Position.z = depth * gl_Position.w;\
}";
static const char* const qglslMainWithTexCoordsVertexShader = "\
attribute lowp vec2 textureCoordArray; \
varying lowp vec2 textureCoords; \
+ uniform highp float depth;\
void setPosition();\
void main(void) \
{\
setPosition();\
+ gl_Position.z = depth * gl_Position.w;\
textureCoords = textureCoordArray; \
}";
@@ -84,20 +88,16 @@ static const char* const qglslMainWithTexCoordsVertexShader = "\
static const char* const qglslPositionOnlyVertexShader = "\
attribute highp vec4 vertexCoordsArray;\
uniform highp mat4 pmvMatrix;\
- uniform highp float depth;\
void setPosition(void)\
{\
gl_Position = pmvMatrix * vertexCoordsArray;\
- gl_Position.z = depth;\
}";
static const char* const qglslUntransformedPositionVertexShader = "\
attribute highp vec4 vertexCoordsArray;\
- uniform highp float depth;\
void setPosition(void)\
{\
gl_Position = vertexCoordsArray;\
- gl_Position.z = depth;\
}";
// Pattern Brush - This assumes the texture size is 8x8 and thus, the inverted size is 0.125
@@ -108,11 +108,9 @@ static const char* const qglslPositionWithPatternBrushVertexShader = "\
uniform mediump vec2 invertedTextureSize; \
uniform mediump mat3 brushTransform; \
varying mediump vec2 patternTexCoords; \
- uniform highp float depth;\
void setPosition(void) { \
gl_Position = pmvMatrix * vertexCoordsArray;\
gl_Position.xy = gl_Position.xy / gl_Position.w; \
- gl_Position.z = depth;\
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
@@ -142,11 +140,9 @@ static const char* const qglslPositionWithLinearGradientBrushVertexShader = "\
uniform highp vec3 linearData; \
uniform highp mat3 brushTransform; \
varying mediump float index ; \
- uniform highp float depth;\
void setPosition() { \
gl_Position = pmvMatrix * vertexCoordsArray;\
gl_Position.xy = gl_Position.xy / gl_Position.w; \
- gl_Position.z = depth;\
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
@@ -174,12 +170,10 @@ static const char* const qglslPositionWithConicalGradientBrushVertexShader = "\
uniform mediump vec2 halfViewportSize; \
uniform highp mat3 brushTransform; \
varying highp vec2 A; \
- uniform highp float depth;\
void setPosition(void)\
{\
gl_Position = pmvMatrix * vertexCoordsArray;\
gl_Position.xy = gl_Position.xy / gl_Position.w; \
- gl_Position.z = depth; \
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
@@ -215,12 +209,10 @@ static const char* const qglslPositionWithRadialGradientBrushVertexShader = "\
uniform highp vec2 fmp; \
varying highp float b; \
varying highp vec2 A; \
- uniform highp float depth;\
void setPosition(void) \
{\
gl_Position = pmvMatrix * vertexCoordsArray;\
gl_Position.xy = gl_Position.xy / gl_Position.w; \
- gl_Position.z = depth; \
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
@@ -254,11 +246,9 @@ static const char* const qglslPositionWithTextureBrushVertexShader = "\
uniform mediump vec2 invertedTextureSize; \
uniform mediump mat3 brushTransform; \
varying mediump vec2 brushTextureCoords; \
- uniform highp float depth;\
void setPosition(void) { \
gl_Position = pmvMatrix * vertexCoordsArray;\
gl_Position.xy = gl_Position.xy / gl_Position.w; \
- gl_Position.z = depth; \
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 91df197..e24742f 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -654,6 +654,9 @@ void QGL2PaintEngineEx::sync()
glDisable(GL_BLEND);
glActiveTexture(GL_TEXTURE0);
+
+ d->needsSync = true;
+ d->shaderManager->setDirty();
}
void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode)
@@ -1216,6 +1219,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
d->simpleShaderDepthUniformDirty = true;
d->depthUniformDirty = true;
d->opacityUniformDirty = true;
+ d->needsSync = false;
d->use_system_clip = !systemClip().isEmpty();
@@ -1294,11 +1298,15 @@ void QGL2PaintEngineEx::ensureActive()
ctx->d_ptr->active_engine = this;
- glDisable(GL_DEPTH_TEST);
+ d->needsSync = true;
+ }
+ if (d->needsSync) {
glViewport(0, 0, d->width, d->height);
-
+ glDepthMask(false);
+ glDepthFunc(GL_LEQUAL);
setState(state());
+ d->needsSync = false;
}
}
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index 448964b..0d28a49 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -248,6 +248,8 @@ public:
uint uniformIdentifiers[NumUniforms];
GLuint lastTexture;
+
+ bool needsSync;
};
QT_END_NAMESPACE
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 1b499b6..3185664 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -378,7 +378,7 @@ void QDirectFBPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
Q_D(QDirectFBPaintEngine);
d->dirtyClip = true;
const QPoint bottom = d->transform.map(QPoint(0, int(path.controlPointRect().bottom())));
- if (bottom.y() >= d->lastLockedHeight)
+ if (bottom.y() > d->lastLockedHeight)
d->lock();
QRasterPaintEngine::clip(path, op);
}
@@ -389,7 +389,7 @@ void QDirectFBPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)
d->dirtyClip = true;
if (d->clip() && !d->clip()->hasRectClip && d->clip()->enabled) {
const QPoint bottom = d->transform.map(QPoint(0, rect.bottom()));
- if (bottom.y() >= d->lastLockedHeight)
+ if (bottom.y() > d->lastLockedHeight)
d->lock();
}
@@ -567,6 +567,7 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap,
QPixmapData *data = pixmap.pixmapData();
Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
+ dfbData->unlockDirectFB();
IDirectFBSurface *s = dfbData->directFBSurface();
d->blit(r, s, sr);
}
@@ -598,6 +599,10 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r,
QRasterPaintEngine::drawTiledPixmap(r, pix, sp);
} else {
d->unlock();
+ QPixmapData *data = pixmap.pixmapData();
+ Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
+ QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
+ dfbData->unlockDirectFB();
d->drawTiledPixmap(r, pixmap);
}
}
@@ -913,11 +918,17 @@ void QDirectFBPaintEnginePrivate::end()
void QDirectFBPaintEnginePrivate::setPen(const QPen &p)
{
pen = p;
- simplePen = (pen.style() == Qt::NoPen) ||
- (pen.style() == Qt::SolidLine
- && !antialiased
- && (pen.brush().style() == Qt::SolidPattern)
- && (pen.widthF() <= 1 && scale != NoScale));
+ if (pen.style() == Qt::NoPen) {
+ simplePen = true;
+ } else if (pen.style() == Qt::SolidLine
+ && !antialiased
+ && pen.brush().style() == Qt::SolidPattern
+ && pen.widthF() <= 1.0
+ && (scale == NoScale || pen.isCosmetic())) {
+ simplePen = true;
+ } else {
+ simplePen = false;
+ }
}
void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode mode)
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index 9dc7818..c9d5d7c 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -90,7 +90,6 @@ void QDirectFBPixmapData::resize(int width, int height)
setSerialNumber(++global_ser_no);
}
-
// mostly duplicated from qimage.cpp (QImageData::checkForAlphaPixels)
static bool checkForAlphaPixels(const QImage &img)
{
@@ -209,6 +208,7 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect)
QPixmapData::copy(data, rect);
return;
}
+ unlockDirectFB();
const QDirectFBPixmapData *otherData = static_cast<const QDirectFBPixmapData*>(data);
IDirectFBSurface *src = otherData->directFBSurface();
@@ -296,10 +296,10 @@ void QDirectFBPixmapData::fill(const QColor &color)
QPixmap QDirectFBPixmapData::transformed(const QTransform &transform,
Qt::TransformationMode mode) const
{
+ QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this);
if (!dfbSurface || transform.type() != QTransform::TxScale
|| mode != Qt::FastTransformation)
{
- QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this);
const QImage *image = that->buffer();
Q_ASSERT(image);
const QImage transformed = image->transformed(transform, mode);
@@ -308,6 +308,7 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform,
data->fromImage(transformed, Qt::AutoColor);
return QPixmap(data);
}
+ that->unlockDirectFB();
const QSize size = transform.mapRect(QRect(0, 0, w, h)).size();
if (size.isEmpty())
diff --git a/src/script/qscriptecmafunction.cpp b/src/script/qscriptecmafunction.cpp
index 87b0639..0bb5f12 100644
--- a/src/script/qscriptecmafunction.cpp
+++ b/src/script/qscriptecmafunction.cpp
@@ -436,7 +436,7 @@ QScriptValueImpl Function::method_connect(QScriptContextPrivate *context, QScrip
QLatin1String("Function.prototype.connect: target is not a function"));
}
- bool ok = eng->scriptConnect(self, receiver, slot);
+ bool ok = eng->scriptConnect(self, receiver, slot, Qt::AutoConnection);
if (!ok) {
return context->throwError(
QString::fromLatin1("Function.prototype.connect: failed to connect to %0::%1")
diff --git a/src/script/qscriptecmaglobal.cpp b/src/script/qscriptecmaglobal.cpp
index a7cb115..b756a27 100644
--- a/src/script/qscriptecmaglobal.cpp
+++ b/src/script/qscriptecmaglobal.cpp
@@ -305,8 +305,7 @@ public:
}
if (context->state() != QScriptContext::ExceptionState) {
- QTextStream qout(stdout, QIODevice::WriteOnly);
- qout << result << endl;
+ qDebug(qPrintable(result));
context->setReturnValue(eng->undefinedValue());
}
#ifndef Q_SCRIPT_NO_EVENT_NOTIFY
diff --git a/src/script/qscriptengine.cpp b/src/script/qscriptengine.cpp
index de8bd8d..de78403 100644
--- a/src/script/qscriptengine.cpp
+++ b/src/script/qscriptengine.cpp
@@ -1616,7 +1616,8 @@ bool qScriptConnect(QObject *sender, const char *signal,
QScriptEnginePrivate *eng_p = QScriptEnginePrivate::get(function.engine());
return eng_p->scriptConnect(sender, signal,
eng_p->toImpl(receiver),
- eng_p->toImpl(function));
+ eng_p->toImpl(function),
+ Qt::AutoConnection);
}
/*!
diff --git a/src/script/qscriptengine_p.cpp b/src/script/qscriptengine_p.cpp
index 0a238bc..ffb5a27 100644
--- a/src/script/qscriptengine_p.cpp
+++ b/src/script/qscriptengine_p.cpp
@@ -2312,7 +2312,8 @@ void QScriptEnginePrivate::deletePendingQObjects()
bool QScriptEnginePrivate::scriptConnect(QObject *sender, const char *signal,
const QScriptValueImpl &receiver,
- const QScriptValueImpl &function)
+ const QScriptValueImpl &function,
+ Qt::ConnectionType type)
{
Q_ASSERT(sender);
Q_ASSERT(signal);
@@ -2320,7 +2321,7 @@ bool QScriptEnginePrivate::scriptConnect(QObject *sender, const char *signal,
int index = meta->indexOfSignal(QMetaObject::normalizedSignature(signal+1));
if (index == -1)
return false;
- return scriptConnect(sender, index, receiver, function);
+ return scriptConnect(sender, index, receiver, function, /*wrapper=*/QScriptValueImpl(), type);
}
bool QScriptEnginePrivate::scriptDisconnect(QObject *sender, const char *signal,
@@ -2339,10 +2340,11 @@ bool QScriptEnginePrivate::scriptDisconnect(QObject *sender, const char *signal,
bool QScriptEnginePrivate::scriptConnect(QObject *sender, int signalIndex,
const QScriptValueImpl &receiver,
const QScriptValueImpl &function,
- const QScriptValueImpl &senderWrapper)
+ const QScriptValueImpl &senderWrapper,
+ Qt::ConnectionType type)
{
QScriptQObjectData *data = qobjectData(sender);
- return data->addSignalHandler(sender, signalIndex, receiver, function, senderWrapper);
+ return data->addSignalHandler(sender, signalIndex, receiver, function, senderWrapper, type);
}
bool QScriptEnginePrivate::scriptDisconnect(QObject *sender, int signalIndex,
@@ -2357,11 +2359,12 @@ bool QScriptEnginePrivate::scriptDisconnect(QObject *sender, int signalIndex,
bool QScriptEnginePrivate::scriptConnect(const QScriptValueImpl &signal,
const QScriptValueImpl &receiver,
- const QScriptValueImpl &function)
+ const QScriptValueImpl &function,
+ Qt::ConnectionType type)
{
QScript::QtFunction *fun = static_cast<QScript::QtFunction*>(signal.toFunction());
int index = fun->mostGeneralMethod();
- return scriptConnect(fun->qobject(), index, receiver, function, fun->object());
+ return scriptConnect(fun->qobject(), index, receiver, function, fun->object(), type);
}
bool QScriptEnginePrivate::scriptDisconnect(const QScriptValueImpl &signal,
diff --git a/src/script/qscriptenginefwd_p.h b/src/script/qscriptenginefwd_p.h
index 11cd839..62942a5 100644
--- a/src/script/qscriptenginefwd_p.h
+++ b/src/script/qscriptenginefwd_p.h
@@ -385,7 +385,8 @@ public:
bool scriptConnect(QObject *sender, const char *signal,
const QScriptValueImpl &receiver,
- const QScriptValueImpl &function);
+ const QScriptValueImpl &function,
+ Qt::ConnectionType type);
bool scriptDisconnect(QObject *sender, const char *signal,
const QScriptValueImpl &receiver,
const QScriptValueImpl &function);
@@ -393,14 +394,16 @@ public:
bool scriptConnect(QObject *sender, int index,
const QScriptValueImpl &receiver,
const QScriptValueImpl &function,
- const QScriptValueImpl &senderWrapper = QScriptValueImpl());
+ const QScriptValueImpl &senderWrapper,
+ Qt::ConnectionType type);
bool scriptDisconnect(QObject *sender, int index,
const QScriptValueImpl &receiver,
const QScriptValueImpl &function);
bool scriptConnect(const QScriptValueImpl &signal,
const QScriptValueImpl &receiver,
- const QScriptValueImpl &function);
+ const QScriptValueImpl &function,
+ Qt::ConnectionType type);
bool scriptDisconnect(const QScriptValueImpl &signal,
const QScriptValueImpl &receiver,
const QScriptValueImpl &function);
diff --git a/src/script/qscriptextqobject.cpp b/src/script/qscriptextqobject.cpp
index 00963a7..a3cb4e6 100644
--- a/src/script/qscriptextqobject.cpp
+++ b/src/script/qscriptextqobject.cpp
@@ -1420,7 +1420,8 @@ public:
bool addSignalHandler(QObject *sender, int signalIndex,
const QScriptValueImpl &receiver,
const QScriptValueImpl &slot,
- const QScriptValueImpl &senderWrapper = QScriptValueImpl());
+ const QScriptValueImpl &senderWrapper,
+ Qt::ConnectionType type);
bool removeSignalHandler(
QObject *sender, int signalIndex,
const QScriptValueImpl &receiver,
@@ -1741,13 +1742,14 @@ void QScript::QObjectConnectionManager::mark(int generation)
bool QScript::QObjectConnectionManager::addSignalHandler(
QObject *sender, int signalIndex, const QScriptValueImpl &receiver,
- const QScriptValueImpl &function, const QScriptValueImpl &senderWrapper)
+ const QScriptValueImpl &function, const QScriptValueImpl &senderWrapper,
+ Qt::ConnectionType type)
{
if (connections.size() <= signalIndex)
connections.resize(signalIndex+1);
QVector<QObjectConnection> &cs = connections[signalIndex];
int absSlotIndex = m_slotCounter + metaObject()->methodOffset();
- bool ok = QMetaObject::connect(sender, signalIndex, this, absSlotIndex);
+ bool ok = QMetaObject::connect(sender, signalIndex, this, absSlotIndex, type);
if (ok) {
cs.append(QScript::QObjectConnection(m_slotCounter++, receiver, function, senderWrapper));
QMetaMethod signal = sender->metaObject()->method(signalIndex);
@@ -2176,12 +2178,13 @@ bool QScriptQObjectData::addSignalHandler(QObject *sender,
int signalIndex,
const QScriptValueImpl &receiver,
const QScriptValueImpl &slot,
- const QScriptValueImpl &senderWrapper)
+ const QScriptValueImpl &senderWrapper,
+ Qt::ConnectionType type)
{
if (!m_connectionManager)
m_connectionManager = new QScript::QObjectConnectionManager();
return m_connectionManager->addSignalHandler(
- sender, signalIndex, receiver, slot, senderWrapper);
+ sender, signalIndex, receiver, slot, senderWrapper, type);
}
bool QScriptQObjectData::removeSignalHandler(QObject *sender,
diff --git a/src/script/qscriptextqobject_p.h b/src/script/qscriptextqobject_p.h
index 764644f..8f10823 100644
--- a/src/script/qscriptextqobject_p.h
+++ b/src/script/qscriptextqobject_p.h
@@ -216,7 +216,8 @@ public:
int signalIndex,
const QScriptValueImpl &receiver,
const QScriptValueImpl &slot,
- const QScriptValueImpl &senderWrapper = QScriptValueImpl());
+ const QScriptValueImpl &senderWrapper,
+ Qt::ConnectionType type);
bool removeSignalHandler(QObject *sender,
int signalIndex,
const QScriptValueImpl &receiver,
diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp
index 893c98c..0c4fff0 100644
--- a/src/sql/drivers/ibase/qsql_ibase.cpp
+++ b/src/sql/drivers/ibase/qsql_ibase.cpp
@@ -157,8 +157,8 @@ static void delDA(XSQLDA *&sqlda)
if (!sqlda)
return;
for (int i = 0; i < sqlda->sqld; ++i) {
- delete sqlda->sqlvar[i].sqlind;
- delete sqlda->sqlvar[i].sqldata;
+ delete [] sqlda->sqlvar[i].sqlind;
+ delete [] sqlda->sqlvar[i].sqldata;
}
free(sqlda);
sqlda = 0;
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
index d197388..0c92013 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/sql/drivers/psql/qsql_psql.cpp
@@ -831,7 +831,7 @@ bool QPSQLDriver::commitTransaction()
if (d->pro == QPSQLDriver::Version8 ||
d->pro == QPSQLDriver::Version81 ||
d->pro == QPSQLDriver::Version82) {
- transaction_failed = QByteArray(PQcmdStatus(res)) == QByteArray("ROLLBACK")?true:false;
+ transaction_failed = qstrcmp(PQcmdStatus(res), "ROLLBACK") == 0;
}
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK || transaction_failed) {