summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJan-Arve Saether <jan-arve.saether@nokia.com>2011-09-07 06:20:24 (GMT)
committerJan-Arve Saether <jan-arve.saether@nokia.com>2011-09-07 06:20:24 (GMT)
commit9d34e9d705cf2f054a668d9e6aafb2efcd500913 (patch)
tree68f2b626e84ba9772c0e7c81e48a1e300421f145 /src/gui
parent80f9451b605aa2eb181d76b79bc1869a3cd9e513 (diff)
parent3927585b3c74c8ccf61b84a525947237f02ea485 (diff)
downloadQt-9d34e9d705cf2f054a668d9e6aafb2efcd500913.zip
Qt-9d34e9d705cf2f054a668d9e6aafb2efcd500913.tar.gz
Qt-9d34e9d705cf2f054a668d9e6aafb2efcd500913.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-water-team
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible_unix.cpp2
-rw-r--r--src/gui/dialogs/qfiledialog_symbian.cpp6
-rw-r--r--src/gui/dialogs/qfiledialog_win_p.h2
-rw-r--r--src/gui/egl/qegl.cpp21
-rw-r--r--src/gui/egl/qeglcontext_p.h1
-rw-r--r--src/gui/embedded/qscreen_qws.cpp1
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp34
-rw-r--r--src/gui/image/qjpeghandler.cpp5
-rw-r--r--src/gui/image/qpixmap_mac.cpp33
-rw-r--r--src/gui/image/qpnghandler.cpp23
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_p.h1
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp50
-rw-r--r--src/gui/kernel/qapplication.cpp21
-rw-r--r--src/gui/kernel/qapplication.h1
-rw-r--r--src/gui/kernel/qapplication_mac.mm5
-rw-r--r--src/gui/kernel/qapplication_qws.cpp5
-rw-r--r--src/gui/kernel/qapplication_s60.cpp23
-rw-r--r--src/gui/kernel/qapplication_win.cpp5
-rw-r--r--src/gui/kernel/qapplication_x11.cpp15
-rw-r--r--src/gui/kernel/qcursor_win.cpp1
-rw-r--r--src/gui/kernel/qdnd_x11.cpp17
-rw-r--r--src/gui/kernel/qevent.cpp3
-rw-r--r--src/gui/kernel/qsoftkeymanager.cpp18
-rw-r--r--src/gui/kernel/qsoftkeymanager_common_p.h2
-rw-r--r--src/gui/kernel/qsoftkeymanager_s60.cpp4
-rw-r--r--src/gui/kernel/qt_s60_p.h29
-rw-r--r--src/gui/kernel/qwidget.cpp10
-rw-r--r--src/gui/kernel/qwidget.h2
-rw-r--r--src/gui/kernel/qwidget_p.h3
-rw-r--r--src/gui/kernel/qwidget_s60.cpp10
-rw-r--r--src/gui/painting/qcosmeticstroker.cpp50
-rw-r--r--src/gui/painting/qcosmeticstroker_p.h10
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp8
-rw-r--r--src/gui/painting/qpaintengine_x11.cpp2
-rw-r--r--src/gui/painting/qpainter.cpp17
-rw-r--r--src/gui/painting/qtessellator.cpp2
-rw-r--r--src/gui/painting/qwindowsurface_raster.cpp21
-rw-r--r--src/gui/s60framework/s60framework.pri3
-rw-r--r--src/gui/styles/qs60style_s60.cpp14
-rw-r--r--src/gui/styles/qwindowsstyle.cpp7
-rw-r--r--src/gui/text/qfont.cpp5
-rw-r--r--src/gui/text/qfontdatabase.cpp10
-rw-r--r--src/gui/text/qfontdatabase_s60.cpp2
-rw-r--r--src/gui/text/qfontengine_coretext.mm12
-rw-r--r--src/gui/text/qfontengine_coretext_p.h6
-rw-r--r--src/gui/text/qfontengine_p.h3
-rw-r--r--src/gui/text/qfontmetrics.cpp3
-rw-r--r--src/gui/text/qglyphrun.cpp3
-rw-r--r--src/gui/text/qplatformfontdatabase_qpa.cpp28
-rw-r--r--src/gui/text/qrawfont.cpp3
-rw-r--r--src/gui/text/qrawfont_ft.cpp2
-rw-r--r--src/gui/text/qtextcontrol.cpp42
-rw-r--r--src/gui/text/qtextdocument_p.cpp1
-rw-r--r--src/gui/text/qtextengine.cpp47
-rw-r--r--src/gui/text/qtextlayout.cpp6
-rw-r--r--src/gui/text/text.pri9
-rw-r--r--src/gui/util/qdesktopservices_s60.cpp8
-rw-r--r--src/gui/widgets/qabstractplatformmenubar_p.h108
-rw-r--r--src/gui/widgets/qcombobox.cpp2
-rw-r--r--src/gui/widgets/qlinecontrol.cpp6
-rw-r--r--src/gui/widgets/qmenu_mac.mm4
-rw-r--r--src/gui/widgets/qmenu_p.h6
-rw-r--r--src/gui/widgets/qmenu_symbian.cpp4
-rw-r--r--src/gui/widgets/qmenu_wince.cpp4
-rw-r--r--src/gui/widgets/qmenubar.cpp139
-rw-r--r--src/gui/widgets/qmenubar_p.h39
-rw-r--r--src/gui/widgets/qmenubar_x11.cpp139
-rw-r--r--src/gui/widgets/qmenubar_x11_p.h87
-rw-r--r--src/gui/widgets/qtabbar.cpp2
-rw-r--r--src/gui/widgets/widgets.pri8
70 files changed, 999 insertions, 226 deletions
diff --git a/src/gui/accessible/qaccessible_unix.cpp b/src/gui/accessible/qaccessible_unix.cpp
index 19fbe78..1c1eb2a 100644
--- a/src/gui/accessible/qaccessible_unix.cpp
+++ b/src/gui/accessible/qaccessible_unix.cpp
@@ -96,7 +96,7 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
}
initialize();
- if (bridges()->isEmpty())
+ if (!bridges() || bridges()->isEmpty())
return;
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(o);
diff --git a/src/gui/dialogs/qfiledialog_symbian.cpp b/src/gui/dialogs/qfiledialog_symbian.cpp
index cd020f6..1ffbf1d 100644
--- a/src/gui/dialogs/qfiledialog_symbian.cpp
+++ b/src/gui/dialogs/qfiledialog_symbian.cpp
@@ -44,7 +44,7 @@
#ifndef QT_NO_FILEDIALOG
#include <private/qfiledialog_p.h>
-#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4)
+#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) && !defined(SYMBIAN_VERSION_9_3) && !defined(SYMBIAN_VERSION_9_2)
#include <driveinfo.h>
#include <AknCommonDialogsDynMem.h>
#include <CAknMemorySelectionDialogMultiDrive.h>
@@ -58,7 +58,7 @@ extern QStringList qt_make_filter_list(const QString &filter); // defined in qfi
extern QStringList qt_clean_filter_list(const QString &filter); // defined in qfiledialog.cpp
enum DialogMode { DialogOpen, DialogSave, DialogFolder };
-#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4)
+#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) && !defined(SYMBIAN_VERSION_9_3) && !defined(SYMBIAN_VERSION_9_2)
class CExtensionFilter : public CBase, public MAknFileFilter
{
public:
@@ -104,7 +104,7 @@ static QString launchSymbianDialog(const QString dialogCaption, const QString st
const QString filter, DialogMode dialogMode)
{
QString selection;
-#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4)
+#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) && !defined(SYMBIAN_VERSION_9_3) && !defined(SYMBIAN_VERSION_9_2)
TFileName startFolder;
if (!startDirectory.isEmpty()) {
QString dir = QDir::toNativeSeparators(QFileDialogPrivate::workingDirectory(startDirectory));
diff --git a/src/gui/dialogs/qfiledialog_win_p.h b/src/gui/dialogs/qfiledialog_win_p.h
index 1ff29d2..1408057 100644
--- a/src/gui/dialogs/qfiledialog_win_p.h
+++ b/src/gui/dialogs/qfiledialog_win_p.h
@@ -240,4 +240,4 @@ DECLARE_INTERFACE_(IFileOpenDialog, IFileDialog)
STDMETHOD(GetResults)(THIS_ IShellItemArray **ppenum) PURE;
STDMETHOD(GetSelectedItems)(THIS_ IShellItemArray **ppsai) PURE;
};
-#endif \ No newline at end of file
+#endif
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index 2f2f772..2a37d45 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -94,6 +94,7 @@ QEglContext::QEglContext()
, current(false)
, ownsContext(true)
, sharing(false)
+ , apiChanged(false)
{
QEglContextTracker::ref();
}
@@ -435,9 +436,20 @@ bool QEglContext::makeCurrent(EGLSurface surface)
return false;
}
+#ifdef Q_OS_SYMBIAN
+ apiChanged = false;
+ if (currentContext(apiType)
+ && currentContext(apiType)->ctx != eglGetCurrentContext()) {
+ // some other EGL based API active. Complete its rendering
+ eglWaitClient();
+ apiChanged = true;
+ }
+#endif
+
// If lazyDoneCurrent() was called on the surface, then we may be able
// to assume that it is still current within the thread.
- if (surface == currentSurface && currentContext(apiType) == this) {
+ if (surface == currentSurface && currentContext(apiType) == this
+ && !apiChanged) {
current = true;
return true;
}
@@ -512,6 +524,13 @@ bool QEglContext::swapBuffers(EGLSurface surface)
bool ok = eglSwapBuffers(QEgl::display(), surface);
if (!ok)
qWarning() << "QEglContext::swapBuffers():" << QEgl::errorString();
+
+#ifdef Q_OS_SYMBIAN
+ if (apiChanged) {
+ eglWaitClient();
+ apiChanged = false;
+ }
+#endif
return ok;
}
diff --git a/src/gui/egl/qeglcontext_p.h b/src/gui/egl/qeglcontext_p.h
index 6cd76b3..0cdaae7 100644
--- a/src/gui/egl/qeglcontext_p.h
+++ b/src/gui/egl/qeglcontext_p.h
@@ -104,6 +104,7 @@ private:
bool current;
bool ownsContext;
bool sharing;
+ bool apiChanged;
static QEglContext *currentContext(QEgl::API api);
static void setCurrentContext(QEgl::API api, QEglContext *context);
diff --git a/src/gui/embedded/qscreen_qws.cpp b/src/gui/embedded/qscreen_qws.cpp
index 2c10357..b17ade0 100644
--- a/src/gui/embedded/qscreen_qws.cpp
+++ b/src/gui/embedded/qscreen_qws.cpp
@@ -1545,6 +1545,7 @@ QImage::Format QScreenPrivate::preferredImageFormat() const
\value SvgalibClass QSvgalibScreen
\value ProxyClass QProxyScreen
\value GLClass QGLScreen
+ \value IntfbClass QIntfbScreen
\value CustomClass Unknown QScreen subclass
\sa classId()
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 2ac2bdf..0c218fc 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1171,24 +1171,26 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
// Update focus scope item ptr in new scope.
QGraphicsItem *newFocusScopeItem = subFocusItem ? subFocusItem : parentFocusScopeItem;
if (newFocusScopeItem && newParent) {
- if (subFocusItem) {
- // Find the subFocusItem's topmost focus scope.
- QGraphicsItem *ancestorScope = 0;
- QGraphicsItem *p = subFocusItem->d_ptr->parent;
- while (p) {
- if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope)
- ancestorScope = p;
- if (p->d_ptr->flags & QGraphicsItem::ItemIsPanel)
- break;
- p = p->d_ptr->parent;
- }
- if (ancestorScope)
- newFocusScopeItem = ancestorScope;
- }
-
QGraphicsItem *p = newParent;
while (p) {
if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) {
+ if (subFocusItem && subFocusItem != q_ptr) {
+ // Find the subFocusItem's topmost focus scope within the new parent's focusscope
+ QGraphicsItem *ancestorScope = 0;
+ QGraphicsItem *p2 = subFocusItem->d_ptr->parent;
+ while (p2 && p2 != p) {
+ if (p2->d_ptr->flags & QGraphicsItem::ItemIsFocusScope)
+ ancestorScope = p2;
+ if (p2->d_ptr->flags & QGraphicsItem::ItemIsPanel)
+ break;
+ if (p2 == q_ptr)
+ break;
+ p2 = p2->d_ptr->parent;
+ }
+ if (ancestorScope)
+ newFocusScopeItem = ancestorScope;
+ }
+
p->d_ptr->focusScopeItem = newFocusScopeItem;
newFocusScopeItem->d_ptr->focusScopeItemChange(true);
// Ensure the new item is no longer the subFocusItem. The
@@ -3297,7 +3299,7 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim
}
if (climb) {
- while (f->d_ptr->focusScopeItem && f->d_ptr->focusScopeItem->isVisible() && f->d_ptr->focusScopeItem != f)
+ while (f->d_ptr->focusScopeItem && f->d_ptr->focusScopeItem->isVisible())
f = f->d_ptr->focusScopeItem;
}
diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp
index 673a6d6..8fea456 100644
--- a/src/gui/image/qjpeghandler.cpp
+++ b/src/gui/image/qjpeghandler.cpp
@@ -74,6 +74,11 @@ extern "C" {
#endif
}
+#if defined(JPEG_TRUE) && !defined(HAVE_BOOLEAN)
+// this jpeglib.h uses JPEG_boolean
+typedef JPEG_boolean boolean;
+#endif
+
QT_BEGIN_NAMESPACE
void QT_FASTCALL convert_rgb888_to_rgb32_C(quint32 *dst, const uchar *src, int len)
diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp
index bdf1f90..47b6eef 100644
--- a/src/gui/image/qpixmap_mac.cpp
+++ b/src/gui/image/qpixmap_mac.cpp
@@ -851,7 +851,33 @@ static void qt_mac_grabDisplayRect(CGDirectDisplayID display, const QRect &displ
ptrCGLDestroyContext(glContextObj); // and destroy the context
}
+#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
// Returns a pixmap containing the screen contents at rect.
+static QPixmap qt_mac_grabScreenRect_10_6(const QRect &rect)
+{
+ const int maxDisplays = 128; // 128 displays should be enough for everyone.
+ CGDirectDisplayID displays[maxDisplays];
+ CGDisplayCount displayCount;
+ const CGRect cgRect = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height());
+ const CGDisplayErr err = CGGetDisplaysWithRect(cgRect, maxDisplays, displays, &displayCount);
+
+ if (err && displayCount == 0)
+ return QPixmap();
+ QPixmap windowPixmap(rect.size());
+ for (uint i = 0; i < displayCount; ++i) {
+ const CGRect bounds = CGDisplayBounds(displays[i]);
+ // Translate to display-local coordinates
+ QRect displayRect = rect.translated(qRound(-bounds.origin.x), qRound(-bounds.origin.y));
+ QCFType<CGImageRef> image = CGDisplayCreateImageForRect(displays[i],
+ CGRectMake(displayRect.x(), displayRect.y(), displayRect.width(), displayRect.height()));
+ QPixmap pix = QPixmap::fromMacCGImageRef(image);
+ QPainter painter(&windowPixmap);
+ painter.drawPixmap(-bounds.origin.x, -bounds.origin.y, pix);
+ }
+ return windowPixmap;
+}
+#endif
+
static QPixmap qt_mac_grabScreenRect(const QRect &rect)
{
if (!resolveOpenGLSymbols())
@@ -927,7 +953,12 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h)
QRect rect(globalCoord.x() + x, globalCoord.y() + y, w, h);
#ifdef QT_MAC_USE_COCOA
- return qt_mac_grabScreenRect(rect);
+#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
+ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6)
+ return qt_mac_grabScreenRect_10_6(rect);
+ else
+#endif
+ return qt_mac_grabScreenRect(rect);
#else
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index f7d07a5..1714442 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -58,6 +58,29 @@
#include <pngconf.h>
#endif
+#if PNG_LIBPNG_VER >= 10400 && PNG_LIBPNG_VER <= 10502 \
+ && defined(PNG_PEDANTIC_WARNINGS_SUPPORTED)
+/*
+ Versions 1.4.0 to 1.5.2 of libpng declare png_longjmp_ptr to
+ have a noreturn attribute if PNG_PEDANTIC_WARNINGS_SUPPORTED
+ is enabled, but most declarations of longjmp in the wild do
+ not add this attribute. This causes problems when the png_jmpbuf
+ macro expands to calling png_set_longjmp_fn with a mismatched
+ longjmp, as compilers such as Clang will treat this as an error.
+
+ To work around this we override the png_jmpbuf macro to cast
+ longjmp to a png_longjmp_ptr.
+*/
+# undef png_jmpbuf
+# ifdef PNG_SETJMP_SUPPORTED
+# define png_jmpbuf(png_ptr) \
+ (*png_set_longjmp_fn((png_ptr), (png_longjmp_ptr)longjmp, sizeof(jmp_buf)))
+# else
+# define png_jmpbuf(png_ptr) \
+ (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP)
+# endif
+#endif
+
#ifdef Q_OS_WINCE
#define CALLBACK_CALL_TYPE __cdecl
#else
diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h
index 9857015..8c30838 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_p.h
+++ b/src/gui/inputmethod/qcoefepinputcontext_p.h
@@ -154,6 +154,7 @@ private:
TUint m_textCapabilities;
bool m_inDestruction;
bool m_pendingInputCapabilitiesChanged;
+ bool m_pendingTransactionCancel;
int m_cursorVisibility;
int m_inlinePosition;
MFepInlineTextFormatRetriever *m_formatRetriever;
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index 5ddd53f..56338b2 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -64,6 +64,8 @@
#define QT_EAknCursorPositionChanged MAknEdStateObserver::EAknEdwinStateEvent(6)
// MAknEdStateObserver::EAknActivatePenInputRequest
#define QT_EAknActivatePenInputRequest MAknEdStateObserver::EAknEdwinStateEvent(7)
+// MAknEdStateObserver::EAknClosePenInputRequest
+#define QT_EAknClosePenInputRequest MAknEdStateObserver::EAknEdwinStateEvent(10)
// EAknEditorFlagSelectionVisible is only valid from 3.2 onwards.
// Sym^3 AVKON FEP manager expects that this flag is used for FEP-aware editors
@@ -107,6 +109,7 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent)
m_textCapabilities(TCoeInputCapabilities::EAllText),
m_inDestruction(false),
m_pendingInputCapabilitiesChanged(false),
+ m_pendingTransactionCancel(false),
m_cursorVisibility(1),
m_inlinePosition(0),
m_formatRetriever(0),
@@ -252,9 +255,6 @@ bool QCoeFepInputContext::needsInputPanel()
bool QCoeFepInputContext::filterEvent(const QEvent *event)
{
- // The CloseSoftwareInputPanel event is not handled here, because the VK will automatically
- // close when it discovers that the underlying widget does not have input capabilities.
-
if (!focusWidget())
return false;
@@ -318,6 +318,12 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event)
if (!needsInputPanel())
return false;
+ if ((event->type() == QEvent::CloseSoftwareInputPanel)
+ && (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0)) {
+ m_fepState->ReportAknEdStateEventL(QT_EAknClosePenInputRequest);
+ return false;
+ }
+
if (event->type() == QEvent::RequestSoftwareInputPanel) {
// Only request virtual keyboard if it is not yet active or if this is the first time
// panel is requested for this application.
@@ -354,10 +360,6 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event)
if (sControl) {
sControl->setIgnoreFocusChanged(false);
}
- //If m_pointerHandler has already been set, it means that fep inline editing is in progress.
- //When this is happening, do not filter out pointer events.
- if (!m_pointerHandler)
- return true;
}
}
@@ -473,7 +475,7 @@ void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget)
windowToMove->setUpdatesEnabled(false);
if (!alwaysResize) {
- if (gv->scene()) {
+ if (gv->scene() && S60->partial_keyboardAutoTranslation) {
if (gv->scene()->focusItem()) {
// Check if the widget contains cursorPositionChanged signal and disconnect from it.
QByteArray signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged()));
@@ -580,7 +582,7 @@ void QCoeFepInputContext::ensureFocusWidgetVisible(QWidget *widget)
if (!moveWithinVisibleArea) {
// Check if the widget contains cursorPositionChanged signal and connect to it.
QByteArray signal = QMetaObject::normalizedSignature(SIGNAL(cursorPositionChanged()));
- if (gv->scene() && gv->scene()->focusItem()) {
+ if (gv->scene() && gv->scene()->focusItem() && S60->partial_keyboardAutoTranslation) {
int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal.right(signal.length() - 1));
if (index != -1)
connect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget()));
@@ -1062,15 +1064,24 @@ void QCoeFepInputContext::CancelFepInlineEdit()
// We are not supposed to ever have a tempPreeditString and a real preedit string
// from S60 at the same time, so it should be safe to rely on this test to determine
// whether we should honor S60's request to clear the text or not.
- if (m_hasTempPreeditString)
+ if (m_hasTempPreeditString || m_pendingTransactionCancel)
return;
+ m_pendingTransactionCancel = true;
+
QList<QInputMethodEvent::Attribute> attributes;
QInputMethodEvent event(QLatin1String(""), attributes);
event.setCommitString(QLatin1String(""), 0, 0);
m_preeditString.clear();
m_inlinePosition = 0;
sendEvent(event);
+
+ // Sync with native side editor state. Native side can then do various operations
+ // based on editor state, such as removing 'exact word bubble'.
+ if (!m_pendingInputCapabilitiesChanged)
+ ReportAknEdStateEvent(MAknEdStateObserver::EAknSyncEdwinState);
+
+ m_pendingTransactionCancel = false;
}
TInt QCoeFepInputContext::DocumentLengthForFep() const
@@ -1080,7 +1091,18 @@ TInt QCoeFepInputContext::DocumentLengthForFep() const
return 0;
QVariant variant = w->inputMethodQuery(Qt::ImSurroundingText);
- return variant.value<QString>().size() + m_preeditString.size();
+
+ int size = variant.value<QString>().size() + m_preeditString.size();
+
+ // To fix an issue with backspaces not being generated if document size is zero,
+ // fake document length to be at least one always, except when dealing with
+ // hidden text widgets, where this faking would generate extra asterisk. Since the
+ // primary use of hidden text widgets is password fields, they are unlikely to
+ // support multiple lines anyway.
+ if (size == 0 && !(m_textCapabilities & TCoeInputCapabilities::ESecretText))
+ size = 1;
+
+ return size;
}
TInt QCoeFepInputContext::DocumentMaximumLengthForFep() const
@@ -1163,6 +1185,12 @@ void QCoeFepInputContext::GetEditorContentForFep(TDes& aEditorContent, TInt aDoc
// FEP expects the preedit string to be part of the editor content, so let's mix it in.
int cursor = w->inputMethodQuery(Qt::ImCursorPosition).toInt();
text.insert(cursor, m_preeditString);
+
+ // Add additional space to empty non-password text to compensate
+ // for the fake length we specified in DocumentLengthForFep().
+ if (text.size() == 0 && !(m_textCapabilities & TCoeInputCapabilities::ESecretText))
+ text += QChar(0x20);
+
aEditorContent.Copy(qt_QString2TPtrC(text.mid(aDocumentPosition, aLengthToRetrieve)));
}
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index cd13894..15d37c3 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -3321,7 +3321,7 @@ bool QApplication::desktopSettingsAware()
one of the above events. If no keys are being held Qt::NoModifier is
returned.
- \sa mouseButtons()
+ \sa mouseButtons(), queryKeyboardModifiers()
*/
Qt::KeyboardModifiers QApplication::keyboardModifiers()
@@ -3330,6 +3330,25 @@ Qt::KeyboardModifiers QApplication::keyboardModifiers()
}
/*!
+ \fn Qt::KeyboardModifiers QApplication::queryKeyboardModifiers()
+
+ Queries and returns the state of the modifier keys on the keyboard.
+ Unlike keyboardModifiers, this method returns the actual keys held
+ on the input device at the time of calling the method.
+
+ It does not rely on the keypress events having been received by this
+ process, which makes it possible to check the modifiers while moving
+ a window, for instance. Note that in most cases, you should use
+ keyboardModifiers(), which is faster and more accurate since it contains
+ the state of the modifiers as they were when the currently processed
+ event was received.
+
+ \sa keyboardModifiers()
+
+ \since 4.8
+*/
+
+/*!
Returns the current state of the buttons on the mouse. The current state is
updated syncronously as the event queue is emptied of events that will
spontaneously change the mouse state (QEvent::MouseButtonPress and
diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h
index 01a246a..1548849 100644
--- a/src/gui/kernel/qapplication.h
+++ b/src/gui/kernel/qapplication.h
@@ -198,6 +198,7 @@ public:
static void alert(QWidget *widget, int duration = 0);
static Qt::KeyboardModifiers keyboardModifiers();
+ static Qt::KeyboardModifiers queryKeyboardModifiers();
static Qt::MouseButtons mouseButtons();
static void setDesktopSettingsAware(bool);
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index c5ff799..1f75f09 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -1395,6 +1395,11 @@ void QApplication::restoreOverrideCursor()
}
#endif // QT_NO_CURSOR
+Qt::KeyboardModifiers QApplication::queryKeyboardModifiers()
+{
+ return qt_mac_get_modifiers(GetCurrentEventKeyModifiers());
+}
+
QWidget *QApplication::topLevelAt(const QPoint &p)
{
#ifndef QT_MAC_USE_COCOA
diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp
index 3b6a075..193dfcd 100644
--- a/src/gui/kernel/qapplication_qws.cpp
+++ b/src/gui/kernel/qapplication_qws.cpp
@@ -2699,6 +2699,11 @@ void QApplication::alert(QWidget *, int)
{
}
+Qt::KeyboardModifiers QApplication::queryKeyboardModifiers()
+{
+ return keyboardModifiers(); // TODO proper implementation
+}
+
int QApplication::qwsProcessEvent(QWSEvent* event)
{
Q_D(QApplication);
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 5ac9803..80bcdf0 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -115,6 +115,8 @@ QWidget *qt_button_down = 0; // widget got last button-down
QSymbianControl *QSymbianControl::lastFocusedControl = 0;
+static Qt::KeyboardModifiers app_keyboardModifiers = Qt::NoModifier;
+
QS60Data* qGlobalS60Data()
{
return qt_s60Data();
@@ -580,13 +582,20 @@ QPoint QSymbianControl::translatePointForFixedNativeOrientation(const TPoint &po
{
QPoint pos(pointerEventPos.iX, pointerEventPos.iY);
if (qwidget->d_func()->fixNativeOrientationCalled) {
- QSize wsize = qwidget->size();
- TSize size = Size();
+ QSize wsize = qwidget->size(); // always same as the size in the native orientation
+ TSize size = Size(); // depends on the current orientation
if (size.iWidth == wsize.height() && size.iHeight == wsize.width()) {
qreal x = pos.x();
qreal y = pos.y();
- pos.setX(size.iHeight - y);
- pos.setY(x);
+ if (S60->screenRotation == QS60Data::ScreenRotation90) {
+ // DisplayRightUp
+ pos.setX(size.iHeight - y);
+ pos.setY(x);
+ } else if (S60->screenRotation == QS60Data::ScreenRotation270) {
+ // DisplayLeftUp
+ pos.setX(y);
+ pos.setY(size.iWidth - x);
+ }
}
}
return pos;
@@ -735,6 +744,7 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent)
Qt::MouseButton button;
mapS60MouseEventTypeToQt(&type, &button, &pEvent);
Qt::KeyboardModifiers modifiers = mapToQtModifiers(pEvent.iModifiers);
+ app_keyboardModifiers = modifiers;
QPoint widgetPos = translatePointForFixedNativeOrientation(pEvent.iPosition);
TPoint controlScreenPos = PositionRelativeToScreen();
@@ -2590,6 +2600,11 @@ void QApplication::setEffectEnabled(Qt::UIEffect /* effect */, bool /* enable */
// TODO: Implement QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable)
}
+Qt::KeyboardModifiers QApplication::queryKeyboardModifiers()
+{
+ return app_keyboardModifiers;
+}
+
TUint QApplicationPrivate::resolveS60ScanCode(TInt scanCode, TUint keysym)
{
if (!scanCode)
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index c34e75f..756cb56 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -1319,6 +1319,11 @@ Qt::KeyboardModifiers qt_win_getKeyboardModifiers()
return modifiers;
}
+Qt::KeyboardModifiers QApplication::queryKeyboardModifiers()
+{
+ return qt_win_getKeyboardModifiers();
+}
+
/*****************************************************************************
Routines to find a Qt widget from a screen position
*****************************************************************************/
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 666fe85..ef8e2b8 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -3058,6 +3058,21 @@ void QApplicationPrivate::_q_alertTimeOut()
}
}
+Qt::KeyboardModifiers QApplication::queryKeyboardModifiers()
+{
+ Window root;
+ Window child;
+ int root_x, root_y, win_x, win_y;
+ uint keybstate;
+ for (int i = 0; i < ScreenCount(X11->display); ++i) {
+ if (XQueryPointer(X11->display, QX11Info::appRootWindow(i), &root, &child,
+ &root_x, &root_y, &win_x, &win_y, &keybstate))
+ return X11->translateModifiers(keybstate & 0x00ff);
+ }
+ return 0;
+
+}
+
/*****************************************************************************
Special lookup functions for windows that have been reparented recently
*****************************************************************************/
diff --git a/src/gui/kernel/qcursor_win.cpp b/src/gui/kernel/qcursor_win.cpp
index 9f0c516..cef83f5 100644
--- a/src/gui/kernel/qcursor_win.cpp
+++ b/src/gui/kernel/qcursor_win.cpp
@@ -477,6 +477,7 @@ void QCursorData::update()
QPixmap pixmap = QApplicationPrivate::instance()->getPixmapCursor(cshape);
hcurs = create32BitCursor(pixmap, hx, hy);
}
+ break;
default:
qWarning("QCursor::update: Invalid cursor shape %d", cshape);
return;
diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp
index 0c683b4..5847021 100644
--- a/src/gui/kernel/qdnd_x11.cpp
+++ b/src/gui/kernel/qdnd_x11.cpp
@@ -1112,21 +1112,6 @@ void qt_xdnd_send_leave()
waiting_for_status = false;
}
-// TODO: remove and use QApplication::currentKeyboardModifiers() in Qt 4.8.
-static Qt::KeyboardModifiers currentKeyboardModifiers()
-{
- Window root;
- Window child;
- int root_x, root_y, win_x, win_y;
- uint keybstate;
- for (int i = 0; i < ScreenCount(X11->display); ++i) {
- if (XQueryPointer(X11->display, QX11Info::appRootWindow(i), &root, &child,
- &root_x, &root_y, &win_x, &win_y, &keybstate))
- return X11->translateModifiers(keybstate & 0x00ff);
- }
- return 0;
-}
-
void QX11Data::xdndHandleDrop(QWidget *, const XEvent * xe, bool passive)
{
DEBUG("xdndHandleDrop");
@@ -1183,7 +1168,7 @@ void QX11Data::xdndHandleDrop(QWidget *, const XEvent * xe, bool passive)
// Drop coming from another app? Update keyboard modifiers.
if (!qt_xdnd_dragging) {
- QApplicationPrivate::modifier_buttons = currentKeyboardModifiers();
+ QApplicationPrivate::modifier_buttons = QApplication::queryKeyboardModifiers();
}
QDropEvent de(qt_xdnd_current_position, possible_actions, dropData,
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index de2d87e..e1df267 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -142,8 +142,7 @@ QInputEvent::~QInputEvent()
and QWidget::mouseMoveEvent() to receive mouse events in your own
widgets.
- \sa QWidget::setMouseTracking() QWidget::grabMouse()
- QCursor::pos()
+ \sa QWidget::setMouseTracking() QWidget::grabMouse() QCursor::pos()
*/
/*!
diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp
index 500bcff..9caa37e 100644
--- a/src/gui/kernel/qsoftkeymanager.cpp
+++ b/src/gui/kernel/qsoftkeymanager.cpp
@@ -102,7 +102,7 @@ QSoftKeyManager::QSoftKeyManager() :
QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *actionWidget)
{
QAction *action = new QAction(standardSoftKeyText(standardKey), actionWidget);
-#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4)
+#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) && !defined(SYMBIAN_VERSION_9_3) && !defined(SYMBIAN_VERSION_9_2)
int key = 0;
switch (standardKey) {
case OkSoftKey:
@@ -123,8 +123,10 @@ QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *act
default:
break;
};
- if (key != 0)
+ if (key != 0) {
QSoftKeyManager::instance()->d_func()->softKeyCommandActions.insert(action, key);
+ connect(action, SIGNAL(destroyed(QObject*)), QSoftKeyManager::instance(), SLOT(cleanupHash(QObject*)));
+ }
#endif
QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey;
switch (standardKey) {
@@ -157,7 +159,13 @@ QAction *QSoftKeyManager::createKeyedAction(StandardSoftKey standardKey, Qt::Key
QScopedPointer<QAction> action(createAction(standardKey, actionWidget));
connect(action.data(), SIGNAL(triggered()), QSoftKeyManager::instance(), SLOT(sendKeyEvent()));
+
+#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) && !defined(SYMBIAN_VERSION_9_3) && !defined(SYMBIAN_VERSION_9_2)
+ // Don't connect destroyed slot if is was already connected in createAction
+ if (!(QSoftKeyManager::instance()->d_func()->softKeyCommandActions.contains(action.data())))
+#endif
connect(action.data(), SIGNAL(destroyed(QObject*)), QSoftKeyManager::instance(), SLOT(cleanupHash(QObject*)));
+
QSoftKeyManager::instance()->d_func()->keyedActions.insert(action.data(), key);
return action.take();
#endif //QT_NO_ACTION
@@ -166,9 +174,11 @@ QAction *QSoftKeyManager::createKeyedAction(StandardSoftKey standardKey, Qt::Key
void QSoftKeyManager::cleanupHash(QObject *obj)
{
Q_D(QSoftKeyManager);
- QAction *action = qobject_cast<QAction*>(obj);
+ // Can't use qobject_cast in destroyed() signal handler as that'll return NULL,
+ // so use static_cast instead. Since the pointer is only used as a hash key, it is safe.
+ QAction *action = static_cast<QAction *>(obj);
d->keyedActions.remove(action);
-#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4)
+#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) && !defined(SYMBIAN_VERSION_9_3) && !defined(SYMBIAN_VERSION_9_2)
d->softKeyCommandActions.remove(action);
#endif
}
diff --git a/src/gui/kernel/qsoftkeymanager_common_p.h b/src/gui/kernel/qsoftkeymanager_common_p.h
index e9cbd7d..9a11eec 100644
--- a/src/gui/kernel/qsoftkeymanager_common_p.h
+++ b/src/gui/kernel/qsoftkeymanager_common_p.h
@@ -72,7 +72,7 @@ protected:
QMultiHash<int, QAction*> requestedSoftKeyActions;
QWidget *initialSoftKeySource;
bool pendingUpdate;
-#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4)
+#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) && !defined(SYMBIAN_VERSION_9_3) && !defined(SYMBIAN_VERSION_9_2)
QHash<QAction*, int> softKeyCommandActions;
#endif
};
diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp
index b5d0101..999fccc 100644
--- a/src/gui/kernel/qsoftkeymanager_s60.cpp
+++ b/src/gui/kernel/qsoftkeymanager_s60.cpp
@@ -117,7 +117,7 @@ void QSoftKeyManagerPrivateS60::ensureCbaVisibilityAndResponsiviness(CEikButtonG
void QSoftKeyManagerPrivateS60::clearSoftkeys(CEikButtonGroupContainer &cba)
{
-#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4)
+#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) && !defined(SYMBIAN_VERSION_9_3) && !defined(SYMBIAN_VERSION_9_2)
QT_TRAP_THROWING(
//EAknSoftkeyEmpty is used, because using -1 adds softkeys without actions on Symbian3
cba.SetCommandL(0, EAknSoftkeyEmpty, KNullDesC);
@@ -317,7 +317,7 @@ bool QSoftKeyManagerPrivateS60::setSoftkey(CEikButtonGroupContainer &cba,
QString text = softkeyText(*action);
TPtrC nativeText = qt_QString2TPtrC(text);
int command = S60_COMMAND_START + position;
-#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4)
+#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) && !defined(SYMBIAN_VERSION_9_3) && !defined(SYMBIAN_VERSION_9_2)
if (softKeyCommandActions.contains(action))
command = softKeyCommandActions.value(action);
#endif
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index c429b04..96b8141 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -77,8 +77,9 @@
#include <akncontext.h> // CAknContextPane
#include <eikspane.h> // CEikStatusPane
#include <AknPopupFader.h> // MAknFadedComponent and TAknPopupFader
-#include <gfxtranseffect/gfxtranseffect.h> // BeginFullScreen
+#include <bitstd.h> // EGraphicsOrientation constants
#ifdef QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H
+#include <gfxtranseffect/gfxtranseffect.h> // BeginFullScreen
#include <akntranseffect.h> // BeginFullScreen
#endif
#endif
@@ -213,6 +214,14 @@ public:
int nativeScreenWidthInPixels;
int nativeScreenHeightInPixels;
+ enum ScreenRotation {
+ ScreenRotation0, // portrait (or the native orientation)
+ ScreenRotation90, // typically DisplayLeftUp landscape
+ ScreenRotation180, // not used
+ ScreenRotation270 // DisplayRightUp landscape when 3-way orientation is supported
+ };
+ ScreenRotation screenRotation;
+
int beginFullScreenCalled : 1;
int endFullScreenCalled : 1;
};
@@ -384,6 +393,24 @@ inline void QS60Data::updateScreenSize()
inches = S60->screenWidthInTwips / (TReal)KTwipsPerInch;
S60->defaultDpiX = S60->screenWidthInPixels / inches;
+ switch (params.iRotation) {
+ case CFbsBitGc::EGraphicsOrientationNormal:
+ S60->screenRotation = ScreenRotation0;
+ break;
+ case CFbsBitGc::EGraphicsOrientationRotated90:
+ S60->screenRotation = ScreenRotation90;
+ break;
+ case CFbsBitGc::EGraphicsOrientationRotated180:
+ S60->screenRotation = ScreenRotation180;
+ break;
+ case CFbsBitGc::EGraphicsOrientationRotated270:
+ S60->screenRotation = ScreenRotation270;
+ break;
+ default:
+ S60->screenRotation = ScreenRotation0;
+ break;
+ }
+
int screens = S60->screenCount();
for (int i = 0; i < screens; ++i) {
CWsScreenDevice *dev = S60->screenDevice(i);
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index ad8fbb7..0aa1dfa 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -345,6 +345,10 @@ QWidgetPrivate::QWidgetPrivate(int version)
QWidgetPrivate::~QWidgetPrivate()
{
+#ifdef Q_OS_SYMBIAN
+ _q_cleanupWinIds();
+#endif
+
if (widgetItem)
widgetItem->wid = 0;
@@ -12668,9 +12672,11 @@ void QWidget::clearMask()
*/
#ifdef Q_OS_SYMBIAN
-void QWidgetPrivate::_q_delayedDestroy(WId winId)
+void QWidgetPrivate::_q_cleanupWinIds()
{
- delete winId;
+ foreach (WId wid, widCleanupList)
+ delete wid;
+ widCleanupList.clear();
}
#endif
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index 1a9987d..8306ed4 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -806,7 +806,7 @@ private:
Q_DISABLE_COPY(QWidget)
Q_PRIVATE_SLOT(d_func(), void _q_showIfNotHidden())
#ifdef Q_OS_SYMBIAN
- Q_PRIVATE_SLOT(d_func(), void _q_delayedDestroy(WId winId))
+ Q_PRIVATE_SLOT(d_func(), void void _q_cleanupWinIds())
#endif
QWidgetData *data;
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index ad65274..aefffb6 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -419,7 +419,7 @@ public:
#ifdef Q_OS_SYMBIAN
void setSoftKeys_sys(const QList<QAction*> &softkeys);
void activateSymbianWindow(WId wid = 0);
- void _q_delayedDestroy(WId winId);
+ void _q_cleanupWinIds();
#endif
void raise_sys();
@@ -914,6 +914,7 @@ public:
void s60UpdateIsOpaque();
void reparentChildren();
void registerTouchWindow();
+ QList<WId> widCleanupList;
#endif
};
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index d6aaa3f..2b51aaa 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -58,9 +58,7 @@
#endif
// This is necessary in order to be able to perform delayed invocation on slots
-// which take arguments of type WId. One example is
-// QWidgetPrivate::_q_delayedDestroy, which is used to delay destruction of
-// CCoeControl objects until after the CONE event handler has finished running.
+// which take arguments of type WId.
Q_DECLARE_METATYPE(WId)
// Workaround for the fact that S60 SDKs 3.x do not contain the akntoolbar.h
@@ -238,7 +236,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
bool checkExtra = true;
if (q->isWindow() && (data.window_state & (Qt::WindowFullScreen | Qt::WindowMaximized))) {
// Do not allow fullscreen/maximized windows to expand beyond client rect
- TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ TRect r = S60->clientRect();
w = qMin(w, r.Width());
h = qMin(h, r.Height());
@@ -491,8 +489,8 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
// Delay deletion of the control in case this function is called in the
// context of a CONE event handler such as
// CCoeControl::ProcessPointerEventL
- QMetaObject::invokeMethod(q, "_q_delayedDestroy",
- Qt::QueuedConnection, Q_ARG(WId, destroyw));
+ widCleanupList << destroyw;
+ QMetaObject::invokeMethod(q, "_q_cleanupWinIds", Qt::QueuedConnection);
}
if (q->testAttribute(Qt::WA_AcceptTouchEvents))
diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp
index dbe957e..3528e6f 100644
--- a/src/gui/painting/qcosmeticstroker.cpp
+++ b/src/gui/painting/qcosmeticstroker.cpp
@@ -425,13 +425,12 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal
swapped = true;
qSwap(y1, y2);
qSwap(x1, x2);
- --x1; --x2; --y1; --y2;
}
int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1);
int x = x1 << 10;
- int y = (y1+32) >> 6;
- int ys = (y2+32) >> 6;
+ int y = y1 >> 6;
+ int ys = y2 >> 6;
if (y != ys) {
x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6;
@@ -457,13 +456,12 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal
swapped = true;
qSwap(x1, x2);
qSwap(y1, y2);
- --x1; --x2; --y1; --y2;
}
int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1);
int y = y1 << 10;
- int x = (x1+32) >> 6;
- int xs = (x2+32) >> 6;
+ int x = x1 >> 6;
+ int xs = x2 >> 6;
if (x != xs) {
y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6;
@@ -716,10 +714,11 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
QCosmeticStroker::Point last = stroker->lastPixel;
-// qDebug() << "stroke" << x1/64. << y1/64. << x2/64. << y2/64. << capString(caps);
+// qDebug() << "stroke" << x1/64. << y1/64. << x2/64. << y2/64.;
if (dx < dy) {
// vertical
+ QCosmeticStroker::Direction dir = QCosmeticStroker::TopToBottom;
bool swapped = false;
if (y1 > y2) {
@@ -727,30 +726,31 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
qSwap(y1, y2);
qSwap(x1, x2);
caps = swapCaps(caps);
- --x1; --x2; --y1; --y2;
+ dir = QCosmeticStroker::BottomToTop;
}
int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1);
int x = x1 << 10;
+ if ((stroker->lastDir ^ QCosmeticStroker::VerticalMask) == dir)
+ caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin;
+
capAdjust(caps, y1, y2, x, xinc);
- int y = (y1+32) >> 6;
- int ys = (y2+32) >> 6;
+ int y = y1 >> 6;
+ int ys = y2 >> 6;
if (y != ys) {
x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6;
// calculate first and last pixel and perform dropout control
- QCosmeticStroker::Direction dir = QCosmeticStroker::TopToBottom;
QCosmeticStroker::Point first;
first.x = x >> 16;
first.y = y;
last.x = (x + (ys - y - 1)*xinc) >> 16;
last.y = ys - 1;
- if (swapped) {
+ if (swapped)
qSwap(first, last);
- dir = QCosmeticStroker::BottomToTop;
- }
+
bool axisAligned = qAbs(xinc) < (1 << 14);
if (stroker->lastPixel.x >= 0) {
if (first.x == stroker->lastPixel.x &&
@@ -765,7 +765,7 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
} else if (stroker->lastDir != dir &&
(((axisAligned && stroker->lastAxisAligned) &&
stroker->lastPixel.x != first.x && stroker->lastPixel.y != first.y) ||
- (qAbs(stroker->lastPixel.x - first.x) > 1 &&
+ (qAbs(stroker->lastPixel.x - first.x) > 1 ||
qAbs(stroker->lastPixel.y - first.y) > 1))) {
// have a missing pixel, insert it
if (swapped) {
@@ -793,37 +793,39 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
if (!dx)
return;
+ QCosmeticStroker::Direction dir = QCosmeticStroker::LeftToRight;
+
bool swapped = false;
if (x1 > x2) {
swapped = true;
qSwap(x1, x2);
qSwap(y1, y2);
caps = swapCaps(caps);
- --x1; --x2; --y1; --y2;
+ dir = QCosmeticStroker::RightToLeft;
}
int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1);
int y = y1 << 10;
- capAdjust(caps, x1, x2, y, yinc);
+ if ((stroker->lastDir ^ QCosmeticStroker::HorizontalMask) == dir)
+ caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin;
- int x = (x1+32) >> 6;
- int xs = (x2+32) >> 6;
+ capAdjust(caps, x1, x2, y, yinc);
+ int x = x1 >> 6;
+ int xs = x2 >> 6;
if (x != xs) {
y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6;
// calculate first and last pixel to perform dropout control
- QCosmeticStroker::Direction dir = QCosmeticStroker::LeftToRight;
QCosmeticStroker::Point first;
first.x = x;
first.y = y >> 16;
last.x = xs - 1;
last.y = (y + (xs - x - 1)*yinc) >> 16;
- if (swapped) {
+ if (swapped)
qSwap(first, last);
- dir = QCosmeticStroker::RightToLeft;
- }
+
bool axisAligned = qAbs(yinc) < (1 << 14);
if (stroker->lastPixel.x >= 0) {
if (first.x == stroker->lastPixel.x && first.y == stroker->lastPixel.y) {
@@ -837,7 +839,7 @@ static void drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
} else if (stroker->lastDir != dir &&
(((axisAligned && stroker->lastAxisAligned) &&
stroker->lastPixel.x != first.x && stroker->lastPixel.y != first.y) ||
- (qAbs(stroker->lastPixel.x - first.x) > 1 &&
+ (qAbs(stroker->lastPixel.x - first.x) > 1 ||
qAbs(stroker->lastPixel.y - first.y) > 1))) {
// have a missing pixel, insert it
if (swapped) {
diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h
index d7bd79a..53cdf2c 100644
--- a/src/gui/painting/qcosmeticstroker_p.h
+++ b/src/gui/painting/qcosmeticstroker_p.h
@@ -78,10 +78,12 @@ public:
// used to avoid drop outs or duplicated points
enum Direction {
- TopToBottom,
- BottomToTop,
- LeftToRight,
- RightToLeft
+ TopToBottom = 0x1,
+ BottomToTop = 0x2,
+ LeftToRight = 0x4,
+ RightToLeft = 0x8,
+ VerticalMask = 0x3,
+ HorizontalMask = 0xc
};
QCosmeticStroker(QRasterPaintEngineState *s, const QRect &dr)
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 76d7316..36786c4 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3098,7 +3098,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
ensurePen();
ensureState();
-#if defined (Q_WS_WIN) || defined(Q_WS_MAC)
+#if defined (Q_WS_WIN) || defined(Q_WS_MAC) || (defined(Q_OS_MAC) && defined(Q_WS_QPA))
if (!supportsTransformations(ti.fontEngine)) {
QVarLengthArray<QFixedPoint> positions;
@@ -3438,7 +3438,7 @@ bool QRasterPaintEngine::supportsTransformations(const QFontEngine *fontEngine)
bool QRasterPaintEngine::supportsTransformations(qreal pixelSize, const QTransform &m) const
{
-#if defined(Q_WS_MAC)
+#if defined(Q_WS_MAC) || (defined(Q_OS_MAC) && defined(Q_WS_QPA))
// Mac font engines don't support scaling and rotation
if (m.type() > QTransform::TxTranslate)
#else
@@ -3552,7 +3552,7 @@ void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QImage &image, QSp
spans[n].y = y;
spans[n].coverage = 255;
int len = 1;
- while (src_x < w-1 && src[(src_x+1) >> 3] & (0x1 << ((src_x+1) & 7))) {
+ while (src_x+1 < w && src[(src_x+1) >> 3] & (0x1 << ((src_x+1) & 7))) {
++src_x;
++len;
}
@@ -3578,7 +3578,7 @@ void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QImage &image, QSp
spans[n].y = y;
spans[n].coverage = 255;
int len = 1;
- while (src_x < w-1 && src[(src_x+1) >> 3] & (0x80 >> ((src_x+1) & 7))) {
+ while (src_x+1 < w && src[(src_x+1) >> 3] & (0x80 >> ((src_x+1) & 7))) {
++src_x;
++len;
}
diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp
index 147d2ec..17d141c 100644
--- a/src/gui/painting/qpaintengine_x11.cpp
+++ b/src/gui/painting/qpaintengine_x11.cpp
@@ -2333,7 +2333,7 @@ static QPainterPath path_for_glyphs(const QVarLengthArray<glyph_t> &glyphs,
bool set = src[x >> 3] & (0x80 >> (x & 7));
if (set) {
QRect r(xp + x, yp - h, 1, 1);
- while (x < glyph->width-1 && src[(x+1) >> 3] & (0x80 >> ((x+1) & 7))) {
+ while (x+1 < glyph->width && src[(x+1) >> 3] & (0x80 >> ((x+1) & 7))) {
++x;
r.setRight(r.right()+1);
}
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 8e64f3b..efb016e 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5792,16 +5792,19 @@ void QPainter::drawImage(const QRectF &targetRect, const QImage &image, const QR
d->engine->drawImage(QRectF(x, y, w, h), image, QRectF(sx, sy, sw, sh), flags);
}
+#if !defined(QT_NO_RAWFONT)
/*!
- Draws the glyphs represented by \a glyphs at \a position. The \a position gives the
- edge of the baseline for the string of glyphs. The glyphs will be retrieved from the font
- selected on \a glyphs and at offsets given by the positions in \a glyphs.
+ \fn void QPainter::drawGlyphRun(const QPointF &position, const QGlyphRun &glyphs)
+
+ Draws the specified \a glyphs at the given \a position.
+ The \a position gives the edge of the baseline for the string of glyphs.
+ The glyphs will be retrieved from the font selected by \a glyphs and at
+ offsets given by the positions in \a glyphs.
\since 4.8
\sa QGlyphRun::setRawFont(), QGlyphRun::setPositions(), QGlyphRun::setGlyphIndexes()
*/
-#if !defined(QT_NO_RAWFONT)
void QPainter::drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun)
{
Q_D(QPainter);
@@ -9251,9 +9254,9 @@ void QPainter::drawPixmapFragments(const PixmapFragment *fragments, int fragment
\since 4.8
This function is used to draw the same \a pixmap with multiple target
- and source rectangles. If \a sourceRects is 0, the whole pixmap will be
- rendered at each of the target rectangles. The \a hints parameter can be
- used to pass in drawing hints.
+ and source rectangles specified by \a targetRects. If \a sourceRects is 0,
+ the whole pixmap will be rendered at each of the target rectangles.
+ The \a hints parameter can be used to pass in drawing hints.
This function is potentially faster than multiple calls to drawPixmap(),
since the backend can optimize state changes.
diff --git a/src/gui/painting/qtessellator.cpp b/src/gui/painting/qtessellator.cpp
index c469438..94a5128 100644
--- a/src/gui/painting/qtessellator.cpp
+++ b/src/gui/painting/qtessellator.cpp
@@ -893,7 +893,7 @@ void QTessellatorPrivate::processIntersections()
QDEBUG() << " adding edge on left";
--min;
}
- while (max < scanline.size - 1 && scanline.edges[max + 1]->positionAt(y) <= xmax) {
+ while (max + 1 < scanline.size && scanline.edges[max + 1]->positionAt(y) <= xmax) {
QDEBUG() << " adding edge on right";
++max;
}
diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp
index d972384..15ff044 100644
--- a/src/gui/painting/qwindowsurface_raster.cpp
+++ b/src/gui/painting/qwindowsurface_raster.cpp
@@ -229,7 +229,6 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
QRegion wrgn(rgn);
if (!wOffset.isNull())
wrgn.translate(-wOffset);
- QRect wbr = wrgn.boundingRect();
if (wrgn.rectCount() != 1) {
int num;
@@ -237,23 +236,25 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
XSetClipRectangles(X11->display, d_ptr->gc, 0, 0, rects, num, YXBanded);
}
- QRect br = rgn.boundingRect().translated(offset);
+ QPoint widgetOffset = offset + wOffset;
+ QRect clipRect = widget->rect().translated(widgetOffset).intersected(d_ptr->image->image.rect());
+
+ QRect br = rgn.boundingRect().translated(offset).intersected(clipRect);
+ QPoint wpos = br.topLeft() - widgetOffset;
+
#ifndef QT_NO_MITSHM
if (d_ptr->image->xshmpm) {
XCopyArea(X11->display, d_ptr->image->xshmpm, widget->handle(), d_ptr->gc,
- br.x(), br.y(), br.width(), br.height(), wbr.x(), wbr.y());
+ br.x(), br.y(), br.width(), br.height(), wpos.x(), wpos.y());
d_ptr->needsSync = true;
} else if (d_ptr->image->xshmimg) {
- const QImage &src = d->image->image;
- br = br.intersected(src.rect());
XShmPutImage(X11->display, widget->handle(), d_ptr->gc, d_ptr->image->xshmimg,
- br.x(), br.y(), wbr.x(), wbr.y(), br.width(), br.height(), False);
+ br.x(), br.y(), wpos.x(), wpos.y(), br.width(), br.height(), False);
d_ptr->needsSync = true;
} else
#endif
{
const QImage &src = d->image->image;
- br = br.intersected(src.rect());
if (src.format() != QImage::Format_RGB32 || widget->x11Info().depth() < 24) {
Q_ASSERT(src.depth() >= 16);
const QImage sub_src(src.scanLine(br.y()) + br.x() * (uint(src.depth()) / 8),
@@ -262,11 +263,11 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
data->xinfo = widget->x11Info();
data->fromImage(sub_src, Qt::NoOpaqueDetection);
QPixmap pm = QPixmap(data);
- XCopyArea(X11->display, pm.handle(), widget->handle(), d_ptr->gc, 0 , 0 , br.width(), br.height(), wbr.x(), wbr.y());
+ XCopyArea(X11->display, pm.handle(), widget->handle(), d_ptr->gc, 0 , 0 , br.width(), br.height(), wpos.x(), wpos.y());
} else {
// qpaintengine_x11.cpp
extern void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const QImage &image, Drawable hd, GC gc, Display *dpy, Visual *visual, int depth);
- qt_x11_drawImage(br, wbr.topLeft(), src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), widget->x11Info().depth());
+ qt_x11_drawImage(br, wpos, src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), widget->x11Info().depth());
}
}
@@ -311,7 +312,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
}
CGContextClip(context);
- QRect r = rgn.boundingRect();
+ QRect r = rgn.boundingRect().intersected(d->image->image.rect());
const CGRect area = CGRectMake(r.x(), r.y(), r.width(), r.height());
CGImageRef image = CGBitmapContextCreateImage(d->image->cg);
CGImageRef subImage = CGImageCreateWithImageInRect(image, area);
diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri
index e30d2c0..4e94c21 100644
--- a/src/gui/s60framework/s60framework.pri
+++ b/src/gui/s60framework/s60framework.pri
@@ -2,8 +2,7 @@ SOURCES += s60framework/qs60mainapplication.cpp \
s60framework/qs60mainappui.cpp \
s60framework/qs60maindocument.cpp \
s60framework/qs60keycapture.cpp
-HEADERS += qs60keycapture_p.h \
- s60framework/qs60mainapplication_p.h \
+HEADERS += s60framework/qs60mainapplication_p.h \
s60framework/qs60mainapplication.h \
s60framework/qs60mainappui.h \
s60framework/qs60maindocument.h \
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index 913352a..33619d6 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -91,6 +91,7 @@ enum TSupportRelease {
ES60_5_1 = 0x0008,
ES60_5_2 = 0x0010,
ES60_5_3 = 0x0020,
+ ES60_5_4 = 0x0040,
ES60_3_X = ES60_3_1 | ES60_3_2,
// Releases before Symbian Foundation
ES60_PreSF = ES60_3_1 | ES60_3_2 | ES60_5_0,
@@ -98,8 +99,10 @@ enum TSupportRelease {
ES60_Pre52 = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1,
// Releases before S60 5.3
ES60_Pre53 = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2,
+ // Releases before S60 5.4
+ ES60_Pre54 = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 | ES60_5_3,
// Add all new releases here
- ES60_All = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 | ES60_5_3
+ ES60_All = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 | ES60_5_3 | ES60_5_4
};
typedef struct {
@@ -707,7 +710,7 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX(
colorIndex,
icon,
iconMask,
- AknIconUtils::AvkonIconFileName(),
+ (fallbackGraphicID != KErrNotFound ? AknIconUtils::AvkonIconFileName() : KNullDesC),
fallbackGraphicID,
fallbackGraphicsMaskID,
defaultColor);
@@ -922,7 +925,7 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(
skinId,
icon,
iconMask,
- AknIconUtils::AvkonIconFileName(),
+ (fallbackGraphicID != KErrNotFound ? AknIconUtils::AvkonIconFileName() : KNullDesC),
fallbackGraphicID ,
fallbackGraphicsMaskID);
@@ -1016,7 +1019,7 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(
KAknsIIDDefault, //animation is not themed, lets force fallback graphics
animationFrame,
frameMask,
- AknIconUtils::AvkonIconFileName(),
+ (fallbackGraphicID != KErrNotFound ? AknIconUtils::AvkonIconFileName() : KNullDesC),
fallbackGraphicID ,
fallbackGraphicsMaskID);
}
@@ -1228,7 +1231,8 @@ bool QS60StyleModeSpecifics::checkSupport(const int supportedRelease)
(currentRelease == QSysInfo::SV_S60_5_0 && supportedRelease & ES60_5_0) ||
(currentRelease == QSysInfo::SV_S60_5_1 && supportedRelease & ES60_5_1) ||
(currentRelease == QSysInfo::SV_S60_5_2 && supportedRelease & ES60_5_2) ||
- (currentRelease == QSysInfo::SV_S60_5_3 && supportedRelease & ES60_5_3) );
+ (currentRelease == QSysInfo::SV_S60_5_3 && supportedRelease & ES60_5_3) ||
+ (currentRelease == QSysInfo::SV_S60_5_4 && supportedRelease & ES60_5_4) );
}
TAknsItemID QS60StyleModeSpecifics::partSpecificThemeId(int part)
diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp
index c099273..9732c7e 100644
--- a/src/gui/styles/qwindowsstyle.cpp
+++ b/src/gui/styles/qwindowsstyle.cpp
@@ -177,11 +177,14 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e)
// Alt has been pressed - find all widgets that care
QList<QWidget *> l = widget->findChildren<QWidget *>();
- for (int pos=0 ; pos < l.size() ; ++pos) {
+ for (int pos=0 ; pos < l.size() ;) {
QWidget *w = l.at(pos);
if (w->isWindow() || !w->isVisible() ||
- w->style()->styleHint(SH_UnderlineShortcut, 0, w))
+ w->style()->styleHint(SH_UnderlineShortcut, 0, w)) {
l.removeAt(pos);
+ continue;
+ }
+ pos++;
}
// Update states before repainting
d->seenAlt.append(widget);
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 2d6af3b..2df88e2 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -919,8 +919,9 @@ QString QFont::styleName() const
/*!
\since 4.8
- Sets the style name of the font. When set, other style properties
- like \a style() and \a weight() will be ignored for font matching.
+ Sets the style name of the font to the given \a styleName.
+ When set, other style properties like style() and weight() will be ignored
+ for font matching.
\sa styleName()
*/
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 79503f9..1d463c4 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -1943,8 +1943,9 @@ bool QFontDatabase::isScalable(const QString &family,
/*!
- Returns a list of the point sizes available for the font that has
- family \a family and style \a style. The list may be empty.
+ \fn QList<int> QFontDatabase::pointSizes(const QString &family, const QString &style)
+ Returns a list of the point sizes available for the font with the
+ given \a family and \a style. The list may be empty.
\sa smoothSizes(), standardSizes()
*/
@@ -2052,8 +2053,9 @@ QFont QFontDatabase::font(const QString &family, const QString &style,
/*!
- Returns the point sizes of a font that has family \a family and
- style \a style that will look attractive. The list may be empty.
+ \fn QList<int> QFontDatabase::smoothSizes(const QString &family, const QString &style)
+ Returns the point sizes of a font with the given \a family and \a style
+ that will look attractive. The list may be empty.
For non-scalable fonts and bitmap scalable fonts, this function
is equivalent to pointSizes().
diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp
index cf96733..ffa4e59 100644
--- a/src/gui/text/qfontdatabase_s60.cpp
+++ b/src/gui/text/qfontdatabase_s60.cpp
@@ -58,7 +58,7 @@
#endif // SYMBIAN_ENABLE_SPLIT_HEADERS
#endif // QT_NO_FREETYPE
-#ifndef SYMBIAN_VERSION_9_4
+#if !defined(SYMBIAN_VERSION_9_4) && !defined(SYMBIAN_VERSION_9_3) && !defined(SYMBIAN_VERSION_9_2)
#define SYMBIAN_LINKEDFONTS_SUPPORTED
#endif // !SYMBIAN_VERSION_9_4
diff --git a/src/gui/text/qfontengine_coretext.mm b/src/gui/text/qfontengine_coretext.mm
index 64d4a24..153451e 100644
--- a/src/gui/text/qfontengine_coretext.mm
+++ b/src/gui/text/qfontengine_coretext.mm
@@ -135,7 +135,7 @@ void QCoreTextFontEngineMulti::init(bool kerning)
attributeDict = CFDictionaryCreateMutable(0, 2,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
- CFDictionaryAddValue(attributeDict, NSFontAttributeName, ctfont);
+ CFDictionaryAddValue(attributeDict, kCTFontAttributeName, ctfont);
if (!kerning) {
float zero = 0.0;
QCFType<CFNumberRef> noKern = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &zero);
@@ -257,7 +257,7 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay
//NSLog(@"Dictionary %@", runAttribs);
if (!runAttribs)
runAttribs = attributeDict;
- CTFontRef runFont = static_cast<CTFontRef>(CFDictionaryGetValue(runAttribs, NSFontAttributeName));
+ CTFontRef runFont = static_cast<CTFontRef>(CFDictionaryGetValue(runAttribs, kCTFontAttributeName));
uint fontIndex = fontIndexForFont(runFont);
const QFontEngine *engine = engineAt(fontIndex);
fontIndex <<= 24;
@@ -547,7 +547,6 @@ glyph_metrics_t QCoreTextFontEngine::boundingBox(glyph_t glyph)
ret.xoff = ret.xoff.round();
ret.yoff = ret.yoff.round();
}
-
return ret;
}
@@ -723,7 +722,12 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
QImage im(qRound(br.width) + 2, qRound(br.height) + 2, QImage::Format_RGB32);
im.fill(0);
- CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
+ CGColorSpaceRef colorspace =
+#ifdef Q_WS_MAC
+ CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
+#else
+ CGColorSpaceCreateDeviceRGB();
+#endif
uint cgflags = kCGImageAlphaNoneSkipFirst;
#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
cgflags |= kCGBitmapByteOrder32Host;
diff --git a/src/gui/text/qfontengine_coretext_p.h b/src/gui/text/qfontengine_coretext_p.h
index efe8295..0a2ae1f 100644
--- a/src/gui/text/qfontengine_coretext_p.h
+++ b/src/gui/text/qfontengine_coretext_p.h
@@ -44,6 +44,12 @@
#include <private/qfontengine_p.h>
+#ifdef QT_NO_CORESERVICES
+#include <CoreText/CoreText.h>
+#include <CoreGraphics/CoreGraphics.h>
+#include <private/qcore_mac_p.h>
+#endif
+
#if !defined(Q_WS_MAC) || (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
class QRawFontPrivate;
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index a70aec1..8d81acb 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -155,6 +155,7 @@ public:
struct FaceId {
FaceId() : index(0), encoding(0) {}
QByteArray filename;
+ QByteArray uuid;
int index;
int encoding;
};
@@ -295,7 +296,7 @@ inline bool operator ==(const QFontEngine::FaceId &f1, const QFontEngine::FaceId
inline uint qHash(const QFontEngine::FaceId &f)
{
- return qHash((f.index << 16) + f.encoding) + qHash(f.filename);
+ return qHash((f.index << 16) + f.encoding) + qHash(f.filename + f.uuid);
}
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index f3d4107..1d93d54 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -442,9 +442,10 @@ bool QFontMetrics::inFont(QChar ch) const
}
/*!
+ \fn bool QFontMetrics::inFontUcs4(uint character) const
\since 4.8
- Returns true if the character encoded in UCS-4/UTF-32 is a valid
+ Returns true if the given \a character encoded in UCS-4/UTF-32 is a valid
character in the font; otherwise returns false.
*/
bool QFontMetrics::inFontUcs4(uint ucs4) const
diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp
index 2865d91..442f7cc 100644
--- a/src/gui/text/qglyphrun.cpp
+++ b/src/gui/text/qglyphrun.cpp
@@ -175,7 +175,8 @@ QRawFont QGlyphRun::rawFont() const
}
/*!
- Sets the font in which to look up the glyph indexes to \a font.
+ Sets the font specified by \a rawFont to be the font used to look up the
+ glyph indexes.
\sa rawFont(), setGlyphIndexes()
*/
diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp
index d1d1f94..e3eeca5 100644
--- a/src/gui/text/qplatformfontdatabase_qpa.cpp
+++ b/src/gui/text/qplatformfontdatabase_qpa.cpp
@@ -160,6 +160,9 @@ QSupportedWritingSystems::QSupportedWritingSystems(const QSupportedWritingSystem
d->ref.ref();
}
+/*!
+ Assigns the \a other supported writing systems object to this object.
+*/
QSupportedWritingSystems &QSupportedWritingSystems::operator=(const QSupportedWritingSystems &other)
{
if (d != other.d) {
@@ -171,6 +174,9 @@ QSupportedWritingSystems &QSupportedWritingSystems::operator=(const QSupportedWr
return *this;
}
+/*!
+ Destroys the object.
+*/
QSupportedWritingSystems::~QSupportedWritingSystems()
{
if (!d->ref.deref())
@@ -187,12 +193,26 @@ void QSupportedWritingSystems::detach()
}
}
+/*!
+ Sets the supported state of the writing system given by \a writingSystem to
+ the value specified by \a support. A value of true indicates that the
+ writing system is supported; a value of false indicates that it is
+ unsupported.
+
+ \sa supported()
+*/
void QSupportedWritingSystems::setSupported(QFontDatabase::WritingSystem writingSystem, bool support)
{
detach();
d->vector[writingSystem] = support;
}
+/*!
+ Returns true if the writing system given by \a writingSystem is supported;
+ otherwise returns false.
+
+ \sa setSupported()
+*/
bool QSupportedWritingSystems::supported(QFontDatabase::WritingSystem writingSystem) const
{
return d->vector.at(writingSystem);
@@ -295,7 +315,7 @@ QStringList QPlatformFontDatabase::addApplicationFont(const QByteArray &fontData
}
/*!
-
+ Releases the font handle and deletes any associated data loaded from a file.
*/
void QPlatformFontDatabase::releaseHandle(void *handle)
{
@@ -304,7 +324,13 @@ void QPlatformFontDatabase::releaseHandle(void *handle)
}
/*!
+ Returns the path to the font directory.
+
+ The font directory is stored in the general Qt settings unless it has been
+ overridden by the \c QT_QPA_FONTDIR environment variable.
+ When using builds of Qt that do not support settings, the \c QT_QPA_FONTDIR
+ environment variable is the only way to specify the font directory.
*/
QString QPlatformFontDatabase::fontDir() const
{
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index e3e5c57..60a6cb3 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -485,7 +485,8 @@ QVector<quint32> QRawFont::glyphIndexesForString(const QString &text) const
must be at least \a numChars, if that's still not enough, this function will return
false, then you can resize \a glyphIndexes from the size returned in \a numGlyphs.
- \sa glyphIndexesForString(), advancesForGlyphIndexes(), QGlyphs, QTextLayout::glyphs(), QTextFragment::glyphs()
+ \sa glyphIndexesForString(), advancesForGlyphIndexes(), QGlyphRun,
+ QTextLayout::glyphRuns(), QTextFragment::glyphRuns()
*/
bool QRawFont::glyphIndexesForChars(const QChar *chars, int numChars, quint32 *glyphIndexes, int *numGlyphs) const
{
diff --git a/src/gui/text/qrawfont_ft.cpp b/src/gui/text/qrawfont_ft.cpp
index 5bba221..1666df3 100644
--- a/src/gui/text/qrawfont_ft.cpp
+++ b/src/gui/text/qrawfont_ft.cpp
@@ -45,6 +45,7 @@
#include "qrawfont_p.h"
#include "qfontengine_ft_p.h"
+#include "quuid.h"
#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG)
# include "qfontengine_x11_p.h"
@@ -87,6 +88,7 @@ public:
FaceId faceId;
faceId.filename = "";
faceId.index = 0;
+ faceId.uuid = QUuid::createUuid().toByteArray();
return init(faceId, true, Format_None, fontData);
}
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index aacac04..bde2c34 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -680,20 +680,30 @@ void QTextControlPrivate::extendWordwiseSelection(int suggestedNewPosition, qrea
if (!wordSelectionEnabled && (mouseXPosition < wordStartX || mouseXPosition > wordEndX))
return;
- // keep the already selected word even when moving to the left
- // (#39164)
- if (suggestedNewPosition < selectedWordOnDoubleClick.position())
- cursor.setPosition(selectedWordOnDoubleClick.selectionEnd());
- else
- cursor.setPosition(selectedWordOnDoubleClick.selectionStart());
+ if (wordSelectionEnabled) {
+ if (suggestedNewPosition < selectedWordOnDoubleClick.position()) {
+ cursor.setPosition(selectedWordOnDoubleClick.selectionEnd());
+ setCursorPosition(wordStartPos, QTextCursor::KeepAnchor);
+ } else {
+ cursor.setPosition(selectedWordOnDoubleClick.selectionStart());
+ setCursorPosition(wordEndPos, QTextCursor::KeepAnchor);
+ }
+ } else {
+ // keep the already selected word even when moving to the left
+ // (#39164)
+ if (suggestedNewPosition < selectedWordOnDoubleClick.position())
+ cursor.setPosition(selectedWordOnDoubleClick.selectionEnd());
+ else
+ cursor.setPosition(selectedWordOnDoubleClick.selectionStart());
- const qreal differenceToStart = mouseXPosition - wordStartX;
- const qreal differenceToEnd = wordEndX - mouseXPosition;
+ const qreal differenceToStart = mouseXPosition - wordStartX;
+ const qreal differenceToEnd = wordEndX - mouseXPosition;
- if (differenceToStart < differenceToEnd)
- setCursorPosition(wordStartPos, QTextCursor::KeepAnchor);
- else
- setCursorPosition(wordEndPos, QTextCursor::KeepAnchor);
+ if (differenceToStart < differenceToEnd)
+ setCursorPosition(wordStartPos, QTextCursor::KeepAnchor);
+ else
+ setCursorPosition(wordEndPos, QTextCursor::KeepAnchor);
+ }
if (interactionFlags & Qt::TextSelectableByMouse) {
#ifndef QT_NO_CLIPBOARD
@@ -1665,8 +1675,10 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons
#endif //QT_NO_IM
} else {
//emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1)));
- if (cursor.position() != oldCursorPos)
+ if (cursor.position() != oldCursorPos) {
emit q->cursorPositionChanged();
+ emit q->microFocusChanged();
+ }
}
selectionChanged(true);
repaintOldAndNewSelection(oldSelection);
@@ -1710,8 +1722,10 @@ void QTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton button, c
repaintOldAndNewSelection(oldSelection);
- if (cursor.position() != oldCursorPos)
+ if (cursor.position() != oldCursorPos) {
emit q->cursorPositionChanged();
+ emit q->microFocusChanged();
+ }
if (interactionFlags & Qt::LinksAccessibleByMouse) {
if (!(button & Qt::LeftButton))
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index f4cb742..39d0e6c 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -540,6 +540,7 @@ int QTextDocumentPrivate::remove_block(int pos, int *blockFormat, int command, Q
int n = blocks.next(b);
Q_ASSERT((int)blocks.position(n) == pos + 1);
blocks.setSize(b, blocks.size(b) + blocks.size(n) - 1);
+ blocks.fragment(b)->userState = blocks.fragment(n)->userState;
b = n;
}
*blockFormat = blocks.fragment(b)->format;
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 093b43d..aa4a20d 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1532,33 +1532,38 @@ void QTextEngine::itemize() const
const ushort *e = uc + length;
int lastScript = QUnicodeTables::Common;
while (uc < e) {
- int script = QUnicodeTables::script(*uc);
- if (script == QUnicodeTables::Inherited)
- script = lastScript;
- analysis->flags = QScriptAnalysis::None;
- if (*uc == QChar::ObjectReplacementCharacter) {
- if (analysis->bidiLevel % 2)
- --analysis->bidiLevel;
+ switch (*uc) {
+ case QChar::ObjectReplacementCharacter:
analysis->script = QUnicodeTables::Common;
analysis->flags = QScriptAnalysis::Object;
- } else if (*uc == QChar::LineSeparator) {
+ break;
+ case QChar::LineSeparator:
if (analysis->bidiLevel % 2)
--analysis->bidiLevel;
analysis->script = QUnicodeTables::Common;
analysis->flags = QScriptAnalysis::LineOrParagraphSeparator;
if (option.flags() & QTextOption::ShowLineAndParagraphSeparators)
*const_cast<ushort*>(uc) = 0x21B5; // visual line separator
- } else if (*uc == 9) {
+ break;
+ case 9: // Tab
analysis->script = QUnicodeTables::Common;
analysis->flags = QScriptAnalysis::Tab;
analysis->bidiLevel = control.baseLevel();
- } else if ((*uc == 32 || *uc == QChar::Nbsp)
- && (option.flags() & QTextOption::ShowTabsAndSpaces)) {
- analysis->script = QUnicodeTables::Common;
- analysis->flags = QScriptAnalysis::Space;
- analysis->bidiLevel = control.baseLevel();
- } else {
- analysis->script = script;
+ break;
+ case 32: // Space
+ case QChar::Nbsp:
+ if (option.flags() & QTextOption::ShowTabsAndSpaces) {
+ analysis->script = QUnicodeTables::Common;
+ analysis->flags = QScriptAnalysis::Space;
+ analysis->bidiLevel = control.baseLevel();
+ break;
+ }
+ // fall through
+ default:
+ int script = QUnicodeTables::script(*uc);
+ analysis->script = script == QUnicodeTables::Inherited ? lastScript : script;
+ analysis->flags = QScriptAnalysis::None;
+ break;
}
lastScript = analysis->script;
++uc;
@@ -2082,7 +2087,8 @@ void QTextEngine::justify(const QScriptLine &line)
}
}
- QFixed need = line.width - line.textWidth;
+ QFixed leading = leadingSpaceWidth(line);
+ QFixed need = line.width - line.textWidth - leading;
if (need < 0) {
// line overflows already!
const_cast<QScriptLine &>(line).justified = true;
@@ -2426,7 +2432,7 @@ void QTextEngine::indexAdditionalFormats()
between the text that gets truncated and the ellipsis. This is important to get
correctly shaped results for arabic text.
*/
-static bool nextCharJoins(const QString &string, int pos)
+static inline bool nextCharJoins(const QString &string, int pos)
{
while (pos < string.length() && string.at(pos).category() == QChar::Mark_NonSpacing)
++pos;
@@ -2435,13 +2441,14 @@ static bool nextCharJoins(const QString &string, int pos)
return string.at(pos).joining() != QChar::OtherJoining;
}
-static bool prevCharJoins(const QString &string, int pos)
+static inline bool prevCharJoins(const QString &string, int pos)
{
while (pos > 0 && string.at(pos - 1).category() == QChar::Mark_NonSpacing)
--pos;
if (pos == 0)
return false;
- return (string.at(pos - 1).joining() == QChar::Dual || string.at(pos - 1).joining() == QChar::Center);
+ QChar::Joining joining = string.at(pos - 1).joining();
+ return (joining == QChar::Dual || joining == QChar::Center);
}
QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int flags) const
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 515915a..4fd6ddf 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1928,12 +1928,8 @@ found:
if (line.textWidth > 0 && item < eng->layoutData->items.size())
eng->maxWidth += lbh.spaceData.textWidth;
- // In the latter case, text are drawn with trailing spaces at the beginning
- // of a line, so the naturalTextWidth should contain the space width
- if ((eng->option.flags() & QTextOption::IncludeTrailingSpaces) ||
- (line.width == QFIXED_MAX && eng->isRightToLeft())) {
+ if (eng->option.flags() & QTextOption::IncludeTrailingSpaces)
line.textWidth += lbh.spaceData.textWidth;
- }
if (lbh.spaceData.length) {
line.length += lbh.spaceData.length;
line.hasTrailingSpaces = true;
diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri
index b6cdc52..1cfacf7 100644
--- a/src/gui/text/text.pri
+++ b/src/gui/text/text.pri
@@ -106,14 +106,17 @@ unix:x11 {
!embedded:!qpa:!x11:mac {
HEADERS += \
text/qfontengine_mac_p.h
- OBJECTIVE_HEADERS += \
- text/qfontengine_coretext_p.h
SOURCES += \
text/qfont_mac.cpp \
text/qrawfont_mac.cpp
OBJECTIVE_SOURCES += \
- text/qfontengine_coretext.mm \
text/qfontengine_mac.mm
+}
+!embedded:!x11:mac {
+ OBJECTIVE_HEADERS += \
+ text/qfontengine_coretext_p.h
+ OBJECTIVE_SOURCES += \
+ text/qfontengine_coretext.mm
contains(QT_CONFIG, harfbuzz) {
DEFINES += QT_ENABLE_HARFBUZZ_FOR_MAC
}
diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp
index 8c243ed..7a53224 100644
--- a/src/gui/util/qdesktopservices_s60.cpp
+++ b/src/gui/util/qdesktopservices_s60.cpp
@@ -313,12 +313,12 @@ static void handleUrlL(const TDesC& aUrl)
CleanupStack::PopAndDestroy();
}
-static bool handleUrl(const QUrl &url)
+static bool handleUrl(const QUrl &url, bool useEncodedUrl)
{
if (!url.isValid())
return false;
- QString urlString(url.toEncoded());
+ QString urlString(useEncodedUrl ? url.toEncoded() : url.toString());
TPtrC urlPtr(qt_QString2TPtrC(urlString));
TRAPD( err, handleUrlL(urlPtr));
return err ? false : true;
@@ -326,12 +326,12 @@ static bool handleUrl(const QUrl &url)
static bool launchWebBrowser(const QUrl &url)
{
- return handleUrl(url);
+ return handleUrl(url, true);
}
static bool openDocument(const QUrl &file)
{
- return handleUrl(file);
+ return handleUrl(file, false);
}
#endif //USE_SCHEMEHANDLER
diff --git a/src/gui/widgets/qabstractplatformmenubar_p.h b/src/gui/widgets/qabstractplatformmenubar_p.h
new file mode 100644
index 0000000..10e6fdc
--- /dev/null
+++ b/src/gui/widgets/qabstractplatformmenubar_p.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 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$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QABSTRACTPLATFORMMENUBAR_P_H
+#define QABSTRACTPLATFORMMENUBAR_P_H
+
+#include <qfactoryinterface.h>
+#include <qglobal.h>
+#include <qplugin.h>
+
+#ifndef QT_NO_MENUBAR
+
+QT_BEGIN_NAMESPACE
+
+class QAction;
+class QActionEvent;
+class QEvent;
+class QMenuBar;
+class QObject;
+class QWidget;
+
+class QAbstractPlatformMenuBar;
+
+struct QPlatformMenuBarFactoryInterface : public QFactoryInterface
+{
+ virtual QAbstractPlatformMenuBar *create() = 0;
+};
+
+#define QPlatformMenuBarFactoryInterface_iid "com.nokia.qt.QPlatformMenuBarFactoryInterface"
+Q_DECLARE_INTERFACE(QPlatformMenuBarFactoryInterface, QPlatformMenuBarFactoryInterface_iid)
+
+/*!
+ The platform-specific implementation of a menubar
+*/
+class QAbstractPlatformMenuBar
+{
+public:
+ virtual ~QAbstractPlatformMenuBar() {}
+
+ virtual void init(QMenuBar *) = 0;
+
+ virtual void setVisible(bool visible) = 0;
+
+ virtual void actionEvent(QActionEvent *) = 0;
+
+ virtual void handleReparent(QWidget *oldParent, QWidget *newParent, QWidget *oldWindow, QWidget *newWindow) = 0;
+
+ virtual bool allowCornerWidgets() const = 0;
+
+ virtual void popupAction(QAction *) = 0;
+
+ virtual void setNativeMenuBar(bool) = 0;
+
+ virtual bool isNativeMenuBar() const = 0;
+
+ /*!
+ Return true if the native menubar is capable of listening to the
+ shortcut keys. If false is returned, QMenuBar will trigger actions on
+ shortcut itself.
+ */
+ virtual bool shortcutsHandledByNativeMenuBar() const = 0;
+
+ virtual bool menuBarEventFilter(QObject *, QEvent *event) = 0;
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_MENUBAR
+
+#endif // QABSTRACTPLATFORMMENUBAR_P_H
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 41394e3..fc251bf 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -2497,7 +2497,7 @@ void QComboBox::showPopup()
} else {
TRect staConTopRect = TRect();
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, staConTopRect);
- listRect.setWidth(listRect.height());
+ listRect.setWidth(screen.height());
//by default popup is centered on screen in landscape
listRect.moveCenter(screen.center());
if (staConTopRect.IsEmpty() && AknLayoutUtils::CbaLocation() != AknLayoutUtils::EAknCbaLocationBottom) {
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index b6e2f90..a8031e7 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -60,7 +60,7 @@
QT_BEGIN_NAMESPACE
#ifdef QT_GUI_PASSWORD_ECHO_DELAY
-static int qt_passwordEchoDelay = QT_GUI_PASSWORD_ECHO_DELAY;
+static const int qt_passwordEchoDelay = QT_GUI_PASSWORD_ECHO_DELAY;
#endif
/*!
@@ -93,8 +93,8 @@ void QLineControl::updateDisplayText(bool forceUpdate)
if (m_echoMode == QLineEdit::Password) {
str.fill(m_passwordCharacter);
#ifdef QT_GUI_PASSWORD_ECHO_DELAY
- if (m_passwordEchoTimer != 0 && !str.isEmpty()) {
- int cursor = m_text.length() - 1;
+ if (m_passwordEchoTimer != 0 && m_cursor > 0 && m_cursor <= m_text.length()) {
+ int cursor = m_cursor - 1;
QChar uc = m_text.at(cursor);
str[cursor] = uc;
if (cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) {
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index 9db068c..56658b3 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -1639,7 +1639,7 @@ QMenuBarPrivate::QMacMenuBarPrivate::~QMacMenuBarPrivate()
}
void
-QMenuBarPrivate::QMacMenuBarPrivate::addAction(QAction *a, QMacMenuAction *before)
+QMenuBarPrivate::QMacMenuBarPrivate::addAction(QAction *a, QAction *before)
{
if (a->isSeparator() || !menu)
return;
@@ -1649,7 +1649,7 @@ QMenuBarPrivate::QMacMenuBarPrivate::addAction(QAction *a, QMacMenuAction *befor
#ifndef QT_MAC_USE_COCOA
action->command = qt_mac_menu_static_cmd_id++;
#endif
- addAction(action, before);
+ addAction(action, findAction(before));
}
void
diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h
index 0e63799..82bd932 100644
--- a/src/gui/widgets/qmenu_p.h
+++ b/src/gui/widgets/qmenu_p.h
@@ -154,6 +154,9 @@ public:
#endif
scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0),
hasCheckableItems(0), sloppyAction(0), doChildEffects(false)
+#ifdef QT3_SUPPORT
+ ,emitHighlighted(false)
+#endif
#ifdef Q_WS_MAC
,mac_menu(0)
#endif
@@ -163,9 +166,6 @@ public:
#ifdef Q_WS_S60
,symbian_menu(0)
#endif
-#ifdef QT3_SUPPORT
- ,emitHighlighted(false)
-#endif
{ }
~QMenuPrivate()
{
diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp
index c9dbff5..99a1d78 100644
--- a/src/gui/widgets/qmenu_symbian.cpp
+++ b/src/gui/widgets/qmenu_symbian.cpp
@@ -398,12 +398,12 @@ void QMenuPrivate::QSymbianMenuPrivate::rebuild(bool)
{
}
-void QMenuBarPrivate::QSymbianMenuBarPrivate::addAction(QAction *a, QSymbianMenuAction *before)
+void QMenuBarPrivate::QSymbianMenuBarPrivate::addAction(QAction *a, QAction *before)
{
QSymbianMenuAction *action = new QSymbianMenuAction;
action->action = a;
action->command = qt_symbian_menu_static_cmd_id++;
- addAction(action, before);
+ addAction(action, findAction(before));
}
void QMenuBarPrivate::QSymbianMenuBarPrivate::addAction(QSymbianMenuAction *action, QSymbianMenuAction *before)
diff --git a/src/gui/widgets/qmenu_wince.cpp b/src/gui/widgets/qmenu_wince.cpp
index 1157fff..b0c6c1b 100644
--- a/src/gui/widgets/qmenu_wince.cpp
+++ b/src/gui/widgets/qmenu_wince.cpp
@@ -504,12 +504,12 @@ void QMenuPrivate::QWceMenuPrivate::removeAction(QWceMenuAction *action)
rebuild();
}
-void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QAction *a, QWceMenuAction *before)
+void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QAction *a, QAction *before)
{
QWceMenuAction *action = new QWceMenuAction;
action->action = a;
action->command = qt_wce_menu_static_cmd_id++;
- addAction(action, before);
+ addAction(action, findAction(before));
}
void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QWceMenuAction *action, QWceMenuAction *before)
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp
index 3ff98a4..3e5365c 100644
--- a/src/gui/widgets/qmenubar.cpp
+++ b/src/gui/widgets/qmenubar.cpp
@@ -55,6 +55,9 @@
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qwhatsthis.h>
+#ifdef Q_WS_X11
+#include <qpluginloader.h>
+#endif
#ifndef QT_NO_MENUBAR
@@ -66,6 +69,9 @@
#include "qmenu_p.h"
#include "qmenubar_p.h"
#include "qdebug.h"
+#ifdef Q_WS_X11
+#include "qmenubar_x11_p.h"
+#endif
#ifdef Q_WS_WINCE
extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp
@@ -173,7 +179,11 @@ void QMenuBarPrivate::updateGeometries()
return;
int q_width = q->width()-(q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q)*2);
int q_start = -1;
- if(leftWidget || rightWidget) {
+ if(
+#ifdef Q_WS_X11
+ platformMenuBar->allowCornerWidgets() &&
+#endif
+ (leftWidget || rightWidget)) {
int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, q)
+ q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q);
int hmargin = q->style()->pixelMetric(QStyle::PM_MenuBarHMargin, 0, q)
@@ -204,7 +214,11 @@ void QMenuBarPrivate::updateGeometries()
calcActionRects(q_width, q_start);
currentAction = 0;
#ifndef QT_NO_SHORTCUT
- if(itemsDirty) {
+ if(
+#ifdef Q_WS_X11
+ !platformMenuBar->shortcutsHandledByNativeMenuBar() &&
+#endif
+ itemsDirty) {
for(int j = 0; j < shortcutIndexMap.size(); ++j)
q->releaseShortcut(shortcutIndexMap.value(j));
shortcutIndexMap.resize(0); // faster than clear
@@ -212,6 +226,12 @@ void QMenuBarPrivate::updateGeometries()
shortcutIndexMap.append(q->grabShortcut(QKeySequence::mnemonic(actions.at(i)->text())));
}
#endif
+#ifdef Q_WS_X11
+ if(q->isNativeMenuBar()) {//nothing to see here folks, move along..
+ itemsDirty = false;
+ return;
+ }
+#endif
itemsDirty = false;
hiddenActions.clear();
@@ -743,6 +763,11 @@ void QMenuBarPrivate::init()
QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true);
}
#endif
+#ifdef Q_WS_X11
+ platformMenuBar = qt_guiPlatformMenuBarFactory()->create();
+ platformMenuBar->init(q);
+#endif
+
q->setBackgroundRole(QPalette::Button);
oldWindow = oldParent = 0;
#ifdef QT3_SUPPORT
@@ -751,6 +776,10 @@ void QMenuBarPrivate::init()
#ifdef QT_SOFTKEYS_ENABLED
menuBarAction = 0;
#endif
+#ifdef Q_WS_X11
+ cornerWidgetToolBar = 0;
+ cornerWidgetContainer = 0;
+#endif
handleReparent();
q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q));
@@ -821,6 +850,10 @@ QMenuBar::~QMenuBar()
Q_D(QMenuBar);
d->symbianDestroyMenuBar();
#endif
+#ifdef Q_WS_X11
+ Q_D(QMenuBar);
+ delete d->cornerWidgetToolBar;
+#endif
}
/*!
@@ -1072,6 +1105,10 @@ void QMenuBar::paintEvent(QPaintEvent *e)
*/
void QMenuBar::setVisible(bool visible)
{
+#ifdef Q_WS_X11
+ Q_D(QMenuBar);
+ d->platformMenuBar->setVisible(visible);
+#else
#if defined(Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60)
if (isNativeMenuBar()) {
if (!visible)
@@ -1080,6 +1117,7 @@ void QMenuBar::setVisible(bool visible)
}
#endif
QWidget::setVisible(visible);
+#endif // Q_WS_X11
}
/*!
@@ -1275,6 +1313,9 @@ void QMenuBar::actionEvent(QActionEvent *e)
{
Q_D(QMenuBar);
d->itemsDirty = true;
+#ifdef Q_WS_X11
+ d->platformMenuBar->actionEvent(e);
+#endif
#if defined (Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60)
if (isNativeMenuBar()) {
#ifdef Q_WS_MAC
@@ -1287,7 +1328,7 @@ void QMenuBar::actionEvent(QActionEvent *e)
if (!nativeMenuBar)
return;
if(e->type() == QEvent::ActionAdded)
- nativeMenuBar->addAction(e->action(), nativeMenuBar->findAction(e->before()));
+ nativeMenuBar->addAction(e->action(), e->before());
else if(e->type() == QEvent::ActionRemoved)
nativeMenuBar->removeAction(e->action());
else if(e->type() == QEvent::ActionChanged)
@@ -1369,6 +1410,10 @@ void QMenuBarPrivate::handleReparent()
newWindow->installEventFilter(q);
}
+#ifdef Q_WS_X11
+ platformMenuBar->handleReparent(oldParent, newParent, oldWindow, newWindow);
+#endif
+
oldParent = newParent;
oldWindow = newWindow;
@@ -1566,6 +1611,11 @@ bool QMenuBar::event(QEvent *e)
bool QMenuBar::eventFilter(QObject *object, QEvent *event)
{
Q_D(QMenuBar);
+#ifdef Q_WS_X11
+ if (d->platformMenuBar->menuBarEventFilter(object, event)) {
+ return true;
+ }
+#endif
if (object == parent() && object) {
#ifdef QT3_SUPPORT
if (d->doAutoResize && event->type() == QEvent::Resize) {
@@ -1659,7 +1709,7 @@ QRect QMenuBar::actionGeometry(QAction *act) const
QSize QMenuBar::minimumSizeHint() const
{
Q_D(const QMenuBar);
-#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60)
+#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11)
const bool as_gui_menubar = !isNativeMenuBar();
#else
const bool as_gui_menubar = true;
@@ -1682,6 +1732,9 @@ QSize QMenuBar::minimumSizeHint() const
ret += QSize(2*fw + hmargin, 2*fw + vmargin);
}
int margin = 2*vmargin + 2*fw + spaceBelowMenuBar;
+#ifdef Q_WS_X11
+ if (d->platformMenuBar->allowCornerWidgets()) {
+#endif
if(d->leftWidget) {
QSize sz = d->leftWidget->minimumSizeHint();
ret.setWidth(ret.width() + sz.width());
@@ -1694,6 +1747,9 @@ QSize QMenuBar::minimumSizeHint() const
if(sz.height() + margin > ret.height())
ret.setHeight(sz.height() + margin);
}
+#ifdef Q_WS_X11
+ }
+#endif
if(as_gui_menubar) {
QStyleOptionMenuItem opt;
opt.rect = rect();
@@ -1715,7 +1771,7 @@ QSize QMenuBar::minimumSizeHint() const
QSize QMenuBar::sizeHint() const
{
Q_D(const QMenuBar);
-#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60)
+#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11)
const bool as_gui_menubar = !isNativeMenuBar();
#else
const bool as_gui_menubar = true;
@@ -1741,6 +1797,9 @@ QSize QMenuBar::sizeHint() const
ret += QSize(fw + hmargin, fw + vmargin);
}
int margin = 2*vmargin + 2*fw + spaceBelowMenuBar;
+#ifdef Q_WS_X11
+ if(d->platformMenuBar->allowCornerWidgets()) {
+#endif
if(d->leftWidget) {
QSize sz = d->leftWidget->sizeHint();
ret.setWidth(ret.width() + sz.width());
@@ -1753,6 +1812,9 @@ QSize QMenuBar::sizeHint() const
if(sz.height() + margin > ret.height())
ret.setHeight(sz.height() + margin);
}
+#ifdef Q_WS_X11
+ }
+#endif
if(as_gui_menubar) {
QStyleOptionMenuItem opt;
opt.rect = rect();
@@ -1774,7 +1836,7 @@ QSize QMenuBar::sizeHint() const
int QMenuBar::heightForWidth(int) const
{
Q_D(const QMenuBar);
-#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60)
+#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11)
const bool as_gui_menubar = !isNativeMenuBar();
#else
const bool as_gui_menubar = true;
@@ -1794,10 +1856,16 @@ int QMenuBar::heightForWidth(int) const
height += 2*vmargin;
}
int margin = 2*vmargin + 2*fw + spaceBelowMenuBar;
+#ifdef Q_WS_X11
+ if(d->platformMenuBar->allowCornerWidgets()) {
+#endif
if(d->leftWidget)
height = qMax(d->leftWidget->sizeHint().height() + margin, height);
if(d->rightWidget)
height = qMax(d->rightWidget->sizeHint().height() + margin, height);
+#ifdef Q_WS_X11
+ }
+#endif
if(as_gui_menubar) {
QStyleOptionMenuItem opt;
opt.init(this);
@@ -1817,7 +1885,15 @@ void QMenuBarPrivate::_q_internalShortcutActivated(int id)
{
Q_Q(QMenuBar);
QAction *act = actions.at(id);
- setCurrentAction(act, true, true);
+#ifdef Q_WS_X11
+ if (q->isNativeMenuBar()) {
+ platformMenuBar->popupAction(act);
+ } else {
+#endif
+ setCurrentAction(act, true, true);
+#ifdef Q_WS_X11
+ }
+#endif
if (act && !act->menu()) {
activateAction(act, QAction::Trigger);
//100 is the same as the default value in QPushButton::animateClick
@@ -1838,6 +1914,39 @@ void QMenuBarPrivate::_q_updateLayout()
}
}
+#ifdef Q_WS_X11
+void QMenuBarPrivate::updateCornerWidgetToolBar()
+{
+ Q_Q(QMenuBar);
+ if (!cornerWidgetToolBar) {
+ QMainWindow *window = qobject_cast<QMainWindow *>(q->window());
+ if (!window) {
+ qWarning() << "Menubar parent is not a QMainWindow, not showing corner widgets";
+ return;
+ }
+ cornerWidgetToolBar = window->addToolBar(QApplication::translate("QMenuBar", "Corner Toolbar"));
+ cornerWidgetToolBar->setObjectName(QLatin1String("CornerToolBar"));
+ cornerWidgetContainer = new QWidget;
+ cornerWidgetToolBar->addWidget(cornerWidgetContainer);
+ new QHBoxLayout(cornerWidgetContainer);
+ } else {
+ QLayout *layout = cornerWidgetContainer->layout();
+ while (layout->count() > 0) {
+ layout->takeAt(0);
+ }
+ }
+ if (leftWidget) {
+ leftWidget->setParent(cornerWidgetContainer);
+ cornerWidgetContainer->layout()->addWidget(leftWidget);
+ }
+ if (rightWidget) {
+ rightWidget->setParent(cornerWidgetContainer);
+ cornerWidgetContainer->layout()->addWidget(rightWidget);
+ }
+}
+#endif
+
+
/*!
\fn void QMenuBar::setCornerWidget(QWidget *widget, Qt::Corner corner)
@@ -1870,10 +1979,18 @@ void QMenuBar::setCornerWidget(QWidget *w, Qt::Corner corner)
return;
}
+#ifdef Q_WS_X11
+ if(!d->platformMenuBar->allowCornerWidgets()) {
+ d->updateCornerWidgetToolBar();
+ } else {
+#endif
if (w) {
w->setParent(this);
w->installEventFilter(this);
}
+#ifdef Q_WS_X11
+ }
+#endif
d->_q_updateLayout();
}
@@ -1923,6 +2040,9 @@ QWidget *QMenuBar::cornerWidget(Qt::Corner corner) const
void QMenuBar::setNativeMenuBar(bool nativeMenuBar)
{
Q_D(QMenuBar);
+#ifdef Q_WS_X11
+ d->platformMenuBar->setNativeMenuBar(nativeMenuBar);
+#else
if (d->nativeMenuBar == -1 || (nativeMenuBar != bool(d->nativeMenuBar))) {
d->nativeMenuBar = nativeMenuBar;
#ifdef Q_WS_MAC
@@ -1947,15 +2067,20 @@ void QMenuBar::setNativeMenuBar(bool nativeMenuBar)
setVisible(true);
#endif
}
+#endif // Q_WS_X11
}
bool QMenuBar::isNativeMenuBar() const
{
Q_D(const QMenuBar);
+#ifdef Q_WS_X11
+ return d->platformMenuBar->isNativeMenuBar();
+#else
if (d->nativeMenuBar == -1) {
return !QApplication::instance()->testAttribute(Qt::AA_DontUseNativeMenuBar);
}
return d->nativeMenuBar;
+#endif
}
/*!
diff --git a/src/gui/widgets/qmenubar_p.h b/src/gui/widgets/qmenubar_p.h
index 1ac694e..9a1f758 100644
--- a/src/gui/widgets/qmenubar_p.h
+++ b/src/gui/widgets/qmenubar_p.h
@@ -47,7 +47,7 @@
// -------------
//
// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
+// platformMenuBarementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
@@ -61,6 +61,10 @@
#include "qguifunctions_wince.h"
#endif
+#ifdef Q_WS_X11
+#include "qabstractplatformmenubar_p.h"
+#endif
+
#ifndef QT_NO_MENUBAR
#ifdef Q_WS_S60
class CCoeControl;
@@ -71,21 +75,27 @@ class CEikMenuBar;
QT_BEGIN_NAMESPACE
#ifndef QT_NO_MENUBAR
+class QToolBar;
class QMenuBarExtension;
class QMenuBarPrivate : public QWidgetPrivate
{
Q_DECLARE_PUBLIC(QMenuBar)
public:
QMenuBarPrivate() : itemsDirty(0), currentAction(0), mouseDown(0),
- closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0),
- nativeMenuBar(-1), doChildEffects(false)
+ closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0)
+#ifndef Q_WS_X11
+ , nativeMenuBar(-1)
+#endif
+ , doChildEffects(false)
#ifdef QT3_SUPPORT
, doAutoResize(false)
#endif
#ifdef Q_WS_MAC
, mac_menubar(0)
#endif
-
+#ifdef Q_WS_X11
+ , platformMenuBar(0)
+#endif
#ifdef Q_WS_WINCE
, wce_menubar(0), wceClassicMenu(false)
#endif
@@ -96,6 +106,9 @@ public:
{ }
~QMenuBarPrivate()
{
+#ifdef Q_WS_X11
+ delete platformMenuBar;
+#endif
#ifdef Q_WS_MAC
delete mac_menubar;
#endif
@@ -136,8 +149,9 @@ public:
uint keyboardState : 1, altPressed : 1;
QPointer<QWidget> keyboardFocusWidget;
-
+#ifndef Q_WS_X11
int nativeMenuBar : 3; // Only has values -1, 0, and 1
+#endif
//firing of events
void activateAction(QAction *, QAction::ActionEvent);
@@ -173,6 +187,9 @@ public:
#ifdef QT3_SUPPORT
bool doAutoResize;
#endif
+#ifdef Q_WS_X11
+ QAbstractPlatformMenuBar *platformMenuBar;
+#endif
#ifdef Q_WS_MAC
//mac menubar binding
struct QMacMenuBarPrivate {
@@ -181,7 +198,7 @@ public:
QMacMenuBarPrivate();
~QMacMenuBarPrivate();
- void addAction(QAction *, QMacMenuAction* =0);
+ void addAction(QAction *, QAction* =0);
void addAction(QMacMenuAction *, QMacMenuAction* =0);
void syncAction(QMacMenuAction *);
inline void syncAction(QAction *a) { syncAction(findAction(a)); }
@@ -220,7 +237,7 @@ public:
QWceMenuBarPrivate(QMenuBarPrivate *menubar);
~QWceMenuBarPrivate();
- void addAction(QAction *, QWceMenuAction* =0);
+ void addAction(QAction *, QAction* =0);
void addAction(QWceMenuAction *, QWceMenuAction* =0);
void syncAction(QWceMenuAction *);
inline void syncAction(QAction *a) { syncAction(findAction(a)); }
@@ -250,7 +267,7 @@ public:
QMenuBarPrivate *d;
QSymbianMenuBarPrivate(QMenuBarPrivate *menubar);
~QSymbianMenuBarPrivate();
- void addAction(QAction *, QSymbianMenuAction* =0);
+ void addAction(QAction *, QAction* =0);
void addAction(QSymbianMenuAction *, QSymbianMenuAction* =0);
void syncAction(QSymbianMenuAction *);
inline void syncAction(QAction *a) { syncAction(findAction(a)); }
@@ -273,6 +290,12 @@ public:
#ifdef QT_SOFTKEYS_ENABLED
QAction *menuBarAction;
#endif
+
+#ifdef Q_WS_X11
+ void updateCornerWidgetToolBar();
+ QToolBar *cornerWidgetToolBar;
+ QWidget *cornerWidgetContainer;
+#endif
};
#endif
diff --git a/src/gui/widgets/qmenubar_x11.cpp b/src/gui/widgets/qmenubar_x11.cpp
new file mode 100644
index 0000000..25336d4
--- /dev/null
+++ b/src/gui/widgets/qmenubar_x11.cpp
@@ -0,0 +1,139 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 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$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmenubar_x11_p.h"
+
+#ifndef QT_NO_MENUBAR
+
+#include "qapplication.h"
+#include "qdebug.h"
+#include "qevent.h"
+#include "qmenu.h"
+#include "qmenubar.h"
+
+#include <private/qfactoryloader_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QX11MenuBar::~QX11MenuBar()
+{
+}
+
+void QX11MenuBar::init(QMenuBar *_menuBar)
+{
+ nativeMenuBar = -1;
+ menuBar = _menuBar;
+}
+
+void QX11MenuBar::setVisible(bool visible)
+{
+ menuBar->QWidget::setVisible(visible);
+}
+
+void QX11MenuBar::actionEvent(QActionEvent *e)
+{
+ Q_UNUSED(e);
+}
+
+void QX11MenuBar::handleReparent(QWidget *oldParent, QWidget *newParent, QWidget *oldWindow, QWidget *newWindow)
+{
+ Q_UNUSED(oldParent)
+ Q_UNUSED(newParent)
+ Q_UNUSED(oldWindow)
+ Q_UNUSED(newWindow)
+}
+
+bool QX11MenuBar::allowCornerWidgets() const
+{
+ return true;
+}
+
+void QX11MenuBar::popupAction(QAction *)
+{
+}
+
+void QX11MenuBar::setNativeMenuBar(bool value)
+{
+ if (nativeMenuBar == -1 || (value != bool(nativeMenuBar))) {
+ nativeMenuBar = value;
+ }
+}
+
+bool QX11MenuBar::isNativeMenuBar() const
+{
+ return false;
+}
+
+bool QX11MenuBar::shortcutsHandledByNativeMenuBar() const
+{
+ return false;
+}
+
+bool QX11MenuBar::menuBarEventFilter(QObject *, QEvent *)
+{
+ return false;
+}
+
+struct QX11MenuBarFactory : public QPlatformMenuBarFactoryInterface
+{
+ QAbstractPlatformMenuBar *create() { return new QX11MenuBar; }
+ virtual QStringList keys() const { return QStringList(); }
+};
+
+QPlatformMenuBarFactoryInterface *qt_guiPlatformMenuBarFactory()
+{
+ static QPlatformMenuBarFactoryInterface *factory = 0;
+ if (!factory) {
+#ifndef QT_NO_LIBRARY
+ QFactoryLoader loader(QPlatformMenuBarFactoryInterface_iid, QLatin1String("/menubar"));
+ factory = qobject_cast<QPlatformMenuBarFactoryInterface *>(loader.instance(QLatin1String("default")));
+#endif // QT_NO_LIBRARY
+ if(!factory) {
+ static QX11MenuBarFactory def;
+ factory = &def;
+ }
+ }
+ return factory;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_MENUBAR
diff --git a/src/gui/widgets/qmenubar_x11_p.h b/src/gui/widgets/qmenubar_x11_p.h
new file mode 100644
index 0000000..41debd0
--- /dev/null
+++ b/src/gui/widgets/qmenubar_x11_p.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 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$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QX11MENUBAR_P_H
+#define QX11MENUBAR_P_H
+
+#ifndef QT_NO_MENUBAR
+
+#include "qabstractplatformmenubar_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QMenuBar;
+
+class QX11MenuBar : public QAbstractPlatformMenuBar
+{
+public:
+ ~QX11MenuBar();
+
+ virtual void init(QMenuBar *);
+
+ virtual void setVisible(bool visible);
+
+ virtual void actionEvent(QActionEvent *e);
+
+ virtual void handleReparent(QWidget *oldParent, QWidget *newParent, QWidget *oldWindow, QWidget *newWindow);
+
+ virtual bool allowCornerWidgets() const;
+
+ virtual void popupAction(QAction*);
+
+ virtual void setNativeMenuBar(bool);
+ virtual bool isNativeMenuBar() const;
+
+ virtual bool shortcutsHandledByNativeMenuBar() const;
+ virtual bool menuBarEventFilter(QObject *, QEvent *event);
+
+private:
+ QMenuBar *menuBar;
+ int nativeMenuBar : 3; // Only has values -1, 0, and 1
+};
+
+QPlatformMenuBarFactoryInterface *qt_guiPlatformMenuBarFactory();
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_MENUBAR
+
+#endif /* QX11MENUBAR_P_H */
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp
index 16e4aad..8faf156 100644
--- a/src/gui/widgets/qtabbar.cpp
+++ b/src/gui/widgets/qtabbar.cpp
@@ -171,7 +171,7 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const
if (tabIndex > 0 && tabIndex - 1 == d->currentIndex)
option->selectedPosition = QStyleOptionTab::PreviousIsSelected;
- else if (tabIndex < totalTabs - 1 && tabIndex + 1 == d->currentIndex)
+ else if (tabIndex + 1 < totalTabs && tabIndex + 1 == d->currentIndex)
option->selectedPosition = QStyleOptionTab::NextIsSelected;
else
option->selectedPosition = QStyleOptionTab::NotAdjacent;
diff --git a/src/gui/widgets/widgets.pri b/src/gui/widgets/widgets.pri
index 669b838..6b3d6a9 100644
--- a/src/gui/widgets/widgets.pri
+++ b/src/gui/widgets/widgets.pri
@@ -144,6 +144,14 @@ SOURCES += \
widgets/qplaintextedit.cpp \
widgets/qprintpreviewwidget.cpp
+x11: {
+ HEADERS += \
+ widgets/qabstractplatformmenubar_p.h
+
+ SOURCES += \
+ widgets/qmenubar_x11.cpp
+}
+
!embedded:!qpa:mac {
HEADERS += widgets/qmacnativewidget_mac.h \
widgets/qmaccocoaviewcontainer_mac.h