summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qfiledialog_mac.mm9
-rw-r--r--src/gui/dialogs/qfiledialog_win.cpp2
-rw-r--r--src/gui/dialogs/qfontdialog_mac.mm4
-rw-r--r--src/gui/dialogs/qinputdialog.cpp38
-rw-r--r--src/gui/dialogs/qinputdialog.h25
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp18
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h2
-rw-r--r--src/gui/graphicsview/qgraphicsproxywidget.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp76
-rw-r--r--src/gui/graphicsview/qgraphicsview_p.h2
-rw-r--r--src/gui/image/qimage.cpp4
-rw-r--r--src/gui/image/qnativeimage.cpp13
-rw-r--r--src/gui/image/qpixmap_s60.cpp3
-rw-r--r--src/gui/image/qpixmap_x11_p.h1
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp6
-rw-r--r--src/gui/itemviews/qabstractproxymodel.cpp24
-rw-r--r--src/gui/itemviews/qabstractproxymodel.h3
-rw-r--r--src/gui/itemviews/qstringlistmodel.cpp3
-rw-r--r--src/gui/kernel/qapplication.cpp7
-rw-r--r--src/gui/kernel/qapplication_mac.mm2
-rw-r--r--src/gui/kernel/qapplication_s60.cpp13
-rw-r--r--src/gui/kernel/qapplication_win.cpp6
-rw-r--r--src/gui/kernel/qclipboard_x11.cpp24
-rw-r--r--src/gui/kernel/qcocoaapplicationdelegate_mac.mm5
-rw-r--r--src/gui/kernel/qcocoamenuloader_mac.mm8
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm13
-rw-r--r--src/gui/kernel/qdnd_x11.cpp2
-rw-r--r--src/gui/kernel/qmotifdnd_x11.cpp2
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm15
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac_p.h2
-rw-r--r--src/gui/kernel/qt_s60_p.h9
-rw-r--r--src/gui/kernel/qt_x11_p.h2
-rw-r--r--src/gui/kernel/qwidget.cpp25
-rw-r--r--src/gui/kernel/qwidget.h4
-rw-r--r--src/gui/kernel/qwidget_mac.mm2
-rw-r--r--src/gui/kernel/qwidget_p.h10
-rw-r--r--src/gui/kernel/qwidget_s60.cpp28
-rw-r--r--src/gui/kernel/qwidget_x11.cpp21
-rw-r--r--src/gui/painting/painting.pri6
-rw-r--r--src/gui/painting/qcups_p.h1
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp10
-rw-r--r--src/gui/painting/qpaintengine_s60.cpp63
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp9
-rw-r--r--src/gui/painting/qunifiedtoolbarsurface_mac.cpp237
-rw-r--r--src/gui/painting/qunifiedtoolbarsurface_mac_p.h99
-rw-r--r--src/gui/painting/qwindowsurface.cpp4
-rw-r--r--src/gui/painting/qwindowsurface_p.h2
-rw-r--r--src/gui/painting/qwindowsurface_raster.cpp45
-rw-r--r--src/gui/painting/qwindowsurface_raster_p.h2
-rw-r--r--src/gui/painting/qwindowsurface_s60.cpp8
-rw-r--r--src/gui/s60framework/qs60mainapplication.cpp12
-rw-r--r--src/gui/s60framework/qs60mainappui.cpp28
-rw-r--r--src/gui/s60framework/s60framework.pri18
-rw-r--r--src/gui/styles/qgtkstyle.cpp29
-rw-r--r--src/gui/styles/qmacstyle_mac.mm10
-rw-r--r--src/gui/styles/qs60style.cpp11
-rw-r--r--src/gui/text/qfontdatabase.cpp10
-rw-r--r--src/gui/text/qfontengine_ft.cpp25
-rw-r--r--src/gui/text/qfontengine_ft_p.h11
-rw-r--r--src/gui/text/qfontengine_p.h13
-rw-r--r--src/gui/text/qfontengine_s60.cpp68
-rw-r--r--src/gui/text/qfontengine_s60_p.h3
-rw-r--r--src/gui/text/qtextengine.cpp16
-rw-r--r--src/gui/widgets/qmainwindow.cpp13
-rw-r--r--src/gui/widgets/qmainwindowlayout_mac.mm13
-rw-r--r--src/gui/widgets/qmainwindowlayout_p.h13
66 files changed, 966 insertions, 250 deletions
diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm
index 87850a75e4..6c1d7f6312 100644
--- a/src/gui/dialogs/qfiledialog_mac.mm
+++ b/src/gui/dialogs/qfiledialog_mac.mm
@@ -63,6 +63,7 @@
#include <qdesktopwidget.h>
#include <stdlib.h>
#include <qabstracteventdispatcher.h>
+#import <AppKit/NSSavePanel.h>
#include "ui_qfiledialog.h"
QT_BEGIN_NAMESPACE
@@ -84,7 +85,13 @@ QT_USE_NAMESPACE
@class QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate);
-@interface QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) : NSObject {
+@interface QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate)
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+ : NSObject<NSOpenSavePanelDelegate>
+#else
+ : NSObject
+#endif
+{
@public
NSOpenPanel *mOpenPanel;
NSSavePanel *mSavePanel;
diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp
index 5b192b4e34..98860c4fb5 100644
--- a/src/gui/dialogs/qfiledialog_win.cpp
+++ b/src/gui/dialogs/qfiledialog_win.cpp
@@ -603,7 +603,7 @@ QString qt_win_CID_get_existing_directory(const QFileDialogArgs &args)
// Set the FOS_PICKFOLDERS flag
DWORD newOptions;
hr = pfd->GetOptions(&newOptions);
- newOptions |= FOS_PICKFOLDERS;
+ newOptions |= (FOS_PICKFOLDERS | FOS_FORCEFILESYSTEM);
if (SUCCEEDED(hr) && SUCCEEDED((hr = pfd->SetOptions(newOptions)))) {
QWidget *parentWindow = args.parent;
if (parentWindow)
diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm
index 9c63dfab1c..6fb363bcae 100644
--- a/src/gui/dialogs/qfontdialog_mac.mm
+++ b/src/gui/dialogs/qfontdialog_mac.mm
@@ -496,7 +496,7 @@ void QFontDialogPrivate::setFont(void *delegate, const QFont &font)
QMacCocoaAutoReleasePool pool;
QFontEngine *fe = font.d->engineForScript(QUnicodeTables::Common);
NSFontManager *mgr = [NSFontManager sharedFontManager];
- NSFont *nsFont = 0;
+ const NSFont *nsFont = 0;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if (qstrcmp(fe->name(), "CoreText") == 0) {
@@ -522,7 +522,7 @@ void QFontDialogPrivate::setFont(void *delegate, const QFont &font)
size:fontInfo.pointSize()];
}
- [mgr setSelectedFont:nsFont isMultiple:NO];
+ [mgr setSelectedFont:const_cast<NSFont *>(nsFont) isMultiple:NO];
[static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate) setQtFont:font];
}
diff --git a/src/gui/dialogs/qinputdialog.cpp b/src/gui/dialogs/qinputdialog.cpp
index e996ee9be4..2d13c9a29e 100644
--- a/src/gui/dialogs/qinputdialog.cpp
+++ b/src/gui/dialogs/qinputdialog.cpp
@@ -244,6 +244,9 @@ void QInputDialogPrivate::ensureLineEdit()
Q_Q(QInputDialog);
if (!lineEdit) {
lineEdit = new QLineEdit(q);
+#ifndef QT_NO_IM
+ qt_widget_private(lineEdit)->inheritsInputMethodHints = 1;
+#endif
lineEdit->hide();
QObject::connect(lineEdit, SIGNAL(textChanged(QString)),
q, SLOT(_q_textChanged(QString)));
@@ -255,6 +258,9 @@ void QInputDialogPrivate::ensureComboBox()
Q_Q(QInputDialog);
if (!comboBox) {
comboBox = new QComboBox(q);
+#ifndef QT_NO_IM
+ qt_widget_private(comboBox)->inheritsInputMethodHints = 1;
+#endif
comboBox->hide();
QObject::connect(comboBox, SIGNAL(editTextChanged(QString)),
q, SLOT(_q_textChanged(QString)));
@@ -1122,6 +1128,8 @@ void QInputDialog::done(int result)
be entered).
\a text is the default text which is placed in the line edit.
\a mode is the echo mode the line edit will use.
+ \a inputMethodHints is the input method hints that will be used in the
+ edit widget if an input method is active.
If \a ok is nonnull \e *\a ok will be set to true if the user pressed
\gui OK and to false if the user pressed \gui Cancel. The dialog's parent
@@ -1144,13 +1152,14 @@ void QInputDialog::done(int result)
QString QInputDialog::getText(QWidget *parent, const QString &title, const QString &label,
QLineEdit::EchoMode mode, const QString &text, bool *ok,
- Qt::WindowFlags flags)
+ Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints)
{
QInputDialog dialog(parent, flags);
dialog.setWindowTitle(title);
dialog.setLabelText(label);
dialog.setTextValue(text);
dialog.setTextEchoMode(mode);
+ dialog.setInputMethodHints(inputMethodHints);
int ret = dialog.exec();
if (ok)
@@ -1163,6 +1172,17 @@ QString QInputDialog::getText(QWidget *parent, const QString &title, const QStri
}
/*!
+ \internal
+*/
+// ### Qt 5: Use only the version above.
+QString QInputDialog::getText(QWidget *parent, const QString &title, const QString &label,
+ QLineEdit::EchoMode mode, const QString &text, bool *ok,
+ Qt::WindowFlags flags)
+{
+ return getText(parent, title, label, mode, text, ok, flags, Qt::ImhNone);
+}
+
+/*!
\since 4.5
Static convenience function to get an integer input from the user.
@@ -1272,6 +1292,8 @@ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QStr
be entered).
\a items is the string list which is inserted into the combobox.
\a current is the number of the item which should be the current item.
+ \a inputMethodHints is the input method hints that will be used if the
+ combobox is editable and an input method is active.
If \a editable is true the user can enter their own text; otherwise the
user may only select one of the existing items.
@@ -1296,7 +1318,7 @@ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QStr
QString QInputDialog::getItem(QWidget *parent, const QString &title, const QString &label,
const QStringList &items, int current, bool editable, bool *ok,
- Qt::WindowFlags flags)
+ Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints)
{
QString text(items.value(current));
@@ -1306,6 +1328,7 @@ QString QInputDialog::getItem(QWidget *parent, const QString &title, const QStri
dialog.setComboBoxItems(items);
dialog.setTextValue(text);
dialog.setComboBoxEditable(editable);
+ dialog.setInputMethodHints(inputMethodHints);
int ret = dialog.exec();
if (ok)
@@ -1318,6 +1341,17 @@ QString QInputDialog::getItem(QWidget *parent, const QString &title, const QStri
}
/*!
+ \internal
+*/
+// ### Qt 5: Use only the version above.
+QString QInputDialog::getItem(QWidget *parent, const QString &title, const QString &label,
+ const QStringList &items, int current, bool editable, bool *ok,
+ Qt::WindowFlags flags)
+{
+ return getItem(parent, title, label, items, current, editable, ok, flags, Qt::ImhNone);
+}
+
+/*!
\obsolete
Use getInt() instead.
diff --git a/src/gui/dialogs/qinputdialog.h b/src/gui/dialogs/qinputdialog.h
index 02868c13e7..25e27b055c 100644
--- a/src/gui/dialogs/qinputdialog.h
+++ b/src/gui/dialogs/qinputdialog.h
@@ -167,18 +167,37 @@ public:
void setVisible(bool visible);
+#ifdef Q_QDOC
+ static QString getText(QWidget *parent, const QString &title, const QString &label,
+ QLineEdit::EchoMode echo = QLineEdit::Normal,
+ const QString &text = QString(), bool *ok = 0, Qt::WindowFlags flags = 0,
+ Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
+ static QString getItem(QWidget *parent, const QString &title, const QString &label,
+ const QStringList &items, int current = 0, bool editable = true,
+ bool *ok = 0, Qt::WindowFlags flags = 0,
+ Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
+#else
static QString getText(QWidget *parent, const QString &title, const QString &label,
QLineEdit::EchoMode echo = QLineEdit::Normal,
const QString &text = QString(), bool *ok = 0, Qt::WindowFlags flags = 0);
+ static QString getItem(QWidget *parent, const QString &title, const QString &label,
+ const QStringList &items, int current = 0, bool editable = true,
+ bool *ok = 0, Qt::WindowFlags flags = 0);
+ static QString getText(QWidget *parent, const QString &title, const QString &label,
+ QLineEdit::EchoMode echo,
+ const QString &text, bool *ok, Qt::WindowFlags flags,
+ Qt::InputMethodHints inputMethodHints);
+ static QString getItem(QWidget *parent, const QString &title, const QString &label,
+ const QStringList &items, int current, bool editable,
+ bool *ok, Qt::WindowFlags flags,
+ Qt::InputMethodHints inputMethodHints);
+#endif
static int getInt(QWidget *parent, const QString &title, const QString &label, int value = 0,
int minValue = -2147483647, int maxValue = 2147483647,
int step = 1, bool *ok = 0, Qt::WindowFlags flags = 0);
static double getDouble(QWidget *parent, const QString &title, const QString &label, double value = 0,
double minValue = -2147483647, double maxValue = 2147483647,
int decimals = 1, bool *ok = 0, Qt::WindowFlags flags = 0);
- static QString getItem(QWidget *parent, const QString &title, const QString &label,
- const QStringList &items, int current = 0, bool editable = true,
- bool *ok = 0, Qt::WindowFlags flags = 0);
// obsolete
static int getInteger(QWidget *parent, const QString &title, const QString &label, int value = 0,
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 810055f034..3ad8f33971 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -2125,7 +2125,7 @@ void QGraphicsItem::setToolTip(const QString &toolTip)
\snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 2
- If no cursor has been set, the parent's cursor is used.
+ If no cursor has been set, the cursor of the item beneath is used.
\sa setCursor(), hasCursor(), unsetCursor(), QWidget::cursor,
QApplication::overrideCursor()
@@ -2365,7 +2365,7 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo
while (fsi->d_ptr->focusScopeItem && fsi->d_ptr->focusScopeItem->isVisible())
fsi = fsi->d_ptr->focusScopeItem;
fsi->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ true,
- /* focusFromShow = */ true);
+ /* focusFromHide = */ false);
}
break;
}
@@ -2375,6 +2375,10 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo
QGraphicsItem *fi = subFocusItem;
if (fi && fi != scene->focusItem()) {
scene->setFocusItem(fi);
+ } else if (flags & QGraphicsItem::ItemIsFocusScope &&
+ !scene->focusItem() &&
+ q->isAncestorOf(scene->d_func()->lastFocusItem)) {
+ q_ptr->setFocus();
}
}
} else {
@@ -2385,7 +2389,7 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo
if (p->flags() & QGraphicsItem::ItemIsFocusScope) {
if (p->d_ptr->visible) {
p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ true,
- /* focusFromShow = */ true);
+ /* focusFromHide = */ true);
}
break;
}
@@ -3245,13 +3249,13 @@ bool QGraphicsItem::hasFocus() const
*/
void QGraphicsItem::setFocus(Qt::FocusReason focusReason)
{
- d_ptr->setFocusHelper(focusReason, /* climb = */ true, /* focusFromShow = */ false);
+ d_ptr->setFocusHelper(focusReason, /* climb = */ true, /* focusFromHide = */ false);
}
/*!
\internal
*/
-void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromShow)
+void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromHide)
{
// Disabled / unfocusable items cannot accept focus.
if (!q_ptr->isEnabled() || !(flags & QGraphicsItem::ItemIsFocusable))
@@ -3272,7 +3276,7 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim
if (p->flags() & QGraphicsItem::ItemIsFocusScope) {
QGraphicsItem *oldFocusScopeItem = p->d_ptr->focusScopeItem;
p->d_ptr->focusScopeItem = q_ptr;
- if (!p->focusItem() && !focusFromShow) {
+ if (!p->focusItem() && !focusFromHide) {
if (oldFocusScopeItem)
oldFocusScopeItem->d_ptr->focusScopeItemChange(false);
focusScopeItemChange(true);
@@ -3334,7 +3338,7 @@ void QGraphicsItemPrivate::clearFocusHelper(bool giveFocusToParent)
while (p) {
if (p->flags() & QGraphicsItem::ItemIsFocusScope) {
p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ false,
- /* focusFromShow = */ false);
+ /* focusFromHide = */ false);
return;
}
p = p->d_ptr->parent;
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index c8a7699af6..8480c19095 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -477,7 +477,7 @@ public:
inline void markParentDirty(bool updateBoundingRect = false);
- void setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromShow);
+ void setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromHide);
void clearFocusHelper(bool giveFocusToParent);
void setSubFocus(QGraphicsItem *rootItem = 0);
void clearSubFocus(QGraphicsItem *rootItem = 0);
diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp
index 320395ef53..ce63659db7 100644
--- a/src/gui/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp
@@ -266,8 +266,8 @@ void QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent(QGraphicsSceneMouseEvent
}
if (!lastWidgetUnderMouse) {
- QApplicationPrivate::dispatchEnterLeave(embeddedMouseGrabber ? embeddedMouseGrabber : widget, 0);
- lastWidgetUnderMouse = widget;
+ QApplicationPrivate::dispatchEnterLeave(embeddedMouseGrabber ? embeddedMouseGrabber : receiver, 0);
+ lastWidgetUnderMouse = receiver;
}
// Map event position from us to the receiver
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 733d282302..5b1da9ee23 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4362,6 +4362,50 @@ static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion &
}
}
+// Copied from qpaintengine_vg.cpp
+// Returns true for 90, 180, and 270 degree rotations.
+static inline bool transformIsSimple(const QTransform& transform)
+{
+ QTransform::TransformationType type = transform.type();
+ if (type == QTransform::TxNone || type == QTransform::TxTranslate) {
+ return true;
+ } else if (type == QTransform::TxScale) {
+ // Check for 0 and 180 degree rotations.
+ // (0 might happen after 4 rotations of 90 degrees).
+ qreal m11 = transform.m11();
+ qreal m12 = transform.m12();
+ qreal m21 = transform.m21();
+ qreal m22 = transform.m22();
+ if (m12 == 0.0f && m21 == 0.0f) {
+ if (m11 == 1.0f && m22 == 1.0f)
+ return true; // 0 degrees
+ else if (m11 == -1.0f && m22 == -1.0f)
+ return true; // 180 degrees.
+ if(m11 == 1.0f && m22 == -1.0f)
+ return true; // 0 degrees inverted y.
+ else if(m11 == -1.0f && m22 == 1.0f)
+ return true; // 180 degrees inverted y.
+ }
+ } else if (type == QTransform::TxRotate) {
+ // Check for 90, and 270 degree rotations.
+ qreal m11 = transform.m11();
+ qreal m12 = transform.m12();
+ qreal m21 = transform.m21();
+ qreal m22 = transform.m22();
+ if (m11 == 0.0f && m22 == 0.0f) {
+ if (m12 == 1.0f && m21 == -1.0f)
+ return true; // 90 degrees.
+ else if (m12 == -1.0f && m21 == 1.0f)
+ return true; // 270 degrees.
+ else if (m12 == -1.0f && m21 == -1.0f)
+ return true; // 90 degrees inverted y.
+ else if (m12 == 1.0f && m21 == 1.0f)
+ return true; // 270 degrees inverted y.
+ }
+ }
+ return false;
+}
+
/*!
\internal
@@ -4530,32 +4574,28 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
if (invertable)
diff *= painter->worldTransform();
deviceData->lastTransform = painter->worldTransform();
- if (!invertable
- || diff.type() > QTransform::TxTranslate
- || painter->worldTransform().type() > QTransform::TxScale) {
+ bool allowPartialCacheExposure = false;
+ bool simpleTransform = invertable && diff.type() <= QTransform::TxTranslate
+ && transformIsSimple(painter->worldTransform());
+ if (!simpleTransform) {
pixModified = true;
itemCache->allExposed = true;
itemCache->exposed.clear();
+ deviceData->cacheIndent = QPoint();
pix = QPixmap();
+ } else {
+ allowPartialCacheExposure = deviceData->cacheIndent != QPoint();
}
- // ### This is a pretty bad way to determine when to start partial
- // exposure for DeviceCoordinateCache but it's the least intrusive
- // approach for now.
-#if 0
- // Only if the device rect isn't fully contained.
- bool allowPartialCacheExposure = !viewRect.contains(deviceRect);
-#else
- // Only if deviceRect is 20% taller or wider than the desktop.
- bool allowPartialCacheExposure = false;
- if (widget) {
- QRect desktopRect = QApplication::desktop()->availableGeometry(widget);
- allowPartialCacheExposure = (desktopRect.width() * 1.2 < deviceRect.width()
- || desktopRect.height() * 1.2 < deviceRect.height());
+ // Allow partial cache exposure if the device rect isn't fully contained and
+ // deviceRect is 20% taller or wider than the viewRect.
+ if (!allowPartialCacheExposure && !viewRect.contains(deviceRect)) {
+ allowPartialCacheExposure = (viewRect.width() * 1.2 < deviceRect.width())
+ || (viewRect.height() * 1.2 < deviceRect.height());
}
-#endif
+
QRegion scrollExposure;
- if (deviceData->cacheIndent != QPoint() || allowPartialCacheExposure) {
+ if (allowPartialCacheExposure) {
// Part of pixmap is drawn. Either device contains viewrect (big
// item covers whole screen) or parts of device are outside the
// viewport. In either case the device rect must be the intersect
diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h
index 62be800043..38c3bca75b 100644
--- a/src/gui/graphicsview/qgraphicsview_p.h
+++ b/src/gui/graphicsview/qgraphicsview_p.h
@@ -184,7 +184,7 @@ public:
#ifdef Q_WS_MAC
// QWidget::update() works slightly different on the Mac without the raster engine;
// it's not part of our backing store so it needs special threatment.
- if (QApplicationPrivate::graphics_system_name != "raster") {
+ if (QApplicationPrivate::graphics_system_name != QLatin1String("raster")) {
// At this point either HIViewSetNeedsDisplay (Carbon) or setNeedsDisplay: YES (Cocoa)
// is called, which means there's a pending update request. We want to dispatch it
// now because otherwise graphics view updates would require two
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 300e04b4ee..5829fe81d4 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -6689,6 +6689,10 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla
if (format == newFormat)
return true;
+ // No in-place conversion if we have to detach
+ if (ref > 1)
+ return false;
+
const InPlace_Image_Converter *const converterPtr = &inplace_converter_map[format][newFormat];
InPlace_Image_Converter converter = *converterPtr;
if (converter)
diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp
index 84c99113c6..0f7872e92c 100644
--- a/src/gui/image/qnativeimage.cpp
+++ b/src/gui/image/qnativeimage.cpp
@@ -244,8 +244,19 @@ QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /*
: image(width, height, format)
{
-
uint cgflags = kCGImageAlphaNoneSkipFirst;
+ switch (format) {
+ case QImage::Format_ARGB32:
+ cgflags = kCGImageAlphaFirst;
+ break;
+ case QImage::Format_ARGB32_Premultiplied:
+ case QImage::Format_ARGB8565_Premultiplied:
+ case QImage::Format_ARGB6666_Premultiplied:
+ case QImage::Format_ARGB8555_Premultiplied:
+ case QImage::Format_ARGB4444_Premultiplied:
+ cgflags = kCGImageAlphaPremultipliedFirst;
+ break;
+ }
#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
cgflags |= kCGBitmapByteOrder32Host;
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index 47249d9873..b7c8acb81b 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -968,11 +968,12 @@ void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType)
if (needsCopy) {
TSize size = sourceBitmap->SizeInPixels();
+ int bytesPerLine = sourceBitmap->ScanLineLength(size.iWidth, displayMode);
QSymbianBitmapDataAccess da;
da.beginDataAccess(sourceBitmap);
uchar *bytes = (uchar*)sourceBitmap->DataAddress();
- QImage img = QImage(bytes, size.iWidth, size.iHeight, format);
+ QImage img = QImage(bytes, size.iWidth, size.iHeight, bytesPerLine, format);
img = img.copy();
da.endDataAccess(sourceBitmap);
diff --git a/src/gui/image/qpixmap_x11_p.h b/src/gui/image/qpixmap_x11_p.h
index 821fb691ea..f171281f39 100644
--- a/src/gui/image/qpixmap_x11_p.h
+++ b/src/gui/image/qpixmap_x11_p.h
@@ -115,6 +115,7 @@ private:
friend class QEglContext; // Needs gl_surface
friend class QGLContext; // Needs gl_surface
friend class QX11GLPixmapData; // Needs gl_surface
+ friend class QMeeGoGraphicsSystem; // Needs gl_surface and flags
friend bool qt_createEGLSurfaceForPixmap(QPixmapData*, bool); // Needs gl_surface
void release();
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 0842ee8258..b5ca8123bb 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -4101,13 +4101,13 @@ bool QAbstractItemViewPrivate::openEditor(const QModelIndex &index, QEvent *even
if (!w)
return false;
- if (event)
- QApplication::sendEvent(w->focusProxy() ? w->focusProxy() : w, event);
-
q->setState(QAbstractItemView::EditingState);
w->show();
w->setFocus();
+ if (event)
+ QApplication::sendEvent(w->focusProxy() ? w->focusProxy() : w, event);
+
return true;
}
diff --git a/src/gui/itemviews/qabstractproxymodel.cpp b/src/gui/itemviews/qabstractproxymodel.cpp
index 51dfa7a86e..12c4c7bb48 100644
--- a/src/gui/itemviews/qabstractproxymodel.cpp
+++ b/src/gui/itemviews/qabstractproxymodel.cpp
@@ -121,12 +121,15 @@ QAbstractProxyModel::~QAbstractProxyModel()
void QAbstractProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
{
Q_D(QAbstractProxyModel);
- if (d->model)
+ if (d->model) {
disconnect(d->model, SIGNAL(destroyed()), this, SLOT(_q_sourceModelDestroyed()));
+ disconnect(d->model, SIGNAL(modelReset()), this, SLOT(resetInternalData()));
+ }
if (sourceModel) {
d->model = sourceModel;
connect(d->model, SIGNAL(destroyed()), this, SLOT(_q_sourceModelDestroyed()));
+ connect(d->model, SIGNAL(modelReset()), this, SLOT(resetInternalData()));
} else {
d->model = QAbstractItemModelPrivate::staticEmptyModel();
}
@@ -380,6 +383,25 @@ Qt::DropActions QAbstractProxyModel::supportedDropActions() const
return d->model->supportedDropActions();
}
+/*
+ \since 4.8
+
+ This slot is called just after the internal data of a model is cleared
+ while it is being reset.
+
+ This slot is provided the convenience of subclasses of concrete proxy
+ models, such as subclasses of QSortFilterProxyModel which maintain extra
+ data.
+
+ \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 10
+
+ \sa modelAboutToBeReset(), modelReset()
+*/
+void QAbstractProxyModel::resetInternalData()
+{
+
+}
+
QT_END_NAMESPACE
#include "moc_qabstractproxymodel.cpp"
diff --git a/src/gui/itemviews/qabstractproxymodel.h b/src/gui/itemviews/qabstractproxymodel.h
index a5a1168d61..0daa7f8bda 100644
--- a/src/gui/itemviews/qabstractproxymodel.h
+++ b/src/gui/itemviews/qabstractproxymodel.h
@@ -95,6 +95,9 @@ public:
QStringList mimeTypes() const;
Qt::DropActions supportedDropActions() const;
+protected Q_SLOTS:
+ void resetInternalData();
+
protected:
QAbstractProxyModel(QAbstractProxyModelPrivate &, QObject *parent);
diff --git a/src/gui/itemviews/qstringlistmodel.cpp b/src/gui/itemviews/qstringlistmodel.cpp
index 8d69ee4ab8..60ff9520ef 100644
--- a/src/gui/itemviews/qstringlistmodel.cpp
+++ b/src/gui/itemviews/qstringlistmodel.cpp
@@ -290,8 +290,9 @@ QStringList QStringListModel::stringList() const
*/
void QStringListModel::setStringList(const QStringList &strings)
{
+ emit beginResetModel();
lst = strings;
- reset();
+ emit endResetModel();
}
/*!
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 28ad7541f2..d81a3c3af4 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -478,11 +478,14 @@ bool Q_GUI_EXPORT qt_tab_all_widgets = true;
bool qt_in_tab_key_event = false;
int qt_antialiasing_threshold = -1;
static int drag_time = 500;
+#ifndef QT_GUI_DRAG_DISTANCE
+#define QT_GUI_DRAG_DISTANCE 4
+#endif
#ifdef Q_OS_SYMBIAN
// The screens are a bit too small to for your thumb when using only 4 pixels drag distance.
-static int drag_distance = 12;
+static int drag_distance = 12; //XXX move to qplatformdefs.h
#else
-static int drag_distance = 4;
+static int drag_distance = QT_GUI_DRAG_DISTANCE;
#endif
static Qt::LayoutDirection layout_direction = Qt::LeftToRight;
QSize QApplicationPrivate::app_strut = QSize(0,0); // no default application strut
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index c3f3e74a8a..e5364d0e7e 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -1246,7 +1246,7 @@ void qt_init(QApplicationPrivate *priv, int)
qt_redirectNSApplicationSendEvent();
QMacCocoaAutoReleasePool pool;
- NSObject *oldDelegate = [cocoaApp delegate];
+ id oldDelegate = [cocoaApp delegate];
QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) *newDelegate = [QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate];
Q_ASSERT(newDelegate);
[newDelegate setQtPrivate:priv];
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index dc4ddbf91e..19e7d450f0 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -152,18 +152,12 @@ void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible)
if (backingStore.data()) {
backingStore.registerWidget(widget);
} else {
-#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
- S60->wsSession().SendEffectCommand(ETfxCmdRestoreLayer);
-#endif
backingStore.create(window);
backingStore.registerWidget(widget);
qt_widget_private(widget)->invalidateBuffer(widget->rect());
widget->repaint();
}
} else {
-#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
- S60->wsSession().SendEffectCommand(ETfxCmdDeallocateLayer);
-#endif
backingStore.unregisterWidget(widget);
// In order to ensure that any resources used by the window surface
// are immediately freed, we flush the WSERV command buffer.
@@ -1243,10 +1237,11 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */)
qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle());
#ifdef Q_WS_S60
// If widget is fullscreen/minimized, hide status pane and button container otherwise show them.
- const bool visible = !(qwidget->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized));
+ QWidget *const window = qwidget->window();
+ const bool visible = !(window->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized));
const bool statusPaneVisibility = visible;
- const bool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen;
- const bool cbaVisibilityHint = qwidget->windowFlags() & Qt::WindowSoftkeysVisibleHint;
+ const bool isFullscreen = window->windowState() & Qt::WindowFullScreen;
+ const bool cbaVisibilityHint = window->windowFlags() & Qt::WindowSoftkeysVisibleHint;
const bool buttonGroupVisibility = (visible || (isFullscreen && cbaVisibilityHint));
S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility);
#endif
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 2be28b8fbe..a32a957d9b 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -951,8 +951,8 @@ Q_GLOBAL_STATIC(WinClassNameHash, winclassNames)
//
const QString qt_reg_winclass(QWidget *w) // register window class
{
- int flags = w ? int(w->windowFlags()) : 0;
- int type = flags & Qt::WindowType_Mask;
+ Qt::WindowFlags flags = w ? w->windowFlags() : (Qt::WindowFlags)0;
+ Qt::WindowFlags type = flags & Qt::WindowType_Mask;
uint style;
bool icon;
@@ -2331,7 +2331,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
case WM_GETOBJECT:
{
// Ignoring all requests while starting up
- if (QApplication::startingUp() || QApplication::closingDown() || (LONG)lParam != OBJID_CLIENT) {
+ if (QApplication::startingUp() || QApplication::closingDown() || lParam != (LPARAM)OBJID_CLIENT) {
result = false;
break;
}
diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp
index 4b75f0a18d..55548efd27 100644
--- a/src/gui/kernel/qclipboard_x11.cpp
+++ b/src/gui/kernel/qclipboard_x11.cpp
@@ -595,7 +595,7 @@ static inline int maxSelectionIncr(Display *dpy)
{ return XMaxRequestSize(dpy) > 65536 ? 65536*4 : XMaxRequestSize(dpy)*4 - 100; }
bool QX11Data::clipboardReadProperty(Window win, Atom property, bool deleteProperty,
- QByteArray *buffer, int *size, Atom *type, int *format, bool nullterm)
+ QByteArray *buffer, int *size, Atom *type, int *format)
{
int maxsize = maxSelectionIncr(display);
ulong bytes_left; // bytes_after
@@ -641,13 +641,13 @@ bool QX11Data::clipboardReadProperty(Window win, Atom property, bool deletePrope
break;
}
- int newSize = proplen + (nullterm ? 1 : 0);
+ int newSize = proplen;
buffer->resize(newSize);
bool ok = (buffer->size() == newSize);
VDEBUG("QClipboard: read_property(): buffer resized to %d", buffer->size());
- if (ok) {
+ if (ok && newSize) {
// could allocate buffer
while (bytes_left) {
@@ -683,23 +683,19 @@ bool QX11Data::clipboardReadProperty(Window win, Atom property, bool deletePrope
XTextProperty textprop;
textprop.encoding = *type;
textprop.format = *format;
- textprop.nitems = length;
+ textprop.nitems = buffer_offset;
textprop.value = (unsigned char *) buffer->data();
char **list_ret = 0;
int count;
if (XmbTextPropertyToTextList(display, &textprop, &list_ret,
&count) == Success && count && list_ret) {
- offset = strlen(list_ret[0]);
- buffer->resize(offset + (nullterm ? 1 : 0));
+ offset = buffer_offset = strlen(list_ret[0]);
+ buffer->resize(offset);
memcpy(buffer->data(), list_ret[0], offset);
}
if (list_ret) XFreeStringList(list_ret);
}
-
- // zero-terminate (for text)
- if (nullterm)
- buffer->data()[buffer_offset] = '\0';
}
// correct size, not 0-term.
@@ -742,7 +738,7 @@ QByteArray QX11Data::clipboardReadIncrementalProperty(Window win, Atom property,
if (event.xproperty.atom != property ||
event.xproperty.state != PropertyNewValue)
continue;
- if (X11->clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0, false)) {
+ if (X11->clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) {
if (length == 0) { // no more data, we're done
if (nullterm) {
buf.resize(offset+1);
@@ -836,7 +832,7 @@ static Atom send_selection(QClipboardData *d, Atom target, Window window, Atom p
ATOM(INCR), 32, PropModeReplace, (uchar *) &bytes, 1);
(void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment);
- return ATOM(INCR);
+ return property;
}
// make sure we can perform the XChangeProperty in a single request
@@ -1070,7 +1066,7 @@ bool QClipboard::event(QEvent *e)
QByteArray multi_data;
if (req->property == XNone
|| !X11->clipboardReadProperty(req->requestor, req->property, false, &multi_data,
- 0, &multi_type, &multi_format, 0)
+ 0, &multi_type, &multi_format)
|| multi_format != 32) {
// MULTIPLE property not formatted correctly
XSendEvent(dpy, req->requestor, False, NoEventMask, &event);
@@ -1292,7 +1288,7 @@ QByteArray QClipboardWatcher::getDataInFormat(Atom fmtatom) const
Atom type;
XSelectInput(dpy, win, PropertyChangeMask);
- if (X11->clipboardReadProperty(win, ATOM(_QT_SELECTION), true, &buf, 0, &type, 0, false)) {
+ if (X11->clipboardReadProperty(win, ATOM(_QT_SELECTION), true, &buf, 0, &type, 0)) {
if (type == ATOM(INCR)) {
int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0;
buf = X11->clipboardReadIncrementalProperty(win, ATOM(_QT_SELECTION), nbytes, false);
diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
index 7a9dc70a78..9b07d64f70 100644
--- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
+++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
@@ -320,5 +320,10 @@ static void cleanupCocoaApplicationDelegate()
[NSApp terminate:self];
}
+- (void)qtDispatcherToQAction:(id)sender
+{
+ [[NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender];
+}
+
@end
#endif
diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm
index 8d38f4511d..6ee4277b7b 100644
--- a/src/gui/kernel/qcocoamenuloader_mac.mm
+++ b/src/gui/kernel/qcocoamenuloader_mac.mm
@@ -70,13 +70,13 @@ QT_USE_NAMESPACE
showAllItem = [[appMenu itemWithTitle:@"Show All"] retain];
// Get the names in the nib to match the app name set by Qt.
- NSString *appName = reinterpret_cast<const NSString*>(QCFString::toCFStringRef(qAppName()));
+ const NSString *appName = reinterpret_cast<const NSString*>(QCFString::toCFStringRef(qAppName()));
[quitItem setTitle:[[quitItem title] stringByReplacingOccurrencesOfString:@"NewApplication"
- withString:appName]];
+ withString:const_cast<NSString *>(appName)]];
[hideItem setTitle:[[hideItem title] stringByReplacingOccurrencesOfString:@"NewApplication"
- withString:appName]];
+ withString:const_cast<NSString *>(appName)]];
[aboutItem setTitle:[[aboutItem title] stringByReplacingOccurrencesOfString:@"NewApplication"
- withString:appName]];
+ withString:const_cast<NSString *>(appName)]];
[appName release];
// Disable the items that don't do anything. If someone associates a QAction with them
// They should get synced back in.
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 8576f52970..49f7d7f968 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -534,7 +534,7 @@ static int qCocoaViewCount = 0;
return;
// We use a different graphics system.
- if (QApplicationPrivate::graphicsSystem() != 0) {
+ if (QApplicationPrivate::graphicsSystem() != 0 && !qwidgetprivate->isInUnifiedToolbar) {
// Qt handles the painting occuring inside the window.
// Cocoa also keeps track of all widgets as NSView and therefore might
@@ -558,6 +558,15 @@ static int qCocoaViewCount = 0;
CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
qwidgetprivate->hd = cg;
+
+ // We steal the CGContext for flushing in the unified toolbar with the raster engine.
+ if (QApplicationPrivate::graphicsSystem() != 0 && qwidgetprivate->isInUnifiedToolbar) {
+ qwidgetprivate->cgContext = cg;
+ qwidgetprivate->hasOwnContext = true;
+ qwidgetprivate->unifiedSurface->flush(qwidget, qwidgetprivate->ut_rg, qwidgetprivate->ut_pt);
+ return;
+ }
+
CGContextSaveGState(cg);
if (qwidget->isVisible() && qwidget->updatesEnabled()) { //process the actual paint event.
@@ -1408,7 +1417,7 @@ static int qCocoaViewCount = 0;
if (!selectedText.isEmpty()) {
QCFString string(selectedText.mid(theRange.location, theRange.length));
const NSString *tmpString = reinterpret_cast<const NSString *>((CFStringRef)string);
- return [[[NSAttributedString alloc] initWithString:tmpString] autorelease];
+ return [[[NSAttributedString alloc] initWithString:const_cast<NSString *>(tmpString)] autorelease];
} else {
return nil;
}
diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp
index 92dd0a1fc5..68d768883a 100644
--- a/src/gui/kernel/qdnd_x11.cpp
+++ b/src/gui/kernel/qdnd_x11.cpp
@@ -1887,7 +1887,7 @@ static QVariant xdndObtainData(const char *format, QVariant::Type requestedType)
if (got) {
Atom type;
- if (X11->clipboardReadProperty(tw->effectiveWinId(), ATOM(XdndSelection), true, &result, 0, &type, 0, false)) {
+ if (X11->clipboardReadProperty(tw->effectiveWinId(), ATOM(XdndSelection), true, &result, 0, &type, 0)) {
if (type == ATOM(INCR)) {
int nbytes = result.size() >= 4 ? *((int*)result.data()) : 0;
result = X11->clipboardReadIncrementalProperty(tw->effectiveWinId(), ATOM(XdndSelection), nbytes, false);
diff --git a/src/gui/kernel/qmotifdnd_x11.cpp b/src/gui/kernel/qmotifdnd_x11.cpp
index 0a7b350f67..333445501d 100644
--- a/src/gui/kernel/qmotifdnd_x11.cpp
+++ b/src/gui/kernel/qmotifdnd_x11.cpp
@@ -766,7 +766,7 @@ QVariant QX11Data::motifdndObtainData(const char *mimeType)
if (got) {
Atom type;
- if (X11->clipboardReadProperty(tw->internalWinId(), Dnd_selection, true, &result, 0, &type, 0, false)) {
+ if (X11->clipboardReadProperty(tw->internalWinId(), Dnd_selection, true, &result, 0, &type, 0)) {
}
}
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 2dd379172a..5a522f9a15 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -1365,11 +1365,11 @@ QString qt_mac_get_pasteboardString(OSPasteboardRef paste)
QMacCocoaAutoReleasePool pool;
NSPasteboard *pb = nil;
CFStringRef pbname;
- if (PasteboardCopyName (paste, &pbname)) {
- pb = [NSPasteboard generalPasteboard];
+ if (PasteboardCopyName(paste, &pbname) == noErr) {
+ pb = [NSPasteboard pasteboardWithName:const_cast<NSString *>(reinterpret_cast<const NSString *>(pbname))];
+ CFRelease(pbname);
} else {
- pb = [NSPasteboard pasteboardWithName:reinterpret_cast<const NSString *>(pbname)];
- CFRelease (pbname);
+ pb = [NSPasteboard generalPasteboard];
}
if (pb) {
NSString *text = [pb stringForType:NSStringPboardType];
@@ -1561,6 +1561,13 @@ void qt_cocoaStackChildWindowOnTopOfOtherChildren(QWidget *childWidget)
}
}
+void qt_mac_display(QWidget *widget)
+{
+ NSView *theNSView = qt_mac_nativeview_for(widget);
+ [theNSView display];
+ return;
+}
+
#endif // QT_MAC_USE_COCOA
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
index 5c233928f4..04c2d062a6 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h
+++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
@@ -227,6 +227,8 @@ void qt_cocoaPostMessage(id target, SEL selector, int argCount=0, id arg1=0, id
void qt_mac_post_retranslateAppMenu();
+void qt_mac_display(QWidget *widget);
+
QT_END_NAMESPACE
#endif // QT_COCOA_HELPERS_MAC_P_H
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index 7fd2baa5d8..93f64f6221 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -142,6 +142,7 @@ public:
int avkonComponentsSupportTransparency : 1;
int menuBeingConstructed : 1;
QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type
+ static CEikButtonGroupContainer *cba;
enum ScanCodeState {
Unpressed,
@@ -162,6 +163,7 @@ public:
static inline CAknTitlePane* titlePane();
static inline CAknContextPane* contextPane();
static inline CEikButtonGroupContainer* buttonGroupContainer();
+ static inline void setButtonGroupContainer(CEikButtonGroupContainer* newCba);
static void setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, bool buttonGroupVisible);
#endif
static void controlVisibilityChanged(CCoeControl *control, bool visible);
@@ -383,7 +385,12 @@ inline CAknContextPane* QS60Data::contextPane()
inline CEikButtonGroupContainer* QS60Data::buttonGroupContainer()
{
- return CEikonEnv::Static()->AppUiFactory()->Cba();
+ return QS60Data::cba;
+}
+
+inline void QS60Data::setButtonGroupContainer(CEikButtonGroupContainer *newCba)
+{
+ QS60Data::cba = newCba;
}
#endif // Q_WS_S60
diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h
index 73833823de..d62d9c3d48 100644
--- a/src/gui/kernel/qt_x11_p.h
+++ b/src/gui/kernel/qt_x11_p.h
@@ -350,7 +350,7 @@ struct QX11Data
// from qclipboard_x11.cpp
bool clipboardWaitForEvent(Window win, int type, XEvent *event, int timeout);
bool clipboardReadProperty(Window win, Atom property, bool deleteProperty,
- QByteArray *buffer, int *size, Atom *type, int *format, bool nullterm);
+ QByteArray *buffer, int *size, Atom *type, int *format);
QByteArray clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm);
// from qdnd_x11.cpp
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index cd48ca37b1..4e17f0fb23 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -276,6 +276,9 @@ QWidgetPrivate::QWidgetPrivate(int version)
, isMoved(0)
, isGLWidget(0)
, usesDoubleBufferedGLContext(0)
+#ifndef QT_NO_IM
+ , inheritsInputMethodHints(0)
+#endif
#if defined(Q_WS_X11)
, picture(0)
#elif defined(Q_WS_WIN)
@@ -306,6 +309,9 @@ QWidgetPrivate::QWidgetPrivate(int version)
drawRectOriginalAdded = false;
originalDrawMethod = true;
changeMethods = false;
+ hasOwnContext = false;
+ isInUnifiedToolbar = false;
+ unifiedSurface = 0;
#endif // QT_MAC_USE_COCOA
#ifdef QWIDGET_EXTRA_DEBUG
static int count = 0;
@@ -5341,6 +5347,14 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
if (rgn.isEmpty())
return;
+#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
+ // We disable the rendering of QToolBar in the backingStore if
+ // it's supposed to be in the unified toolbar on Mac OS X.
+ if (backingStore && isInUnifiedToolbar)
+ return;
+#endif // Q_WS_MAC && QT_MAC_USE_COCOA
+
+
Q_Q(QWidget);
#ifndef QT_NO_GRAPHICSEFFECT
if (graphicsEffect && graphicsEffect->isEnabled()) {
@@ -5403,6 +5417,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
QPaintEngine *paintEngine = pdev->paintEngine();
if (paintEngine) {
setRedirected(pdev, -offset);
+
#ifdef Q_WS_MAC
// (Alien support) Special case for Mac when redirecting: If the paint device
// is of the Widget type we need to set WA_WState_InPaintEvent since painting
@@ -5445,7 +5460,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
//actually send the paint event
QPaintEvent e(toBePainted);
QCoreApplication::sendSpontaneousEvent(q, &e);
-#if !defined(Q_WS_MAC) && !defined(Q_WS_QWS) && !defined(Q_WS_QPA)
+#if !defined(Q_WS_QWS) && !defined(Q_WS_QPA)
if (backingStore && !onScreen && !asRoot && (q->internalWinId() || !q->nativeParentWidget()->isWindow()))
backingStore->markDirtyOnScreen(toBePainted, q, offset);
#endif
@@ -9242,9 +9257,13 @@ QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const
*/
Qt::InputMethodHints QWidget::inputMethodHints() const
{
- Q_D(const QWidget);
#ifndef QT_NO_IM
- return d->imHints;
+ const QWidgetPrivate *priv = d_func();
+ while (priv->inheritsInputMethodHints) {
+ priv = priv->q_func()->parentWidget()->d_func();
+ Q_ASSERT(priv);
+ }
+ return priv->imHints;
#else //QT_NO_IM
return 0;
#endif //QT_NO_IM
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index 5b579b9063..eea7cca687 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -102,6 +102,8 @@ class QPlatformWindow;
class QLocale;
class QGraphicsProxyWidget;
class QGraphicsEffect;
+class QRasterWindowSurface;
+class QUnifiedToolbarSurface;
#if defined(Q_WS_X11)
class QX11Info;
#endif
@@ -773,6 +775,8 @@ private:
friend OSViewRef qt_mac_nativeview_for(const QWidget *w);
friend void qt_event_request_window_change(QWidget *widget);
friend bool qt_mac_sendMacEventToWidget(QWidget *widget, EventRef ref);
+ friend class QRasterWindowSurface;
+ friend class QUnifiedToolbarSurface;
#endif
#ifdef Q_WS_QWS
friend class QWSBackingStore;
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 5e41efa42e..017541c327 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3176,7 +3176,7 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset)
if (iconButton == nil) {
QCFString string(q->windowTitle());
const NSString *tmpString = reinterpret_cast<const NSString *>((CFStringRef)string);
- [qt_mac_window_for(q) setRepresentedURL:[NSURL fileURLWithPath:tmpString]];
+ [qt_mac_window_for(q) setRepresentedURL:[NSURL fileURLWithPath:const_cast<NSString *>(tmpString)]];
iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton];
}
if (icon.isNull()) {
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 1146a51fa7..fecab924a5 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -755,6 +755,9 @@ public:
uint isMoved : 1;
uint isGLWidget : 1;
uint usesDoubleBufferedGLContext : 1;
+#ifndef QT_NO_IM
+ uint inheritsInputMethodHints : 1;
+#endif
// *************************** Platform specific ************************************
#if defined(Q_WS_X11) // <----------------------------------------------------------- X11
@@ -846,6 +849,13 @@ public:
bool originalDrawMethod;
// Do we need to change the methods?
bool changeMethods;
+ bool hasOwnContext;
+ CGContextRef cgContext;
+ QRegion ut_rg;
+ QPoint ut_pt;
+ bool isInUnifiedToolbar;
+ QWindowSurface *unifiedSurface;
+ QPoint toolbar_offset;
#endif
void determineWindowClass();
void transferChildren();
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 91e74b558d..41ce11eb05 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -69,6 +69,7 @@ extern bool qt_nograb();
QWidget *QWidgetPrivate::mouseGrabber = 0;
QWidget *QWidgetPrivate::keyboardGrabber = 0;
+CEikButtonGroupContainer *QS60Data::cba = 0;
static bool isEqual(const QList<QAction*>& a, const QList<QAction*>& b)
{
@@ -498,9 +499,27 @@ void QWidgetPrivate::show_sys()
// Create the status pane and CBA here
CEikAppUi *ui = static_cast<CEikAppUi *>(S60->appUi());
MEikAppUiFactory *factory = CEikonEnv::Static()->AppUiFactory();
- TRAP_IGNORE(factory->ReadAppInfoResourceL(0, ui));
- if (S60->buttonGroupContainer())
- S60->buttonGroupContainer()->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS);
+
+ QT_TRAP_THROWING(
+ factory->CreateResourceIndependentFurnitureL(ui);
+
+ TRect boundingRect = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+
+ CEikButtonGroupContainer *cba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba,
+ CEikButtonGroupContainer::EHorizontal,ui,R_AVKON_SOFTKEYS_EMPTY_WITH_IDS);
+
+ CEikButtonGroupContainer *oldCba = CEikonEnv::Static()->AppUiFactory()->SwapButtonGroup(cba);
+ Q_ASSERT(!oldCba);
+ S60->setButtonGroupContainer(cba);
+
+ CEikMenuBar *menuBar = new(ELeave) CEikMenuBar;
+ menuBar->ConstructL(ui, 0, R_AVKON_MENUPANE_EMPTY);
+ menuBar->SetMenuType(CEikMenuBar::EMenuOptions);
+ S60->appUi()->AddToStackL(menuBar,ECoeStackPriorityMenu,ECoeStackFlagRefusesFocus);
+
+ CEikMenuBar *oldMenu = CEikonEnv::Static()->AppUiFactory()->SwapMenuBar(menuBar);
+ Q_ASSERT(!oldMenu);
+ )
if (S60->statusPane()) {
// Use QDesktopWidget as the status pane observer to proxy for the AppUi.
@@ -1237,7 +1256,8 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
// At this point the backing store should already be destroyed
// so we flush the command buffer to ensure that the freeing of
// those resources and deleting the window can happen "atomically"
- S60->wsSession().Flush();
+ if (qApp)
+ S60->wsSession().Flush();
}
}
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 8d80e100df..9085e98dd8 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -1933,20 +1933,27 @@ void QWidgetPrivate::show_sys()
if (flags & Qt::WindowStaysOnTopHint) {
if (flags & Qt::WindowStaysOnBottomHint)
qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time";
- netWmState.append(ATOM(_NET_WM_STATE_ABOVE));
- netWmState.append(ATOM(_NET_WM_STATE_STAYS_ON_TOP));
+ if (!netWmState.contains(ATOM(_NET_WM_STATE_ABOVE)))
+ netWmState.append(ATOM(_NET_WM_STATE_ABOVE));
+ if (!netWmState.contains(ATOM(_NET_WM_STATE_STAYS_ON_TOP)))
+ netWmState.append(ATOM(_NET_WM_STATE_STAYS_ON_TOP));
} else if (flags & Qt::WindowStaysOnBottomHint) {
- netWmState.append(ATOM(_NET_WM_STATE_BELOW));
+ if (!netWmState.contains(ATOM(_NET_WM_STATE_BELOW)))
+ netWmState.append(ATOM(_NET_WM_STATE_BELOW));
}
if (q->isFullScreen()) {
- netWmState.append(ATOM(_NET_WM_STATE_FULLSCREEN));
+ if (!netWmState.contains(ATOM(_NET_WM_STATE_FULLSCREEN)))
+ netWmState.append(ATOM(_NET_WM_STATE_FULLSCREEN));
}
if (q->isMaximized()) {
- netWmState.append(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ));
- netWmState.append(ATOM(_NET_WM_STATE_MAXIMIZED_VERT));
+ if (!netWmState.contains(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ)))
+ netWmState.append(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ));
+ if (!netWmState.contains(ATOM(_NET_WM_STATE_MAXIMIZED_VERT)))
+ netWmState.append(ATOM(_NET_WM_STATE_MAXIMIZED_VERT));
}
if (data.window_modality != Qt::NonModal) {
- netWmState.append(ATOM(_NET_WM_STATE_MODAL));
+ if (!netWmState.contains(ATOM(_NET_WM_STATE_MODAL)))
+ netWmState.append(ATOM(_NET_WM_STATE_MODAL));
}
if (!netWmState.isEmpty()) {
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 088ad42478..6eb4bd4858 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -257,6 +257,12 @@ symbian {
QMAKE_CXXFLAGS.ARMCC *= -O3
}
+mac {
+ HEADERS += painting/qunifiedtoolbarsurface_mac_p.h
+ SOURCES += painting/qunifiedtoolbarsurface_mac.cpp
+}
+
+
NEON_SOURCES += painting/qdrawhelper_neon.cpp
NEON_HEADERS += painting/qdrawhelper_neon_p.h
NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S
diff --git a/src/gui/painting/qcups_p.h b/src/gui/painting/qcups_p.h
index 92596798b8..239c2449ce 100644
--- a/src/gui/painting/qcups_p.h
+++ b/src/gui/painting/qcups_p.h
@@ -59,6 +59,7 @@
#ifndef QT_NO_CUPS
#include <QtCore/qlibrary.h>
#include <cups/cups.h>
+#include <cups/ppd.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index ed5d67c891..8cfa3dbd87 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3155,10 +3155,8 @@ void QRasterPaintEngine::drawGlyphsS60(const QPointF &p, const QTextItemInt &ti)
const TUint8 *glyphBitmapBytes;
TSize glyphBitmapSize;
fe->getCharacterData(glyphs[i], tmetrics, glyphBitmapBytes, glyphBitmapSize);
- const glyph_metrics_t metrics = ti.fontEngine->boundingBox(glyphs[i]);
- const int x = qFloor(positions[i].x + metrics.x);
- const int y = qFloor(positions[i].y + metrics.y);
-
+ const int x = qFloor(positions[i].x + tmetrics.HorizBearingX());
+ const int y = qFloor(positions[i].y - tmetrics.HorizBearingY());
alphaPenBlt(glyphBitmapBytes, glyphBitmapSize.iWidth, 8, x, y, glyphBitmapSize.iWidth, glyphBitmapSize.iHeight);
}
@@ -4989,8 +4987,8 @@ protected:
int size, int opacity) const;
uint *addCacheElement(quint64 hash_val, const QGradient &gradient, int opacity) {
if (cache.size() == maxCacheSize()) {
- int elem_to_remove = qrand() % maxCacheSize();
- cache.remove(cache.keys()[elem_to_remove]); // may remove more than 1, but OK
+ // may remove more than 1, but OK
+ cache.erase(cache.begin() + (qrand() % maxCacheSize()));
}
CacheInfo cache_entry(gradient.stops(), opacity, gradient.interpolationMode());
generateGradientColorTable(gradient, cache_entry.buffer, paletteSize(), opacity);
diff --git a/src/gui/painting/qpaintengine_s60.cpp b/src/gui/painting/qpaintengine_s60.cpp
index 068ca0c2f7..d7fc0af863 100644
--- a/src/gui/painting/qpaintengine_s60.cpp
+++ b/src/gui/painting/qpaintengine_s60.cpp
@@ -59,44 +59,63 @@ bool QS60PaintEngine::begin(QPaintDevice *device)
{
Q_D(QS60PaintEngine);
- pixmapData->beginDataAccess();
- bool ret = QRasterPaintEngine::begin(device);
- // Make sure QPaintEngine::paintDevice() returns the proper device.
- // QRasterPaintEngine changes pdev to QImage in case of RasterClass QPixmapData
- // which is incorrect in Symbian.
- d->pdev = device;
- return ret;
+ if (pixmapData->classId() == QPixmapData::RasterClass) {
+ pixmapData->beginDataAccess();
+ bool ret = QRasterPaintEngine::begin(device);
+ // Make sure QPaintEngine::paintDevice() returns the proper device.
+ // QRasterPaintEngine changes pdev to QImage in case of RasterClass QPixmapData
+ // which is incorrect in Symbian.
+ d->pdev = device;
+ return ret;
+ }
+
+ return QRasterPaintEngine::begin(device);
}
bool QS60PaintEngine::end()
{
- bool ret = QRasterPaintEngine::end();
- pixmapData->endDataAccess();
- return ret;
+ if (pixmapData->classId() == QPixmapData::RasterClass) {
+ bool ret = QRasterPaintEngine::end();
+ pixmapData->endDataAccess();
+ return ret;
+ }
+ return QRasterPaintEngine::end();
}
void QS60PaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm)
{
- QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData());
- srcData->beginDataAccess();
- QRasterPaintEngine::drawPixmap(p, pm);
- srcData->endDataAccess();
+ if (pm.pixmapData()->classId() == QPixmapData::RasterClass) {
+ QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData());
+ srcData->beginDataAccess();
+ QRasterPaintEngine::drawPixmap(p, pm);
+ srcData->endDataAccess();
+ } else {
+ QRasterPaintEngine::drawPixmap(p, pm);
+ }
}
void QS60PaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
{
- QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData());
- srcData->beginDataAccess();
- QRasterPaintEngine::drawPixmap(r, pm, sr);
- srcData->endDataAccess();
+ if (pm.pixmapData()->classId() == QPixmapData::RasterClass) {
+ QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData());
+ srcData->beginDataAccess();
+ QRasterPaintEngine::drawPixmap(r, pm, sr);
+ srcData->endDataAccess();
+ } else {
+ QRasterPaintEngine::drawPixmap(r, pm, sr);
+ }
}
void QS60PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr)
{
- QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData());
- srcData->beginDataAccess();
- QRasterPaintEngine::drawTiledPixmap(r, pm, sr);
- srcData->endDataAccess();
+ if (pm.pixmapData()->classId() == QPixmapData::RasterClass) {
+ QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData());
+ srcData->beginDataAccess();
+ QRasterPaintEngine::drawTiledPixmap(r, pm, sr);
+ srcData->endDataAccess();
+ } else {
+ QRasterPaintEngine::drawTiledPixmap(r, pm, sr);
+ }
}
void QS60PaintEngine::prepare(QImage *image)
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 92198765f1..78c1019567 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -143,6 +143,13 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
QHash<GlyphAndSubPixelPosition, Coord> listItemCoordinates;
int rowHeight = 0;
+ QFontEngine::GlyphFormat format;
+ switch (m_type) {
+ case Raster_A8: format = QFontEngine::Format_A8; break;
+ case Raster_RGBMask: format = QFontEngine::Format_A32; break;
+ default: format = QFontEngine::Format_Mono; break;
+ }
+
// check each glyph for its metrics and get the required rowHeight.
for (int i=0; i < numGlyphs; ++i) {
const glyph_t glyph = glyphs[i];
@@ -157,7 +164,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
continue;
if (listItemCoordinates.contains(GlyphAndSubPixelPosition(glyph, subPixelPosition)))
continue;
- glyph_metrics_t metrics = fontEngine->boundingBox(glyph, m_transform);
+ glyph_metrics_t metrics = fontEngine->alphaMapBoundingBox(glyph, m_transform, format);
#ifdef CACHE_DEBUG
printf("(%4x): w=%.2f, h=%.2f, xoff=%.2f, yoff=%.2f, x=%.2f, y=%.2f\n",
diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp
new file mode 100644
index 0000000000..ab05dbdc09
--- /dev/null
+++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp
@@ -0,0 +1,237 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qunifiedtoolbarsurface_mac_p.h"
+#include <private/qt_cocoa_helpers_mac_p.h>
+#include <private/qbackingstore_p.h>
+
+#include <QDebug>
+
+#ifdef QT_MAC_USE_COCOA
+
+QT_BEGIN_NAMESPACE
+
+QUnifiedToolbarSurface::QUnifiedToolbarSurface(QWidget *widget)
+ : QRasterWindowSurface(widget, false), d_ptr(new QUnifiedToolbarSurfacePrivate)
+{
+ d_ptr->image = 0;
+ d_ptr->inSetGeometry = false;
+ setStaticContentsSupport(true);
+
+ setGeometry(QRect(QPoint(0, 0), QSize(widget->width(), 100))); // FIXME: Fix height.
+}
+
+QUnifiedToolbarSurface::~QUnifiedToolbarSurface()
+{
+ if (d_ptr->image)
+ delete d_ptr->image;
+}
+
+QPaintDevice *QUnifiedToolbarSurface::paintDevice()
+{
+ return &d_ptr->image->image;
+}
+
+void QUnifiedToolbarSurface::recursiveRedirect(QObject *object, const QPoint &offset)
+{
+ if (object != 0) {
+ if (object->isWidgetType()) {
+ QWidget *widget = qobject_cast<QWidget *>(object);
+ widget->d_func()->unifiedSurface = this;
+ widget->d_func()->isInUnifiedToolbar = true;
+ widget->d_func()->toolbar_offset = offset;
+ }
+
+ for (int i = 0; i < object->children().size(); ++i) {
+ recursiveRedirect(object->children().at(i), offset);
+ }
+ }
+}
+
+void QUnifiedToolbarSurface::insertToolbar(QWidget *toolbar, const QPoint &offset)
+{
+ setGeometry(QRect(QPoint(0, 0), QSize(offset.x() + toolbar->width(), 100))); // FIXME
+ recursiveRedirect(toolbar, offset);
+// toolbar->d_func()->toolbar_offset = offset;
+}
+
+void QUnifiedToolbarSurface::setGeometry(const QRect &rect)
+{
+ QWindowSurface::setGeometry(rect);
+ Q_D(QUnifiedToolbarSurface);
+ d->inSetGeometry = true;
+ if (d->image == 0 || d->image->width() < rect.width() || d->image->height() < rect.height())
+ prepareBuffer(QImage::Format_ARGB32_Premultiplied, window());
+ d->inSetGeometry = false;
+}
+
+void QUnifiedToolbarSurface::beginPaint(const QRegion &rgn)
+{
+ QPainter p(&d_ptr->image->image);
+ p.setCompositionMode(QPainter::CompositionMode_Source);
+ const QVector<QRect> rects = rgn.rects();
+ const QColor blank = Qt::transparent;
+ for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
+ p.fillRect(*it, blank);
+ }
+}
+
+void QUnifiedToolbarSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &offset)
+{
+ Q_D(QUnifiedToolbarSurface);
+
+ if (!d->image || rgn.rectCount() == 0) {
+ return;
+ }
+
+ Q_UNUSED(offset);
+
+ // Get a context for the widget.
+ CGContextRef context;
+ if (!(widget->d_func()->hasOwnContext)) {
+ widget->d_func()->ut_rg = rgn;
+ widget->d_func()->ut_pt = offset;
+ qt_mac_display(widget);
+ return;
+ } else {
+ context = widget->d_func()->cgContext;
+ widget->render(widget->d_func()->unifiedSurface->paintDevice(), widget->d_func()->toolbar_offset, QRegion(), QWidget::DrawChildren);
+ }
+
+ CGContextSaveGState(context);
+
+ int areaX = widget->geometry().x() + widget->d_func()->toolbar_offset.x();
+ int areaY = widget->geometry().y() + widget->d_func()->toolbar_offset.y();
+ int areaWidth = widget->geometry().width();
+ int areaHeight = widget->geometry().height();
+ const CGRect area = CGRectMake(areaX, areaY, areaWidth, areaHeight);
+
+ // Clip to region.
+ const QVector<QRect> &rects = rgn.rects();
+ for (int i = 0; i < rects.size(); ++i) {
+ const QRect &rect = rects.at(i);
+ // CGContextAddRect(context, CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()));
+ CGContextAddRect(context, CGRectMake(0, 0, 1000, 1000)); //FIXME: Set correct size.
+ }
+ CGContextAddRect(context, area);
+ CGContextClip(context);
+
+
+ CGImageRef image = CGBitmapContextCreateImage(d->image->cg);
+ CGImageRef subImage = CGImageCreateWithImageInRect(image, area);
+
+ const CGRect drawingArea = CGRectMake(0, 0, areaWidth, areaHeight);
+ qt_mac_drawCGImage(context, &drawingArea, subImage);
+
+ CGImageRelease(subImage);
+ CGImageRelease(image);
+
+ CGContextFlush(context);
+
+ // Restore context.
+ CGContextRestoreGState(context);
+ widget->d_func()->hasOwnContext = false;
+}
+
+void QUnifiedToolbarSurface::prepareBuffer(QImage::Format format, QWidget *widget)
+{
+ Q_D(QUnifiedToolbarSurface);
+
+ int width = geometry().width();
+ int height = geometry().height();
+ if (d->image) {
+ width = qMax(d->image->width(), width);
+ height = qMax(d->image->height(), height);
+ }
+
+ if (width == 0 || height == 0) {
+ delete d->image;
+ d->image = 0;
+ return;
+ }
+
+ QNativeImage *oldImage = d->image;
+
+ d->image = new QNativeImage(width, height, format, false, widget);
+
+ if (oldImage && d->inSetGeometry && hasStaticContents()) {
+ // Make sure we use the const version of bits() (no detach).
+ const uchar *src = const_cast<const QImage &>(oldImage->image).bits();
+ uchar *dst = d->image->image.bits();
+
+ const int srcBytesPerLine = oldImage->image.bytesPerLine();
+ const int dstBytesPerLine = d->image->image.bytesPerLine();
+ const int bytesPerPixel = oldImage->image.depth() >> 3;
+
+ QRegion staticRegion(staticContents());
+ // Make sure we're inside the boundaries of the old image.
+ staticRegion &= QRect(0, 0, oldImage->image.width(), oldImage->image.height());
+ const QVector<QRect> &rects = staticRegion.rects();
+ const QRect *srcRect = rects.constData();
+
+ // Copy the static content of the old image into the new one.
+ int numRectsLeft = rects.size();
+ do {
+ const int bytesOffset = srcRect->x() * bytesPerPixel;
+ const int dy = srcRect->y();
+
+ // Adjust src and dst to point to the right offset.
+ const uchar *s = src + dy * srcBytesPerLine + bytesOffset;
+ uchar *d = dst + dy * dstBytesPerLine + bytesOffset;
+ const int numBytes = srcRect->width() * bytesPerPixel;
+
+ int numScanLinesLeft = srcRect->height();
+ do {
+ ::memcpy(d, s, numBytes);
+ d += dstBytesPerLine;
+ s += srcBytesPerLine;
+ } while (--numScanLinesLeft);
+
+ ++srcRect;
+ } while (--numRectsLeft);
+ }
+
+ delete oldImage;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_MAC_USE_COCOA
diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h
new file mode 100644
index 0000000000..4d72ff9f54
--- /dev/null
+++ b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QUNIFIEDTOOLBARSURFACE_MAC_P_H
+#define QUNIFIEDTOOLBARSURFACE_MAC_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qwindowsurface_raster_p.h>
+#include <QWidget>
+#include <private/qwidget_p.h>
+#include <private/qnativeimage_p.h>
+
+#ifdef QT_MAC_USE_COCOA
+
+QT_BEGIN_NAMESPACE
+
+class QNativeImage;
+
+
+class QUnifiedToolbarSurfacePrivate
+{
+public:
+ QNativeImage *image;
+ uint inSetGeometry : 1;
+};
+
+class Q_GUI_EXPORT QUnifiedToolbarSurface : public QRasterWindowSurface
+{
+public:
+ QUnifiedToolbarSurface(QWidget *widget);
+ ~QUnifiedToolbarSurface();
+
+ void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
+ void setGeometry(const QRect &rect);
+ void beginPaint(const QRegion &rgn);
+ void insertToolbar(QWidget *toolbar, const QPoint &offset);
+
+private:
+ QPaintDevice *paintDevice();
+ void prepareBuffer(QImage::Format format, QWidget *widget);
+ void recursiveRedirect(QObject *widget, const QPoint &offset);
+
+ Q_DECLARE_PRIVATE(QUnifiedToolbarSurface)
+ QScopedPointer<QUnifiedToolbarSurfacePrivate> d_ptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_MAC_USE_COCOA
+
+#endif // QUNIFIEDTOOLBARSURFACE_MAC_P_H
diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp
index 845cf6d8df..e9eb9c5d37 100644
--- a/src/gui/painting/qwindowsurface.cpp
+++ b/src/gui/painting/qwindowsurface.cpp
@@ -118,11 +118,11 @@ public:
/*!
Constructs an empty surface for the given top-level \a window.
*/
-QWindowSurface::QWindowSurface(QWidget *window)
+QWindowSurface::QWindowSurface(QWidget *window, bool setDefaultSurface)
: d_ptr(new QWindowSurfacePrivate(window))
{
if (!QApplicationPrivate::runtime_graphics_system) {
- if(window)
+ if(setDefaultSurface && window)
window->setWindowSurface(this);
}
}
diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h
index c8450214e7..82100c30ff 100644
--- a/src/gui/painting/qwindowsurface_p.h
+++ b/src/gui/painting/qwindowsurface_p.h
@@ -68,7 +68,7 @@ class QPlatformWindow;
class Q_GUI_EXPORT QWindowSurface
{
public:
- QWindowSurface(QWidget *window);
+ QWindowSurface(QWidget *window, bool setDefaultSurface = true);
virtual ~QWindowSurface();
QWidget *window() const;
diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp
index 6a2cb1e605..217723f0c8 100644
--- a/src/gui/painting/qwindowsurface_raster.cpp
+++ b/src/gui/painting/qwindowsurface_raster.cpp
@@ -64,6 +64,9 @@
#ifdef Q_WS_MAC
#include <private/qt_cocoa_helpers_mac_p.h>
+#include <QMainWindow>
+#include <private/qmainwindowlayout_p.h>
+#include <QToolBar>
#endif
QT_BEGIN_NAMESPACE
@@ -82,8 +85,8 @@ public:
uint inSetGeometry : 1;
};
-QRasterWindowSurface::QRasterWindowSurface(QWidget *window)
- : QWindowSurface(window), d_ptr(new QRasterWindowSurfacePrivate)
+QRasterWindowSurface::QRasterWindowSurface(QWidget *window, bool setDefaultSurface)
+ : QWindowSurface(window, setDefaultSurface), d_ptr(new QRasterWindowSurfacePrivate)
{
#ifdef Q_WS_X11
d_ptr->gc = XCreateGC(X11->display, window->handle(), 0, 0);
@@ -248,6 +251,25 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
#ifdef Q_WS_MAC
+#ifdef QT_MAC_USE_COCOA
+ // Unified toolbar hack.
+ QMainWindow* mWindow = qobject_cast<QMainWindow*>(widget->window());
+ if (mWindow) {
+ QMainWindowLayout *mLayout = qobject_cast<QMainWindowLayout*>(mWindow->layout());
+ QList<QToolBar *> toolbarList = mLayout->qtoolbarsInUnifiedToolbarList;
+
+ for (int i = 0; i < toolbarList.size(); ++i) {
+ QToolBar* toolbar = toolbarList.at(i);
+ if (mLayout->toolBarArea(toolbar) == Qt::TopToolBarArea) {
+ QWidget* tbWidget = (QWidget*) toolbar;
+ if (tbWidget->d_func()->unifiedSurface) {
+ tbWidget->d_func()->unifiedSurface->flush(tbWidget, rgn, offset);
+ }
+ }
+ }
+ }
+#endif // QT_MAC_USE_COCOA
+
Q_UNUSED(offset);
// Get a context for the widget.
#ifndef QT_MAC_USE_COCOA
@@ -318,6 +340,25 @@ void QRasterWindowSurface::setGeometry(const QRect &rect)
prepareBuffer(QNativeImage::systemFormat(), window());
}
d->inSetGeometry = false;
+
+#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
+ QMainWindow* mWindow = qobject_cast<QMainWindow*>(window());
+ if (mWindow) {
+ QMainWindowLayout *mLayout = qobject_cast<QMainWindowLayout*>(mWindow->layout());
+ QList<QToolBar *> toolbarList = mLayout->qtoolbarsInUnifiedToolbarList;
+
+ for (int i = 0; i < toolbarList.size(); ++i) {
+ QToolBar* toolbar = toolbarList.at(i);
+ if (mLayout->toolBarArea(toolbar) == Qt::TopToolBarArea) {
+ QWidget* tbWidget = (QWidget*) toolbar;
+ if (tbWidget->d_func()->unifiedSurface) {
+ tbWidget->d_func()->unifiedSurface->setGeometry(rect);
+ }
+ }
+ }
+ }
+#endif // Q_WS_MAC && QT_MAC_USE_COCOA
+
}
// from qwindowsurface.cpp
diff --git a/src/gui/painting/qwindowsurface_raster_p.h b/src/gui/painting/qwindowsurface_raster_p.h
index 2b932a9d11..a7c3b9f45d 100644
--- a/src/gui/painting/qwindowsurface_raster_p.h
+++ b/src/gui/painting/qwindowsurface_raster_p.h
@@ -97,7 +97,7 @@ class QNativeImage;
class Q_GUI_EXPORT QRasterWindowSurface : public QWindowSurface
{
public:
- QRasterWindowSurface(QWidget *widget);
+ QRasterWindowSurface(QWidget *widget, bool setDefaultSurface = true);
~QRasterWindowSurface();
QPaintDevice *paintDevice();
diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp
index d4dcf7dd07..eb9eff224f 100644
--- a/src/gui/painting/qwindowsurface_s60.cpp
+++ b/src/gui/painting/qwindowsurface_s60.cpp
@@ -102,9 +102,11 @@ QS60WindowSurface::~QS60WindowSurface()
// Issue empty redraw to clear the UI surface
QWidget *w = window();
- RWindow *const window = static_cast<RWindow *>(w->winId()->DrawableWindow());
- window->BeginRedraw();
- window->EndRedraw();
+ if (w->testAttribute(Qt::WA_WState_Created)) {
+ RWindow *const window = static_cast<RWindow *>(w->winId()->DrawableWindow());
+ window->BeginRedraw();
+ window->EndRedraw();
+ }
}
}
#endif
diff --git a/src/gui/s60framework/qs60mainapplication.cpp b/src/gui/s60framework/qs60mainapplication.cpp
index 5d4c54e337..24d2496367 100644
--- a/src/gui/s60framework/qs60mainapplication.cpp
+++ b/src/gui/s60framework/qs60mainapplication.cpp
@@ -47,6 +47,9 @@
#include "qs60mainapplication.h"
#include <bautils.h>
#include <coemain.h>
+#ifndef Q_WS_S60
+# include <eikserverapp.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -58,7 +61,6 @@ CApaApplication *newS60Application()
return new QS60MainApplication;
}
-_LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main" QT_LIBINFIX_UNICODE L".rsc");
/*!
\class QS60MainApplication
@@ -129,10 +131,6 @@ TUid QS60MainApplication::AppDllUid() const
*/
TFileName QS60MainApplication::ResourceFileName() const
{
- TFindFile finder(iCoeEnv->FsSession());
- TInt err = finder.FindByDir(KQtWrapperResourceFile, KNullDesC);
- if (err == KErrNone)
- return finder.File();
return KNullDesC();
}
@@ -157,7 +155,11 @@ CDictionaryStore *QS60MainApplication::OpenIniFileLC(RFs &aFs) const
*/
void QS60MainApplication::NewAppServerL(CApaAppServer *&aAppServer)
{
+#ifdef Q_WS_S60
QS60MainApplicationBase::NewAppServerL(aAppServer);
+#else
+ aAppServer = new(ELeave) CEikAppServer;
+#endif
}
QT_END_NAMESPACE
diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp
index ea9dbb3227..92b3b5529c 100644
--- a/src/gui/s60framework/qs60mainappui.cpp
+++ b/src/gui/s60framework/qs60mainappui.cpp
@@ -50,16 +50,6 @@
#endif
#include <barsread.h>
#include <qconfig.h>
-#ifdef Q_WS_S60
-# if defined(QT_LIBINFIX_UNQUOTED)
-// Two level macro needed for proper expansion of libinfix
-# define QT_S60MAIN_RSG_2(x) <s60main##x##.rsg>
-# define QT_S60MAIN_RSG(x) QT_S60MAIN_RSG_2(x)
-# include QT_S60MAIN_RSG(QT_LIBINFIX_UNQUOTED)
-# else
-# include <s60main.rsg>
-# endif
-#endif
#include "qs60mainappui.h"
#include <QtGui/qapplication.h>
@@ -125,8 +115,8 @@ void QS60MainAppUi::ConstructL()
#ifdef Q_WS_S60
flags |= CAknAppUi::EAknEnableSkin;
// After 5th Edition S60, native side supports animated wallpapers.
- // However, there is no support for that feature on Qt side, so indicate to
- // native UI framework that this application will not support background animations.
+ // However, there is no support for that feature on Qt side, so indicate to
+ // native UI framework that this application will not support background animations.
if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0)
flags |= KAknDisableAnimationBackground;
#endif
@@ -244,7 +234,7 @@ void QS60MainAppUi::DynInitMenuBarL(TInt /* resourceId */, CEikMenuBar * /* menu
void QS60MainAppUi::DynInitMenuPaneL(TInt resourceId, CEikMenuPane *menuPane)
{
#ifdef Q_WS_S60
- if (resourceId == R_QT_WRAPPERAPP_MENU) {
+ if (resourceId == R_AVKON_MENUPANE_EMPTY) {
if (menuPane->NumberOfItemsInPane() <= 1)
QT_TRYCATCH_LEAVING(qt_symbian_show_toplevel(menuPane));
@@ -274,7 +264,17 @@ void QS60MainAppUi::RestoreMenuL(CCoeControl *menuWindow, TInt resourceId, TMenu
DynInitMenuPaneL(resourceId, (CEikMenuPane*)menuWindow);
else
DynInitMenuBarL(resourceId, (CEikMenuBar*)menuWindow);
- } else
+ } else if(resourceId == R_AVKON_MENUPANE_EMPTY) {
+ CEikMenuBarTitle *title = new(ELeave) CEikMenuBarTitle;
+ CleanupStack::PushL(title);
+
+ title->iData.iMenuPaneResourceId = R_AVKON_MENUPANE_EMPTY;
+ title->iTitleFlags = 0;
+
+ S60->menuBar()->TitleArray()->AddTitleL(title);
+ CleanupStack::Pop( title );
+ }
+ else
#endif
{
QS60MainAppUiBase::RestoreMenuL(menuWindow, resourceId, menuType);
diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri
index edbacc0a1a..19525b7fdb 100644
--- a/src/gui/s60framework/s60framework.pri
+++ b/src/gui/s60framework/s60framework.pri
@@ -1,21 +1,3 @@
-contains(QT_CONFIG, s60) {
-# This block serves the minimalistic resource file for S60 3.1 platforms.
-# Note there is no way to ifdef S60 version in mmp file, that is why the resource
-# file is always compiled for WINSCW
-
- minimalAppResource31 = \
- "SOURCEPATH s60framework" \
- "START RESOURCE s60main.rss" \
- "TARGET s60main$${QT_LIBINFIX}" \
- "HEADER" \
- "TARGETPATH /resource/apps" \
- "END"
-
- MMP_RULES += minimalAppResource31
-
- SYMBIAN_RESOURCES += s60framework/s60main.rss
-}
-
SOURCES += s60framework/qs60mainapplication.cpp \
s60framework/qs60mainappui.cpp \
s60framework/qs60maindocument.cpp
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index c5429dd0f5..9cc64b398d 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -225,9 +225,8 @@ QPalette QGtkStyle::standardPalette() const
GtkStyle *style = d->gtkStyle();
GtkWidget *gtkButton = d->gtkWidget("GtkButton");
GtkWidget *gtkEntry = d->getTextColorWidget();
-
- GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg;
- QColor bg, base, text, fg, highlight, highlightText;
+ GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg, gdkaSbg, gdkaSfg;
+ QColor bg, base, text, fg, highlight, highlightText, inactiveHighlight, inactiveHighlightedTExt;
gdkBg = style->bg[GTK_STATE_NORMAL];
gdkForeground = gtkButton->style->fg[GTK_STATE_NORMAL];
@@ -237,14 +236,23 @@ QPalette QGtkStyle::standardPalette() const
gdkText = gtkEntry->style->text[GTK_STATE_NORMAL];
gdkSbg = gtkEntry->style->base[GTK_STATE_SELECTED];
gdkSfg = gtkEntry->style->text[GTK_STATE_SELECTED];
+
+ // The ACTIVE base color is really used for inactive windows
+ gdkaSbg = gtkEntry->style->base[GTK_STATE_ACTIVE];
+ gdkaSfg = gtkEntry->style->text[GTK_STATE_ACTIVE];
+
bg = QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8);
text = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
fg = QColor(gdkForeground.red>>8, gdkForeground.green>>8, gdkForeground.blue>>8);
base = QColor(gdkBase.red>>8, gdkBase.green>>8, gdkBase.blue>>8);
highlight = QColor(gdkSbg.red>>8, gdkSbg.green>>8, gdkSbg.blue>>8);
highlightText = QColor(gdkSfg.red>>8, gdkSfg.green>>8, gdkSfg.blue>>8);
+ inactiveHighlight = QColor(gdkaSbg.red>>8, gdkaSbg.green>>8, gdkaSbg.blue>>8);
+ inactiveHighlightedTExt = QColor(gdkaSfg.red>>8, gdkaSfg.green>>8, gdkaSfg.blue>>8);
palette.setColor(QPalette::HighlightedText, highlightText);
+
+
palette.setColor(QPalette::Light, bg.lighter(125));
palette.setColor(QPalette::Shadow, bg.darker(130));
palette.setColor(QPalette::Dark, bg.darker(120));
@@ -279,6 +287,10 @@ QPalette QGtkStyle::standardPalette() const
highlightText.setHsv(highlightText.hue(), 0, highlightText.value(), highlightText.alpha());
palette.setColor(QPalette::Disabled, QPalette::Highlight, highlight);
palette.setColor(QPalette::Disabled, QPalette::HighlightedText, highlightText);
+
+ palette.setColor(QPalette::Inactive, QPalette::HighlightedText, inactiveHighlightedTExt);
+ palette.setColor(QPalette::Inactive, QPalette::Highlight, inactiveHighlight);
+
style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow",
d->gtk_window_get_type());
if (style) {
@@ -791,10 +803,13 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element,
// ### this mess should move to subcontrolrect
QRect frameRect = option->rect.adjusted(1, 1, -1, -2);
- if (qobject_cast<const QTabBar*>(widget))
- frameRect.adjust(-1, 1, 1, 1);
-
- gtkPainter.paintFocus(NULL, "tab", frameRect, GTK_STATE_ACTIVE, style);
+ if (qobject_cast<const QTabBar*>(widget)) {
+ GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook");
+ style = gtkPainter.getStyle(gtkNotebook);
+ gtkPainter.paintFocus(gtkNotebook, "tab", frameRect.adjusted(-1, 1, 1, 1), GTK_STATE_ACTIVE, style);
+ } else {
+ gtkPainter.paintFocus(NULL, "tab", frameRect, GTK_STATE_ACTIVE, style);
+ }
}
break;
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 556e0f303e..3a05f40ba7 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -3336,6 +3336,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (needText) {
QPalette pal = tb->palette;
QPalette::ColorRole role = QPalette::NoRole;
+ if (!proxy()->styleHint(SH_UnderlineShortcut, tb, w))
+ alignment |= Qt::TextHideMnemonic;
if (down)
cr.translate(shiftX, shiftY);
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5
@@ -3353,13 +3355,13 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
role = QPalette::HighlightedText;
}
}
- drawItemText(p, cr, alignment, pal,
- tb->state & State_Enabled, tb->text, role);
+ proxy()->drawItemText(p, cr, alignment, pal,
+ tb->state & State_Enabled, tb->text, role);
if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_5 &&
(tb->state & State_Sunken)) {
// Draw a "drop shadow" in earlier versions.
- drawItemText(p, cr.adjusted(0, 1, 0, 1), alignment,
- tb->palette, tb->state & State_Enabled, tb->text);
+ proxy()->drawItemText(p, cr.adjusted(0, 1, 0, 1), alignment,
+ tb->palette, tb->state & State_Enabled, tb->text);
}
}
} else {
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index cf7e9634d5..89f54bc297 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -106,8 +106,8 @@ const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = {
// *** generated pixel metrics ***
{5,0,-909,0,0,2,0,0,-1,7,12,22,15,15,7,198,-909,-909,-909,20,13,2,0,0,21,7,18,30,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1,106},
{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,28,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1,106},
-{7,0,-909,0,0,2,0,0,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,13,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135},
-{7,0,-909,0,0,2,0,0,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,12,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135},
+{7,0,-909,0,0,2,0,0,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135},
+{7,0,-909,0,0,2,0,0,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135},
{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1,106}
// *** End of generated data ***
};
@@ -2453,7 +2453,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
case PE_PanelItemViewRow: // ### Qt 5: remove
#ifndef QT_NO_ITEMVIEWS
if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
- if (QS60StylePrivate::equalToThemePalette(vopt->palette.base().texture().cacheKey(), QPalette::Base)) {
+ if (!QS60StylePrivate::equalToThemePalette(vopt->palette.base().texture().cacheKey(), QPalette::Base)) {
//QPalette::Base has been changed, let commonstyle draw the item
commonStyleDraws = true;
} else {
@@ -2530,11 +2530,6 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const
//without having to define custom pixel metric
metricValue *= 2;
- if (widget && (metric == PM_FocusFrameHMargin))
- if (qobject_cast<const QTableView *>(widget))
- //Halve the focus frame margin for table items
- metricValue /= 2;
-
return metricValue;
}
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 9abc8838c3..bae2a209a6 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -2454,10 +2454,12 @@ QString QFontDatabase::writingSystemSample(WritingSystem writingSystem)
sample += QChar(0x4f8b);
break;
case Japanese:
- sample += QChar(0x3050);
- sample += QChar(0x3060);
- sample += QChar(0x30b0);
- sample += QChar(0x30c0);
+ sample += QChar(0x30b5);
+ sample += QChar(0x30f3);
+ sample += QChar(0x30d7);
+ sample += QChar(0x30eb);
+ sample += QChar(0x3067);
+ sample += QChar(0x3059);
break;
case Korean:
sample += QChar(0xac00);
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index e0e9995a4c..81e2594504 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -760,10 +760,10 @@ void QFontEngineFT::setDefaultHintStyle(HintStyle style)
default_hint_style = style;
}
-QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph) const
+QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph, GlyphFormat format) const
{
Glyph *g = set->getGlyph(glyph);
- if (g)
+ if (g && g->format == format)
return g;
int load_flags = FT_LOAD_DEFAULT | default_load_flags;
@@ -771,6 +771,18 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph
? FT_LOAD_TARGET_LIGHT
: FT_LOAD_TARGET_NORMAL;
+ if (format == Format_Mono) {
+ load_target = FT_LOAD_TARGET_MONO;
+ } else if (format == Format_A32) {
+ if (subpixelType == QFontEngineFT::Subpixel_RGB || subpixelType == QFontEngineFT::Subpixel_BGR) {
+ if (default_hint_style == HintFull)
+ load_target = FT_LOAD_TARGET_LCD;
+ } else if (subpixelType == QFontEngineFT::Subpixel_VRGB || subpixelType == QFontEngineFT::Subpixel_VBGR) {
+ if (default_hint_style == HintFull)
+ load_target = FT_LOAD_TARGET_LCD_V;
+ }
+ }
+
if (set->outline_drawing)
load_flags = FT_LOAD_NO_BITMAP;
@@ -1772,6 +1784,11 @@ glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph)
glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph, const QTransform &matrix)
{
+ return alphaMapBoundingBox(glyph, matrix, QFontEngine::Format_None);
+}
+
+glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, const QTransform &matrix, QFontEngine::GlyphFormat format)
+{
FT_Face face = 0;
glyph_metrics_t overall;
QGlyphSet *glyphSet = 0;
@@ -1815,9 +1832,9 @@ glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph, const QTransform &matr
glyphSet = &defaultGlyphSet;
}
Glyph * g = glyphSet->getGlyph(glyph);
- if (!g) {
+ if (!g || g->format != format) {
face = lockFace();
- g = loadGlyphMetrics(glyphSet, glyph);
+ g = loadGlyphMetrics(glyphSet, glyph, format);
}
if (g) {
diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h
index 5a27032d89..f0f7153a0c 100644
--- a/src/gui/text/qfontengine_ft_p.h
+++ b/src/gui/text/qfontengine_ft_p.h
@@ -130,13 +130,6 @@ private:
class Q_GUI_EXPORT QFontEngineFT : public QFontEngine
{
public:
- enum GlyphFormat {
- Format_None,
- Format_Render = Format_None,
- Format_Mono,
- Format_A8,
- Format_A32
- };
/* we don't cache glyphs that are too large anyway, so we can make this struct rather small */
struct Glyph {
@@ -242,6 +235,8 @@ private:
virtual void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const;
virtual QImage alphaMapForGlyph(glyph_t);
virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, int margin, const QTransform &t);
+ virtual glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, const QTransform &matrix,
+ QFontEngine::GlyphFormat format);
virtual void removeGlyphFromCache(glyph_t glyph);
virtual int glyphCount() const;
@@ -313,7 +308,7 @@ protected:
bool embeddedbitmap;
private:
- QFontEngineFT::Glyph *loadGlyphMetrics(QGlyphSet *set, uint glyph) const;
+ QFontEngineFT::Glyph *loadGlyphMetrics(QGlyphSet *set, uint glyph, GlyphFormat format) const;
GlyphFormat defaultFormat;
FT_Matrix matrix;
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 3a744a08e8..e919d12d8a 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -120,6 +120,14 @@ public:
TestFontEngine = 0x1000
};
+ enum GlyphFormat {
+ Format_None,
+ Format_Render = Format_None,
+ Format_Mono,
+ Format_A8,
+ Format_A32
+ };
+
QFontEngine();
virtual ~QFontEngine();
@@ -191,6 +199,11 @@ public:
virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t);
virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, int margin, const QTransform &t);
+ virtual glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, const QTransform &matrix, GlyphFormat /*format*/)
+ {
+ return boundingBox(glyph, matrix);
+ }
+
virtual void removeGlyphFromCache(glyph_t);
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) = 0;
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index e9dcfa077c..134c1edfcb 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -41,6 +41,7 @@
#include "qfontengine_s60_p.h"
#include "qtextengine_p.h"
+#include "qendian.h"
#include "qglobal.h"
#include <private/qapplication_p.h>
#include "qimage.h"
@@ -177,6 +178,24 @@ CFont *QSymbianTypeFaceExtras::fontOwner() const
return m_cFont;
}
+QFixed QSymbianTypeFaceExtras::unitsPerEm() const
+{
+ if (m_unitsPerEm.value() != 0)
+ return m_unitsPerEm;
+ const QByteArray head = getSfntTable(MAKE_TAG('h', 'e', 'a', 'd'));
+ const int unitsPerEmOffset = 18;
+ if (head.size() > unitsPerEmOffset + sizeof(quint16)) {
+ const uchar* tableData = reinterpret_cast<const uchar*>(head.constData());
+ const uchar* unitsPerEm = tableData + unitsPerEmOffset;
+ m_unitsPerEm = qFromBigEndian<quint16>(unitsPerEm);
+ } else {
+ // Bitmap font? Corrupt font?
+ // We return -1 and let the QFontEngineS60 return the pixel size.
+ m_unitsPerEm = -1;
+ }
+ return m_unitsPerEm;
+}
+
// duplicated from qfontengine_xyz.cpp
static inline unsigned int getChar(const QChar *str, int &i, const int len)
{
@@ -249,6 +268,13 @@ QFontEngineS60::~QFontEngineS60()
releaseFont(m_scaledFont);
}
+QFixed QFontEngineS60::emSquareSize() const
+{
+ const QFixed unitsPerEm = m_extras->unitsPerEm();
+ return unitsPerEm.toInt() == -1 ?
+ QFixed::fromReal(m_originalFontSizeInPixels) : unitsPerEm;
+}
+
bool QFontEngineS60::stringToCMap(const QChar *characters, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const
{
if (*nglyphs < len) {
@@ -278,10 +304,13 @@ bool QFontEngineS60::stringToCMap(const QChar *characters, int len, QGlyphLayout
void QFontEngineS60::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const
{
Q_UNUSED(flags);
+ TOpenFontCharMetrics metrics;
+ const TUint8 *glyphBitmapBytes;
+ TSize glyphBitmapSize;
for (int i = 0; i < glyphs->numGlyphs; i++) {
- const glyph_metrics_t bbox = boundingBox_const(glyphs->glyphs[i]);
- glyphs->advances_x[i] = bbox.xoff;
- glyphs->advances_y[i] = bbox.yoff;
+ getCharacterData(glyphs->glyphs[i], metrics, glyphBitmapBytes, glyphBitmapSize);
+ glyphs->advances_x[i] = metrics.HorizAdvance();
+ glyphs->advances_y[i] = 0;
}
}
@@ -309,6 +338,7 @@ void QFontEngineS60::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions,
parseGlyphPathData(outlineChar, outlineEnd, *path, fontSizeInPixels,
positions[count++].toPointF(), false);
} while(KErrNone == iterator.Next() && count <= nglyphs);
+ iterator.Close();
#else // Q_SYMBIAN_HAS_GLYPHOUTLINE_API
QFontEngine::addGlyphsToPath(glyphs, positions, nglyphs, path, flags);
#endif //Q_SYMBIAN_HAS_GLYPHOUTLINE_API
@@ -316,29 +346,17 @@ void QFontEngineS60::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions,
QImage QFontEngineS60::alphaMapForGlyph(glyph_t glyph)
{
+ // Note: On some Symbian versions (apparently <= Symbian^1), this
+ // function will return gray values 0x00, 0x10 ... 0xe0, 0xf0 due
+ // to a bug. The glyphs are nowhere perfectly opaque.
+ // This has been fixed for Symbian^3.
+
TOpenFontCharMetrics metrics;
const TUint8 *glyphBitmapBytes;
TSize glyphBitmapSize;
getCharacterData(glyph, metrics, glyphBitmapBytes, glyphBitmapSize);
QImage result(glyphBitmapBytes, glyphBitmapSize.iWidth, glyphBitmapSize.iHeight, glyphBitmapSize.iWidth, QImage::Format_Indexed8);
result.setColorTable(grayPalette());
-
- // The above setColorTable() call detached the image data anyway, so why not shape tha data a bit, while we can.
- // CFont::GetCharacterData() returns 8-bit data that obviously was 4-bit data before, and converted to 8-bit incorrectly.
- // The data values are 0x00, 0x10 ... 0xe0, 0xf0. So, a real opaque 0xff is never reached, which we get punished
- // for every time we want to blit this glyph in the raster paint engine.
- // "Fix" is to convert all 0xf0 to 0xff. Is fine, quality wise, and I assume faster than correcting all values.
- // Blitting is however, evidentially faster now.
- const int bpl = result.bytesPerLine();
- for (int row = 0; row < result.height(); ++row) {
- uchar *scanLine = result.scanLine(row);
- for (int column = 0; column < bpl; ++column) {
- if (*scanLine == 0xf0)
- *scanLine = 0xff;
- scanLine++;
- }
- }
-
return result;
}
@@ -360,13 +378,11 @@ glyph_metrics_t QFontEngineS60::boundingBox_const(glyph_t glyph) const
const TUint8 *glyphBitmapBytes;
TSize glyphBitmapSize;
getCharacterData(glyph, metrics, glyphBitmapBytes, glyphBitmapSize);
- TRect glyphBounds;
- metrics.GetHorizBounds(glyphBounds);
const glyph_metrics_t result(
- glyphBounds.iTl.iX,
- glyphBounds.iTl.iY,
- glyphBounds.Width(),
- glyphBounds.Height(),
+ metrics.HorizBearingX(),
+ -metrics.HorizBearingY(),
+ metrics.Width(),
+ metrics.Height(),
metrics.HorizAdvance(),
0
);
diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h
index d05c23c4e0..c65ce55f1b 100644
--- a/src/gui/text/qfontengine_s60_p.h
+++ b/src/gui/text/qfontengine_s60_p.h
@@ -82,11 +82,13 @@ public:
const uchar *cmap() const;
CFont *fontOwner() const;
bool isSymbolCMap() const;
+ QFixed unitsPerEm() const;
private:
CFont* m_cFont;
mutable bool m_symbolCMap;
mutable QByteArray m_cmapTable;
+ mutable QFixed m_unitsPerEm;
#ifndef Q_SYMBIAN_HAS_FONTTABLE_API
COpenFont *m_openFont;
mutable MOpenFontTrueTypeExtension *m_trueTypeExtension;
@@ -99,6 +101,7 @@ public:
QFontEngineS60(const QFontDef &fontDef, const QSymbianTypeFaceExtras *extras);
~QFontEngineS60();
+ QFixed emSquareSize() const;
bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const;
void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const;
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 34d9fa6b9a..f4f2168177 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1976,9 +1976,11 @@ void QTextEngine::justify(const QScriptLine &line)
if (kashida_pos >= 0) {
// qDebug("kashida position at %d in word", kashida_pos);
set(&justificationPoints[nPoints], kashida_type, g.mid(kashida_pos), fontEngine(si));
- minKashida = qMin(minKashida, justificationPoints[nPoints].kashidaWidth);
- maxJustify = qMax(maxJustify, justificationPoints[nPoints].type);
- ++nPoints;
+ if (justificationPoints[nPoints].kashidaWidth > 0) {
+ minKashida = qMin(minKashida, justificationPoints[nPoints].kashidaWidth);
+ maxJustify = qMax(maxJustify, justificationPoints[nPoints].type);
+ ++nPoints;
+ }
}
kashida_pos = -1;
kashida_type = HB_Arabic_Normal;
@@ -2002,9 +2004,11 @@ void QTextEngine::justify(const QScriptLine &line)
}
if (kashida_pos >= 0) {
set(&justificationPoints[nPoints], kashida_type, g.mid(kashida_pos), fontEngine(si));
- minKashida = qMin(minKashida, justificationPoints[nPoints].kashidaWidth);
- maxJustify = qMax(maxJustify, justificationPoints[nPoints].type);
- ++nPoints;
+ if (justificationPoints[nPoints].kashidaWidth > 0) {
+ minKashida = qMin(minKashida, justificationPoints[nPoints].kashidaWidth);
+ maxJustify = qMax(maxJustify, justificationPoints[nPoints].type);
+ ++nPoints;
+ }
}
}
diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp
index 4ca11b039f..d4118bd486 100644
--- a/src/gui/widgets/qmainwindow.cpp
+++ b/src/gui/widgets/qmainwindow.cpp
@@ -1516,14 +1516,21 @@ void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set)
if (!isWindow() || d->useHIToolBar == set || QSysInfo::MacintoshVersion < QSysInfo::MV_10_3)
return;
- // ### Disable the unified toolbar when using anything but the native graphics system.
- // ### Disable when using alien widgets as well
- if (windowSurface() || testAttribute(Qt::WA_NativeWindow) == false)
+ // ### Disable when using alien widgets
+ if (testAttribute(Qt::WA_NativeWindow) == false) {
return;
+ }
d->useHIToolBar = set;
createWinId(); // We need the hiview for down below.
+#ifdef QT_MAC_USE_COCOA
+ // Activate the unified toolbar with the raster engine.
+ if (windowSurface()) {
+ d->layout->unifiedSurface = new QUnifiedToolbarSurface(this);
+ }
+#endif // QT_MAC_USE_COCOA
+
d->layout->updateHIToolBarStatus();
// Enabling the unified toolbar clears the opaque size grip setting, update it.
d->macUpdateOpaqueSizeGrip();
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm
index 1bfc746089..126cc4a925 100644
--- a/src/gui/widgets/qmainwindowlayout_mac.mm
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm
@@ -408,6 +408,7 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar
beforeIndex = qtoolbarsInUnifiedToolbarList.size();
int toolbarIndex = qtoolbarsInUnifiedToolbarList.indexOf(toolbar);
+
#ifndef QT_MAC_USE_COCOA
HIToolbarRef macToolbar = NULL;
if ((GetWindowToolbar(window, &macToolbar) == noErr) && !macToolbar) {
@@ -444,6 +445,18 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar
#endif
}
qtoolbarsInUnifiedToolbarList.insert(beforeIndex, toolbar);
+
+ // Adding to the unified toolbar surface for the raster engine.
+ if (layoutState.mainWindow->windowSurface()) {
+ QPoint offset(0, 0);
+ for (int i = 0; i < beforeIndex; ++i) {
+ offset.setX(offset.x() + qtoolbarsInUnifiedToolbarList.at(i)->size().width());
+ }
+#ifdef QT_MAC_USE_COCOA
+ unifiedSurface->insertToolbar(toolbar, offset);
+#endif // QT_MAC_USE_COCOA
+ }
+
#ifndef QT_MAC_USE_COCOA
QCFType<HIToolbarItemRef> outItem;
const QObject *stupidArray[] = { toolbar, this };
diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h
index e1b981c1cd..e882d118e7 100644
--- a/src/gui/widgets/qmainwindowlayout_p.h
+++ b/src/gui/widgets/qmainwindowlayout_p.h
@@ -85,7 +85,11 @@ typedef HIObjectRef HIToolbarItemRef;
typedef const void * CFTypeRef;
typedef const struct __CFString * CFStringRef;
-#endif
+# ifdef QT_MAC_USE_COCOA
+#include <private/qunifiedtoolbarsurface_mac_p.h>
+# endif // QT_MAC_USE_COCOA
+
+#endif // Q_WS_MAC
QT_BEGIN_NAMESPACE
@@ -337,7 +341,12 @@ public:
bool useHIToolBar;
void syncUnifiedToolbarVisibility();
bool blockVisiblityCheck;
-#endif
+
+#ifdef QT_MAC_USE_COCOA
+ QUnifiedToolbarSurface *unifiedSurface;
+#endif // QT_MAC_USE_COCOA
+
+#endif // Q_WS_MAC
};
QT_END_NAMESPACE