summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorWater-Team <water@pad.test.qt.nokia.com>2011-06-29 21:42:03 (GMT)
committerWater-Team <water@pad.test.qt.nokia.com>2011-06-29 21:42:03 (GMT)
commit0a8daa8845325fba9cf2ec973eb6bab8a2853dd5 (patch)
tree504c698037ee6283f1b5dbc6fa658bb2bfffb99a /src/gui
parent680023c4921019614948c277cde5498645836cb9 (diff)
parent6b3f2a3b96d01dc339d07a076300d29616603b28 (diff)
downloadQt-0a8daa8845325fba9cf2ec973eb6bab8a2853dd5.zip
Qt-0a8daa8845325fba9cf2ec973eb6bab8a2853dd5.tar.gz
Qt-0a8daa8845325fba9cf2ec973eb6bab8a2853dd5.tar.bz2
Merge branch '4.8-upstream' into master-water
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible.cpp131
-rw-r--r--src/gui/dialogs/qfiledialog_mac.mm3
-rw-r--r--src/gui/egl/qegl_p.h10
-rw-r--r--src/gui/embedded/embedded.pri2
-rw-r--r--src/gui/embedded/qkbdqnx_qws.cpp257
-rw-r--r--src/gui/embedded/qlock.cpp128
-rw-r--r--src/gui/embedded/qmouselinuxinput_qws.cpp18
-rw-r--r--src/gui/embedded/qmouseqnx_qws.cpp96
-rw-r--r--src/gui/embedded/qmouseqnx_qws.h2
-rw-r--r--src/gui/embedded/qscreen_qws.h3
-rw-r--r--src/gui/embedded/qscreenqnx_qws.cpp409
-rw-r--r--src/gui/embedded/qscreenqnx_qws.h1
-rw-r--r--src/gui/embedded/qwslock.cpp67
-rw-r--r--src/gui/embedded/qwslock_p.h8
-rw-r--r--src/gui/embedded/qwssharedmemory.cpp89
-rw-r--r--src/gui/embedded/qwssharedmemory_p.h5
-rw-r--r--src/gui/graphicsview/qgraphicslayout.cpp20
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp19
-rw-r--r--src/gui/graphicsview/qgraphicswidget.h2
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.cpp14
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.h5
-rw-r--r--src/gui/image/image.pri4
-rw-r--r--src/gui/image/qimage.cpp15
-rw-r--r--src/gui/image/qpixmap.h2
-rw-r--r--src/gui/image/qpixmap_raster_symbian.cpp (renamed from src/gui/image/qpixmap_s60.cpp)73
-rw-r--r--src/gui/image/qpixmap_raster_symbian_p.h (renamed from src/gui/image/qpixmap_s60_p.h)23
-rw-r--r--src/gui/image/qpixmapdata.cpp5
-rw-r--r--src/gui/image/qpixmapdata_p.h7
-rw-r--r--src/gui/image/qpixmapdatafactory.cpp4
-rw-r--r--src/gui/image/qvolatileimage.cpp35
-rw-r--r--src/gui/image/qvolatileimage_p.h1
-rw-r--r--src/gui/image/qvolatileimagedata_symbian.cpp27
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp57
-rw-r--r--src/gui/itemviews/qtableview.cpp2
-rw-r--r--src/gui/kernel/qactiongroup.cpp4
-rw-r--r--src/gui/kernel/qapplication.cpp4
-rw-r--r--src/gui/kernel/qapplication_mac.mm3
-rw-r--r--src/gui/kernel/qapplication_qpa.cpp3
-rw-r--r--src/gui/kernel/qapplication_qws.cpp7
-rw-r--r--src/gui/kernel/qapplication_s60.cpp54
-rw-r--r--src/gui/kernel/qdesktopwidget_s60.cpp2
-rw-r--r--src/gui/kernel/qevent.cpp6
-rw-r--r--src/gui/kernel/qgenericplugin_qpa.cpp2
-rw-r--r--src/gui/kernel/qgenericpluginfactory_qpa.cpp3
-rw-r--r--src/gui/kernel/qmime_mac.cpp4
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.cpp89
-rw-r--r--src/gui/kernel/qplatformglcontext_qpa.cpp6
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.cpp16
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.cpp23
-rw-r--r--src/gui/kernel/qplatformwindowformat_qpa.cpp24
-rw-r--r--src/gui/kernel/qsoftkeymanager.cpp16
-rw-r--r--src/gui/kernel/qsoftkeymanager_s60.cpp54
-rw-r--r--src/gui/kernel/qt_mac.cpp1
-rw-r--r--src/gui/kernel/qt_s60_p.h3
-rw-r--r--src/gui/kernel/qwidget_mac.mm12
-rw-r--r--src/gui/kernel/qwidget_qpa.cpp22
-rw-r--r--src/gui/kernel/qwidget_s60.cpp12
-rw-r--r--src/gui/painting/painting.pri4
-rw-r--r--src/gui/painting/qbrush.cpp18
-rw-r--r--src/gui/painting/qcosmeticstroker.cpp34
-rw-r--r--src/gui/painting/qcosmeticstroker_p.h34
-rw-r--r--src/gui/painting/qgraphicssystem.cpp4
-rw-r--r--src/gui/painting/qgraphicssystem_raster.cpp4
-rw-r--r--src/gui/painting/qpaintengine.cpp1
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp7
-rw-r--r--src/gui/painting/qpaintengine_raster_symbian.cpp (renamed from src/gui/painting/qpaintengine_s60.cpp)64
-rw-r--r--src/gui/painting/qpaintengine_raster_symbian_p.h (renamed from src/gui/painting/qpaintengine_s60_p.h)18
-rw-r--r--src/gui/painting/qpaintengineex.cpp2
-rw-r--r--src/gui/painting/qwindowsurface_qws.cpp8
-rw-r--r--src/gui/painting/qwindowsurface_s60.cpp14
-rw-r--r--src/gui/s60framework/qs60mainappui.cpp14
-rw-r--r--src/gui/styles/qcommonstyle.cpp2
-rw-r--r--src/gui/styles/qs60style.cpp9
-rw-r--r--src/gui/styles/qs60style.h4
-rw-r--r--src/gui/styles/qs60style_feedbackinterface_p.h50
-rw-r--r--src/gui/styles/qs60style_p.h2
-rw-r--r--src/gui/styles/qs60style_s60.cpp10
-rw-r--r--src/gui/text/qfont.cpp1
-rw-r--r--src/gui/text/qfont_p.h3
-rw-r--r--src/gui/text/qfont_s60.cpp2
-rw-r--r--src/gui/text/qfontdatabase_mac.cpp2
-rw-r--r--src/gui/text/qfontdatabase_qws.cpp8
-rw-r--r--src/gui/text/qfontdatabase_s60.cpp2
-rw-r--r--src/gui/text/qfontdatabase_x11.cpp55
-rw-r--r--src/gui/text/qfontengine_s60.cpp2
-rw-r--r--src/gui/text/qfontengine_x11.cpp28
-rw-r--r--src/gui/text/qfontmetrics.cpp6
-rw-r--r--src/gui/text/qplatformfontdatabase_qpa.cpp64
-rw-r--r--src/gui/text/qrawfont.cpp56
-rw-r--r--src/gui/text/qtextdocument.cpp6
-rw-r--r--src/gui/text/qtextdocumentfragment.cpp9
-rw-r--r--src/gui/text/qtextdocumentfragment_p.h2
-rw-r--r--src/gui/text/qtextengine.cpp26
-rw-r--r--src/gui/text/qtextformat.cpp61
-rw-r--r--src/gui/text/qtextlayout.cpp2
-rw-r--r--src/gui/widgets/qlineedit.cpp7
-rw-r--r--src/gui/widgets/qmdiarea.cpp2
-rw-r--r--src/gui/widgets/qtabwidget.cpp2
98 files changed, 1686 insertions, 877 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index 00427eb..337bb99 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -212,42 +212,101 @@ QT_BEGIN_NAMESPACE
This enum type defines accessible event types.
- \value AcceleratorChanged
- \value Alert A system alert (e.g., a message from a QMessageBox)
- \value ContextHelpEnd Context help (QWhatsThis) for an object is finished.
- \value ContextHelpStart Context help (QWhatsThis) for an object is initiated.
- \value DefaultActionChanged The default QAccessible::Action for the accessible object changed
- \value DescriptionChanged The objects QAccessible::Description changed.
- \value DialogEnd A dialog (QDialog) is been hidden
- \value DialogStart A dialog (QDialog) has been set visible.
- \value DragDropEnd A Drag & Drop operation is about to finished.
- \value DragDropStart A Drag & Drop operation is about to be initiated.
- \value Focus An object has gained keyboard focus.
- \value ForegroundChanged A window has been activated (i.e., a new window has gained focus on the desktop)
- \value HelpChanged The QAccessible::Help text property of an object has changed
- \value LocationChanged An objects location on the screen changed
- \value MenuCommand A menu item is triggered.
- \value MenuEnd A menu has been closed (Qt uses PopupMenuEnd for all menus)
- \value MenuStart A menu has been opened on the menubar (Qt uses PopupMenuStart for all menus)
- \value NameChanged The QAccessible::Name property of an object has changed
- \value ObjectCreated A new object is created.
- \value ObjectDestroyed An object is deleted.
- \value ObjectHide An object is hidden (i.e., with QWidget::hide()). Any children the object that is hidden has do not send this event.
- It is not send when an object is hidden as it is being obcured by others.
- \value ObjectReorder A layout or item view has added, removed, or moved an object (Qt does not use this event).
- \value ObjectShow An object is displayed (i.e., with QWidget::show()).
- \value ParentChanged An objects parent object changed.
- \value PopupMenuEnd A popup menu has closed.
- \value PopupMenuStart A popupmenu has opened.
- \value ScrollingEnd A scrollbar scroll operation has ended (the mouse has released the slider handle)
- \value ScrollingStart A scrollbar scroll operation is about to start (i.e., the mouse has pressed on the slider handle)
- \value Selection The selection has changed in a menu or item view.
- \value SelectionAdd An item has been added to the selection in an item view.
- \value SelectionRemove An item has been removed from an item view selection.
- \value SelectionWithin Several changes to a selection has occurred in an item view.
- \value SoundPlayed A sound has been played by an object
- \value StateChanged The QAccessible::State of an object has changed.
- \value ValueChanged The QAccessible::Value of an object has changed.
+ \value AcceleratorChanged The keyboard accelerator for an action has been changed.
+ \value ActionChanged An action has been changed.
+ \value ActiveDescendantChanged
+ \value Alert A system alert (e.g., a message from a QMessageBox)
+ \value AttributeChanged
+ \value ContextHelpEnd Context help (QWhatsThis) for an object is finished.
+ \value ContextHelpStart Context help (QWhatsThis) for an object is initiated.
+ \value DefaultActionChanged The default QAccessible::Action for the accessible
+ object has changed.
+ \value DescriptionChanged The object's QAccessible::Description changed.
+ \value DialogEnd A dialog (QDialog) has been hidden
+ \value DialogStart A dialog (QDialog) has been set visible.
+ \value DocumentContentChanged The contents of a text document have changed.
+ \value DocumentLoadComplete A document has been loaded.
+ \value DocumentLoadStopped A document load has been stopped.
+ \value DocumentReload A document reload has been initiated.
+ \value DragDropEnd A drag and drop operation is about to finished.
+ \value DragDropStart A drag and drop operation is about to be initiated.
+ \value Focus An object has gained keyboard focus.
+ \value ForegroundChanged A window has been activated (i.e., a new window has
+ gained focus on the desktop).
+ \value HelpChanged The QAccessible::Help text property of an object has
+ changed.
+ \value HyperlinkEndIndexChanged The end position of the display text for a hypertext
+ link has changed.
+ \value HyperlinkNumberOfAnchorsChanged The number of anchors in a hypertext link has changed,
+ perhaps because the display text has been split to
+ provide more than one link.
+ \value HyperlinkSelectedLinkChanged The link for the selected hypertext link has changed.
+ \value HyperlinkStartIndexChanged The start position of the display text for a hypertext
+ link has changed.
+ \value HypertextChanged The display text for a hypertext link has changed.
+ \value HypertextLinkActivated A hypertext link has been activated, perhaps by being
+ clicked or via a key press.
+ \value HypertextLinkSelected A hypertext link has been selected.
+ \value HypertextNLinksChanged
+ \value LocationChanged An object's location on the screen has changed.
+ \value MenuCommand A menu item is triggered.
+ \value MenuEnd A menu has been closed (Qt uses PopupMenuEnd for all
+ menus).
+ \value MenuStart A menu has been opened on the menubar (Qt uses
+ PopupMenuStart for all menus).
+ \value NameChanged The QAccessible::Name property of an object has changed.
+ \value ObjectAttributeChanged
+ \value ObjectCreated A new object is created.
+ \value ObjectDestroyed An object is deleted.
+ \value ObjectHide An object is hidden; for example, with QWidget::hide().
+ Any children the object that is hidden has do not send
+ this event. It is not sent when an object is hidden as
+ it is being obcured by others.
+ \value ObjectReorder A layout or item view has added, removed, or moved an
+ object (Qt does not use this event).
+ \value ObjectShow An object is displayed; for example, with
+ QWidget::show().
+ \value PageChanged
+ \value ParentChanged An object's parent object changed.
+ \value PopupMenuEnd A pop-up menu has closed.
+ \value PopupMenuStart A pop-up menu has opened.
+ \value ScrollingEnd A scrollbar scroll operation has ended (the mouse has
+ released the slider handle).
+ \value ScrollingStart A scrollbar scroll operation is about to start; this may
+ be caused by a mouse press on the slider handle, for
+ example.
+ \value SectionChanged
+ \value SelectionAdd An item has been added to the selection in an item view.
+ \value SelectionRemove An item has been removed from an item view selection.
+ \value Selection The selection has changed in a menu or item view.
+ \value SelectionWithin Several changes to a selection has occurred in an item
+ view.
+ \value SoundPlayed A sound has been played by an object
+ \value StateChanged The QAccessible::State of an object has changed.
+ \value TableCaptionChanged A table caption has been changed.
+ \value TableColumnDescriptionChanged The description of a table column, typically found in
+ the column's header, has been changed.
+ \value TableColumnHeaderChanged A table column header has been changed.
+ \value TableModelChanged The model providing data for a table has been changed.
+ \value TableRowDescriptionChanged The description of a table row, typically found in the
+ row's header, has been changed.
+ \value TableRowHeaderChanged A table row header has been changed.
+ \value TableSummaryChanged The summary of a table has been changed.
+ \value TextAttributeChanged
+ \value TextCaretMoved The caret has moved in an editable widget.
+ The caret represents the cursor position in an editable
+ widget with the input focus.
+ \value TextColumnChanged A text column has been changed.
+ \value TextInserted Text has been inserted into an editable widget.
+ \value TextRemoved Text has been removed from an editable widget.
+ \value TextSelectionChanged The selected text has changed in an editable widget.
+ \value TextUpdated The text has been update in an editable widget.
+ \value ValueChanged The QAccessible::Value of an object has changed.
+ \value VisibleDataChanged
+
+ The values for this enum are defined to be the same as those defined in the
+ \l{AccessibleEventID.idl File Reference}{IAccessible2} and
+ \l{Microsoft Active Accessibility Event Constants}{MSAA} specifications.
*/
/*!
diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm
index 885ce77..fb52274 100644
--- a/src/gui/dialogs/qfiledialog_mac.mm
+++ b/src/gui/dialogs/qfiledialog_mac.mm
@@ -553,9 +553,6 @@ void QFileDialogPrivate::QNSOpenSavePanelDelegate_filterSelected(int menuIndex)
emit q_func()->filterSelected(nameFilters.at(menuIndex));
}
-extern OSErr qt_mac_create_fsref(const QString &, FSRef *); // qglobal.cpp
-extern void qt_mac_to_pascal_string(QString s, Str255 str, TextEncoding encoding=0, int len=-1); // qglobal.cpp
-
void QFileDialogPrivate::setDirectory_sys(const QString &directory)
{
#ifndef QT_MAC_USE_COCOA
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index 9b0d82e..15e7cab 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -165,13 +165,21 @@ typedef int EGLImageKHR;
typedef void *EGLImageKHR;
#endif
+#if !defined(EGL_NO_IMAGE_KHR)
#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
+#endif
+#if !defined(EGL_IMAGE_PRESERVED_KHR)
#define EGL_IMAGE_PRESERVED_KHR 0x30D2
+#endif
+#if !defined(EGL_KHR_image_base)
#define EGL_KHR_image_base
#endif
+#endif
-#if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_pixmap)
+#if !defined(EGL_KHR_image)
#define EGL_NATIVE_PIXMAP_KHR 0x30B0
+#endif
+#if !defined(EGL_KHR_image_pixmap)
#define EGL_KHR_image_pixmap
#endif
diff --git a/src/gui/embedded/embedded.pri b/src/gui/embedded/embedded.pri
index 31f0bc6..836c116 100644
--- a/src/gui/embedded/embedded.pri
+++ b/src/gui/embedded/embedded.pri
@@ -117,7 +117,7 @@ embedded {
contains( gfx-drivers, qnx ) {
HEADERS += embedded/qscreenqnx_qws.h
SOURCES += embedded/qscreenqnx_qws.cpp
- LIBS += -lgf
+ LIBS_PRIVATE += -lgf
}
contains( gfx-drivers, integrityfb ) {
diff --git a/src/gui/embedded/qkbdqnx_qws.cpp b/src/gui/embedded/qkbdqnx_qws.cpp
index 5a8118d..ad76446 100644
--- a/src/gui/embedded/qkbdqnx_qws.cpp
+++ b/src/gui/embedded/qkbdqnx_qws.cpp
@@ -40,16 +40,16 @@
****************************************************************************/
#include "qkbdqnx_qws.h"
-#include "QtCore/qsocketnotifier.h"
+
+#include "qplatformdefs.h"
+#include "qsocketnotifier.h"
+#include "private/qcore_unix_p.h"
#include "QtCore/qdebug.h"
#include <sys/dcmd_input.h>
-#include <photon/keycodes.h>
-
-#include "qplatformdefs.h"
+#include <sys/keycodes.h>
#include <errno.h>
-
QT_BEGIN_NAMESPACE
/*!
@@ -72,7 +72,7 @@ QT_BEGIN_NAMESPACE
Example invocation from command line: \c{/usr/photon/bin/devi-hid -Pr kbd mouse}
Note that after running \c{devi-hid}, you will not be able to use the local
- shell anymore. It is suggested to run the command in a shell scrip, that launches
+ shell anymore. It is suggested to run the command in a shell script, that launches
a Qt application after invocation of \c{devi-hid}.
To make \l{Qt for Embedded Linux} explicitly choose the qnx keyboard
@@ -100,15 +100,13 @@ QWSQnxKeyboardHandler::QWSQnxKeyboardHandler(const QString &device)
QT_OPEN_RDONLY);
if (keyboardFD == -1) {
qErrnoWarning(errno, "QWSQnxKeyboardHandler: Unable to open device");
- return;
- }
-
- // create a socket notifier so we'll wake up whenever keyboard input is detected.
- QSocketNotifier *notifier = new QSocketNotifier(keyboardFD, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)), SLOT(socketActivated()));
-
- qDebug() << "QWSQnxKeyboardHandler: connected.";
+ } else {
+ // create a socket notifier so we'll wake up whenever keyboard input is detected.
+ QSocketNotifier *notifier = new QSocketNotifier(keyboardFD, QSocketNotifier::Read, this);
+ connect(notifier, SIGNAL(activated(int)), SLOT(socketActivated()));
+ qDebug("QWSQnxKeyboardHandler: connected.");
+ }
}
/*!
@@ -116,7 +114,16 @@ QWSQnxKeyboardHandler::QWSQnxKeyboardHandler(const QString &device)
*/
QWSQnxKeyboardHandler::~QWSQnxKeyboardHandler()
{
- QT_CLOSE(keyboardFD);
+ if (keyboardFD != -1)
+ QT_CLOSE(keyboardFD);
+}
+
+// similar to PhKeyToMb
+static inline bool key_sym_displayable(unsigned long sym)
+{
+ if (sym >= 0xF000)
+ return sym >= 0xF100 && (sizeof(wchar_t) > 2 || sym < 0x10000);
+ return (sym & ~0x9F) != 0; // exclude 0...0x1F and 0x80...0x9F
}
/*! \internal
@@ -136,6 +143,11 @@ void QWSQnxKeyboardHandler::socketActivated()
// the bytes read must be the size of a keyboard packet
Q_ASSERT(bytesRead == sizeof(_keyboard_packet));
+ if (packet.data.flags & KEY_SYM_VALID_EX)
+ packet.data.flags |= KEY_SYM_VALID;
+ else if (!(packet.data.flags & (KEY_SYM_VALID | KEY_CAP_VALID)))
+ return;
+
#if 0
qDebug() << "keyboard got scancode"
<< hex << packet.data.modifiers
@@ -145,86 +157,157 @@ void QWSQnxKeyboardHandler::socketActivated()
<< packet.data.key_scan;
#endif
- // QNX is nice enough to translate the raw keyboard data into a QNX data structure
+ // QNX is nice enough to translate the raw keyboard data into generic format for us.
// Now we just have to translate it into a format Qt understands.
- // figure out whether it's a press
- bool isPress = packet.data.key_cap & KEY_DOWN;
- // figure out whether the key is still pressed and the key event is repeated
- bool isRepeat = packet.data.key_cap & KEY_REPEAT;
-
- Qt::Key key = Qt::Key_unknown;
- int unicode = 0xffff;
-
- // TODO - this switch is not complete!
- switch (packet.data.key_scan) {
- case KEYCODE_SPACE: key = Qt::Key_Space; unicode = 0x20; break;
- case KEYCODE_F1: key = Qt::Key_F1; break;
- case KEYCODE_F2: key = Qt::Key_F2; break;
- case KEYCODE_F3: key = Qt::Key_F3; break;
- case KEYCODE_F4: key = Qt::Key_F4; break;
- case KEYCODE_F5: key = Qt::Key_F5; break;
- case KEYCODE_F6: key = Qt::Key_F6; break;
- case KEYCODE_F7: key = Qt::Key_F7; break;
- case KEYCODE_F8: key = Qt::Key_F8; break;
- case KEYCODE_F9: key = Qt::Key_F9; break;
- case KEYCODE_F10: key = Qt::Key_F10; break;
- case KEYCODE_F11: key = Qt::Key_F11; break;
- case KEYCODE_F12: key = Qt::Key_F12; break;
- case KEYCODE_BACKSPACE: key = Qt::Key_Backspace; break;
- case KEYCODE_TAB: key = Qt::Key_Tab; break;
- case KEYCODE_RETURN: key = Qt::Key_Return; break;
- case KEYCODE_KP_ENTER: key = Qt::Key_Enter; break;
- case KEYCODE_UP:
- case KEYCODE_KP_UP:
- key = Qt::Key_Up; break;
- case KEYCODE_DOWN:
- case KEYCODE_KP_DOWN:
- key = Qt::Key_Down; break;
- case KEYCODE_LEFT:
- case KEYCODE_KP_LEFT:
- key = Qt::Key_Left; break;
- case KEYCODE_RIGHT:
- case KEYCODE_KP_RIGHT:
- key = Qt::Key_Right; break;
- case KEYCODE_HOME:
- case KEYCODE_KP_HOME:
- key = Qt::Key_Home; break;
- case KEYCODE_END:
- case KEYCODE_KP_END:
- key = Qt::Key_End; break;
- case KEYCODE_PG_UP:
- case KEYCODE_KP_PG_UP:
- key = Qt::Key_PageUp; break;
- case KEYCODE_PG_DOWN:
- case KEYCODE_KP_PG_DOWN:
- key = Qt::Key_PageDown; break;
- case KEYCODE_INSERT:
- case KEYCODE_KP_INSERT:
- key = Qt::Key_Insert; break;
- case KEYCODE_DELETE:
- case KEYCODE_KP_DELETE:
- key = Qt::Key_Delete; break;
- case KEYCODE_ESCAPE:
- key = Qt::Key_Escape; break;
- default: // none of the above, try the key_scan directly
- unicode = packet.data.key_scan;
- break;
- }
-
// figure out the modifiers that are currently pressed
Qt::KeyboardModifiers modifiers = Qt::NoModifier;
- if (packet.data.flags & KEYMOD_SHIFT)
+ if (packet.data.modifiers & KEYMOD_SHIFT)
modifiers |= Qt::ShiftModifier;
- if (packet.data.flags & KEYMOD_CTRL)
+ if (packet.data.modifiers & KEYMOD_CTRL)
modifiers |= Qt::ControlModifier;
- if (packet.data.flags & KEYMOD_ALT)
+ if (packet.data.modifiers & KEYMOD_ALT)
modifiers |= Qt::AltModifier;
+ if (packet.data.modifiers & KEYMOD_NUM_LOCK)
+ modifiers |= Qt::KeypadModifier;
+#if 0
+ // special case for AltGr
+ if (packet.data.modifiers & KEYMOD_ALTGR)
+ key = Qt::Key_AltGr;
+#endif
+
+ // figure out whether it's a press
+ bool isPress = packet.data.flags & KEY_DOWN;
+ // figure out whether the key is still pressed and the key event is repeated
+ bool isRepeat = packet.data.flags & KEY_REPEAT;
+
+ int key = Qt::Key_unknown;
+ int unicode = 0;
+
+ if (((packet.data.flags & KEY_SYM_VALID) && key_sym_displayable(unicode = packet.data.key_sym))
+ || ((packet.data.flags & KEY_CAP_VALID) && key_sym_displayable(unicode = packet.data.key_cap))) {
+ if (unicode <= 0x0ff) {
+ if (unicode >= 'a' && unicode <= 'z')
+ key = Qt::Key_A + unicode - 'a';
+ else
+ key = unicode;
+ }
+ // Ctrl<something> or Alt<something> is not a displayable character
+ if (modifiers & (Qt::ControlModifier | Qt::AltModifier))
+ unicode = 0;
+ } else {
+ unicode = 0;
+
+ unsigned long sym = 0;
+ if (packet.data.flags & KEY_SYM_VALID)
+ sym = packet.data.key_sym;
+ else if (packet.data.flags & KEY_CAP_VALID)
+ sym = packet.data.key_cap;
- // if the unicode value is not ascii, we ignore it.
- // TODO - do a complete mapping between all QNX scan codes and Qt codes
- if (unicode != 0xffff && !isascii(unicode))
- return; // unprintable character
+ switch (sym) {
+ case KEYCODE_ESCAPE: key = Qt::Key_Escape; unicode = 27; break;
+ case KEYCODE_TAB: key = Qt::Key_Tab; unicode = 9; break;
+ case KEYCODE_BACK_TAB: key = Qt::Key_Backtab; break;
+ case KEYCODE_BACKSPACE: key = Qt::Key_Backspace; unicode = 127; break;
+ case KEYCODE_RETURN: key = Qt::Key_Return; break;
+ case KEYCODE_KP_ENTER: key = Qt::Key_Enter; break;
+ case KEYCODE_INSERT:
+ case KEYCODE_KP_INSERT:
+ key = Qt::Key_Insert; break;
+ case KEYCODE_KP_DELETE:
+ if (modifiers & Qt::KeypadModifier) {
+ key = Qt::Key_Comma;
+ break;
+ }
+ // fall through
+ case KEYCODE_DELETE:
+ key = Qt::Key_Delete; break;
+ case KEYCODE_PAUSE:
+ case KEYCODE_BREAK:
+ if (modifiers & (Qt::ControlModifier | Qt::AltModifier))
+ return; // sometimes occurs at the middle of a key sequence
+ key = Qt::Key_Pause; break;
+ case KEYCODE_PRINT:
+ if (modifiers & (Qt::ControlModifier | Qt::AltModifier))
+ return; // sometimes occurs at the middle of a key sequence
+ key = Qt::Key_Print; break;
+ case KEYCODE_SYSREQ:
+ key = Qt::Key_SysReq; break;
+ case KEYCODE_HOME:
+ case KEYCODE_KP_HOME:
+ key = Qt::Key_Home; break;
+ case KEYCODE_END:
+ case KEYCODE_KP_END:
+ key = Qt::Key_End; break;
+ case KEYCODE_LEFT:
+ case KEYCODE_KP_LEFT:
+ key = Qt::Key_Left; break;
+ case KEYCODE_UP:
+ case KEYCODE_KP_UP:
+ key = Qt::Key_Up; break;
+ case KEYCODE_RIGHT:
+ case KEYCODE_KP_RIGHT:
+ key = Qt::Key_Right; break;
+ case KEYCODE_DOWN:
+ case KEYCODE_KP_DOWN:
+ key = Qt::Key_Down; break;
+ case KEYCODE_PG_UP:
+ case KEYCODE_KP_PG_UP:
+ key = Qt::Key_PageUp; break;
+ case KEYCODE_PG_DOWN:
+ case KEYCODE_KP_PG_DOWN:
+ key = Qt::Key_PageDown; break;
+
+ case KEYCODE_LEFT_SHIFT:
+ case KEYCODE_RIGHT_SHIFT:
+ key = Qt::Key_Shift; break;
+ case KEYCODE_LEFT_CTRL:
+ case KEYCODE_RIGHT_CTRL:
+ key = Qt::Key_Control; break;
+ case KEYCODE_LEFT_ALT:
+ case KEYCODE_RIGHT_ALT:
+ key = Qt::Key_Alt; break;
+ case KEYCODE_CAPS_LOCK:
+ key = Qt::Key_CapsLock; break;
+ case KEYCODE_NUM_LOCK:
+ key = Qt::Key_NumLock; break;
+ case KEYCODE_SCROLL_LOCK:
+ key = Qt::Key_ScrollLock; break;
+
+ case KEYCODE_F1:
+ case KEYCODE_F2:
+ case KEYCODE_F3:
+ case KEYCODE_F4:
+ case KEYCODE_F5:
+ case KEYCODE_F6:
+ case KEYCODE_F7:
+ case KEYCODE_F8:
+ case KEYCODE_F9:
+ case KEYCODE_F10:
+ case KEYCODE_F11:
+ case KEYCODE_F12:
+ key = Qt::Key_F1 + sym - KEYCODE_F1; break;
+
+ case KEYCODE_MENU: key = Qt::Key_Menu; break;
+ case KEYCODE_LEFT_HYPER: key = Qt::Key_Hyper_L; break;
+ case KEYCODE_RIGHT_HYPER: key = Qt::Key_Hyper_R; break;
+
+ case KEYCODE_KP_PLUS: key = Qt::Key_Plus; break;
+ case KEYCODE_KP_MINUS: key = Qt::Key_Minus; break;
+ case KEYCODE_KP_MULTIPLY: key = Qt::Key_multiply; break;
+ case KEYCODE_KP_DIVIDE: key = Qt::Key_Slash; break;
+ case KEYCODE_KP_FIVE:
+ if (!(modifiers & Qt::KeypadModifier))
+ key = Qt::Key_5;
+ break;
+
+ default: // none of the above
+ break;
+ }
+ }
+
+ if (key == Qt::Key_unknown && unicode == 0)
+ return;
// call processKeyEvent. This is where all the magic happens to insert a
// key event into Qt's event loop.
diff --git a/src/gui/embedded/qlock.cpp b/src/gui/embedded/qlock.cpp
index ac15431..eaad15c 100644
--- a/src/gui/embedded/qlock.cpp
+++ b/src/gui/embedded/qlock.cpp
@@ -41,7 +41,6 @@
#include "qlock_p.h"
-
#ifdef QT_NO_QWS_MULTIPROCESS
QT_BEGIN_NAMESPACE
@@ -83,7 +82,7 @@ QT_END_NAMESPACE
#else // QT_NO_QWS_MULTIPROCESS
#if defined(Q_OS_DARWIN)
-# define Q_NO_SEMAPHORE
+# define QT_NO_SEMAPHORE
#endif
#include "qwssignalhandler_p.h"
@@ -91,11 +90,13 @@ QT_END_NAMESPACE
#include <unistd.h>
#include <sys/types.h>
#include <sys/ipc.h>
-#if defined(Q_NO_SEMAPHORE)
+#if defined(QT_NO_SEMAPHORE)
# include <sys/stat.h>
# include <sys/file.h>
-#else
+#elif !defined(QT_POSIX_IPC)
# include <sys/sem.h>
+#else
+# include <semaphore.h>
#endif
#include <string.h>
#include <errno.h>
@@ -109,17 +110,24 @@ QT_BEGIN_NAMESPACE
class QLockData
{
public:
-#ifdef Q_NO_SEMAPHORE
+#if defined(QT_NO_SEMAPHORE) || defined(QT_POSIX_IPC)
QByteArray file;
-#endif // Q_NO_SEMAPHORE
+#endif
+#if !defined(QT_POSIX_IPC)
int id;
+#else
+ sem_t *id; // Read mode resource counter
+ sem_t *rsem; // Read mode lock
+ sem_t *wsem; // Write mode lock
+#endif
int count;
bool owned;
};
+
/*!
\class QLock
- \brief The QLock class is a wrapper for a System V shared semaphore.
+ \brief The QLock class is a wrapper for a system shared semaphore.
\ingroup qws
@@ -148,7 +156,7 @@ QLock::QLock(const QString &filename, char id, bool create)
{
data = new QLockData;
data->count = 0;
-#ifdef Q_NO_SEMAPHORE
+#if defined(QT_NO_SEMAPHORE)
data->file = filename.toLocal8Bit() + id;
for (int x = 0; x < 2; ++x) {
data->id = QT_OPEN(data->file.constData(), O_RDWR | (x ? O_CREAT : 0), S_IRWXU);
@@ -157,7 +165,7 @@ QLock::QLock(const QString &filename, char id, bool create)
break;
}
}
-#else
+#elif !defined(QT_POSIX_IPC)
key_t semkey = ftok(filename.toLocal8Bit().constData(), id);
data->id = semget(semkey, 0, 0);
data->owned = create;
@@ -170,6 +178,28 @@ QLock::QLock(const QString &filename, char id, bool create)
arg.val = MAX_LOCKS;
semctl(data->id, 0, SETVAL, arg);
}
+#else
+ data->file = filename.toLocal8Bit() + id;
+ data->owned = create;
+
+ char ids[3] = { 'c', 'r', 'w' };
+ sem_t **sems[3] = { &data->id, &data->rsem, &data->wsem };
+ unsigned short initialValues[3] = { MAX_LOCKS, 1, 1 };
+ for (int i = 0; i < 3; ++i) {
+ QByteArray file = data->file + ids[i];
+ do {
+ *sems[i] = sem_open(file.constData(), 0, 0666, 0);
+ } while (*sems[i] == SEM_FAILED && errno == EINTR);
+ if (create) {
+ if (*sems[i] != SEM_FAILED) {
+ sem_close(*sems[i]);
+ sem_unlink(file.constData());
+ }
+ do {
+ *sems[i] = sem_open(file.constData(), O_CREAT, 0666, initialValues[i]);
+ } while (*sems[i] == SEM_FAILED && errno == EINTR);
+ }
+ }
#endif
if (!isValid()) {
qWarning("QLock::QLock: Cannot %s semaphore %s '%c' (%d, %s)",
@@ -193,17 +223,32 @@ QLock::~QLock()
while (locked())
unlock();
-#ifdef Q_NO_SEMAPHORE
+
+#if defined(QT_NO_SEMAPHORE)
if (isValid())
QT_CLOSE(data->id);
+#elif defined(QT_POSIX_IPC)
+ if (data->id != SEM_FAILED)
+ sem_close(data->id);
+ if (data->rsem != SEM_FAILED)
+ sem_close(data->rsem);
+ if (data->wsem != SEM_FAILED)
+ sem_close(data->wsem);
#endif
+
if (data->owned) {
-#ifdef Q_NO_SEMAPHORE
+#if defined(QT_NO_SEMAPHORE)
unlink(data->file.constData());
-#else
+#elif !defined(QT_POSIX_IPC)
qt_semun semval;
semval.val = 0;
semctl(data->id, 0, IPC_RMID, semval);
+#else
+ char ids[3] = { 'c', 'r', 'w' };
+ for (int i = 0; i < 3; ++i) {
+ QByteArray file = data->file + ids[i];
+ sem_unlink(file.constData());
+ }
#endif
}
delete data;
@@ -216,7 +261,11 @@ QLock::~QLock()
*/
bool QLock::isValid() const
{
+#if !defined(QT_POSIX_IPC)
return data && data->id != -1;
+#else
+ return data && data->id != SEM_FAILED && data->rsem != SEM_FAILED && data->wsem != SEM_FAILED;
+#endif
}
/*!
@@ -232,21 +281,48 @@ bool QLock::isValid() const
*/
void QLock::lock(Type t)
{
+ if (!isValid())
+ return;
+
if (!data->count) {
type = t;
int rv;
-#ifdef Q_NO_SEMAPHORE
+#if defined(QT_NO_SEMAPHORE)
int op = type == Write ? LOCK_EX : LOCK_SH;
EINTR_LOOP(rv, flock(data->id, op));
-#else
+#elif !defined(QT_POSIX_IPC)
sembuf sops;
sops.sem_num = 0;
sops.sem_op = type == Write ? -MAX_LOCKS : -1;
sops.sem_flg = SEM_UNDO;
EINTR_LOOP(rv, semop(data->id, &sops, 1));
+#else
+ if (type == Write) {
+ EINTR_LOOP(rv, sem_wait(data->rsem));
+ if (rv != -1) {
+ EINTR_LOOP(rv, sem_wait(data->wsem));
+ if (rv == -1)
+ sem_post(data->rsem);
+ }
+ } else {
+ EINTR_LOOP(rv, sem_wait(data->wsem));
+ if (rv != -1) {
+ EINTR_LOOP(rv, sem_trywait(data->rsem));
+ if (rv != -1 || errno == EAGAIN) {
+ EINTR_LOOP(rv, sem_wait(data->id));
+ if (rv == -1) {
+ int semval;
+ sem_getvalue(data->id, &semval);
+ if (semval == MAX_LOCKS)
+ sem_post(data->rsem);
+ }
+ }
+ rv = sem_post(data->wsem);
+ }
+ }
#endif
if (rv == -1) {
qDebug("QLock::lock(): %s", strerror(errno));
@@ -265,19 +341,37 @@ void QLock::lock(Type t)
*/
void QLock::unlock()
{
- if (data->count) {
+ if (!isValid())
+ return;
+
+ if (data->count > 0) {
data->count--;
if (!data->count) {
int rv;
-#ifdef Q_NO_SEMAPHORE
+#if defined(QT_NO_SEMAPHORE)
EINTR_LOOP(rv, flock(data->id, LOCK_UN));
-#else
+#elif !defined(QT_POSIX_IPC)
sembuf sops;
sops.sem_num = 0;
sops.sem_op = type == Write ? MAX_LOCKS : 1;
sops.sem_flg = SEM_UNDO;
EINTR_LOOP(rv, semop(data->id, &sops, 1));
+#else
+ if (type == Write) {
+ sem_post(data->wsem);
+ rv = sem_post(data->rsem);
+ } else {
+ EINTR_LOOP(rv, sem_wait(data->wsem));
+ if (rv != -1) {
+ sem_post(data->id);
+ int semval;
+ sem_getvalue(data->id, &semval);
+ if (semval == MAX_LOCKS)
+ sem_post(data->rsem);
+ rv = sem_post(data->wsem);
+ }
+ }
#endif
if (rv == -1)
qDebug("QLock::unlock(): %s", strerror(errno));
diff --git a/src/gui/embedded/qmouselinuxinput_qws.cpp b/src/gui/embedded/qmouselinuxinput_qws.cpp
index efcf6d4..19a9a99 100644
--- a/src/gui/embedded/qmouselinuxinput_qws.cpp
+++ b/src/gui/embedded/qmouselinuxinput_qws.cpp
@@ -135,19 +135,21 @@ void QWSLinuxInputMousePrivate::readMouseData()
int n = 0;
forever {
- n = QT_READ(m_fd, reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
-
- if (n == 0) {
+ int bytesRead = QT_READ(m_fd, reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
+ if (bytesRead == 0) {
qWarning("Got EOF from the input device.");
return;
- } else if (n < 0 && (errno != EINTR && errno != EAGAIN)) {
- qWarning("Could not read from input device: %s", strerror(errno));
- return;
- } else if (n % sizeof(buffer[0]) == 0) {
+ }
+ if (bytesRead == -1) {
+ if (errno != EAGAIN)
+ qWarning("Could not read from input device: %s", strerror(errno));
break;
}
- }
+ n += bytesRead;
+ if (n % sizeof(buffer[0]) == 0)
+ break;
+ }
n /= sizeof(buffer[0]);
for (int i = 0; i < n; ++i) {
diff --git a/src/gui/embedded/qmouseqnx_qws.cpp b/src/gui/embedded/qmouseqnx_qws.cpp
index a9647c0..d0b892e 100644
--- a/src/gui/embedded/qmouseqnx_qws.cpp
+++ b/src/gui/embedded/qmouseqnx_qws.cpp
@@ -39,14 +39,13 @@
**
****************************************************************************/
-#include "qplatformdefs.h"
#include "qmouseqnx_qws.h"
+#include "qplatformdefs.h"
#include "qsocketnotifier.h"
-#include "qdebug.h"
+#include "private/qcore_unix_p.h"
#include <sys/dcmd_input.h>
-
#include <errno.h>
QT_BEGIN_NAMESPACE
@@ -92,22 +91,28 @@ QT_BEGIN_NAMESPACE
\sa QMouseDriverFactory
*/
-QQnxMouseHandler::QQnxMouseHandler(const QString & /*driver*/, const QString &device)
+QQnxMouseHandler::QQnxMouseHandler(const QString & driver, const QString &device)
+ : QObject(), QWSMouseHandler(driver, device), mouseButtons(Qt::NoButton)
{
// open the mouse device with O_NONBLOCK so reading won't block when there's no data
mouseFD = QT_OPEN(device.isEmpty() ? "/dev/devi/mouse0" : device.toLatin1().constData(),
- QT_OPEN_RDONLY | O_NONBLOCK);
+ QT_OPEN_RDONLY | O_NONBLOCK);
if (mouseFD == -1) {
qErrnoWarning(errno, "QQnxMouseHandler: Unable to open mouse device");
- return;
+ } else {
+ struct _pointer_info data;
+ if (devctl(mouseFD, _POINTERGETINFO, &data, sizeof(data), NULL) == EOK)
+ absolutePositioning = (data.flags & _POINTER_FLAG_ABSOLUTE);
+ else
+ absolutePositioning = !device.isEmpty() && device.contains(QLatin1String("touch"));
+
+ // register a socket notifier on the file descriptor so we'll wake up whenever
+ // there's a mouse move waiting for us.
+ mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this);
+ connect(mouseNotifier, SIGNAL(activated(int)), SLOT(socketActivated()));
+
+ qDebug("QQnxMouseHandler: connected.");
}
-
- // register a socket notifier on the file descriptor so we'll wake up whenever
- // there's a mouse move waiting for us.
- mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this);
- connect(mouseNotifier, SIGNAL(activated(int)), SLOT(socketActivated()));
-
- qDebug() << "QQnxMouseHandler: connected.";
}
/*!
@@ -115,7 +120,8 @@ QQnxMouseHandler::QQnxMouseHandler(const QString & /*driver*/, const QString &de
*/
QQnxMouseHandler::~QQnxMouseHandler()
{
- QT_CLOSE(mouseFD);
+ if (mouseFD != -1)
+ QT_CLOSE(mouseFD);
}
/*! \reimp */
@@ -140,39 +146,45 @@ void QQnxMouseHandler::suspend()
*/
void QQnxMouseHandler::socketActivated()
{
+ QPoint queuedPos = mousePos;
+
// _mouse_packet is a QNX structure. devi-hid is nice enough to translate
// the raw byte data from mouse devices into generic format for us.
- _mouse_packet packet;
+ struct _mouse_packet buffer[32];
+ int n = 0;
- int iteration = 0;
-
- // read mouse events in batches of 10. Since we're getting quite a lot
- // of mouse events, it's better to do them in batches than to return to the
- // event loop every time.
- do {
- int bytesRead = QT_READ(mouseFD, &packet, sizeof(packet));
+ forever {
+ int bytesRead = QT_READ(mouseFD, reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
if (bytesRead == -1) {
// EAGAIN means that there are no more mouse events to read
if (errno != EAGAIN)
- qErrnoWarning(errno, "QQnxMouseHandler: Unable to read from socket");
- return;
+ qErrnoWarning(errno, "QQnxMouseHandler: Could not read from input device");
+ break;
}
- // bytes read should always be equal to the size of a packet.
- Q_ASSERT(bytesRead == sizeof(packet));
+ n += bytesRead;
+ if (n % sizeof(buffer[0]) == 0)
+ break;
+ }
+ n /= sizeof(buffer[0]);
- // translate the coordinates from the QNX data structure to Qt coordinates
- // note the swapped y axis
- QPoint pos = mousePos;
- pos += QPoint(packet.dx, -packet.dy);
+ for (int i = 0; i < n; ++i) {
+ const struct _mouse_packet &packet = buffer[i];
- // QNX only tells us relative mouse movements, not absolute ones, so limit the
- // cursor position manually to the screen
- limitToScreen(pos);
+ // translate the coordinates from the QNX data structure to the Qt coordinates
+ if (absolutePositioning) {
+ queuedPos = QPoint(packet.dx, packet.dy);
+ } else {
+ // note the swapped y axis
+ queuedPos += QPoint(packet.dx, -packet.dy);
+
+ // QNX only tells us relative mouse movements, not absolute ones, so
+ // limit the cursor position manually to the screen
+ limitToScreen(queuedPos);
+ }
// translate the QNX mouse button bitmask to Qt buttons
int buttons = Qt::NoButton;
-
if (packet.hdr.buttons & _POINTER_BUTTON_LEFT)
buttons |= Qt::LeftButton;
if (packet.hdr.buttons & _POINTER_BUTTON_MIDDLE)
@@ -180,11 +192,17 @@ void QQnxMouseHandler::socketActivated()
if (packet.hdr.buttons & _POINTER_BUTTON_RIGHT)
buttons |= Qt::RightButton;
- // call mouseChanged() - this does all the magic to actually move the on-screen
- // mouse cursor.
- mouseChanged(pos, buttons, 0);
- } while (++iteration < 11);
+ if (buttons != mouseButtons) {
+ // send the MouseEvent to avoid missing any clicks
+ mouseChanged(queuedPos, buttons, 0);
+ // mousePos updated by the mouseChanged()
+ queuedPos = mousePos;
+ mouseButtons = buttons;
+ }
+ }
+
+ if (queuedPos != mousePos)
+ mouseChanged(queuedPos, mouseButtons, 0);
}
QT_END_NAMESPACE
-
diff --git a/src/gui/embedded/qmouseqnx_qws.h b/src/gui/embedded/qmouseqnx_qws.h
index 2a5eef2..54deaf3 100644
--- a/src/gui/embedded/qmouseqnx_qws.h
+++ b/src/gui/embedded/qmouseqnx_qws.h
@@ -70,6 +70,8 @@ private Q_SLOTS:
private:
QSocketNotifier *mouseNotifier;
int mouseFD;
+ int mouseButtons;
+ bool absolutePositioning;
};
QT_END_NAMESPACE
diff --git a/src/gui/embedded/qscreen_qws.h b/src/gui/embedded/qscreen_qws.h
index 2ecc6e7..5ff90f9 100644
--- a/src/gui/embedded/qscreen_qws.h
+++ b/src/gui/embedded/qscreen_qws.h
@@ -44,7 +44,7 @@
#include <QtCore/qnamespace.h>
#include <QtCore/qpoint.h>
-#include <QtCore/qlist.h>
+#include <QtCore/qstringlist.h>
#include <QtGui/qrgb.h>
#include <QtCore/qrect.h>
#include <QtGui/qimage.h>
@@ -357,6 +357,7 @@ private:
friend class QVNCScreen;
friend class QLinuxFbScreen;
friend class QVFbScreen;
+ friend class QQnxScreen;
friend class QProxyScreen;
friend class QIntfbScreen;
#endif
diff --git a/src/gui/embedded/qscreenqnx_qws.cpp b/src/gui/embedded/qscreenqnx_qws.cpp
index 4afe087..d34e732 100644
--- a/src/gui/embedded/qscreenqnx_qws.cpp
+++ b/src/gui/embedded/qscreenqnx_qws.cpp
@@ -40,7 +40,9 @@
****************************************************************************/
#include "qscreenqnx_qws.h"
-#include "qdebug.h"
+
+#include <qapplication.h>
+#include <qregexp.h>
#include <gf/gf.h>
@@ -52,6 +54,10 @@ struct QQnxScreenContext
inline QQnxScreenContext()
: device(0), display(0), layer(0), hwSurface(0), memSurface(0), context(0)
{}
+ inline ~QQnxScreenContext()
+ { cleanup(); }
+
+ void cleanup();
gf_dev_t device;
gf_dev_info_t deviceInfo;
@@ -64,6 +70,35 @@ struct QQnxScreenContext
gf_context_t context;
};
+void QQnxScreenContext::cleanup()
+{
+ if (context) {
+ gf_context_free(context);
+ context = 0;
+ }
+ if (memSurface) {
+ gf_surface_free(memSurface);
+ memSurface = 0;
+ }
+ if (hwSurface) {
+ gf_surface_free(hwSurface);
+ hwSurface = 0;
+ }
+ if (layer) {
+ gf_layer_detach(layer);
+ layer = 0;
+ }
+ if (display) {
+ gf_display_detach(display);
+ display = 0;
+ }
+ if (device) {
+ gf_dev_detach(device);
+ device = 0;
+ }
+}
+
+
/*!
\class QQnxScreen
\preliminary
@@ -117,19 +152,23 @@ QQnxScreen::~QQnxScreen()
delete d;
}
-/*! \reimp
+/*!
+ \reimp
*/
bool QQnxScreen::initDevice()
{
- // implement this if you have multiple processes that want to access the display
- // (not required if QT_NO_QWS_MULTIPROCESS is set)
+#ifndef QT_NO_QWS_CURSOR
+ QScreenCursor::initSoftwareCursor();
+#endif
+
return true;
}
-/*! \internal
- Attaches to the named device \a name.
+/*!
+ \internal
+ Attaches to the named device \a name.
*/
-static bool attachDevice(QQnxScreenContext * const d, const char *name)
+static inline bool attachDevice(QQnxScreenContext * const d, const char *name)
{
int ret = gf_dev_attach(&d->device, name, &d->deviceInfo);
if (ret != GF_ERR_OK) {
@@ -139,193 +178,231 @@ static bool attachDevice(QQnxScreenContext * const d, const char *name)
return true;
}
-/*! \internal
- Attaches to the display at index \a displayIndex.
- */
-static bool attachDisplay(QQnxScreenContext * const d, int displayIndex)
+/*!
+ \internal
+ Attaches to the display at index \a displayIndex.
+*/
+static inline bool attachDisplay(QQnxScreenContext * const d, int displayIndex)
{
int ret = gf_display_attach(&d->display, d->device, displayIndex, &d->displayInfo);
if (ret != GF_ERR_OK) {
- qWarning("QQnxScreen: gf_display_attach(%d) failed with error code %d",
- displayIndex, ret);
+ qWarning("QQnxScreen: gf_display_attach(%d) failed with error code %d", displayIndex, ret);
return false;
}
return true;
}
-/*! \internal
- Attaches to the layer \a layerIndex.
- */
-static bool attachLayer(QQnxScreenContext * const d, int layerIndex)
+/*!
+ \internal
+ Attaches to the layer \a layerIndex.
+*/
+static inline bool attachLayer(QQnxScreenContext * const d, int layerIndex)
{
- int ret = gf_layer_attach(&d->layer, d->display, layerIndex, 0);
+ unsigned flags = QApplication::type() != QApplication::GuiServer ? GF_LAYER_ATTACH_PASSIVE : 0;
+ int ret = gf_layer_attach(&d->layer, d->display, layerIndex, flags);
if (ret != GF_ERR_OK) {
- qWarning("QQnxScreen: gf_layer_attach(%d) failed with error code %d", layerIndex,
- ret);
+ qWarning("QQnxScreen: gf_layer_attach(%d) failed with error code %d", layerIndex, ret);
return false;
}
- gf_layer_enable(d->layer);
return true;
}
-/*! \internal
- Creates a new hardware surface (usually on the Gfx card memory) with the dimensions \a w * \a h.
- */
-static bool createHwSurface(QQnxScreenContext * const d, int w, int h)
+/*!
+ \internal
+ Creates a new hardware surface (usually on the Gfx card memory) with the dimensions \a w * \a h.
+*/
+static inline bool createHwSurface(QQnxScreenContext * const d, int w, int h)
{
int ret = gf_surface_create_layer(&d->hwSurface, &d->layer, 1, 0,
- w, h, GF_FORMAT_ARGB8888, 0, 0);
+ w, h, d->displayInfo.format, 0, 0);
if (ret != GF_ERR_OK) {
- qWarning("QQnxScreen: gf_surface_create_layer(%dx%d) failed with error code %d",
- w, h, ret);
+ qWarning("QQnxScreen: gf_surface_create_layer(%dx%d) failed with error code %d", w, h, ret);
return false;
}
gf_layer_set_surfaces(d->layer, &d->hwSurface, 1);
+ gf_layer_enable(d->layer);
+
ret = gf_layer_update(d->layer, 0);
if (ret != GF_ERR_OK) {
qWarning("QQnxScreen: gf_layer_update() failed with error code %d\n", ret);
return false;
}
- return true;
-}
-
-/*! \internal
- Creates an in-memory, linear accessible surface of dimensions \a w * \a h.
- This is the main surface that QWS blits to.
- */
-static bool createMemSurface(QQnxScreenContext * const d, int w, int h)
-{
- // Note: gf_surface_attach() could also be used, so we'll create the buffer
- // and let the surface point to it. Here, we use surface_create instead.
-
- int ret = gf_surface_create(&d->memSurface, d->device, w, h,
- GF_FORMAT_ARGB8888, 0,
- GF_SURFACE_CREATE_CPU_FAST_ACCESS | GF_SURFACE_CREATE_CPU_LINEAR_ACCESSIBLE
- | GF_SURFACE_PHYS_CONTIG | GF_SURFACE_CREATE_SHAREABLE);
+ ret = gf_context_create(&d->context);
if (ret != GF_ERR_OK) {
- qWarning("QQnxScreen: gf_surface_create(%dx%d) failed with error code %d",
- w, h, ret);
+ qWarning("QQnxScreen: gf_context_create() failed with error code %d", ret);
return false;
}
- gf_surface_get_info(d->memSurface, &d->memSurfaceInfo);
-
- if (d->memSurfaceInfo.sid == unsigned(GF_SID_INVALID)) {
- qWarning("QQnxScreen: gf_surface_get_info() failed.");
+ ret = gf_context_set_surface(d->context, d->hwSurface);
+ if (ret != GF_ERR_OK) {
+ qWarning("QQnxScreen: gf_context_set_surface() failed with error code %d", ret);
return false;
}
return true;
}
-/* \internal
- Creates a QNX gf context and sets our memory surface on it.
- */
-static bool createContext(QQnxScreenContext * const d)
+/*!
+ \internal
+ Creates an in-memory, linear accessible surface of dimensions \a w * \a h.
+ This is the main surface that QWS blits to.
+*/
+static inline bool createMemSurface(QQnxScreenContext * const d, int w, int h)
{
- int ret = gf_context_create(&d->context);
+#ifndef QT_NO_QWS_MULTIPROCESS
+ if (QApplication::type() != QApplication::GuiServer) {
+ unsigned sidlist[64];
+ int n = gf_surface_sidlist(d->device, sidlist); // undocumented API
+ for (int i = 0; i < n; ++i) {
+ int ret = gf_surface_attach_by_sid(&d->memSurface, d->device, sidlist[i]);
+ if (ret == GF_ERR_OK) {
+ gf_surface_get_info(d->memSurface, &d->memSurfaceInfo);
+ if (d->memSurfaceInfo.sid != unsigned(GF_SID_INVALID)) {
+ // can we use the surface's vaddr?
+ unsigned flags = GF_SURFACE_CPU_LINEAR_READABLE | GF_SURFACE_CPU_LINEAR_WRITEABLE;
+ if ((d->memSurfaceInfo.flags & flags) == flags)
+ return true;
+ }
+
+ gf_surface_free(d->memSurface);
+ d->memSurface = 0;
+ }
+ }
+ qWarning("QQnxScreen: cannot attach to an usable surface; create a new one.");
+ }
+#endif
+ int ret = gf_surface_create(&d->memSurface, d->device, w, h, d->displayInfo.format, 0,
+ GF_SURFACE_CREATE_CPU_FAST_ACCESS | GF_SURFACE_CREATE_CPU_LINEAR_ACCESSIBLE
+ | GF_SURFACE_CREATE_PHYS_CONTIG | GF_SURFACE_CREATE_SHAREABLE);
if (ret != GF_ERR_OK) {
- qWarning("QQnxScreen: gf_context_create() failed with error code %d", ret);
+ qWarning("QQnxScreen: gf_surface_create(%dx%d) failed with error code %d",
+ w, h, ret);
return false;
}
- ret = gf_context_set_surface(d->context, d->memSurface);
- if (ret != GF_ERR_OK) {
- qWarning("QQnxScreen: gf_context_set_surface() failed with error code %d", ret);
+ gf_surface_get_info(d->memSurface, &d->memSurfaceInfo);
+
+ if (d->memSurfaceInfo.sid == unsigned(GF_SID_INVALID)) {
+ qWarning("QQnxScreen: gf_surface_get_info() failed.");
return false;
}
return true;
}
-/*! \reimp
- Connects to QNX's io-display based device based on the \a displaySpec parameters
- from the \c{QWS_DISPLAY} environment variable. See the QQnxScreen class documentation
- for possible parameters.
+/*!
+ \reimp
+ Connects to QNX's io-display based device based on the \a displaySpec parameters
+ from the \c{QWS_DISPLAY} environment variable. See the QQnxScreen class documentation
+ for possible parameters.
- \sa QQnxScreen
- */
+ \sa QQnxScreen
+*/
bool QQnxScreen::connect(const QString &displaySpec)
{
const QStringList params = displaySpec.split(QLatin1Char(':'), QString::SkipEmptyParts);
- bool isOk = false;
- QRegExp deviceRegExp(QLatin1String("^device=(.+)$"));
- if (params.indexOf(deviceRegExp) != -1) {
- isOk = attachDevice(d, deviceRegExp.cap(1).toLocal8Bit().constData());
- } else {
- // no device specified - attach to device 0 (the default)
- isOk = attachDevice(d, GF_DEVICE_INDEX(0));
+ // default to device 0
+ int deviceIndex = 0;
+ if (!params.isEmpty()) {
+ QRegExp deviceRegExp(QLatin1String("^device=(.+)$"));
+ if (params.indexOf(deviceRegExp) != -1)
+ deviceIndex = deviceRegExp.cap(1).toInt();
}
- if (!isOk)
+ if (!attachDevice(d, GF_DEVICE_INDEX(deviceIndex)))
return false;
qDebug("QQnxScreen: Attached to Device, number of displays: %d", d->deviceInfo.ndisplays);
- // default to display 0
- int displayIndex = 0;
- QRegExp displayRegexp(QLatin1String("^display=(\\d+)$"));
- if (params.indexOf(displayRegexp) != -1) {
- displayIndex = displayRegexp.cap(1).toInt();
+ // default to display id passed to constructor
+ int displayIndex = displayId;
+ if (!params.isEmpty()) {
+ QRegExp displayRegexp(QLatin1String("^display=(\\d+)$"));
+ if (params.indexOf(displayRegexp) != -1)
+ displayIndex = displayRegexp.cap(1).toInt();
}
if (!attachDisplay(d, displayIndex))
return false;
qDebug("QQnxScreen: Attached to Display %d, resolution %dx%d, refresh %d Hz",
- displayIndex, d->displayInfo.xres, d->displayInfo.yres,
- d->displayInfo.refresh);
-
+ displayIndex, d->displayInfo.xres, d->displayInfo.yres, d->displayInfo.refresh);
// default to main_layer_index from the displayInfo struct
- int layerIndex = 0;
- QRegExp layerRegexp(QLatin1String("^layer=(\\d+)$"));
- if (params.indexOf(layerRegexp) != -1) {
- layerIndex = layerRegexp.cap(1).toInt();
- } else {
- layerIndex = d->displayInfo.main_layer_index;
+ int layerIndex = d->displayInfo.main_layer_index;
+ if (!params.isEmpty()) {
+ QRegExp layerRegexp(QLatin1String("^layer=(\\d+)$"));
+ if (params.indexOf(layerRegexp) != -1)
+ layerIndex = layerRegexp.cap(1).toInt();
}
if (!attachLayer(d, layerIndex))
return false;
+ // determine the pixel format and the pixel type
+ switch (d->displayInfo.format) {
+#if defined(QT_QWS_DEPTH_32) || defined(QT_QWS_DEPTH_GENERIC)
+ case GF_FORMAT_ARGB8888:
+ pixeltype = QScreen::BGRPixel;
+ // fall through
+ case GF_FORMAT_BGRA8888:
+ setPixelFormat(QImage::Format_ARGB32);
+ break;
+#endif
+#if defined(QT_QWS_DEPTH_24)
+ case GF_FORMAT_BGR888:
+ pixeltype = QScreen::BGRPixel;
+ setPixelFormat(QImage::Format_RGB888);
+ break;
+#endif
+#if defined(QT_QWS_DEPTH_16) || defined(QT_QWS_DEPTH_GENERIC)
+ case GF_FORMAT_PACK_RGB565:
+ case GF_FORMAT_PKLE_RGB565:
+ case GF_FORMAT_PKBE_RGB565:
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ setFrameBufferLittleEndian((d->displayInfo.format & GF_FORMAT_PKLE) == GF_FORMAT_PKLE);
+#endif
+ setPixelFormat(QImage::Format_RGB16);
+ break;
+#endif
+ default:
+ return false;
+ }
+
// tell QWSDisplay the width and height of the display
w = dw = d->displayInfo.xres;
h = dh = d->displayInfo.yres;
-
- // we only support 32 bit displays for now.
- QScreen::d = 32;
+ QScreen::d = (d->displayInfo.format & GF_FORMAT_BPP); // colour depth
// assume 72 dpi as default, to calculate the physical dimensions if not specified
const int defaultDpi = 72;
-
- // Handle display physical size spec.
- QRegExp mmWidthRegexp(QLatin1String("^mmWidth=(\\d+)$"));
- if (params.indexOf(mmWidthRegexp) == -1) {
- physWidth = qRound(dw * 25.4 / defaultDpi);
- } else {
- physWidth = mmWidthRegexp.cap(1).toInt();
+ // Handle display physical size
+ physWidth = qRound(dw * 25.4 / defaultDpi);
+ physHeight = qRound(dh * 25.4 / defaultDpi);
+ if (!params.isEmpty()) {
+ QRegExp mmWidthRegexp(QLatin1String("^mmWidth=(\\d+)$"));
+ if (params.indexOf(mmWidthRegexp) != -1)
+ physWidth = mmWidthRegexp.cap(1).toInt();
+
+ QRegExp mmHeightRegexp(QLatin1String("^mmHeight=(\\d+)$"));
+ if (params.indexOf(mmHeightRegexp) != -1)
+ physHeight = mmHeightRegexp.cap(1).toInt();
}
- QRegExp mmHeightRegexp(QLatin1String("^mmHeight=(\\d+)$"));
- if (params.indexOf(mmHeightRegexp) == -1) {
- physHeight = qRound(dh * 25.4 / defaultDpi);
- } else {
- physHeight = mmHeightRegexp.cap(1).toInt();
+ if (QApplication::type() == QApplication::GuiServer) {
+ // create a hardware surface with our dimensions. In the old days, it was possible
+ // to get a pointer directly to the hw surface, so we could blit directly. Now, we
+ // have to use one indirection more, because it's not guaranteed that the hw surface
+ // is mappable into our process.
+ if (!createHwSurface(d, w, h))
+ return false;
}
- // create a hardware surface with our dimensions. In the old days, it was possible
- // to get a pointer directly to the hw surface, so we could blit directly. Now, we
- // have to use one indirection more, because it's not guaranteed that the hw surface
- // is mappable into our process.
- if (!createHwSurface(d, w, h))
- return false;
-
// create an in-memory linear surface that is used by QWS. QWS will blit directly in here.
if (!createMemSurface(d, w, h))
return false;
@@ -338,72 +415,84 @@ bool QQnxScreen::connect(const QString &displaySpec)
// the overall size of the in-memory buffer is linestep * height
size = mapsize = lstep * h;
- // create a QNX drawing context
- if (!createContext(d))
- return false;
-
- // we're always using a software cursor for now. Initialize it here.
- QScreenCursor::initSoftwareCursor();
-
// done, the driver should be connected to the display now.
return true;
}
-/*! \reimp
- */
+/*!
+ \reimp
+*/
void QQnxScreen::disconnect()
{
- if (d->context)
- gf_context_free(d->context);
-
- if (d->memSurface)
- gf_surface_free(d->memSurface);
-
- if (d->hwSurface)
- gf_surface_free(d->hwSurface);
-
- if (d->layer)
- gf_layer_detach(d->layer);
-
- if (d->display)
- gf_display_detach(d->display);
-
- if (d->device)
- gf_dev_detach(d->device);
-
- d->memSurface = 0;
- d->hwSurface = 0;
- d->context = 0;
- d->layer = 0;
- d->display = 0;
- d->device = 0;
+ d->cleanup();
}
-/*! \reimp
- */
+/*!
+ \reimp
+*/
void QQnxScreen::shutdownDevice()
{
}
-
-/*! \reimp
- QQnxScreen doesn't support setting the mode, use io-display instead.
- */
+/*!
+ \reimp
+ QQnxScreen doesn't support setting the mode, use io-display instead.
+*/
void QQnxScreen::setMode(int,int,int)
{
qWarning("QQnxScreen: Unable to change mode, use io-display instead.");
}
-/*! \reimp
- */
+/*!
+ \reimp
+*/
bool QQnxScreen::supportsDepth(int depth) const
{
- // only 32-bit for the moment
- return depth == 32;
+ gf_modeinfo_t displayMode;
+ for (int i = 0; gf_display_query_mode(d->display, i, &displayMode) == GF_ERR_OK; ++i) {
+ switch (displayMode.primary_format) {
+#if defined(QT_QWS_DEPTH_32) || defined(QT_QWS_DEPTH_GENERIC)
+ case GF_FORMAT_ARGB8888:
+ case GF_FORMAT_BGRA8888:
+ if (depth == 32)
+ return true;
+ break;
+#endif
+#if defined(QT_QWS_DEPTH_24)
+ case GF_FORMAT_BGR888:
+ if (depth == 24)
+ return true;
+ break;
+#endif
+#if defined(QT_QWS_DEPTH_16) || defined(QT_QWS_DEPTH_GENERIC)
+ case GF_FORMAT_PACK_RGB565:
+ case GF_FORMAT_PKLE_RGB565:
+ case GF_FORMAT_PKBE_RGB565:
+ if (depth == 16)
+ return true;
+ break;
+#endif
+ default:
+ break;
+ }
+ }
+
+ return false;
}
-/*! \reimp
- */
+/*!
+ \reimp
+*/
+void QQnxScreen::blank(bool on)
+{
+ int ret = gf_display_set_dpms(d->display, on ? GF_DPMS_OFF : GF_DPMS_ON);
+ if (ret != GF_ERR_OK)
+ qWarning("QQnxScreen: gf_display_set_dpms() failed with error code %d", ret);
+}
+
+/*!
+ \reimp
+*/
void QQnxScreen::exposeRegion(QRegion r, int changing)
{
// here is where the actual magic happens. QWS will call exposeRegion whenever
@@ -414,6 +503,10 @@ void QQnxScreen::exposeRegion(QRegion r, int changing)
QScreen::exposeRegion(r, changing);
// now our in-memory surface should be up to date with the latest changes.
+
+ if (!d->hwSurface)
+ return;
+
// the code below copies the region from the in-memory surface to the hardware.
// just get the bounding rectangle of the region. Most screen updates are rectangular
@@ -432,16 +525,14 @@ void QQnxScreen::exposeRegion(QRegion r, int changing)
// blit the changed region from the memory surface to the hardware surface
ret = gf_draw_blit2(d->context, d->memSurface, d->hwSurface,
- br.x(), br.y(), br.right(), br.bottom(), br.x(), br.y());
- if (ret != GF_ERR_OK) {
+ br.x(), br.y(), br.right(), br.bottom(), br.x(), br.y());
+ if (ret != GF_ERR_OK)
qWarning("QQnxScreen: gf_draw_blit2() failed with error code %d", ret);
- }
// flush all drawing commands (in our case, a single blit)
ret = gf_draw_flush(d->context);
- if (ret != GF_ERR_OK) {
+ if (ret != GF_ERR_OK)
qWarning("QQnxScreen: gf_draw_flush() failed with error code %d", ret);
- }
// tell QNX that we're done drawing.
gf_draw_end(d->context);
diff --git a/src/gui/embedded/qscreenqnx_qws.h b/src/gui/embedded/qscreenqnx_qws.h
index 38c0ac9..6f6d18a 100644
--- a/src/gui/embedded/qscreenqnx_qws.h
+++ b/src/gui/embedded/qscreenqnx_qws.h
@@ -66,6 +66,7 @@ public:
void shutdownDevice();
void setMode(int,int,int);
bool supportsDepth(int) const;
+ void blank(bool on);
void exposeRegion(QRegion r, int changing);
diff --git a/src/gui/embedded/qwslock.cpp b/src/gui/embedded/qwslock.cpp
index c14f50b..f9ea000 100644
--- a/src/gui/embedded/qwslock.cpp
+++ b/src/gui/embedded/qwslock.cpp
@@ -45,12 +45,15 @@
#include "qwssignalhandler_p.h"
+#include <stdint.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/ipc.h>
+#ifndef QT_POSIX_IPC
#include <sys/sem.h>
+#endif
#include <sys/time.h>
#include <time.h>
#ifdef Q_OS_LINUX
@@ -66,6 +69,12 @@ QT_BEGIN_NAMESPACE
#error QWSLock currently requires semaphores
#endif
+#ifdef QT_POSIX_IPC
+#include <QtCore/QAtomicInt>
+
+static QBasicAtomicInt localUniqueId = Q_BASIC_ATOMIC_INITIALIZER(1);
+#endif
+
QWSLock::QWSLock(int id) : semId(id)
{
static unsigned short initialValues[3] = { 1, 1, 0 };
@@ -74,6 +83,7 @@ QWSLock::QWSLock(int id) : semId(id)
QWSSignalHandler::instance()->addWSLock(this);
#endif
+#ifndef QT_POSIX_IPC
if (semId == -1) {
semId = semget(IPC_PRIVATE, 3, IPC_CREAT | 0666);
if (semId == -1) {
@@ -88,6 +98,30 @@ QWSLock::QWSLock(int id) : semId(id)
qFatal("Unable to initialize semaphores");
}
}
+#else
+ sems[0] = sems[1] = sems[2] = SEM_FAILED;
+ owned = false;
+
+ if (semId == -1) {
+ // ### generate really unique IDs
+ semId = (getpid() << 16) + (localUniqueId.fetchAndAddRelaxed(1) % ushort(-1));
+ owned = true;
+ }
+
+ QByteArray pfx = "/qwslock_" + QByteArray::number(semId, 16) + '_';
+ QByteArray keys[3] = { pfx + "BackingStore", pfx + "Communication", pfx + "RegionEvent" };
+ for (int i = 0; i < 3; ++i) {
+ if (owned)
+ sem_unlink(keys[i].constData());
+ do {
+ sems[i] = sem_open(keys[i].constData(), (owned ? O_CREAT : 0), 0666, initialValues[i]);
+ } while (sems[i] == SEM_FAILED && errno == EINTR);
+ if (sems[i] == SEM_FAILED) {
+ perror("QWSLock::QWSLock");
+ qFatal("Unable to %s semaphore", (owned ? "create" : "open"));
+ }
+ }
+#endif
lockCount[0] = lockCount[1] = 0;
}
@@ -99,10 +133,27 @@ QWSLock::~QWSLock()
#endif
if (semId != -1) {
+#ifndef QT_POSIX_IPC
qt_semun semval;
semval.val = 0;
semctl(semId, 0, IPC_RMID, semval);
semId = -1;
+#else
+ // emulate the SEM_UNDO behavior for the BackingStore lock
+ while (hasLock(BackingStore))
+ unlock(BackingStore);
+
+ QByteArray pfx = "/qwslock_" + QByteArray::number(semId, 16) + '_';
+ QByteArray keys[3] = { pfx + "BackingStore", pfx + "Communication", pfx + "RegionEvent" };
+ for (int i = 0; i < 3; ++i) {
+ if (sems[i] != SEM_FAILED) {
+ sem_close(sems[i]);
+ sems[i] = SEM_FAILED;
+ }
+ if (owned)
+ sem_unlink(keys[i].constData());
+ }
+#endif
}
}
@@ -110,6 +161,7 @@ bool QWSLock::up(unsigned short semNum)
{
int ret;
+#ifndef QT_POSIX_IPC
sembuf sops = { semNum, 1, 0 };
// As the BackingStore lock is a mutex, and only one process may own
// the lock, it's safe to use SEM_UNDO. On the other hand, the
@@ -119,6 +171,9 @@ bool QWSLock::up(unsigned short semNum)
sops.sem_flg |= SEM_UNDO;
EINTR_LOOP(ret, semop(semId, &sops, 1));
+#else
+ ret = sem_post(sems[semNum]);
+#endif
if (ret == -1) {
qDebug("QWSLock::up(): %s", strerror(errno));
return false;
@@ -131,6 +186,7 @@ bool QWSLock::down(unsigned short semNum, int)
{
int ret;
+#ifndef QT_POSIX_IPC
sembuf sops = { semNum, -1, 0 };
// As the BackingStore lock is a mutex, and only one process may own
// the lock, it's safe to use SEM_UNDO. On the other hand, the
@@ -140,6 +196,9 @@ bool QWSLock::down(unsigned short semNum, int)
sops.sem_flg |= SEM_UNDO;
EINTR_LOOP(ret, semop(semId, &sops, 1));
+#else
+ EINTR_LOOP(ret, sem_wait(sems[semNum]));
+#endif
if (ret == -1) {
qDebug("QWSLock::down(): %s", strerror(errno));
return false;
@@ -150,7 +209,13 @@ bool QWSLock::down(unsigned short semNum, int)
int QWSLock::getValue(unsigned short semNum) const
{
- int ret = semctl(semId, semNum, GETVAL, 0);
+ int ret;
+#ifndef QT_POSIX_IPC
+ ret = semctl(semId, semNum, GETVAL, 0);
+#else
+ if (sem_getvalue(sems[semNum], &ret) == -1)
+ ret = -1;
+#endif
if (ret == -1)
qDebug("QWSLock::getValue(): %s", strerror(errno));
return ret;
diff --git a/src/gui/embedded/qwslock_p.h b/src/gui/embedded/qwslock_p.h
index d020b22..71a4cca 100644
--- a/src/gui/embedded/qwslock_p.h
+++ b/src/gui/embedded/qwslock_p.h
@@ -57,6 +57,10 @@
#ifndef QT_NO_QWS_MULTIPROCESS
+#ifdef QT_POSIX_IPC
+# include <semaphore.h>
+#endif
+
QT_BEGIN_NAMESPACE
class QWSLock
@@ -80,6 +84,10 @@ private:
int semId;
int lockCount[2];
+#ifdef QT_POSIX_IPC
+ sem_t *sems[3];
+ bool owned;
+#endif
};
QT_END_NAMESPACE
diff --git a/src/gui/embedded/qwssharedmemory.cpp b/src/gui/embedded/qwssharedmemory.cpp
index a677626..853de61 100644
--- a/src/gui/embedded/qwssharedmemory.cpp
+++ b/src/gui/embedded/qwssharedmemory.cpp
@@ -45,14 +45,37 @@
#include <sys/types.h>
#include <sys/ipc.h>
+#ifndef QT_POSIX_IPC
#include <sys/shm.h>
+#else
+#include <sys/mman.h>
+#include <sys/stat.h>
+#endif
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <private/qcore_unix_p.h>
//#define QT_SHM_DEBUG
QT_BEGIN_NAMESPACE
+#ifdef QT_POSIX_IPC
+#include <QtCore/QAtomicInt>
+
+static QBasicAtomicInt localUniqueId = Q_BASIC_ATOMIC_INITIALIZER(1);
+
+static inline QByteArray makeKey(int id)
+{
+ return "/qwsshm_" + QByteArray::number(id, 16);
+}
+#endif
+
QWSSharedMemory::QWSSharedMemory()
: shmId(-1), shmBase(0), shmSize(0)
+#ifdef QT_POSIX_IPC
+ , hand(-1)
+#endif
{
}
@@ -66,19 +89,47 @@ bool QWSSharedMemory::create(int size)
if (shmId != -1)
detach();
+#ifndef QT_POSIX_IPC
shmId = shmget(IPC_PRIVATE, size, IPC_CREAT | 0600);
+#else
+ // ### generate really unique IDs
+ shmId = (getpid() << 16) + (localUniqueId.fetchAndAddRelaxed(1) % ushort(-1));
+ QByteArray shmName = makeKey(shmId);
+ EINTR_LOOP(hand, shm_open(shmName.constData(), O_RDWR | O_CREAT, 0660));
+ if (hand != -1) {
+ // the size may only be set once; ignore errors
+ int ret;
+ EINTR_LOOP(ret, ftruncate(hand, size));
+ if (ret == -1)
+ shmId = -1;
+ } else {
+ shmId = -1;
+ }
+#endif
if (shmId == -1) {
#ifdef QT_SHM_DEBUG
perror("QWSSharedMemory::create():");
qWarning("Error allocating shared memory of size %d", size);
#endif
+ detach();
return false;
}
+
+#ifndef QT_POSIX_IPC
shmBase = shmat(shmId, 0, 0);
// On Linux, it is possible to attach a shared memory segment even if it
// is already marked to be deleted. However, POSIX.1-2001 does not specify
// this behaviour and many other implementations do not support it.
shmctl(shmId, IPC_RMID, 0);
+#else
+ // grab the size
+ QT_STATBUF st;
+ if (QT_FSTAT(hand, &st) != -1) {
+ shmSize = st.st_size;
+ // grab the memory
+ shmBase = mmap(0, shmSize, PROT_READ | PROT_WRITE, MAP_SHARED, hand, 0);
+ }
+#endif
if (shmBase == (void*)-1 || !shmBase) {
#ifdef QT_SHM_DEBUG
perror("QWSSharedMemory::create():");
@@ -102,7 +153,21 @@ bool QWSSharedMemory::attach(int id)
return false;
shmId = id;
+#ifndef QT_POSIX_IPC
shmBase = shmat(shmId, 0, 0);
+#else
+ QByteArray shmName = makeKey(shmId);
+ EINTR_LOOP(hand, shm_open(shmName.constData(), O_RDWR, 0660));
+ if (hand != -1) {
+ // grab the size
+ QT_STATBUF st;
+ if (QT_FSTAT(hand, &st) != -1) {
+ shmSize = st.st_size;
+ // grab the memory
+ shmBase = mmap(0, shmSize, PROT_READ | PROT_WRITE, MAP_SHARED, hand, 0);
+ }
+ }
+#endif
if (shmBase == (void*)-1 || !shmBase) {
#ifdef QT_SHM_DEBUG
perror("QWSSharedMemory::attach():");
@@ -117,8 +182,28 @@ bool QWSSharedMemory::attach(int id)
void QWSSharedMemory::detach()
{
+#ifndef QT_POSIX_IPC
if (shmBase && shmBase != (void*)-1)
shmdt(shmBase);
+#else
+ if (shmBase && shmBase != (void*)-1)
+ munmap(shmBase, shmSize);
+ if (hand > 0) {
+ // get the number of current attachments
+ int shm_nattch = 0;
+ QT_STATBUF st;
+ if (QT_FSTAT(hand, &st) == 0) {
+ // subtract 2 from linkcount: one for our own open and one for the dir entry
+ shm_nattch = st.st_nlink - 2;
+ }
+ qt_safe_close(hand);
+ // if there are no attachments then unlink the shared memory
+ if (shm_nattch == 0) {
+ QByteArray shmName = makeKey(shmId);
+ shm_unlink(shmName.constData());
+ }
+ }
+#endif
shmBase = 0;
shmSize = 0;
shmId = -1;
@@ -129,11 +214,13 @@ int QWSSharedMemory::size() const
if (shmId == -1)
return 0;
+#ifndef QT_POSIX_IPC
if (!shmSize) {
struct shmid_ds shm;
shmctl(shmId, IPC_STAT, &shm);
- const_cast<QWSSharedMemory *>(this)->shmSize = shm.shm_segsz;
+ shmSize = shm.shm_segsz;
}
+#endif
return shmSize;
}
diff --git a/src/gui/embedded/qwssharedmemory_p.h b/src/gui/embedded/qwssharedmemory_p.h
index f3ce241..42ef6c8 100644
--- a/src/gui/embedded/qwssharedmemory_p.h
+++ b/src/gui/embedded/qwssharedmemory_p.h
@@ -77,7 +77,10 @@ public:
private:
int shmId;
void *shmBase;
- int shmSize;
+ mutable int shmSize;
+#ifdef QT_POSIX_IPC
+ int hand;
+#endif
};
#endif // QT_NO_QWS_MULTIPROCESS
diff --git a/src/gui/graphicsview/qgraphicslayout.cpp b/src/gui/graphicsview/qgraphicslayout.cpp
index cd6416c..6fbe849 100644
--- a/src/gui/graphicsview/qgraphicslayout.cpp
+++ b/src/gui/graphicsview/qgraphicslayout.cpp
@@ -269,18 +269,8 @@ void QGraphicsLayout::activate()
return;
Q_ASSERT(!parentItem->isLayout());
- if (QGraphicsLayout::instantInvalidatePropagation()) {
- QGraphicsWidget *parentWidget = static_cast<QGraphicsWidget*>(parentItem);
- if (!parentWidget->parentLayoutItem()) {
- // we've reached the topmost widget, resize it
- bool wasResized = parentWidget->testAttribute(Qt::WA_Resized);
- parentWidget->resize(parentWidget->size());
- parentWidget->setAttribute(Qt::WA_Resized, wasResized);
- }
-
- setGeometry(parentItem->contentsRect()); // relayout children
- } else {
- setGeometry(parentItem->contentsRect()); // relayout children
+ setGeometry(parentItem->contentsRect()); // relayout children
+ if (!QGraphicsLayout::instantInvalidatePropagation()) {
parentLayoutItem()->updateGeometry();
}
}
@@ -478,7 +468,7 @@ static bool g_instantInvalidatePropagation = false;
/*!
\internal
\since 4.8
- \see instantInvalidatePropagation
+ \sa instantInvalidatePropagation()
Calling this function with \a enable set to true will enable a feature that
makes propagation of invalidation up to ancestor layout items to be done in
@@ -489,7 +479,7 @@ static bool g_instantInvalidatePropagation = false;
invalid (not activated). This is the recommended behaviour.
If not set it will also propagate up the parentLayoutItem() hierarchy, but
- it will stop at the \i first \i widget it encounters, and post a layout
+ it will stop at the \e{first widget} it encounters, and post a layout
request to the widget. When the layout request is consumed, this might
cause it to continue propagation up to the parentLayoutItem() of the
widget. It will continue in this fashion until it has reached a widget with
@@ -508,7 +498,7 @@ void QGraphicsLayout::setInstantInvalidatePropagation(bool enable)
/*!
\internal
\since 4.8
- \see setInstantInvalidatePropagation
+ \sa setInstantInvalidatePropagation()
returns true if the complete widget/layout hierarchy is rearranged in one go.
*/
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index 804394a..965b1b34 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -347,11 +347,10 @@ void QGraphicsWidget::setGeometry(const QRectF &rect)
{
QGraphicsWidgetPrivate *wd = QGraphicsWidget::d_func();
QGraphicsLayoutItemPrivate *d = QGraphicsLayoutItem::d_ptr.data();
- QRectF newGeom;
+ QRectF newGeom = rect;
QPointF oldPos = d->geom.topLeft();
if (!wd->inSetPos) {
setAttribute(Qt::WA_Resized);
- newGeom = rect;
newGeom.setSize(rect.size().expandedTo(effectiveSizeHint(Qt::MinimumSize))
.boundedTo(effectiveSizeHint(Qt::MaximumSize)));
@@ -405,14 +404,7 @@ void QGraphicsWidget::setGeometry(const QRectF &rect)
emit widthChanged();
if (oldSize.height() != newGeom.size().height())
emit heightChanged();
- QGraphicsLayout *lay = wd->layout;
- if (QGraphicsLayout::instantInvalidatePropagation()) {
- if (!lay || lay->isActivated()) {
- QApplication::sendEvent(this, &re);
- }
- } else {
- QApplication::sendEvent(this, &re);
- }
+ QApplication::sendEvent(this, &re);
}
}
@@ -1091,8 +1083,11 @@ void QGraphicsWidget::updateGeometry()
* When the event is received, it will start flowing all the way down to the leaf
* widgets in one go. This will make a relayout flicker-free.
*/
- if (QGraphicsLayout::instantInvalidatePropagation())
- QApplication::postEvent(static_cast<QGraphicsWidget *>(this), new QEvent(QEvent::LayoutRequest));
+ if (QGraphicsLayout::instantInvalidatePropagation()) {
+ Q_D(QGraphicsWidget);
+ ++d->refCountInvokeRelayout;
+ QMetaObject::invokeMethod(this, "_q_relayout", Qt::QueuedConnection);
+ }
}
if (!QGraphicsLayout::instantInvalidatePropagation()) {
bool wasResized = testAttribute(Qt::WA_Resized);
diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h
index 063be2d..5085817 100644
--- a/src/gui/graphicsview/qgraphicswidget.h
+++ b/src/gui/graphicsview/qgraphicswidget.h
@@ -234,6 +234,8 @@ protected:
private:
Q_DISABLE_COPY(QGraphicsWidget)
Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QGraphicsWidget)
+ Q_PRIVATE_SLOT(d_func(), void _q_relayout())
+
friend class QGraphicsScene;
friend class QGraphicsScenePrivate;
friend class QGraphicsView;
diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp
index 8649dec..ca6713b 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.cpp
+++ b/src/gui/graphicsview/qgraphicswidget_p.cpp
@@ -233,6 +233,18 @@ void QGraphicsWidgetPrivate::resolveLayoutDirection()
}
}
+/* private slot */
+void QGraphicsWidgetPrivate::_q_relayout()
+{
+ --refCountInvokeRelayout;
+ if (refCountInvokeRelayout == 0) {
+ Q_Q(QGraphicsWidget);
+ bool wasResized = q->testAttribute(Qt::WA_Resized);
+ q->resize(q->size()); // this will restrict the size
+ q->setAttribute(Qt::WA_Resized, wasResized);
+ }
+}
+
QPalette QGraphicsWidgetPrivate::naturalWidgetPalette() const
{
Q_Q(const QGraphicsWidget);
@@ -903,4 +915,6 @@ void QGraphicsWidgetPrivate::setGeometryFromSetPos()
QT_END_NAMESPACE
+#include "moc_qgraphicswidget.cpp"
+
#endif //QT_NO_GRAPHICSVIEW
diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h
index 398abc3..fd96fce 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.h
+++ b/src/gui/graphicsview/qgraphicswidget_p.h
@@ -81,6 +81,7 @@ public:
polished(0),
inSetPos(0),
autoFillBackground(0),
+ refCountInvokeRelayout(0),
focusPolicy(Qt::NoFocus),
focusNext(0),
focusPrev(0),
@@ -106,6 +107,7 @@ public:
QGraphicsLayout *layout;
void setLayoutDirection_helper(Qt::LayoutDirection direction);
void resolveLayoutDirection();
+ void _q_relayout();
// Style
QPalette palette;
@@ -179,11 +181,14 @@ public:
return false;
return (attributes & (1 << bit)) != 0;
}
+ // 32 bits
quint32 attributes : 10;
quint32 inSetGeometry : 1;
quint32 polished: 1;
quint32 inSetPos : 1;
quint32 autoFillBackground : 1;
+ quint32 refCountInvokeRelayout : 16;
+ quint32 padding : 2; // feel free to use
// Focus
Qt::FocusPolicy focusPolicy;
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index 72738c9..17b7da3 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -77,8 +77,8 @@ else:mac {
SOURCES += image/qpixmap_mac.cpp
}
else:symbian {
- HEADERS += image/qpixmap_s60_p.h
- SOURCES += image/qpixmap_s60.cpp
+ HEADERS += image/qpixmap_raster_symbian_p.h
+ SOURCES += image/qpixmap_raster_symbian.cpp
}
!symbian|contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2) {
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 61a228d..a3378de 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -62,7 +62,11 @@
#include <qhash.h>
+#if defined(Q_OS_SYMBIAN)
+#include <private/qpaintengine_raster_symbian_p.h>
+#else
#include <private/qpaintengine_raster_p.h>
+#endif
#include <private/qimage_p.h>
#include <private/qfont_p.h>
@@ -2008,10 +2012,11 @@ void QImage::fill(uint pixel)
/*!
\fn void QImage::fill(Qt::GlobalColor color)
-
\overload
-
\since 4.8
+
+ Fills the image with the given \a color, described as a standard global
+ color.
*/
void QImage::fill(Qt::GlobalColor color)
@@ -2022,7 +2027,7 @@ void QImage::fill(Qt::GlobalColor color)
/*!
- \fn void QImage::fill(Qt::GlobalColor color)
+ \fn void QImage::fill(const QColor &color)
\overload
@@ -5778,7 +5783,11 @@ QPaintEngine *QImage::paintEngine() const
return 0;
if (!d->paintEngine) {
+#ifdef Q_OS_SYMBIAN
+ d->paintEngine = new QSymbianRasterPaintEngine(const_cast<QImage *>(this));
+#else
d->paintEngine = new QRasterPaintEngine(const_cast<QImage *>(this));
+#endif
}
return d->paintEngine;
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index 76c23c8..4668913 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -271,7 +271,7 @@ private:
friend class QPixmapData;
friend class QX11PixmapData;
friend class QMacPixmapData;
- friend class QS60PixmapData;
+ friend class QSymbianRasterPixmapData;
friend class QBitmap;
friend class QPaintDevice;
friend class QPainter;
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_raster_symbian.cpp
index ac29f5d..ae2682b 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_raster_symbian.cpp
@@ -45,13 +45,13 @@
#include <private/qapplication_p.h>
#include <private/qgraphicssystem_p.h>
#include <private/qt_s60_p.h>
-#include <private/qpaintengine_s60_p.h>
#include <private/qfont_p.h>
+#include <private/qpaintengine_raster_symbian_p.h>
#include "qpixmap.h"
#include "qpixmap_raster_p.h"
#include <qwidget.h>
-#include "qpixmap_s60_p.h"
+#include "qpixmap_raster_symbian_p.h"
#include "qnativeimage_p.h"
#include "qbitmap.h"
#include "qimage.h"
@@ -65,10 +65,10 @@ const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08,
0x10, 0x20, 0x40, 0x80 };
static bool cleanup_function_registered = false;
-static QS60PixmapData *firstPixmap = 0;
+static QSymbianRasterPixmapData *firstPixmap = 0;
// static
-void QS60PixmapData::qt_symbian_register_pixmap(QS60PixmapData *pd)
+void QSymbianRasterPixmapData::qt_symbian_register_pixmap(QSymbianRasterPixmapData *pd)
{
if (!cleanup_function_registered) {
qAddPostRoutine(qt_symbian_release_pixmaps);
@@ -83,7 +83,7 @@ void QS60PixmapData::qt_symbian_register_pixmap(QS60PixmapData *pd)
}
// static
-void QS60PixmapData::qt_symbian_unregister_pixmap(QS60PixmapData *pd)
+void QSymbianRasterPixmapData::qt_symbian_unregister_pixmap(QSymbianRasterPixmapData *pd)
{
if (pd->next)
pd->next->prev = pd->prev;
@@ -94,10 +94,10 @@ void QS60PixmapData::qt_symbian_unregister_pixmap(QS60PixmapData *pd)
}
// static
-void QS60PixmapData::qt_symbian_release_pixmaps()
+void QSymbianRasterPixmapData::qt_symbian_release_pixmaps()
{
- // Scan all QS60PixmapData objects in the system and destroy them.
- QS60PixmapData *pd = firstPixmap;
+ // Scan all QSymbianRasterPixmapData objects in the system and destroy them.
+ QSymbianRasterPixmapData *pd = firstPixmap;
while (pd != 0) {
pd->release();
pd = pd->next;
@@ -393,7 +393,7 @@ QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap)
return pixmap;
}
-QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type),
+QSymbianRasterPixmapData::QSymbianRasterPixmapData(PixelType type) : QRasterPixmapData(type),
symbianBitmapDataAccess(new QSymbianBitmapDataAccess),
cfbsBitmap(0),
pengine(0),
@@ -405,14 +405,14 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type),
qt_symbian_register_pixmap(this);
}
-QS60PixmapData::~QS60PixmapData()
+QSymbianRasterPixmapData::~QSymbianRasterPixmapData()
{
release();
delete symbianBitmapDataAccess;
qt_symbian_unregister_pixmap(this);
}
-void QS60PixmapData::resize(int width, int height)
+void QSymbianRasterPixmapData::resize(int width, int height)
{
if (width <= 0 || height <= 0) {
w = width;
@@ -446,7 +446,7 @@ void QS60PixmapData::resize(int width, int height)
}
}
-void QS60PixmapData::release()
+void QSymbianRasterPixmapData::release()
{
if (cfbsBitmap) {
QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
@@ -464,7 +464,7 @@ void QS60PixmapData::release()
/*!
* Takes ownership of bitmap. Used by window surface
*/
-void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat)
+void QSymbianRasterPixmapData::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat)
{
Q_ASSERT(bitmap);
@@ -496,9 +496,9 @@ void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat)
}
}
-QImage QS60PixmapData::toImage(const QRect &r) const
+QImage QSymbianRasterPixmapData::toImage(const QRect &r) const
{
- QS60PixmapData *that = const_cast<QS60PixmapData*>(this);
+ QSymbianRasterPixmapData *that = const_cast<QSymbianRasterPixmapData*>(this);
that->beginDataAccess();
QImage copy = that->image.copy(r);
that->endDataAccess();
@@ -506,7 +506,7 @@ QImage QS60PixmapData::toImage(const QRect &r) const
return copy;
}
-void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags)
+void QSymbianRasterPixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags)
{
release();
@@ -588,13 +588,13 @@ void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags
}
}
-void QS60PixmapData::copy(const QPixmapData *data, const QRect &rect)
+void QSymbianRasterPixmapData::copy(const QPixmapData *data, const QRect &rect)
{
- const QS60PixmapData *s60Data = static_cast<const QS60PixmapData*>(data);
+ const QSymbianRasterPixmapData *s60Data = static_cast<const QSymbianRasterPixmapData*>(data);
fromImage(s60Data->toImage(rect), Qt::AutoColor | Qt::OrderedAlphaDither);
}
-bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect)
+bool QSymbianRasterPixmapData::scroll(int dx, int dy, const QRect &rect)
{
beginDataAccess();
bool res = QRasterPixmapData::scroll(dx, dy, rect);
@@ -602,7 +602,10 @@ bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect)
return res;
}
-int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
+Q_GUI_EXPORT int qt_defaultDpiX();
+Q_GUI_EXPORT int qt_defaultDpiY();
+
+int QSymbianRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
{
if (!cfbsBitmap)
return 0;
@@ -633,7 +636,7 @@ int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
}
-void QS60PixmapData::fill(const QColor &color)
+void QSymbianRasterPixmapData::fill(const QColor &color)
{
if (color.alpha() != 255) {
QImage im(width(), height(), QImage::Format_ARGB32_Premultiplied);
@@ -647,7 +650,7 @@ void QS60PixmapData::fill(const QColor &color)
}
}
-void QS60PixmapData::setMask(const QBitmap &mask)
+void QSymbianRasterPixmapData::setMask(const QBitmap &mask)
{
if (mask.size().isEmpty()) {
if (image.depth() != 1) {
@@ -678,7 +681,7 @@ void QS60PixmapData::setMask(const QBitmap &mask)
}
}
-void QS60PixmapData::setAlphaChannel(const QPixmap &alphaChannel)
+void QSymbianRasterPixmapData::setAlphaChannel(const QPixmap &alphaChannel)
{
QImage img(toImage());
img.setAlphaChannel(alphaChannel.toImage());
@@ -686,21 +689,21 @@ void QS60PixmapData::setAlphaChannel(const QPixmap &alphaChannel)
fromImage(img, Qt::OrderedDither | Qt::OrderedAlphaDither);
}
-QImage QS60PixmapData::toImage() const
+QImage QSymbianRasterPixmapData::toImage() const
{
return toImage(QRect());
}
-QPaintEngine* QS60PixmapData::paintEngine() const
+QPaintEngine* QSymbianRasterPixmapData::paintEngine() const
{
if (!pengine) {
- QS60PixmapData *that = const_cast<QS60PixmapData*>(this);
- that->pengine = new QS60PaintEngine(&that->image, that);
+ QSymbianRasterPixmapData *that = const_cast<QSymbianRasterPixmapData*>(this);
+ that->pengine = new QSymbianRasterPaintEngine(&that->image, that);
}
return pengine;
}
-void QS60PixmapData::beginDataAccess()
+void QSymbianRasterPixmapData::beginDataAccess()
{
if(!cfbsBitmap)
return;
@@ -740,12 +743,12 @@ void QS60PixmapData::beginDataAccess()
is_null = (w <= 0 || h <= 0);
if (pengine) {
- QS60PaintEngine *engine = static_cast<QS60PaintEngine *>(pengine);
+ QSymbianRasterPaintEngine *engine = static_cast<QSymbianRasterPaintEngine *>(pengine);
engine->prepare(&image);
}
}
-void QS60PixmapData::endDataAccess(bool readOnly) const
+void QSymbianRasterPixmapData::endDataAccess(bool readOnly) const
{
Q_UNUSED(readOnly);
@@ -812,7 +815,7 @@ RSgImage *QPixmap::toSymbianRSgImage() const
return sgImage;
}
-void* QS60PixmapData::toNativeType(NativeType type)
+void* QSymbianRasterPixmapData::toNativeType(NativeType type)
{
if (type == QPixmapData::SgImage) {
return 0;
@@ -895,7 +898,7 @@ void* QS60PixmapData::toNativeType(NativeType type)
return 0;
}
-void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType)
+void QSymbianRasterPixmapData::fromNativeType(void* pixmap, NativeType nativeType)
{
if (nativeType == QPixmapData::SgImage) {
return;
@@ -1005,7 +1008,7 @@ void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType)
}
}
-void QS60PixmapData::convertToDisplayMode(int mode)
+void QSymbianRasterPixmapData::convertToDisplayMode(int mode)
{
const TDisplayMode displayMode = static_cast<TDisplayMode>(mode);
if (!cfbsBitmap || cfbsBitmap->DisplayMode() == displayMode)
@@ -1032,9 +1035,9 @@ void QS60PixmapData::convertToDisplayMode(int mode)
UPDATE_BUFFER();
}
-QPixmapData *QS60PixmapData::createCompatiblePixmapData() const
+QPixmapData *QSymbianRasterPixmapData::createCompatiblePixmapData() const
{
- return new QS60PixmapData(pixelType());
+ return new QSymbianRasterPixmapData(pixelType());
}
QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_raster_symbian_p.h
index e481549..7f4e53a 100644
--- a/src/gui/image/qpixmap_s60_p.h
+++ b/src/gui/image/qpixmap_raster_symbian_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QPIXMAPDATA_S60_P_H
-#define QPIXMAPDATA_S60_P_H
+#ifndef QPIXMAP_RASTER_SYMBIAN_P_H
+#define QPIXMAP_RASTER_SYMBIAN_P_H
//
// W A R N I N G
@@ -81,11 +81,11 @@ private:
bool wasLocked;
};
-class QS60PixmapData : public QRasterPixmapData
+class QSymbianRasterPixmapData : public QRasterPixmapData
{
public:
- QS60PixmapData(PixelType type);
- ~QS60PixmapData();
+ QSymbianRasterPixmapData(PixelType type);
+ ~QSymbianRasterPixmapData();
QPixmapData *createCompatiblePixmapData() const;
@@ -122,20 +122,19 @@ private:
bool formatLocked;
- QS60PixmapData *next;
- QS60PixmapData *prev;
+ QSymbianRasterPixmapData *next;
+ QSymbianRasterPixmapData *prev;
- static void qt_symbian_register_pixmap(QS60PixmapData *pd);
- static void qt_symbian_unregister_pixmap(QS60PixmapData *pd);
+ static void qt_symbian_register_pixmap(QSymbianRasterPixmapData *pd);
+ static void qt_symbian_unregister_pixmap(QSymbianRasterPixmapData *pd);
static void qt_symbian_release_pixmaps();
friend class QPixmap;
friend class QS60WindowSurface;
- friend class QS60PaintEngine;
+ friend class QSymbianRasterPaintEngine;
friend class QS60Data;
};
QT_END_NAMESPACE
-#endif // QPIXMAPDATA_S60_P_H
-
+#endif // QPIXMAP_RASTER_SYMBIAN_P_H
diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp
index c46429c..934dbb8 100644
--- a/src/gui/image/qpixmapdata.cpp
+++ b/src/gui/image/qpixmapdata.cpp
@@ -276,6 +276,11 @@ QImage* QPixmapData::buffer()
}
#if defined(Q_OS_SYMBIAN)
+QVolatileImage QPixmapData::toVolatileImage() const
+{
+ return QVolatileImage();
+}
+
void* QPixmapData::toNativeType(NativeType /* type */)
{
return 0;
diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h
index 5b75aa1..960eb8f 100644
--- a/src/gui/image/qpixmapdata_p.h
+++ b/src/gui/image/qpixmapdata_p.h
@@ -56,6 +56,10 @@
#include <QtGui/qpixmap.h>
#include <QtCore/qatomic.h>
+#ifdef Q_OS_SYMBIAN
+#include <QtGui/private/qvolatileimage_p.h>
+#endif
+
QT_BEGIN_NAMESPACE
class QImageReader;
@@ -135,6 +139,7 @@ public:
}
#if defined(Q_OS_SYMBIAN)
+ virtual QVolatileImage toVolatileImage() const;
virtual void* toNativeType(NativeType type);
virtual void fromNativeType(void* pixmap, NativeType type);
#endif
@@ -154,7 +159,7 @@ protected:
private:
friend class QPixmap;
friend class QX11PixmapData;
- friend class QS60PixmapData;
+ friend class QSymbianRasterPixmapData;
friend class QImagePixmapCleanupHooks; // Needs to set is_cached
friend class QGLTextureCache; //Needs to check the reference count
friend class QExplicitlySharedDataPointer<QPixmapData>;
diff --git a/src/gui/image/qpixmapdatafactory.cpp b/src/gui/image/qpixmapdatafactory.cpp
index f7c79880..ebe89e4 100644
--- a/src/gui/image/qpixmapdatafactory.cpp
+++ b/src/gui/image/qpixmapdatafactory.cpp
@@ -57,7 +57,7 @@
# include <private/qpixmap_raster_p.h>
#endif
#ifdef Q_OS_SYMBIAN
-# include <private/qpixmap_s60_p.h>
+# include <private/qpixmap_raster_symbian_p.h>
#endif
#include "private/qapplication_p.h"
@@ -88,7 +88,7 @@ QPixmapData* QSimplePixmapDataFactory::create(QPixmapData::PixelType type)
#elif defined(Q_WS_QPA)
return new QRasterPixmapData(type);
#elif defined(Q_OS_SYMBIAN)
- return new QS60PixmapData(type);
+ return new QSymbianRasterPixmapData(type);
#else
#error QSimplePixmapDataFactory::create() not implemented
#endif
diff --git a/src/gui/image/qvolatileimage.cpp b/src/gui/image/qvolatileimage.cpp
index b8612b1..9734c82 100644
--- a/src/gui/image/qvolatileimage.cpp
+++ b/src/gui/image/qvolatileimage.cpp
@@ -200,6 +200,16 @@ QImage &QVolatileImage::imageRef() // non-const, in order to cause a detach
return d->image;
}
+/*!
+ Non-detaching version, for read-only access only.
+ Must be guarded by begin/endDataAccess().
+ */
+const QImage &QVolatileImage::constImageRef() const
+{
+ const_cast<QVolatileImageData *>(d.data())->ensureImage();
+ return d->image;
+}
+
void *QVolatileImage::duplicateNativeImage() const
{
return d->duplicateNativeImage();
@@ -289,12 +299,14 @@ bool QVolatileImagePaintEngine::end()
void QVolatileImagePaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm)
{
#ifdef Q_OS_SYMBIAN
- void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage);
- if (nativeData) {
- QVolatileImage *img = static_cast<QVolatileImage *>(nativeData);
- img->beginDataAccess();
- QRasterPaintEngine::drawImage(p, img->imageRef());
- img->endDataAccess(true);
+ QVolatileImage img = pm.pixmapData()->toVolatileImage();
+ if (!img.isNull()) {
+ img.beginDataAccess();
+ // imageRef() would detach and since we received the QVolatileImage from
+ // toVolatileImage() by value, it would cause a copy which would ruin
+ // our goal. So use constImageRef() instead.
+ QRasterPaintEngine::drawImage(p, img.constImageRef());
+ img.endDataAccess(true);
} else {
QRasterPaintEngine::drawPixmap(p, pm);
}
@@ -306,12 +318,11 @@ void QVolatileImagePaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm)
void QVolatileImagePaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
{
#ifdef Q_OS_SYMBIAN
- void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage);
- if (nativeData) {
- QVolatileImage *img = static_cast<QVolatileImage *>(nativeData);
- img->beginDataAccess();
- QRasterPaintEngine::drawImage(r, img->imageRef(), sr);
- img->endDataAccess(true);
+ QVolatileImage img = pm.pixmapData()->toVolatileImage();
+ if (!img.isNull()) {
+ img.beginDataAccess();
+ QRasterPaintEngine::drawImage(r, img.constImageRef(), sr);
+ img.endDataAccess(true);
} else {
QRasterPaintEngine::drawPixmap(r, pm, sr);
}
diff --git a/src/gui/image/qvolatileimage_p.h b/src/gui/image/qvolatileimage_p.h
index 97d6ea6..bed2e91 100644
--- a/src/gui/image/qvolatileimage_p.h
+++ b/src/gui/image/qvolatileimage_p.h
@@ -87,6 +87,7 @@ public:
bool ensureFormat(QImage::Format format);
QImage toImage() const;
QImage &imageRef();
+ const QImage &constImageRef() const;
QPaintEngine *paintEngine();
void setAlphaChannel(const QPixmap &alphaChannel);
void fill(uint pixelValue);
diff --git a/src/gui/image/qvolatileimagedata_symbian.cpp b/src/gui/image/qvolatileimagedata_symbian.cpp
index 6984722..c20c417 100644
--- a/src/gui/image/qvolatileimagedata_symbian.cpp
+++ b/src/gui/image/qvolatileimagedata_symbian.cpp
@@ -53,8 +53,11 @@ static CFbsBitmap *rasterizeBitmap(CFbsBitmap *bitmap, TDisplayMode newMode)
return 0;
}
QScopedPointer<CFbsBitmap> newBitmap(new CFbsBitmap);
- if (newBitmap->Create(bitmap->SizeInPixels(), newMode) != KErrNone) {
- qWarning("QVolatileImage: Failed to create new bitmap");
+ const TSize size = bitmap->SizeInPixels();
+ TInt err = newBitmap->Create(size, newMode);
+ if (err != KErrNone) {
+ qWarning("QVolatileImage: Failed to create new bitmap (w %d h %d dispmode %d err %d)",
+ size.iWidth, size.iHeight, newMode, err);
return 0;
}
CFbsBitmapDevice *bitmapDevice = 0;
@@ -97,6 +100,7 @@ static inline TDisplayMode format2TDisplayMode(QImage::Format format)
mode = Q_SYMBIAN_ECOLOR16MAP;
break;
default:
+ qWarning("QVolatileImage: Unknown image format %d", format);
mode = ENone;
break;
}
@@ -109,8 +113,9 @@ static CFbsBitmap *imageToBitmap(const QImage &image)
return 0;
}
CFbsBitmap *bitmap = new CFbsBitmap;
- if (bitmap->Create(TSize(image.width(), image.height()),
- format2TDisplayMode(image.format())) == KErrNone) {
+ TInt err = bitmap->Create(TSize(image.width(), image.height()),
+ format2TDisplayMode(image.format()));
+ if (err == KErrNone) {
bitmap->BeginDataAccess();
uchar *dptr = reinterpret_cast<uchar *>(bitmap->DataAddress());
int bmpLineLen = bitmap->DataStride();
@@ -128,7 +133,8 @@ static CFbsBitmap *imageToBitmap(const QImage &image)
}
bitmap->EndDataAccess();
} else {
- qWarning("QVolatileImage: Failed to create source bitmap");
+ qWarning("QVolatileImage: Failed to create source bitmap (w %d h %d fmt %d err %d)",
+ image.width(), image.height(), image.format(), err);
delete bitmap;
bitmap = 0;
}
@@ -155,8 +161,9 @@ static CFbsBitmap *convertData(const QVolatileImageData &source, QImage::Format
static CFbsBitmap *duplicateBitmap(const CFbsBitmap &sourceBitmap)
{
CFbsBitmap *bitmap = new CFbsBitmap;
- if (bitmap->Duplicate(sourceBitmap.Handle()) != KErrNone) {
- qWarning("QVolatileImage: Failed to duplicate source bitmap");
+ TInt err = bitmap->Duplicate(sourceBitmap.Handle());
+ if (err != KErrNone) {
+ qWarning("QVolatileImage: Failed to duplicate source bitmap (%d)", err);
delete bitmap;
bitmap = 0;
}
@@ -166,8 +173,10 @@ static CFbsBitmap *duplicateBitmap(const CFbsBitmap &sourceBitmap)
static CFbsBitmap *createBitmap(int w, int h, QImage::Format format)
{
CFbsBitmap *bitmap = new CFbsBitmap;
- if (bitmap->Create(TSize(w, h), format2TDisplayMode(format)) != KErrNone) {
- qWarning("QVolatileImage: Failed to create source bitmap %d,%d (%d)", w, h, format);
+ TInt err = bitmap->Create(TSize(w, h), format2TDisplayMode(format));
+ if (err != KErrNone) {
+ qWarning("QVolatileImage: Failed to create source bitmap (w %d h %d fmt %d err %d)",
+ w, h, format, err);
delete bitmap;
bitmap = 0;
}
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index ebf0ff8..f8d7e28 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -366,7 +366,8 @@ bool QCoeFepInputContext::symbianFilterEvent(QWidget *keyWidget, const QSymbianE
}
if (event->type() == QSymbianEvent::ResourceChangeEvent
- && event->resourceChangeType() == KEikMessageFadeAllWindows) {
+ && (event->resourceChangeType() == KEikMessageFadeAllWindows
+ || event->resourceChangeType() == KEikDynamicLayoutVariantSwitch)) {
reset();
}
@@ -467,7 +468,10 @@ void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget)
}
} else {
if (m_splitViewResizeBy)
- gv->resize(gv->rect().width(), m_splitViewResizeBy);
+ if (m_splitViewPreviousWindowStates & Qt::WindowFullScreen)
+ gv->resize(gv->rect().width(), qApp->desktop()->height());
+ else
+ gv->resize(gv->rect().width(), m_splitViewResizeBy);
}
// Resizing might have led to widget losing its original windowstate.
// Restore previous window state.
@@ -646,6 +650,7 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints)
{
using namespace Qt;
+ reset();
commitTemporaryPreeditString();
const bool anynumbermodes = hints & (ImhDigitsOnly | ImhFormattedNumbersOnly | ImhDialableCharactersOnly);
@@ -698,11 +703,6 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints)
}
else if (anynumbermodes) {
flags |= EAknEditorNumericInputMode;
- if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0
- && ((hints & ImhFormattedNumbersOnly) || (hints & ImhDialableCharactersOnly))) {
- //workaround - the * key does not launch the symbols menu, making it impossible to use these modes unless text mode is enabled.
- flags |= EAknEditorTextInputMode;
- }
}
else if (anytextmodes) {
flags |= EAknEditorTextInputMode;
@@ -783,8 +783,6 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints)
m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_EMAIL_ADDR_SPECIAL_CHARACTER_TABLE_DIALOG);
} else if (needsCharMap) {
m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG);
- } else if ((hints & ImhFormattedNumbersOnly) || (hints & ImhDialableCharactersOnly)) {
- m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG);
} else {
m_fepState->SetSpecialCharacterTableResourceId(0);
}
@@ -895,19 +893,40 @@ void QCoeFepInputContext::translateInputWidget()
m_transformation = (rootItem->transform().isTranslating()) ? QRectF(0,0, gv->width(), rootItem->transform().dy()) : QRectF();
- // Do nothing if the cursor is visible in the splitview area.
- if (splitViewRect.contains(cursorP.boundingRect()))
+ // Adjust cursor bounding rect to be lower, so that view translates if the cursor gets near
+ // the splitview border.
+ QRect cursorRect = cursorP.boundingRect().adjusted(0, cursor.height(), 0, cursor.height());
+ if (splitViewRect.contains(cursorRect))
return;
- // New Y position should be ideally at the center of the splitview area.
- // If that would expose unpainted canvas, limit the tranformation to the visible scene bottom.
-
- const qreal maxY = gv->sceneRect().bottom() - splitViewRect.bottom() + m_transformation.height();
- qreal dy = -(qMin(maxY, (cursor.bottom() - vkbRect.top() / 2)));
-
- // Do not allow transform above screen top.
- if (m_transformation.height() + dy > 0)
+ // New Y position should be ideally just above the keyboard.
+ // If that would expose unpainted canvas, limit the tranformation to the visible scene rect or
+ // to the focus item's shape/clip path.
+
+ const QPainterPath path = gv->scene()->focusItem()->isClipped() ?
+ gv->scene()->focusItem()->clipPath() : gv->scene()->focusItem()->shape();
+ const qreal itemHeight = path.boundingRect().height();
+
+ // Limit the maximum translation so that underlaying window content is not exposed.
+ qreal maxY = gv->sceneRect().bottom() - splitViewRect.bottom();
+ maxY = m_transformation.height() ? (qMin(itemHeight, maxY) + m_transformation.height()) : maxY;
+ if (maxY < 0)
+ maxY = 0;
+
+ // Translation should happen row-by-row, but initially it needs to ensure that cursor is visible.
+ const qreal translation = m_transformation.height() ?
+ cursor.height() : (cursorRect.bottom() - vkbRect.top());
+ const qreal dy = -(qMin(maxY, translation));
+
+ // Do not allow transform above screen top, nor beyond scenerect
+ if (m_transformation.height() + dy > 0 || gv->sceneRect().bottom() + m_transformation.height() < 0) {
+ // If we already have some transformation, remove it.
+ if (m_transformation.height() < 0 || gv->sceneRect().bottom() + m_transformation.height() < 0) {
+ rootItem->resetTransform();
+ translateInputWidget();
+ }
return;
+ }
rootItem->setTransform(QTransform::fromTranslate(0, dy), true);
}
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp
index 52fbfa5..617409f 100644
--- a/src/gui/itemviews/qtableview.cpp
+++ b/src/gui/itemviews/qtableview.cpp
@@ -1102,7 +1102,7 @@ void QTableView::setRootIndex(const QModelIndex &index)
}
/*!
- \reimp
+ \internal
*/
void QTableView::doItemsLayout()
{
diff --git a/src/gui/kernel/qactiongroup.cpp b/src/gui/kernel/qactiongroup.cpp
index 8029dfb..cbab6aa 100644
--- a/src/gui/kernel/qactiongroup.cpp
+++ b/src/gui/kernel/qactiongroup.cpp
@@ -108,8 +108,8 @@ void QActionGroupPrivate::_q_actionHovered()
\ingroup mainwindow-classes
- In some situations it is useful to group actions together. For
- example, if you have a \gui{Left Align} action, a \gui{Right
+ In some situations it is useful to group QAction objects together.
+ For example, if you have a \gui{Left Align} action, a \gui{Right
Align} action, a \gui{Justify} action, and a \gui{Center} action,
only one of these actions should be active at any one time. One
simple way of achieving this is to group the actions together in
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 3803599..361ec6d 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -1288,8 +1288,8 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
|| event->type() == QEvent::LanguageChange
|| event->type() == QEvent::UpdateSoftKeys
|| event->type() == QEvent::InputMethod)) {
- for (int i = 0; i < postedEvents->size(); ++i) {
- const QPostEvent &cur = postedEvents->at(i);
+ for (QPostEventList::const_iterator it = postedEvents->constBegin(); it != postedEvents->constEnd(); ++it) {
+ const QPostEvent &cur = *it;
if (cur.receiver != receiver || cur.event == 0 || cur.event->type() != event->type())
continue;
if (cur.event->type() == QEvent::LayoutRequest
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index 0b9cad8..c5ff799 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -218,7 +218,6 @@ extern OSWindowRef qt_mac_window_for(const QWidget*); //qwidget_mac.cpp
extern QWidget *qt_mac_find_window(OSWindowRef); //qwidget_mac.cpp
extern void qt_mac_set_cursor(const QCursor *); //qcursor_mac.cpp
extern bool qt_mac_is_macsheet(const QWidget *); //qwidget_mac.cpp
-extern QString qt_mac_from_pascal_string(const Str255); //qglobal.cpp
extern void qt_mac_command_set_enabled(MenuRef, UInt32, bool); //qmenu_mac.cpp
extern bool qt_sendSpontaneousEvent(QObject *obj, QEvent *event); // qapplication.cpp
extern void qt_mac_update_cursor(); // qcursor_mac.mm
@@ -2624,8 +2623,6 @@ OSStatus QApplicationPrivate::globalAppleEventProcessor(const AppleEvent *ae, Ap
Return true if you want to stop the event from being processed.
Return false for normal event dispatching. The default
implementation returns false.
-
- \sa macEventFilter(void *nsevent)
*/
bool QApplication::macEventFilter(EventHandlerCallRef, EventRef)
{
diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp
index 5787c71..b23c15c 100644
--- a/src/gui/kernel/qapplication_qpa.cpp
+++ b/src/gui/kernel/qapplication_qpa.cpp
@@ -444,6 +444,9 @@ void QApplication::alert(QWidget *, int)
{
}
+/*!
+ \internal
+*/
QPlatformNativeInterface *QApplication::platformNativeInterface()
{
QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp
index 1197c77..3b6a075 100644
--- a/src/gui/kernel/qapplication_qws.cpp
+++ b/src/gui/kernel/qapplication_qws.cpp
@@ -209,7 +209,7 @@ QString qws_dataDir()
if (!S_ISDIR(buf.st_mode))
qFatal("%s is not a directory", dataDir.constData());
-#if !defined(Q_OS_INTEGRITY) && !defined(Q_OS_VXWORKS)
+#if !defined(Q_OS_INTEGRITY) && !defined(Q_OS_VXWORKS) && !defined(Q_OS_QNX)
if (buf.st_uid != getuid())
qFatal("Qt for Embedded Linux data directory is not owned by user %d", getuid());
@@ -2184,6 +2184,11 @@ void qt_init(QApplicationPrivate *priv, int type)
qws_screen_is_interlaced = read_bool_env_var("QWS_INTERLACE",false);
const char *display = ::getenv("QWS_DISPLAY");
+
+#ifdef QT_QWS_DEFAULT_DRIVER_NAME
+ if (!display) display = QT_QWS_DEFAULT_DRIVER_NAME;
+#endif
+
if (display)
qws_display_spec = display; // since we setenv later!
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 31d02d4..5ac9803 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -134,7 +134,7 @@ void QS60Data::setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, boo
s->MakeVisible(statusPaneVisible);
}
if (buttonGroupVisibilityChanged || statusPaneVisibilityChanged) {
- const QSize size = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect()).size();
+ const QSize size = qt_TRect2QRect(S60->clientRect()).size();
const QSize oldSize; // note that QDesktopWidget::resizeEvent ignores the QResizeEvent contents
QResizeEvent event(size, oldSize);
QApplication::instance()->sendEvent(QApplication::desktop(), &event);
@@ -231,6 +231,28 @@ void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible)
}
}
+TRect QS60Data::clientRect()
+{
+ TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ if (S60->partialKeyboardOpen) {
+ // Adjust client rect when splitview is open, since for some curious reason
+ // native side insists that clientRect starts from (0,0) even though status
+ // pane might be visible.
+ TRect statusPaneRect;
+ TRect mainRect;
+ AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane, statusPaneRect);
+ AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainRect);
+ int clientAreaHeight = mainRect.Height();
+ CEikStatusPane *const s = S60->statusPane();
+ if (s && s->IsVisible())
+ r.Move(0, statusPaneRect.Height());
+ else
+ clientAreaHeight += statusPaneRect.Height();
+ r.SetHeight(clientAreaHeight);
+ }
+ return r;
+}
+
bool qt_nograb() // application no-grab option
{
#if defined(QT_DEBUG)
@@ -908,6 +930,15 @@ TKeyResponse QSymbianControl::sendSymbianKeyEvent(const TKeyEvent &keyEvent, QEv
}
Qt::KeyboardModifiers mods = mapToQtModifiers(keyEvent.iModifiers);
+
+ TInt code = keyEvent.iCode;
+
+ if (mods == Qt::ControlModifier) {
+ //only support ctrl+a .. ctrl+z, 0x40 is the key value before Qt::Key_A
+ if (code > 0 && code < 27)
+ keyCode = 0x40 + code;
+ }
+
QKeyEventEx qKeyEvent(type, keyCode, mods, qt_keymapper_private()->translateKeyEvent(keyCode, mods),
(keyEvent.iRepeats != 0), 1, keyEvent.iScanCode, s60Keysym, keyEvent.iModifiers);
QWidget *widget;
@@ -1435,7 +1466,9 @@ void QSymbianControl::handleClientAreaChange()
if (qwidget->isFullScreen() && !cbaVisibilityHint) {
SetExtentToWholeScreen();
} else if (qwidget->isMaximized() || (qwidget->isFullScreen() && cbaVisibilityHint)) {
- TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ // Note that if there is S60->splitViewLastWidget, it means the resizing is done
+ // by input context handling and we can use just default ClientRect.
+ TRect r = (!S60->splitViewLastWidget) ? S60->clientRect() : static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
SetExtent(r.iTl, r.Size());
} else if (!qwidget->isMinimized()) { // Normal geometry
if (!qwidget->testAttribute(Qt::WA_Resized)) {
@@ -1443,7 +1476,7 @@ void QSymbianControl::handleClientAreaChange()
qwidget->setAttribute(Qt::WA_Resized, false); //not a user resize
}
if (!qwidget->testAttribute(Qt::WA_Moved) && qwidget->windowType() != Qt::Dialog) {
- TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ TRect r = S60->clientRect();
SetPosition(r.iTl);
qwidget->setAttribute(Qt::WA_Moved, false); // not really an explicit position
}
@@ -1489,13 +1522,14 @@ void QSymbianControl::HandleResourceChange(int resourceType)
if (!ic) {
ic = qobject_cast<QCoeFepInputContext *>(qApp->inputContext());
}
- if (ic && isSplitViewWidget(widget)) {
+ if (ic) {
if (resourceType == KSplitViewCloseEvent) {
S60->partialKeyboardOpen = false;
ic->resetSplitViewWidget();
} else {
S60->partialKeyboardOpen = true;
- ic->ensureFocusWidgetVisible(widget);
+ if (isSplitViewWidget(widget))
+ ic->ensureFocusWidgetVisible(widget);
}
}
}
@@ -1508,7 +1542,8 @@ void QSymbianControl::HandleResourceChange(int resourceType)
// client area.
if (S60->statusPane() && (S60->statusPane()->IsVisible() || m_lastStatusPaneVisibility)) {
m_lastStatusPaneVisibility = S60->statusPane()->IsVisible();
- handleClientAreaChange();
+ if (S60->handleStatusPaneResizeNotifications)
+ handleClientAreaChange();
}
if (IsFocused() && IsVisible()) {
qwidget->d_func()->setWindowIcon_sys(true);
@@ -1531,6 +1566,11 @@ void QSymbianControl::HandleResourceChange(int resourceType)
QResizeEvent e(qt_desktopWidget->size(), qt_desktopWidget->size());
QApplication::sendEvent(qt_desktopWidget, &e);
}
+ // Send resize event to dialogs so they can adjust their position if necessary.
+ if (qwidget->windowType() & Qt::Dialog) {
+ QResizeEvent e(qwidget->size(), qwidget->size());
+ QApplication::sendEvent(qwidget, &e);
+ }
break;
}
#endif
@@ -1907,7 +1947,7 @@ void qt_cleanup()
qt_S60Beep = 0;
}
QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles
- QPixmapCache::clear(); // Has to happen now, since QS60PixmapData has FBS handles
+ QPixmapCache::clear(); // Has to happen now, since QSymbianRasterPixmapData has FBS handles
#ifdef QT_NO_FREETYPE
qt_cleanup_symbianFontDatabase();
diff --git a/src/gui/kernel/qdesktopwidget_s60.cpp b/src/gui/kernel/qdesktopwidget_s60.cpp
index 156c970..86d8f3f 100644
--- a/src/gui/kernel/qdesktopwidget_s60.cpp
+++ b/src/gui/kernel/qdesktopwidget_s60.cpp
@@ -161,7 +161,7 @@ void QDesktopWidgetPrivate::init(QDesktopWidget *that)
(*rects)[i] = r;
QRect wr;
if (i == 0)
- wr = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect());
+ wr = qt_TRect2QRect(S60->clientRect());
else
wr = rects->at(i);
(*workrects)[i].setRect(wr.x(), wr.y(), wr.width(), wr.height());
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index bdd2fe4..de2d87e 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3103,10 +3103,10 @@ QUrl QFileOpenEvent::url() const
}
/*!
- \fn bool openFile(QFile &file, QIODevice::OpenMode flags) const
+ \fn bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const
- Opens a QFile on the file referenced by this event.
- Returns true if successful; otherwise returns false.
+ Opens a QFile on the \a file referenced by this event in the mode specified
+ by \a flags. Returns true if successful; otherwise returns false.
This is necessary as some files cannot be opened by name, but require specific
information stored in this event.
diff --git a/src/gui/kernel/qgenericplugin_qpa.cpp b/src/gui/kernel/qgenericplugin_qpa.cpp
index ca2fe7a..e7b65b7 100644
--- a/src/gui/kernel/qgenericplugin_qpa.cpp
+++ b/src/gui/kernel/qgenericplugin_qpa.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
\brief The QGenericPlugin class is an abstract base class for
window-system related plugins in Qt QPA.
- Note that this class is only available in \l{Qt QPA}.
+ Note that this class is only available in Qt QPA.
A mouse plugin can be created by subclassing
QGenericPlugin and reimplementing the pure virtual keys() and
diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.cpp b/src/gui/kernel/qgenericpluginfactory_qpa.cpp
index 8db22fb..fb6a0d8 100644
--- a/src/gui/kernel/qgenericpluginfactory_qpa.cpp
+++ b/src/gui/kernel/qgenericpluginfactory_qpa.cpp
@@ -65,8 +65,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
\brief The QGenericPluginFactory class creates window-system
related plugin drivers in Qt QPA.
- Note that this class is only available in \l{Qt QPA}.
-
+ Note that this class is only available in Qt QPA.
\sa QGenericPlugin
*/
diff --git a/src/gui/kernel/qmime_mac.cpp b/src/gui/kernel/qmime_mac.cpp
index a1df34e..8b47d8e 100644
--- a/src/gui/kernel/qmime_mac.cpp
+++ b/src/gui/kernel/qmime_mac.cpp
@@ -119,10 +119,6 @@ const QStringList& qEnabledDraggedTypes()
*****************************************************************************/
//#define DEBUG_MIME_MAPS
-//functions
-extern QString qt_mac_from_pascal_string(const Str255); //qglobal.cpp
-extern void qt_mac_from_pascal_string(QString, Str255, TextEncoding encoding=0, int len=-1); //qglobal.cpp
-
ScrapFlavorType qt_mac_mime_type = 'CUTE';
CFStringRef qt_mac_mime_typeUTI = CFSTR("com.pasteboard.trolltech.marker");
diff --git a/src/gui/kernel/qplatformcursor_qpa.cpp b/src/gui/kernel/qplatformcursor_qpa.cpp
index e612e2d..0695486 100644
--- a/src/gui/kernel/qplatformcursor_qpa.cpp
+++ b/src/gui/kernel/qplatformcursor_qpa.cpp
@@ -52,48 +52,46 @@ QT_BEGIN_NAMESPACE
QList <QWeakPointer<QPlatformCursor> > QPlatformCursorPrivate::instances;
/*!
- \class QGraphicsSystemCursor
+ \class QPlatformCursor
- \brief The QGraphicsSystemCursor class provides information about
+ \brief The QPlatformCursor class provides information about
pointer device events (movement, buttons), and requests to change
the currently displayed cursor.
- Note that QGraphicsSystemCursor does not include any graphics for
+ Note that QPlatformCursor does not include any graphics for
display. An application that sets a QCursor may provide its own
graphics.
- \sa QGraphicsSystemCursorImage
+ \sa QPlatformCursorImage
*/
/*!
- \fn virtual void QGraphicsSystemCursor::pointerEvent(const QMouseEvent & event)
+ \fn virtual void QPlatformCursor::pointerEvent(const QMouseEvent & event)
This method is called by Qt whenever a QMouseEvent is generated by the
underlying pointer input. \a event is a reference to the QMouseEvent in
question. A default do-nothing implementation is provided.
-
- \sa QApplicationPrivate::handleMouseEvent()
*/
/*!
- \fn virtual void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor, QWidget * widget)
+ \fn virtual void QPlatformCursor::changeCursor(QCursor * widgetCursor, QWidget * widget)
\brief This method is called by Qt whenever the cursor graphic should be changed.
- Implementation of this method is mandatory for a subclass of QGraphicsSystemCursor.
+ Implementation of this method is mandatory for a subclass of QPlatformCursor.
\a widgetCursor is a pointer to the QCursor that should be displayed.
\a widget is a pointer to the widget currently displayed at QCursor::pos(). Note
that this may be 0 if the current position is not occupied by a displayed widget.
- \sa QApplicationPrivate::handleMouseEvent(), QCursor::pos()
+ \sa QCursor::pos()
*/
/*!
- \fn QGraphicsSystemCursor::QGraphicsSystemCursor()
+ \fn QPlatformCursor::QPlatformCursor(QPlatformScreen *screen)
- \brief Constructs a QGraphicsSystemCursor
+ Constructs a QPlatformCursor for the given \a screen.
*/
QPlatformCursor::QPlatformCursor(QPlatformScreen *scr )
: screen(scr)
@@ -106,12 +104,12 @@ QPlatformCursor::QPlatformCursor(QPlatformScreen *scr )
// from src/gui/embedded/QGraphicsSystemCursorImage_qws.cpp
/*!
- \class QGraphicsSystemCursorImage
+ \class QPlatformCursorImage
- \brief The QGraphicsSystemCursorImage class provides a set of graphics
+ \brief The QPlatformCursorImage class provides a set of graphics
intended to be used as cursors.
- \sa QGraphicsSystemCursor
+ \sa QPlatformCursor
*/
static QPlatformCursorImage *systemCursorTable[Qt::LastCursor+1];
@@ -502,7 +500,7 @@ void QPlatformCursorImage::createSystemCursor(int id)
}
/*!
- \fn void QGraphicsSystemCursorImage::set(Qt::CursorShape id)
+ \fn void QPlatformCursorImage::set(Qt::CursorShape id)
\brief Calling this method sets the cursor image to the specified shape
@@ -531,15 +529,8 @@ void QPlatformCursorImage::set(Qt::CursorShape id)
}
/*!
- \fn void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy)
-
- \brief Set the cursor image to the specified QImage, with the hotsport at (hx, hy)
-
- \a image A pointer to a QImage
-
- \a hx The x coordinate of the cursor's hotspot
-
- \a hy the y coordinate of the cursor's hotspot
+ Sets the cursor image to the given \a image, with the hotspot at the
+ point specified by (\a hx, \a hy).
*/
void QPlatformCursorImage::set(const QImage &image, int hx, int hy)
@@ -550,22 +541,19 @@ void QPlatformCursorImage::set(const QImage &image, int hx, int hy)
}
/*!
- \fn void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy)
-
- \brief set the cursor image to the graphic represented by the combination of data, mask,
- width, and height
-
- \a data The pixel data of the graphic
-
- \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn
+ \fn void QPlatformCursorImage::set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy)
- \a width The width of the graphic in pixels
+ Sets the cursor image to the graphic represented by the combination of
+ \a data and \a mask, with dimensions given by \a width and \a height and a
+ hotspot at the point specified by (\a hx, \a hy).
- \a height The height of the graphic in pixels
+ The image data specified by \a data must be supplied in the format
+ described by QImage::Format_Indexed8.
- \a hx The X hotspot of the cursor graphic
-
- \a hy The Y hotspot of the cursor graphic
+ The corresponding mask data specified by \a mask must be supplied in a
+ character array containing packed 1 bit per pixel format data, with any
+ padding bits at the end of the array. Bits of value 0 represent transparent
+ pixels in the image data.
*/
void QPlatformCursorImage::set(const uchar *data, const uchar *mask,
int width, int height, int hx, int hy)
@@ -625,34 +613,23 @@ void QPlatformCursorImage::set(const uchar *data, const uchar *mask,
}
/*!
- \fn QGraphicsSystemCursorImage::QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY)
-
- \brief set the cursor image to the graphic represented by the combination of data, mask,
- width, and height
-
- \a data The pixel data of the graphic
-
- \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn
-
- \a width The width of the graphic in pixels
-
- \a height The height of the graphic in pixels
-
- \a hotX The X hotspot of the cursor graphic
+ \fn QPlatformCursorImage::QPlatformCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY)
- \a hotY The Y hotspot of the cursor graphic
+ Sets the cursor image to the graphic represented by the combination of
+ \a data and \a mask, with dimensions given by \a width and \a height and a
+ hotspot at the point specified by (\a hotX, \a hotY).
- \sa set
+ \sa set()
*/
/*!
- \fn QImage *QGraphicsSystemCursorImage::image()
+ \fn QImage *QPlatformCursorImage::image()
\brief Return the cursor graphic as a pointer to a QImage
*/
/*!
- \fn QPoint QGraphicsSystemCursorImage::hotspot()
+ \fn QPoint QPlatformCursorImage::hotspot()
\brief Return the cursor's hotspot
*/
diff --git a/src/gui/kernel/qplatformglcontext_qpa.cpp b/src/gui/kernel/qplatformglcontext_qpa.cpp
index 8daa5d4..5c56efb 100644
--- a/src/gui/kernel/qplatformglcontext_qpa.cpp
+++ b/src/gui/kernel/qplatformglcontext_qpa.cpp
@@ -191,17 +191,17 @@ void QPlatformGLContext::deleteQGLContext()
which maps to the QPlatformGLContext.
*/
-/*! \fn void swapBuffers()
+/*! \fn void QPlatformGLContext::swapBuffers()
Reimplement in subclass to native swap buffers calls
*/
-/*! getProcAddress(const QString& procName)
+/*! \fn void *QPlatformGLContext::getProcAddress(const QString &procName)
Reimplement in subclass to native getProcAddr calls.
Note: its convenient to use qPrintable(const QString &str) to get the const char * pointer
*/
-/*! platformWindowFormat() const
+/*! \fn QPlatformWindowFormat QPlatformGLContext::platformWindowFormat() const
QWidget has the function qplatformWindowFormat(). That function is for the application
programmer to request the format of the window and the context that he wants.
diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp
index 972fb0a..29287fe 100644
--- a/src/gui/kernel/qplatformintegration_qpa.cpp
+++ b/src/gui/kernel/qplatformintegration_qpa.cpp
@@ -132,20 +132,20 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const
the recommended approach for making new platform plugin is to copy an existing plugin inside
the QTSRCTREE/src/plugins/platform and develop the plugin inside the source tree.
- The minimal platformintegration is the smallest platform integration it is possible to make,
+ The minimal platform integration is the smallest platform integration it is possible to make,
which makes it an ideal starting point for new plugins. For a slightly more advanced plugin,
consider reviewing the directfb plugin, or the testlite plugin.
*/
/*!
- \fn QPixmapData *createPixmapData(QPixmapData::PixelType type) const
+ \fn QPixmapData *QPlatformIntegration::createPixmapData(QPixmapData::PixelType type) const
Factory function for QPixmapData. PixelType can be either PixmapType or BitmapType.
\sa QPixmapData
*/
/*!
- \fn QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const
+ \fn QPlatformWindow *QPlatformIntegration::createPlatformWindow(QWidget *widget, WId winId = 0) const
Factory function for QPlatformWindow. The widget parameter is a pointer to the top level
widget(tlw) which the QPlatformWindow is suppose to be created for. The WId handle is actually
@@ -162,7 +162,7 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const
*/
/*!
- \fn QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const
+ \fn QWindowSurface *QPlatformIntegration::createWindowSurface(QWidget *widget, WId winId) const
Factory function for QWindowSurface. The QWidget parameter is a pointer to the
top level widget(tlw) the window surface is created for. A QPlatformWindow is always created
@@ -175,7 +175,7 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const
*/
/*!
- \fn void moveToScreen(QWidget *window, int screen)
+ \fn void QPlatformIntegration::moveToScreen(QWidget *window, int screen)
This function is called when a QWidget is displayed on screen, or the QWidget is to be
displayed on a new screen. The QWidget parameter is a pointer to the top level widget and
@@ -187,14 +187,14 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const
*/
/*!
- \fn QList<QPlatformScreen *> screens() const
+ \fn QList<QPlatformScreen *> QPlatformIntegration::screens() const
Accessor function to a list of all the screens on the current system. The screen with the
index == 0 is the default/main screen.
*/
/*!
- \fn bool isVirtualDesktop()
+ \fn bool QPlatformIntegration::isVirtualDesktop()
Returns if the current windowing system configuration defines all the screens to be one
desktop(virtual desktop), or if each screen is a desktop of its own.
@@ -203,7 +203,7 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const
*/
/*!
- \fn QPixmap grabWindow(WId window, int x, int y, int width, int height) const
+ \fn QPixmap QPlatformIntegration::grabWindow(WId window, int x, int y, int width, int height) const
This function is called when Qt needs to be able to grab the content of a window.
diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp
index 87e40e4..2a1e7e4 100644
--- a/src/gui/kernel/qplatformscreen_qpa.cpp
+++ b/src/gui/kernel/qplatformscreen_qpa.cpp
@@ -66,12 +66,15 @@ QWidget *QPlatformScreen::topLevelAt(const QPoint & pos) const
return 0;
}
-/*! \fn physicalSize() const
- Reimplement in subclass to return the physical size of the screen. This function is used by
- QFont to convert point sizes to pixel sizes.
-
- Default implementation takes the pixel size of the screen, considers a dpi of 100 and returns
- the calculated (and probably wrong) physical size
+/*!
+ Reimplement this function in subclass to return the physical size of the
+ screen. This function is used by QFont to convert point sizes to pixel
+ sizes.
+
+ The default implementation takes the pixel size of the screen, considers a
+ resolution of 100 dots per inch, and returns the calculated physical size.
+ A device with a screen that has different resolutions will need to be
+ supported by a suitable reimplementation of this function.
*/
QSize QPlatformScreen::physicalSize() const
{
@@ -110,20 +113,20 @@ QPlatformScreen * QPlatformScreen::platformScreenForWidget(const QWidget *widget
QPlatformScreen is also used by the public api QDesktopWidget for information about the desktop.
*/
-/*! \fn geometry() const
+/*! \fn QRect QPlatformScreen::geometry() const = 0
Reimplement in subclass to return the pixel geometry of the screen
*/
-/*! \fn availableGeometry() const
+/*! \fn QRect QPlatformScreen::availableGeometry() const
Reimplement in subclass to return the pixel geometry of the available space
This normally is the desktop screen minus the task manager, global menubar etc.
*/
-/*! \fn depth() const
+/*! \fn int QPlatformScreen::depth() const = 0
Reimplement in subclass to return current depth of the screen
*/
-/*! \fn format() const
+/*! \fn QImage::Format QPlatformScreen::format() const = 0
Reimplement in subclass to return the image format which corresponds to the screen format
*/
diff --git a/src/gui/kernel/qplatformwindowformat_qpa.cpp b/src/gui/kernel/qplatformwindowformat_qpa.cpp
index e89b458..482ae68 100644
--- a/src/gui/kernel/qplatformwindowformat_qpa.cpp
+++ b/src/gui/kernel/qplatformwindowformat_qpa.cpp
@@ -122,8 +122,6 @@ public:
\i \link setStencil() Stencil buffer.\endlink
\i \link setStereo() Stereo buffers.\endlink
\i \link setDirectRendering() Direct rendering.\endlink
- \i \link setOverlay() Presence of an overlay.\endlink
- \i \link setPlane() Plane of an overlay.\endlink
\i \link setSampleBuffers() Multisample buffers.\endlink
\endlist
@@ -168,7 +166,7 @@ public:
United States and other countries.
\endlegalese
- \sa QPlatformContext, QWidget
+ \sa QPlatformGLContext, QWidget
*/
/*!
@@ -182,8 +180,6 @@ public:
\i \link setStencil() Stencil buffer:\endlink Enabled.
\i \link setStereo() Stereo:\endlink Disabled.
\i \link setDirectRendering() Direct rendering:\endlink Enabled.
- \i \link setOverlay() Overlay:\endlink Disabled.
- \i \link setPlane() Plane:\endlink 0 (i.e., normal plane).
\i \link setSampleBuffers() Multisample buffers:\endlink Disabled.
\endlist
*/
@@ -207,14 +203,10 @@ QPlatformWindowFormat::QPlatformWindowFormat()
\snippet doc/src/snippets/code/src_opengl_qgl.cpp 3
Note that there are QGL::FormatOption values to turn format settings
- both on and off, e.g. QGL::DepthBuffer and QGL::NoDepthBuffer,
+ both on and off; e.g., QGL::DepthBuffer and QGL::NoDepthBuffer,
QGL::DirectRendering and QGL::IndirectRendering, etc.
- The \a plane parameter defaults to 0 and is the plane which this
- format should be associated with. Not all OpenGL implementations
- supports overlay/underlay rendering planes.
-
- \sa defaultFormat(), setOption(), setPlane()
+ \sa defaultFormat(), setOption()
*/
QPlatformWindowFormat::QPlatformWindowFormat(QPlatformWindowFormat::FormatOptions options)
@@ -619,8 +611,6 @@ QPlatformGLContext *QPlatformWindowFormat::sharedGLContext() const
Otherwise returns false.
WindowSurface is enabled by default.
-
- \sa setOverlay()
*/
/*!
@@ -628,9 +618,7 @@ QPlatformGLContext *QPlatformWindowFormat::sharedGLContext() const
otherwise the QWidget will only have a QPlatformWindow.
- This is useful for ie. QGLWidget where the QPlatformGLContext controls the surface.
-
- \sa hasOverlay()
+ This is useful for QGLWidget where the QPlatformGLContext controls the surface.
*/
void QPlatformWindowFormat::setWindowSurface(bool enable)
@@ -894,7 +882,7 @@ void QPlatformWindowFormat::setDefaultFormat(const QPlatformWindowFormat &f)
}
-/*!
+/*
Returns the default QPlatformWindowFormat for overlay contexts.
The default overlay format is:
@@ -907,9 +895,7 @@ void QPlatformWindowFormat::setDefaultFormat(const QPlatformWindowFormat &f)
\i \link setStencil() Stencil buffer:\endlink Disabled.
\i \link setStereo() Stereo:\endlink Disabled.
\i \link setDirectRendering() Direct rendering:\endlink Enabled.
- \i \link setOverlay() Overlay:\endlink Disabled.
\i \link setSampleBuffers() Multisample buffers:\endlink Disabled.
- \i \link setPlane() Plane:\endlink 1 (i.e., first overlay plane).
\endlist
\sa setDefaultFormat()
diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp
index 57893f9..a866da3 100644
--- a/src/gui/kernel/qsoftkeymanager.cpp
+++ b/src/gui/kernel/qsoftkeymanager.cpp
@@ -48,9 +48,6 @@
#ifdef Q_WS_S60
#include "private/qsoftkeymanager_s60_p.h"
-#endif
-
-#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4)
#include "private/qt_s60_p.h"
#endif
@@ -193,11 +190,14 @@ void QSoftKeyManager::sendKeyEvent()
void QSoftKeyManager::updateSoftKeys()
{
- if (QApplication::activeWindow()) {
- QSoftKeyManager::instance()->d_func()->pendingUpdate = true;
- QEvent *event = new QEvent(QEvent::UpdateSoftKeys);
- QApplication::postEvent(QSoftKeyManager::instance(), event);
- }
+#ifdef Q_WS_S60
+ // Do not adjust softkeys if application is not the topmost one
+ if (S60->wsSession().GetFocusWindowGroup() != S60->windowGroup().WindowGroupId())
+ return;
+#endif
+ QSoftKeyManager::instance()->d_func()->pendingUpdate = true;
+ QEvent *event = new QEvent(QEvent::UpdateSoftKeys);
+ QApplication::postEvent(QSoftKeyManager::instance(), event);
}
bool QSoftKeyManager::appendSoftkeys(const QWidget &source, int level)
diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp
index acdb0e5..b5d0101 100644
--- a/src/gui/kernel/qsoftkeymanager_s60.cpp
+++ b/src/gui/kernel/qsoftkeymanager_s60.cpp
@@ -53,6 +53,10 @@
#include <eiksoftkeyimage.h>
#include <eikcmbut.h>
+#ifndef QT_NO_STYLE_S60
+#include <qs60style.h>
+#endif
+
#ifndef QT_NO_SOFTKEYMANAGER
QT_BEGIN_NAMESPACE
@@ -220,26 +224,42 @@ bool QSoftKeyManagerPrivateS60::isOrientationLandscape()
QSize QSoftKeyManagerPrivateS60::cbaIconSize(CEikButtonGroupContainer *cba, int position)
{
-
int index = position;
index += isOrientationLandscape() ? 0 : 1;
if(cachedCbaIconSize[index].isNull()) {
- // Only way I figured out to get CBA icon size without RnD SDK, was
- // to set some dummy icon to CBA first and then ask CBA button CCoeControl::Size()
- // The returned value is cached to avoid unnecessary icon setting every time.
- const bool left = (position == LSK_POSITION);
- if(position == LSK_POSITION || position == RSK_POSITION) {
- CEikImage* tmpImage = NULL;
- QT_TRAP_THROWING(tmpImage = new (ELeave) CEikImage);
- EikSoftkeyImage::SetImage(cba, *tmpImage, left); // Takes myimage ownership
- int command = S60_COMMAND_START + position;
- setNativeSoftkey(*cba, position, command, KNullDesC());
- cachedCbaIconSize[index] = qt_TSize2QSize(cba->ControlOrNull(command)->Size());
- EikSoftkeyImage::SetLabel(cba, left);
-
- if(cachedCbaIconSize[index] == QSize(138,72)) {
- // Hack for S60 5.0 (5800) landscape orientation, which return wrong icon size
- cachedCbaIconSize[index] = QSize(60,60);
+ if (QSysInfo::s60Version() >= QSysInfo::SV_S60_5_3) {
+ // S60 5.3 and later have fixed icon size on softkeys, while the button
+ // itself is bigger, so the automatic check doesn't work.
+ // Use custom pixel metrics to deduce the CBA icon size
+ int iconHeight = 30;
+ int iconWidth = 30;
+#ifndef QT_NO_STYLE_S60
+ QS60Style *s60Style = 0;
+ s60Style = qobject_cast<QS60Style *>(QApplication::style());
+ if (s60Style) {
+ iconWidth = s60Style->pixelMetric((QStyle::PixelMetric)PM_CbaIconWidth);
+ iconHeight = s60Style->pixelMetric((QStyle::PixelMetric)PM_CbaIconHeight);
+ }
+#endif
+ cachedCbaIconSize[index] = QSize(iconWidth, iconHeight);
+ } else {
+ // Only way I figured out to get CBA icon size without RnD SDK, was
+ // to set some dummy icon to CBA first and then ask CBA button CCoeControl::Size()
+ // The returned value is cached to avoid unnecessary icon setting every time.
+ const bool left = (position == LSK_POSITION);
+ if (position == LSK_POSITION || position == RSK_POSITION) {
+ CEikImage* tmpImage = NULL;
+ QT_TRAP_THROWING(tmpImage = new (ELeave) CEikImage);
+ EikSoftkeyImage::SetImage(cba, *tmpImage, left); // Takes tmpImage ownership
+ int command = S60_COMMAND_START + position;
+ setNativeSoftkey(*cba, position, command, KNullDesC());
+ cachedCbaIconSize[index] = qt_TSize2QSize(cba->ControlOrNull(command)->Size());
+ EikSoftkeyImage::SetLabel(cba, left);
+
+ if (cachedCbaIconSize[index] == QSize(138,72)) {
+ // Hack for S60 5.0 landscape orientation, which return wrong icon size
+ cachedCbaIconSize[index] = QSize(60,60);
+ }
}
}
}
diff --git a/src/gui/kernel/qt_mac.cpp b/src/gui/kernel/qt_mac.cpp
index 339bc82..69f0034 100644
--- a/src/gui/kernel/qt_mac.cpp
+++ b/src/gui/kernel/qt_mac.cpp
@@ -61,7 +61,6 @@ QFont qfontForThemeFont(ThemeFontID themeID)
SInt16 f_size;
Style f_style;
GetThemeFont(themeID, Script, f_name, &f_size, &f_style);
- extern QString qt_mac_from_pascal_string(const Str255); //qglobal.cpp
return QFont(qt_mac_from_pascal_string(f_name), f_size,
(f_style & ::bold) ? QFont::Bold : QFont::Normal,
(bool)(f_style & ::italic));
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index 67eb07b..c429b04 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -161,6 +161,7 @@ public:
int partial_keyboard : 1;
int partial_keyboardAutoTranslation : 1;
int partialKeyboardOpen : 1;
+ int handleStatusPaneResizeNotifications : 1;
QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type
QPointer<QWidget> splitViewLastWidget;
@@ -198,6 +199,7 @@ public:
static bool setRecursiveDecorationsVisibility(QWidget *window, Qt::WindowStates newState);
#endif
static void controlVisibilityChanged(CCoeControl *control, bool visible);
+ static TRect clientRect();
#ifdef Q_OS_SYMBIAN
TTrapHandler *s60InstalledTrapHandler;
@@ -353,6 +355,7 @@ inline QS60Data::QS60Data()
partial_keyboard(0),
partial_keyboardAutoTranslation(1),
partialKeyboardOpen(0),
+ handleStatusPaneResizeNotifications(1),
s60ApplicationFactory(0)
#ifdef Q_OS_SYMBIAN
,s60InstalledTrapHandler(0)
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 225a296..a51e295 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -4554,6 +4554,11 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM
QPoint oldp = q->pos();
QSize olds = q->size();
+ // Apply size restrictions, applicable for Windows & Widgets.
+ if (QWExtra *extra = extraData()) {
+ w = qBound(extra->minw, w, extra->maxw);
+ h = qBound(extra->minh, h, extra->maxh);
+ }
const bool isResize = (olds != QSize(w, h));
if (!realWindow && !isResize && QPoint(x, y) == oldp)
@@ -4563,13 +4568,6 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM
data.window_state = data.window_state & ~Qt::WindowMaximized;
const bool visible = q->isVisible();
- // Apply size restrictions, applicable for Windows & Widgets.
- if (QWExtra *extra = extraData()) {
- w = qMin(w, extra->maxw);
- h = qMin(h, extra->maxh);
- w = qMax(w, extra->minw);
- h = qMax(h, extra->minh);
- }
data.crect = QRect(x, y, w, h);
if (realWindow) {
diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp
index c7ce99a..56c3010 100644
--- a/src/gui/kernel/qwidget_qpa.cpp
+++ b/src/gui/kernel/qwidget_qpa.cpp
@@ -129,6 +129,11 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
{
Q_D(QWidget);
+ d->aboutToDestroy();
+ if (!isWindow() && parentWidget())
+ parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry()));
+ d->deactivateWidgetCleanup();
+
if ((windowType() == Qt::Popup))
qApp->d_func()->closePopup(this);
@@ -136,6 +141,8 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
if (this == QApplicationPrivate::active_window)
QApplication::setActiveWindow(0);
+ setAttribute(Qt::WA_WState_Created, false);
+
if (windowType() != Qt::Desktop) {
if (destroySubWindows) {
QObjectList childList(children());
@@ -155,6 +162,8 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
d->hide_sys();
}
}
+
+ d->setWinId(0);
}
}
@@ -412,6 +421,7 @@ void QWidgetPrivate::hide_sys()
{
Q_Q(QWidget);
q->setAttribute(Qt::WA_Mapped, false);
+ deactivateWidgetCleanup();
if (!q->isWindow()) {
QWidget *p = q->parentWidget();
if (p &&p->isVisible()) {
@@ -681,8 +691,10 @@ int QWidget::metric(PaintDeviceMetric m) const
/*!
\preliminary
- Sets the window to be the \a window specified.
- The QWidget takes ownership of the \a surface.
+ Sets the window to be the platform \a window specified.
+
+ The widget takes ownership of the \a window. Any platform window
+ previously set on the widget will be destroyed.
*/
void QWidget::setPlatformWindow(QPlatformWindow *window)
{
@@ -711,6 +723,9 @@ QPlatformWindow *QWidget::platformWindow() const
return 0;
}
+/*!
+ Sets the platform window format for the widget to the \a format specified.
+*/
void QWidget::setPlatformWindowFormat(const QPlatformWindowFormat &format)
{
if (isWindow() || testAttribute(Qt::WA_NativeWindow)) {
@@ -727,6 +742,9 @@ void QWidget::setPlatformWindowFormat(const QPlatformWindowFormat &format)
}
}
+/*!
+ Returns the platform window format for the widget.
+*/
QPlatformWindowFormat QWidget::platformWindowFormat() const
{
Q_D(const QWidget);
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 5672686..d6aaa3f 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -359,7 +359,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
if (popup)
flags |= Qt::WindowStaysOnTopHint; // a popup stays on top
- TRect clientRect = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ TRect clientRect = S60->clientRect();
int sw = clientRect.Width();
int sh = clientRect.Height();
@@ -538,8 +538,6 @@ void QWidgetPrivate::show_sys()
QT_TRAP_THROWING(
factory->CreateResourceIndependentFurnitureL(ui);
- TRect boundingRect = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
-
CEikButtonGroupContainer *cba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba,
CEikButtonGroupContainer::EHorizontal,ui,R_AVKON_SOFTKEYS_EMPTY_WITH_IDS);
if (isFullscreen && !cbaRequested)
@@ -592,11 +590,13 @@ void QWidgetPrivate::show_sys()
// Fill client area if maximized OR
// Put window below status pane unless the window has an explicit position.
if (!isFullscreen) {
+ // Use QS60Data::clientRect to take into account that native keyboard
+ // might affect ClientRect() return value.
if (q->windowState() & Qt::WindowMaximized) {
- TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ TRect r = S60->clientRect();
id->SetExtent(r.iTl, r.Size());
} else if (!q->testAttribute(Qt::WA_Moved) && q->windowType() != Qt::Dialog) {
- id->SetPosition(static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl);
+ id->SetPosition(S60->clientRect().iTl);
}
}
@@ -1267,7 +1267,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
// normal mode after showing the status pane, the geometry would overlap so we should
// move it if it never had an explicit position.
if (!wasMoved && S60->statusPane() && decorationsVisible) {
- TPoint tl = static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl;
+ TPoint tl = S60->clientRect().iTl;
normalGeometry.setTopLeft(QPoint(tl.iX, tl.iY));
}
#endif
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index d5ae364..27b1bf2 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -198,12 +198,12 @@ qpa {
symbian {
SOURCES += \
- painting/qpaintengine_s60.cpp \
+ painting/qpaintengine_raster_symbian.cpp \
painting/qregion_s60.cpp \
painting/qcolormap_s60.cpp
HEADERS += \
- painting/qpaintengine_s60_p.h
+ painting/qpaintengine_raster_symbian_p.h
}
x11|embedded|qpa {
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 5d8f43b..79c4c4e 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -1826,9 +1826,9 @@ static QPointF qt_radial_gradient_adapt_focal_point(const QPointF &center,
radius and \a focalPoint.
\note If the given focal point is outside the circle defined by the
- center (\a cx, \a cy) and the \a radius it will be re-adjusted to
- the intersection between the line from the center to the focal point
- and the circle.
+ \a center point and \a radius, it will be re-adjusted to lie at a point on
+ the circle where it intersects with the line from \a center to
+ \a focalPoint.
\sa QGradient::setColorAt(), QGradient::setStops()
*/
@@ -1947,11 +1947,9 @@ QRadialGradient::QRadialGradient(const QPointF &center, qreal centerRadius, cons
/*!
\since 4.8
- Constructs an extended radial gradient with the given \a center, \a
- centerRadius, \a focalPoint, and \a focalRadius.
- Constructs a radial gradient with the given center (\a cx, \a cy),
- center radius \a centerRadius, focal point (\a fx, \a fy), and
- focal radius \a focalRadius.
+ Constructs an extended radial gradient with the given center
+ (\a cx, \a cy), center radius, \a centerRadius, focal point, (\a fx, \a fy),
+ and focal radius \a focalRadius.
*/
QRadialGradient::QRadialGradient(qreal cx, qreal cy, qreal centerRadius, qreal fx, qreal fy, qreal focalRadius)
{
@@ -2049,7 +2047,7 @@ qreal QRadialGradient::centerRadius() const
return m_data.radial.cradius;
}
-/*
+/*!
\since 4.8
Sets the center radius of this radial gradient in logical coordinates
@@ -2080,7 +2078,7 @@ qreal QRadialGradient::focalRadius() const
return u.f;
}
-/*
+/*!
\since 4.8
Sets the focal radius of this radial gradient in logical coordinates
diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp
index cdc0978..dbe957e 100644
--- a/src/gui/painting/qcosmeticstroker.cpp
+++ b/src/gui/painting/qcosmeticstroker.cpp
@@ -7,29 +7,29 @@
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** 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
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** 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.
**
**
**
diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h
index 0aa71fc..d7bd79a 100644
--- a/src/gui/painting/qcosmeticstroker_p.h
+++ b/src/gui/painting/qcosmeticstroker_p.h
@@ -7,29 +7,29 @@
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** 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
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** 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.
**
**
**
diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp
index d4a8015..04e45d2 100644
--- a/src/gui/painting/qgraphicssystem.cpp
+++ b/src/gui/painting/qgraphicssystem.cpp
@@ -54,7 +54,7 @@
# include <QtGui/private/qapplication_p.h>
#endif
#ifdef Q_OS_SYMBIAN
-# include <private/qpixmap_s60_p.h>
+# include <private/qpixmap_raster_symbian_p.h>
# include <private/qgraphicssystemex_symbian_p.h>
#else
# include <private/qgraphicssystemex_p.h>
@@ -80,7 +80,7 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ
#elif defined(Q_WS_QPA)
return QApplicationPrivate::platformIntegration()->createPixmapData(type);
#elif defined(Q_OS_SYMBIAN)
- return new QS60PixmapData(type);
+ return new QSymbianRasterPixmapData(type);
#elif !defined(Q_WS_QWS)
#error QGraphicsSystem::createDefaultPixmapData() not implemented
#endif
diff --git a/src/gui/painting/qgraphicssystem_raster.cpp b/src/gui/painting/qgraphicssystem_raster.cpp
index 0edbe9f..addfff7 100644
--- a/src/gui/painting/qgraphicssystem_raster.cpp
+++ b/src/gui/painting/qgraphicssystem_raster.cpp
@@ -42,7 +42,7 @@
#include "qgraphicssystem_raster_p.h"
#ifdef Q_OS_SYMBIAN
-#include "private/qpixmap_s60_p.h"
+#include "private/qpixmap_raster_symbian_p.h"
#include "private/qwindowsurface_s60_p.h"
#else
#include "private/qpixmap_raster_p.h"
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
QPixmapData *QRasterGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
{
#ifdef Q_OS_SYMBIAN
- return new QS60PixmapData(type);
+ return new QSymbianRasterPixmapData(type);
#else
return new QRasterPixmapData(type);
#endif
diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp
index 9562d83..c46513a 100644
--- a/src/gui/painting/qpaintengine.cpp
+++ b/src/gui/painting/qpaintengine.cpp
@@ -387,6 +387,7 @@ void QPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDraw
\value MaxUser Last user type ID
\value OpenGL2
\value PaintBuffer
+ \value Blitter
*/
/*!
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 30553b5..9ba4592 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -2774,10 +2774,12 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
{
Q_D(QRasterPaintEngine);
QRasterPaintEngineState *s = state();
+ const QFixed offs = QFixed::fromReal(aliasedCoordinateDelta);
#if !defined(QT_NO_FREETYPE)
if (fontEngine->type() == QFontEngine::Freetype) {
QFontEngineFT *fe = static_cast<QFontEngineFT *>(fontEngine);
+ const QFixed xOffs = fe->supportsSubPixelPositions() ? 0 : offs;
QFontEngineFT::GlyphFormat neededFormat =
painter()->device()->devType() == QInternal::Widget
? fe->defaultGlyphFormat()
@@ -2851,8 +2853,8 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
};
alphaPenBlt(glyph->data, pitch, depth,
- qFloor(positions[i].x) + glyph->x,
- qFloor(positions[i].y) - glyph->y,
+ qFloor(positions[i].x + xOffs) + glyph->x,
+ qFloor(positions[i].y + offs) - glyph->y,
glyph->width, glyph->height);
}
if (lockedFace)
@@ -2892,7 +2894,6 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
rightShift = 3; // divide by 8
int margin = cache->glyphMargin();
- const QFixed offs = QFixed::fromReal(aliasedCoordinateDelta);
const uchar *bits = image.bits();
for (int i=0; i<numGlyphs; ++i) {
diff --git a/src/gui/painting/qpaintengine_s60.cpp b/src/gui/painting/qpaintengine_raster_symbian.cpp
index 091e2e6..3b27077 100644
--- a/src/gui/painting/qpaintengine_s60.cpp
+++ b/src/gui/painting/qpaintengine_raster_symbian.cpp
@@ -38,29 +38,30 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <private/qpaintengine_s60_p.h>
-#include <private/qpixmap_s60_p.h>
+
+#include <private/qpaintengine_raster_symbian_p.h>
+#include <private/qpixmap_raster_symbian_p.h>
#include <private/qt_s60_p.h>
#include <private/qvolatileimage_p.h>
QT_BEGIN_NAMESPACE
-class QS60PaintEnginePrivate : public QRasterPaintEnginePrivate
+class QSymbianRasterPaintEnginePrivate : public QRasterPaintEnginePrivate
{
public:
- QS60PaintEnginePrivate() {}
+ QSymbianRasterPaintEnginePrivate() {}
};
-QS60PaintEngine::QS60PaintEngine(QPaintDevice *device, QS60PixmapData *data)
- : QRasterPaintEngine(*(new QS60PaintEnginePrivate), device), pixmapData(data)
+QSymbianRasterPaintEngine::QSymbianRasterPaintEngine(QPaintDevice *device, QSymbianRasterPixmapData *data)
+ : QRasterPaintEngine(*(new QSymbianRasterPaintEnginePrivate), device), pixmapData(data)
{
}
-bool QS60PaintEngine::begin(QPaintDevice *device)
+bool QSymbianRasterPaintEngine::begin(QPaintDevice *device)
{
- Q_D(QS60PaintEngine);
+ Q_D(QSymbianRasterPaintEngine);
- if (pixmapData->classId() == QPixmapData::RasterClass) {
+ if (pixmapData && pixmapData->classId() == QPixmapData::RasterClass) {
pixmapData->beginDataAccess();
bool ret = QRasterPaintEngine::begin(device);
// Make sure QPaintEngine::paintDevice() returns the proper device.
@@ -69,13 +70,12 @@ bool QS60PaintEngine::begin(QPaintDevice *device)
d->pdev = device;
return ret;
}
-
return QRasterPaintEngine::begin(device);
}
-bool QS60PaintEngine::end()
+bool QSymbianRasterPaintEngine::end()
{
- if (pixmapData->classId() == QPixmapData::RasterClass) {
+ if (pixmapData && pixmapData->classId() == QPixmapData::RasterClass) {
bool ret = QRasterPaintEngine::end();
pixmapData->endDataAccess();
return ret;
@@ -83,50 +83,51 @@ bool QS60PaintEngine::end()
return QRasterPaintEngine::end();
}
-void QS60PaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm)
+void QSymbianRasterPaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm)
{
if (pm.pixmapData()->classId() == QPixmapData::RasterClass) {
- QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData());
+ QSymbianRasterPixmapData *srcData = static_cast<QSymbianRasterPixmapData *>(pm.pixmapData());
srcData->beginDataAccess();
QRasterPaintEngine::drawPixmap(p, pm);
srcData->endDataAccess();
} else {
- void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage);
- if (nativeData) {
- QVolatileImage *img = static_cast<QVolatileImage *>(nativeData);
- img->beginDataAccess();
- QRasterPaintEngine::drawImage(p, img->imageRef());
- img->endDataAccess(true);
+ QVolatileImage img = pm.pixmapData()->toVolatileImage();
+ if (!img.isNull()) {
+ img.beginDataAccess();
+ // imageRef() would detach and since we received the QVolatileImage
+ // from toVolatileImage() by value, it would cause a copy which
+ // would ruin our goal. So use constImageRef() instead.
+ QRasterPaintEngine::drawImage(p, img.constImageRef());
+ img.endDataAccess(true);
} else {
QRasterPaintEngine::drawPixmap(p, pm);
}
}
}
-void QS60PaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
+void QSymbianRasterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
{
if (pm.pixmapData()->classId() == QPixmapData::RasterClass) {
- QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData());
+ QSymbianRasterPixmapData *srcData = static_cast<QSymbianRasterPixmapData *>(pm.pixmapData());
srcData->beginDataAccess();
QRasterPaintEngine::drawPixmap(r, pm, sr);
srcData->endDataAccess();
} else {
- void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage);
- if (nativeData) {
- QVolatileImage *img = static_cast<QVolatileImage *>(nativeData);
- img->beginDataAccess();
- QRasterPaintEngine::drawImage(r, img->imageRef(), sr);
- img->endDataAccess(true);
+ QVolatileImage img = pm.pixmapData()->toVolatileImage();
+ if (!img.isNull()) {
+ img.beginDataAccess();
+ QRasterPaintEngine::drawImage(r, img.constImageRef(), sr);
+ img.endDataAccess(true);
} else {
QRasterPaintEngine::drawPixmap(r, pm, sr);
}
}
}
-void QS60PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr)
+void QSymbianRasterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr)
{
if (pm.pixmapData()->classId() == QPixmapData::RasterClass) {
- QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData());
+ QSymbianRasterPixmapData *srcData = static_cast<QSymbianRasterPixmapData *>(pm.pixmapData());
srcData->beginDataAccess();
QRasterPaintEngine::drawTiledPixmap(r, pm, sr);
srcData->endDataAccess();
@@ -135,7 +136,8 @@ void QS60PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const
}
}
-void QS60PaintEngine::prepare(QImage *image)
+// used by QSymbianRasterPixmapData::beginDataAccess()
+void QSymbianRasterPaintEngine::prepare(QImage *image)
{
QRasterBuffer *buffer = d_func()->rasterBuffer.data();
if (buffer)
diff --git a/src/gui/painting/qpaintengine_s60_p.h b/src/gui/painting/qpaintengine_raster_symbian_p.h
index 2a3b443..cb51ecb 100644
--- a/src/gui/painting/qpaintengine_s60_p.h
+++ b/src/gui/painting/qpaintengine_raster_symbian_p.h
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#ifndef QPAINTENGINE_S60_P_H
-#define QPAINTENGINE_S60_P_H
+#ifndef QPAINTENGINE_RASTER_SYMBIAN_P_H
+#define QPAINTENGINE_RASTER_SYMBIAN_P_H
//
// W A R N I N G
@@ -57,15 +57,15 @@
QT_BEGIN_NAMESPACE
-class QS60PaintEnginePrivate;
-class QS60PixmapData;
+class QSymbianRasterPaintEnginePrivate;
+class QSymbianRasterPixmapData;
-class QS60PaintEngine : public QRasterPaintEngine
+class QSymbianRasterPaintEngine : public QRasterPaintEngine
{
- Q_DECLARE_PRIVATE(QS60PaintEngine)
+ Q_DECLARE_PRIVATE(QSymbianRasterPaintEngine)
public:
- QS60PaintEngine(QPaintDevice *device, QS60PixmapData* data);
+ QSymbianRasterPaintEngine(QPaintDevice *device, QSymbianRasterPixmapData *data = 0);
bool begin(QPaintDevice *device);
bool end();
@@ -76,9 +76,9 @@ public:
void prepare(QImage* image);
private:
- QS60PixmapData *pixmapData;
+ QSymbianRasterPixmapData *pixmapData;
};
QT_END_NAMESPACE
-#endif // QPAINTENGINE_S60_P_H
+#endif // QPAINTENGINE_RASTER_SYMBIAN_P_H
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 8510416..5105d9a 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -1084,7 +1084,7 @@ void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem)
changedHints = true;
}
- fill(qtVectorPathForPath(path), staticTextItem->color);
+ fill(qtVectorPathForPath(path), s->pen.color());
if (changedHints) {
s->renderHints = oldHints;
diff --git a/src/gui/painting/qwindowsurface_qws.cpp b/src/gui/painting/qwindowsurface_qws.cpp
index 7e8cf9b..3789a33 100644
--- a/src/gui/painting/qwindowsurface_qws.cpp
+++ b/src/gui/painting/qwindowsurface_qws.cpp
@@ -1065,10 +1065,12 @@ bool QWSSharedMemSurface::setMemory(int memId)
return true;
mem.detach();
- if (!mem.attach(memId)) {
+
+ if (memId != -1 && !mem.attach(memId)) {
+#ifndef QT_NO_DEBUG
perror("QWSSharedMemSurface: attaching to shared memory");
- qCritical("QWSSharedMemSurface: Error attaching to"
- " shared memory 0x%x", memId);
+ qCritical("QWSSharedMemSurface: Error attaching to shared memory 0x%x", memId);
+#endif
return false;
}
diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp
index 8801d75..d1ac926 100644
--- a/src/gui/painting/qwindowsurface_s60.cpp
+++ b/src/gui/painting/qwindowsurface_s60.cpp
@@ -44,7 +44,7 @@
#include <QtGui/qpaintdevice.h>
#include <private/qwidget_p.h>
#include <private/qwindowsurface_s60_p.h>
-#include <private/qpixmap_s60_p.h>
+#include <private/qpixmap_raster_symbian_p.h>
#include <private/qt_s60_p.h>
#include <private/qapplication_p.h>
#include <private/qdrawhelper_p.h>
@@ -92,7 +92,7 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget)
Q_CHECK_PTR(bitmap);
qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) );
- QS60PixmapData *data = new QS60PixmapData(QPixmapData::PixmapType);
+ QSymbianRasterPixmapData *data = new QSymbianRasterPixmapData(QPixmapData::PixmapType);
if (data) {
data->fromSymbianBitmap(bitmap, true);
d_ptr->device = QPixmap(data);
@@ -131,7 +131,7 @@ void QS60WindowSurface::beginPaint(const QRegion &rgn)
QWidgetPrivate *windowPrivate = qt_widget_private(window());
if (!windowPrivate->isOpaque || blitWriteAlpha(windowPrivate)) {
- QS60PixmapData *pixmapData = static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data());
+ QSymbianRasterPixmapData *pixmapData = static_cast<QSymbianRasterPixmapData *>(d_ptr->device.data_ptr().data());
TDisplayMode mode = displayMode(false);
if (pixmapData->cfbsBitmap->DisplayMode() != mode)
@@ -169,7 +169,7 @@ QImage* QS60WindowSurface::buffer(const QWidget *widget)
return 0;
const QPoint off = offset(widget);
- QImage *img = &(static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data())->image);
+ QImage *img = &(static_cast<QSymbianRasterPixmapData *>(d_ptr->device.data_ptr().data())->image);
QRect rect(off, widget->size());
rect &= QRect(QPoint(), img->size());
@@ -217,7 +217,7 @@ bool QS60WindowSurface::scroll(const QRegion &area, int dx, int dy)
if (d_ptr->device.isNull())
return false;
- QS60PixmapData *data = static_cast<QS60PixmapData*>(d_ptr->device.data_ptr().data());
+ QSymbianRasterPixmapData *data = static_cast<QSymbianRasterPixmapData*>(d_ptr->device.data_ptr().data());
data->scroll(dx, dy, rect);
return true;
@@ -233,7 +233,7 @@ void QS60WindowSurface::setGeometry(const QRect& rect)
if (rect == geometry())
return;
- QS60PixmapData *data = static_cast<QS60PixmapData*>(d_ptr->device.data_ptr().data());
+ QSymbianRasterPixmapData *data = static_cast<QSymbianRasterPixmapData*>(d_ptr->device.data_ptr().data());
data->resize(rect.width(), rect.height());
QWindowSurface::setGeometry(rect);
@@ -246,7 +246,7 @@ QWindowSurface::WindowSurfaceFeatures QS60WindowSurface::features() const
CFbsBitmap* QS60WindowSurface::symbianBitmap() const
{
- QS60PixmapData *data = static_cast<QS60PixmapData*>(d_ptr->device.data_ptr().data());
+ QSymbianRasterPixmapData *data = static_cast<QSymbianRasterPixmapData*>(d_ptr->device.data_ptr().data());
return data->cfbsBitmap;
}
diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/gui/s60framework/qs60mainappui.cpp
index bfd1825..ec97f7b 100644
--- a/src/gui/s60framework/qs60mainappui.cpp
+++ b/src/gui/s60framework/qs60mainappui.cpp
@@ -316,7 +316,21 @@ TRect QS60MainAppUi::ApplicationRect() const
*/
void QS60MainAppUi::HandleScreenDeviceChangedL()
{
+ // This function triggers AppUi relayout which also generates
+ // HandleStatusPaneSizeChange(). We don't want to handle
+ // status pane resizes at this point because it causes
+ // Qt window resize and thus EGL surface resize in the middle of
+ // incomplete layout process causing unnecessary overhead.
+ // To prevent status pane resize handling while layout is still
+ // in progress, we guard relayouting with handleStatusPaneResizeNotifications
+ // flag. QSymbianControl checks this flag before doing Qt window
+ // resize due to status pane change.
+ // Eventually when layout is ready, Symbian framework calls
+ // HandleResourceChangeL(KEikDynamicLayoutVariantSwitch) which triggers
+ // resize to Qt window and to its EGL surface.
+ S60->handleStatusPaneResizeNotifications = false;
QS60MainAppUiBase::HandleScreenDeviceChangedL();
+ S60->handleStatusPaneResizeNotifications = true;
}
/*!
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index e5171d8..ad0e151 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -5292,7 +5292,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
pixmap = QIcon::fromTheme(QLatin1String("media-seek-backward")).pixmap(16);
break;
case SP_MediaSkipForward:
- pixmap = QIcon::fromTheme(QLatin1String("media-skip-backward")).pixmap(16);
+ pixmap = QIcon::fromTheme(QLatin1String("media-skip-forward")).pixmap(16);
break;
case SP_MediaSkipBackward:
pixmap = QIcon::fromTheme(QLatin1String("media-skip-backward")).pixmap(16);
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 219b963..b0ea0d1 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -101,9 +101,12 @@ const int QS60StylePrivate::m_numberOfLayouts =
const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = {
// *** generated pixel metrics ***
-{7,0,-909,0,0,2,0,5,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,11,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135},
-{7,0,-909,0,0,2,0,5,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,13,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135},
-{9,0,-909,0,0,2,0,5,-1,34,99,76,51,51,25,352,-909,-909,-909,29,25,7,0,0,43,34,42,76,7,7,2,-909,-909,0,9,14,0,23,39,30,30,37,37,9,391,40,0,-909,-909,-909,-909,0,0,29,2,-909,0,0,-909,29,-909,-909,-909,-909,115,37,96,48,96,19,19,9,1,25,-909,9,101,24,9,0,7,7,7,16,7,7,-909,3,-909,-909,-909,-909,9,9,3,1,184}
+{5,0,-909,0,0,2,0,2,-1,7,12,22,15,15,7,198,-909,-909,-909,20,13,2,0,0,21,7,18,30,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1,106,30,30},
+{5,0,-909,0,0,1,0,2,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,28,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1,106,30,30},
+{7,0,-909,0,0,2,0,5,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,11,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,3,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135,30,30},
+{7,0,-909,0,0,2,0,5,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,13,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,3,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135,30,30},
+{7,0,-909,0,0,2,0,2,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1,106,30,30},
+{9,0,-909,0,0,2,0,5,-1,30,99,76,51,51,25,352,-909,-909,-909,29,25,7,0,0,43,34,42,76,7,7,2,-909,-909,0,9,14,0,23,39,30,30,37,37,9,391,40,0,-909,-909,-909,-909,0,0,29,2,-909,0,0,-909,29,-909,-909,-909,-909,115,37,96,48,96,2,2,9,1,25,-909,9,101,24,9,0,7,7,7,16,7,7,-909,3,-909,-909,-909,-909,9,9,3,1,184,30,30}
// *** End of generated data ***
};
diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h
index 6993bf4..8ec5eb9 100644
--- a/src/gui/styles/qs60style.h
+++ b/src/gui/styles/qs60style.h
@@ -57,7 +57,9 @@ enum {
PM_FrameCornerHeight,
PM_BoldLineWidth,
PM_ThinLineWidth,
- PM_MessageBoxHeight
+ PM_MessageBoxHeight,
+ PM_CbaIconWidth,
+ PM_CbaIconHeight
};
class QS60StylePrivate;
diff --git a/src/gui/styles/qs60style_feedbackinterface_p.h b/src/gui/styles/qs60style_feedbackinterface_p.h
new file mode 100644
index 0000000..0dc46b8
--- /dev/null
+++ b/src/gui/styles/qs60style_feedbackinterface_p.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 <QObject>
+
+class TactileFeedbackInterface : public QObject
+{
+ public:
+ virtual void touchFeedback(QEvent *event, const QWidget *widget) = 0;
+};
+
+Q_DECLARE_INTERFACE(TactileFeedbackInterface, "com.trolltech.Qt.TactileFeedbackInterface/1.0")
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index 1cf069b..62c4b00 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -60,7 +60,7 @@
QT_BEGIN_NAMESPACE
const int MAX_NON_CUSTOM_PIXELMETRICS = 92;
-const int CUSTOMVALUESCOUNT = 5;
+const int CUSTOMVALUESCOUNT = 7;
const int MAX_PIXELMETRICS = MAX_NON_CUSTOM_PIXELMETRICS + CUSTOMVALUESCOUNT;
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index 58d70a4..2d2710c 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -45,7 +45,7 @@
#include "qstyleoption.h"
#include "qstyle.h"
#include "private/qt_s60_p.h"
-#include "private/qpixmap_s60_p.h"
+#include "private/qpixmap_raster_symbian_p.h"
#include "private/qcore_symbian_p.h"
#include "private/qvolatileimage_p.h"
#include "qapplication.h"
@@ -1059,6 +1059,14 @@ void QS60StyleModeSpecifics::frameIdAndCenterId(QS60StylePrivate::SkinFrameEleme
centerId.Set(KAknsIIDQsnFrPopupCenterSubmenu);
frameId.Set(KAknsIIDQsnFrPopupSub);
break;
+ case QS60StylePrivate::SF_SettingsList:
+ // Starting from S60_5_3, the root theme has been changed so that KAknsIIDQsnFrSetOpt is empty.
+ // Set the theme ID to None, to avoid theme server trying to draw the empty frame.
+ if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_2) {
+ centerId.Set(KAknsIIDNone);
+ frameId.Set(KAknsIIDNone);
+ }
+ break;
case QS60StylePrivate::SF_PanelBackground:
// remove center piece for panel graphics, so that only border is drawn
centerId.Set(KAknsIIDNone);
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index d4c81b9..2d6af3b 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -147,6 +147,7 @@ bool QFontDef::exactMatch(const QFontDef &other) const
&& weight == other.weight
&& style == other.style
&& this_family == other_family
+ && (styleName.isEmpty() || other.styleName.isEmpty() || styleName == other.styleName)
&& (this_foundry.isEmpty()
|| other_foundry.isEmpty()
|| this_foundry == other_foundry)
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index 8eeae6f..ebc842c 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -113,6 +113,7 @@ struct QFontDef
&& styleStrategy == other.styleStrategy
&& ignorePitch == other.ignorePitch && fixedPitch == other.fixedPitch
&& family == other.family
+ && (styleName.isEmpty() || other.styleName.isEmpty() || styleName == other.styleName)
&& hintingPreference == other.hintingPreference
#ifdef Q_WS_X11
&& addStyle == other.addStyle
@@ -128,6 +129,8 @@ struct QFontDef
if (styleHint != other.styleHint) return styleHint < other.styleHint;
if (styleStrategy != other.styleStrategy) return styleStrategy < other.styleStrategy;
if (family != other.family) return family < other.family;
+ if (!styleName.isEmpty() && !other.styleName.isEmpty() && styleName != other.styleName)
+ return styleName < other.styleName;
if (hintingPreference != other.hintingPreference) return hintingPreference < other.hintingPreference;
#ifdef Q_WS_X11
diff --git a/src/gui/text/qfont_s60.cpp b/src/gui/text/qfont_s60.cpp
index e0f4bad..0fc8a97 100644
--- a/src/gui/text/qfont_s60.cpp
+++ b/src/gui/text/qfont_s60.cpp
@@ -42,7 +42,7 @@
#include "qfont.h"
#include "qfont_p.h"
#include <private/qt_s60_p.h>
-#include <private/qpixmap_s60_p.h>
+#include <private/qpixmap_raster_symbian_p.h>
#include "qmutex.h"
QT_BEGIN_NAMESPACE
diff --git a/src/gui/text/qfontdatabase_mac.cpp b/src/gui/text/qfontdatabase_mac.cpp
index 724dbf6..60cf586 100644
--- a/src/gui/text/qfontdatabase_mac.cpp
+++ b/src/gui/text/qfontdatabase_mac.cpp
@@ -388,7 +388,6 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
if(fnt->data.isEmpty()) {
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
- extern OSErr qt_mac_create_fsref(const QString &, FSRef *); // qglobal.cpp
FSRef ref;
if(qt_mac_create_fsref(fnt->fileName, &ref) != noErr)
return;
@@ -398,7 +397,6 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
#endif
{
#ifndef Q_WS_MAC64
- extern Q_CORE_EXPORT OSErr qt_mac_create_fsspec(const QString &, FSSpec *); // global.cpp
FSSpec spec;
if(qt_mac_create_fsspec(fnt->fileName, &spec) != noErr)
return;
diff --git a/src/gui/text/qfontdatabase_qws.cpp b/src/gui/text/qfontdatabase_qws.cpp
index c5a04f1..313000f 100644
--- a/src/gui/text/qfontdatabase_qws.cpp
+++ b/src/gui/text/qfontdatabase_qws.cpp
@@ -75,6 +75,11 @@
#include <qresource.h>
#endif
+#ifdef Q_OS_QNX
+// ### using QFontEngineQPF leads to artifacts on QNX
+# define QT_NO_QWS_SHARE_FONTS
+#endif
+
QT_BEGIN_NAMESPACE
#ifndef QT_NO_LIBRARY
@@ -759,9 +764,6 @@ bool QFontDatabase::supportsThreadedFontRendering()
return true;
}
-/*!
- \internal
-*/
QFontEngine *
QFontDatabase::findFont(int script, const QFontPrivate *fp,
const QFontDef &request)
diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp
index eea075f..980b5de 100644
--- a/src/gui/text/qfontdatabase_s60.cpp
+++ b/src/gui/text/qfontdatabase_s60.cpp
@@ -47,7 +47,7 @@
#include "qdesktopservices.h"
#include "qtemporaryfile.h"
#include "qtextcodec.h"
-#include <private/qpixmap_s60_p.h>
+#include <private/qpixmap_raster_symbian_p.h>
#include <private/qt_s60_p.h>
#include "qendian.h"
#include <private/qcore_symbian_p.h>
diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp
index 754334c..958daa2 100644
--- a/src/gui/text/qfontdatabase_x11.cpp
+++ b/src/gui/text/qfontdatabase_x11.cpp
@@ -1566,9 +1566,8 @@ static FcPattern *getFcPattern(const QFontPrivate *fp, int script, const QFontDe
qt_addPatternProps(pattern, fp->screen, script, request);
- FcDefaultSubstitute(pattern);
FcConfigSubstitute(0, pattern, FcMatchPattern);
- FcConfigSubstitute(0, pattern, FcMatchFont);
+ FcDefaultSubstitute(pattern);
// these should only get added to the pattern _after_ substitution
// append the default fallback font for the specified script
@@ -1606,35 +1605,20 @@ static void FcFontSetRemove(FcFontSet *fs, int at)
memmove(fs->fonts + at, fs->fonts + at + 1, len);
}
-static QFontEngine *tryPatternLoad(FcPattern *p, int screen,
- const QFontDef &request, int script, FcPattern **matchedPattern = 0)
+static QFontEngine *tryPatternLoad(FcPattern *match, int screen,
+ const QFontDef &request, int script)
{
#ifdef FONT_MATCH_DEBUG
FcChar8 *fam;
- FcPatternGetString(p, FC_FAMILY, 0, &fam);
+ FcPatternGetString(match, FC_FAMILY, 0, &fam);
FM_DEBUG("==== trying %s\n", fam);
#endif
FM_DEBUG("passes charset test\n");
- FcPattern *pattern = FcPatternDuplicate(p);
- // add properties back in as the font selected from the
- // list doesn't contain them.
- qt_addPatternProps(pattern, screen, script, request);
-
- FcConfigSubstitute(0, pattern, FcMatchPattern);
- FcDefaultSubstitute(pattern);
- FcResult res;
- FcPattern *match = FcFontMatch(0, pattern, &res);
-
- if (matchedPattern)
- *matchedPattern = 0;
QFontEngineX11FT *engine = 0;
if (!match) // probably no fonts available.
goto done;
- if (matchedPattern)
- *matchedPattern = FcPatternDuplicate(match);
-
if (script != QUnicodeTables::Common) {
// skip font if it doesn't support the language we want
if (specialChars[script]) {
@@ -1673,11 +1657,6 @@ static QFontEngine *tryPatternLoad(FcPattern *p, int screen,
}
}
done:
- FcPatternDestroy(pattern);
- if (!engine && matchedPattern && *matchedPattern) {
- FcPatternDestroy(*matchedPattern);
- *matchedPattern = 0;
- }
return engine;
}
@@ -1726,14 +1705,26 @@ static QFontEngine *loadFc(const QFontPrivate *fp, int script, const QFontDef &r
#endif
QFontEngine *fe = 0;
- FcPattern *matchedPattern = 0;
- fe = tryPatternLoad(pattern, fp->screen, request, script, &matchedPattern);
+ FcResult res;
+ FcPattern *match = FcFontMatch(0, pattern, &res);
+ fe = tryPatternLoad(match, fp->screen, request, script);
if (!fe) {
FcFontSet *fs = qt_fontSetForPattern(pattern, request);
+ if (match) {
+ FcPatternDestroy(match);
+ match = 0;
+ }
+
if (fs) {
- for (int i = 0; !fe && i < fs->nfont; ++i)
- fe = tryPatternLoad(fs->fonts[i], fp->screen, request, script, &matchedPattern);
+ for (int i = 0; !fe && i < fs->nfont; ++i) {
+ match = FcFontRenderPrepare(NULL, pattern, fs->fonts[i]);
+ fe = tryPatternLoad(match, fp->screen, request, script);
+ if (fe)
+ break;
+ FcPatternDestroy(match);
+ match = 0;
+ }
FcFontSetDestroy(fs);
}
FM_DEBUG("engine for script %d is %s\n", script, fe ? fe->fontDef.family.toLatin1().data(): "(null)");
@@ -1741,11 +1732,11 @@ static QFontEngine *loadFc(const QFontPrivate *fp, int script, const QFontDef &r
if (fe
&& script == QUnicodeTables::Common
&& !(request.styleStrategy & QFont::NoFontMerging) && !fe->symbol) {
- fe = new QFontEngineMultiFT(fe, matchedPattern, pattern, fp->screen, request);
+ fe = new QFontEngineMultiFT(fe, match, pattern, fp->screen, request);
} else {
FcPatternDestroy(pattern);
- if (matchedPattern)
- FcPatternDestroy(matchedPattern);
+ if (match)
+ FcPatternDestroy(match);
}
return fe;
}
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index 2bcee01..b0824cb 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -46,7 +46,7 @@
#include <private/qapplication_p.h>
#include "qimage.h"
#include <private/qt_s60_p.h>
-#include <private/qpixmap_s60_p.h>
+#include <private/qpixmap_raster_symbian_p.h>
#include <e32base.h>
#include <e32std.h>
diff --git a/src/gui/text/qfontengine_x11.cpp b/src/gui/text/qfontengine_x11.cpp
index e3bfa5d..490866c 100644
--- a/src/gui/text/qfontengine_x11.cpp
+++ b/src/gui/text/qfontengine_x11.cpp
@@ -863,11 +863,8 @@ glyph_t QFontEngineXLFD::glyphIndexToFreetypeGlyphIndex(glyph_t g) const
// Multi FT engine
// ------------------------------------------------------------------
-static QFontEngine *engineForPattern(FcPattern *pattern, const QFontDef &request,
- int screen)
+static QFontEngine *engineForPattern(FcPattern *match, const QFontDef &request, int screen)
{
- FcResult res;
- FcPattern *match = FcFontMatch(0, pattern, &res);
QFontEngineX11FT *engine = new QFontEngineX11FT(match, request, screen);
if (!engine->invalid())
return engine;
@@ -879,9 +876,9 @@ static QFontEngine *engineForPattern(FcPattern *pattern, const QFontDef &request
}
QFontEngineMultiFT::QFontEngineMultiFT(QFontEngine *fe, FcPattern *matchedPattern, FcPattern *p, int s, const QFontDef &req)
- : QFontEngineMulti(2), request(req), pattern(p), firstEnginePattern(matchedPattern), fontSet(0), screen(s)
+ : QFontEngineMulti(2), request(req), pattern(p), fontSet(0), screen(s)
{
-
+ firstEnginePattern = FcPatternDuplicate(matchedPattern);
engines[0] = fe;
engines.at(0)->ref.ref();
fontDef = engines[0]->fontDef;
@@ -907,8 +904,6 @@ void QFontEngineMultiFT::loadEngine(int at)
extern QMutex *qt_fontdatabase_mutex();
QMutexLocker locker(qt_fontdatabase_mutex());
- extern void qt_addPatternProps(FcPattern *pattern, int screen, int script,
- const QFontDef &request);
extern QFontDef qt_FcPatternToQFontDef(FcPattern *pattern, const QFontDef &);
extern FcFontSet *qt_fontSetForPattern(FcPattern *pattern, const QFontDef &request);
@@ -940,22 +935,18 @@ void QFontEngineMultiFT::loadEngine(int at)
Q_ASSERT(at < engines.size());
Q_ASSERT(engines.at(at) == 0);
- FcPattern *pattern = FcPatternDuplicate(fontSet->fonts[at + firstFontIndex - 1]);
- qt_addPatternProps(pattern, screen, QUnicodeTables::Common, request);
-
- QFontDef fontDef = qt_FcPatternToQFontDef(pattern, this->request);
+ FcPattern *match = FcFontRenderPrepare(NULL, pattern, fontSet->fonts[at + firstFontIndex - 1]);
+ QFontDef fontDef = qt_FcPatternToQFontDef(match, this->request);
// note: we use -1 for the script to make sure that we keep real
// FT engines separate from Multi engines in the font cache
QFontCache::Key key(fontDef, -1, screen);
QFontEngine *fontEngine = QFontCache::instance()->findEngine(key);
if (!fontEngine) {
- FcConfigSubstitute(0, pattern, FcMatchPattern);
- FcDefaultSubstitute(pattern);
- fontEngine = engineForPattern(pattern, request, screen);
+ fontEngine = engineForPattern(match, request, screen);
QFontCache::instance()->insertEngine(key, fontEngine);
}
- FcPatternDestroy(pattern);
+ FcPatternDestroy(match);
fontEngine->ref.ref();
engines[at] = fontEngine;
}
@@ -1123,17 +1114,14 @@ QFontEngineX11FT::QFontEngineX11FT(FcPattern *pattern, const QFontDef &fd, int s
}
#endif
- if (!init(face_id, antialias, defaultFormat)) {
- FcPatternDestroy(pattern);
+ if (!init(face_id, antialias, defaultFormat))
return;
- }
if (!freetype->charset) {
FcCharSet *cs;
FcPatternGetCharSet (pattern, FC_CHARSET, 0, &cs);
freetype->charset = FcCharSetCopy(cs);
}
- FcPatternDestroy(pattern);
}
QFontEngineX11FT::~QFontEngineX11FT()
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 195bd78..9e1646f 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -1329,8 +1329,10 @@ bool QFontMetricsF::inFont(QChar ch) const
}
/*!
- Returns true if the character encoded in UCS-4/UTF-32 is a valid
- character in the font; otherwise returns false.
+ \fn bool QFontMetricsF::inFontUcs4(uint ch) const
+
+ Returns true if the character given by \a ch, encoded in UCS-4/UTF-32,
+ is a valid character in the font; otherwise returns false.
*/
bool QFontMetricsF::inFontUcs4(uint ucs4) const
{
diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp
index 6071c55..7e829db 100644
--- a/src/gui/text/qplatformfontdatabase_qpa.cpp
+++ b/src/gui/text/qplatformfontdatabase_qpa.cpp
@@ -51,6 +51,13 @@ extern void qt_registerFont(const QString &familyname, const QString &foundrynam
QFont::Style style, int stretch, bool antialiased,bool scalable, int pixelSize,
const QSupportedWritingSystems &writingSystems, void *hanlde);
+/*!
+ \fn void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void *)
+
+ Registers the pre-rendered QPF2 font contained in the given \a dataArray.
+
+ \sa registerFont()
+*/
void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void *handle)
{
if (dataArray.size() == 0)
@@ -88,6 +95,32 @@ void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void *
}
}
+/*!
+ \fn void QPlatformFontDatabase::registerFont(const QString &familyName,
+ const QString &foundryName, QFont::Weight weight, QFont::Style style,
+ QFont::Stretch stretch, bool antialiased, bool scalable, int pixelSize,
+ const QSupportedWritingSystems &writingSystems, void *usrPtr)
+
+ Registers a font with the given set of attributes describing the font's
+ foundry, family name, style and stretch information, pixel size, and
+ supported writing systems. Additional information about whether the font
+ can be scaled and antialiased can also be provided.
+
+ The foundry name and font family are described by \a foundryName and
+ \a familyName. The font weight (light, normal, bold, etc.), style (normal,
+ oblique, italic) and stretch information (condensed, expanded, unstretched,
+ etc.) are specified by \a weight, \a style and \a stretch.
+
+ Some fonts can be antialiased and scaled; \a scalable and \a antialiased
+ can be set to true for fonts with these attributes. The intended pixel
+ size of non-scalable fonts is specified by \a pixelSize; this value will be
+ ignored for scalable fonts.
+
+ The writing systems supported by the font are specified by the
+ \a writingSystems argument.
+
+ \sa registerQPF2Font()
+*/
void QPlatformFontDatabase::registerFont(const QString &familyname, const QString &foundryname, QFont::Weight weight,
QFont::Style style, QFont::Stretch stretch, bool antialiased, bool scalable, int pixelSize,
const QSupportedWritingSystems &writingSystems, void *usrPtr)
@@ -206,7 +239,8 @@ void QPlatformFontDatabase::populateFontDatabase()
}
/*!
-
+ Returns the font engine that can be used to render the font described by
+ the font definition, \a fontDef, in the specified \a script.
*/
QFontEngine *QPlatformFontDatabase::fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle)
{
@@ -229,7 +263,8 @@ QFontEngine *QPlatformFontDatabase::fontEngine(const QByteArray &fontData, qreal
}
/*!
-
+ Returns a list of alternative fonts for the specified \a family and
+ \a style and \a script using the \a styleHint given.
*/
QStringList QPlatformFontDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const
{
@@ -241,8 +276,13 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString family, cons
}
/*!
- Adds an application font. Returns a list of family names, or an empty list if the font could
- not be added
+ Adds an application font described by the font contained supplied \a fontData
+ or using the font contained in the file referenced by \a fileName. Returns
+ a list of family names, or an empty list if the font could not be added.
+
+ \note The default implementation of this function does not add an application
+ font. Subclasses should reimplement this function to perform the necessary
+ loading and registration of fonts.
*/
QStringList QPlatformFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
{
@@ -280,21 +320,23 @@ QString QPlatformFontDatabase::fontDir() const
/*!
\class QPlatformFontDatabase
- \brief The QPlatformFontDatabase makes it possible to customize how fonts are picked up, and
- and how they are rendered
+ \brief The QPlatformFontDatabase class makes it possible to customize how fonts
+ are discovered and how they are rendered
\ingroup painting
QPlatformFontDatabase is the superclass which is intended to let platform implementations use
native font handling.
- Qt has its internal fontdatabase which it uses to pick up available fonts. To be able
- to populate this database subclass this class, and reimplement populateFontDatabase().
+ Qt has its internal font database which it uses to discover available fonts on the
+ user's system. To be able to populate this database subclass this class, and
+ reimplement populateFontDatabase().
- Use the function registerFont to populate the internal fontdatabase.
+ Use the function registerFont() to populate the internal font database.
- Sometimes a specified font does not have the required glyphs, then the fallbackForFamily
- function is called.
+ Sometimes a specified font does not have the required glyphs; in such a case, the
+ fallbackForFamily() function is called automatically to find alternative font
+ families that can supply alternatives to the missing glyphs.
\sa QSupportedWritingSystems
*/
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index a6ec86e..ec5cc18 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -87,16 +87,16 @@ QT_BEGIN_NAMESPACE
QRawFont can be constructed in a number of ways:
\list
- \o \l It can be constructed by calling QTextLayout::glyphRuns() or QTextFragment::glyphRuns().
- The returned QGlyphRun objects will contain QRawFont objects which represent the actual
- fonts used to render each portion of the text.
- \o \l It can be constructed by passing a QFont object to QRawFont::fromFont(). The function
- will return a QRawFont object representing the font that will be selected as response to
- the QFont query and the selected writing system.
- \o \l It can be constructed by passing a file name or QByteArray directly to the QRawFont
- constructor, or by calling loadFromFile() or loadFromData(). In this case, the
- font will not be registered in QFontDatabase, and it will not be available as part of
- regular font selection.
+ \o It can be constructed by calling QTextLayout::glyphs() or QTextFragment::glyphs(). The
+ returned QGlyphs objects will contain QRawFont objects which represent the actual fonts
+ used to render each portion of the text.
+ \o It can be constructed by passing a QFont object to QRawFont::fromFont(). The function
+ will return a QRawFont object representing the font that will be selected as response to
+ the QFont query and the selected writing system.
+ \o It can be constructed by passing a file name or QByteArray directly to the QRawFont
+ constructor, or by calling loadFromFile() or loadFromData(). In this case, the
+ font will not be registered in QFontDatabase, and it will not be available as part of
+ regular font selection.
\endlist
QRawFont is considered local to the thread in which it is constructed (either using a
@@ -132,8 +132,9 @@ QRawFont::QRawFont()
}
/*!
- Constructs a QRawFont representing the font contained in the file referenced by \a fileName,
- with \a pixelSize size in pixels, and the selected \a hintingPreference.
+ Constructs a QRawFont representing the font contained in the file referenced
+ by \a fileName for the size (in pixels) given by \a pixelSize, and using the
+ hinting preference specified by \a hintingPreference.
\note The referenced file must contain a TrueType or OpenType font.
*/
@@ -146,7 +147,9 @@ QRawFont::QRawFont(const QString &fileName,
}
/*!
- Constructs a QRawFont representing the font contained in \a fontData.
+ Constructs a QRawFont representing the font contained in the supplied
+ \a fontData for the size (in pixels) given by \a pixelSize, and using the
+ hinting preference specified by \a hintingPreference.
\note The data must contain a TrueType or OpenType font.
*/
@@ -192,7 +195,9 @@ bool QRawFont::isValid() const
}
/*!
- Replaces the current QRawFont with the contents of the file references by \a fileName.
+ Replaces the current QRawFont with the contents of the file referenced
+ by \a fileName for the size (in pixels) given by \a pixelSize, and using the
+ hinting preference specified by \a hintingPreference.
The file must reference a TrueType or OpenType font.
@@ -208,7 +213,9 @@ void QRawFont::loadFromFile(const QString &fileName,
}
/*!
- Replaces the current QRawFont with the contents of \a fontData.
+ Replaces the current QRawFont with the font contained in the supplied
+ \a fontData for the size (in pixels) given by \a pixelSize, and using the
+ hinting preference specified by \a hintingPreference.
The \a fontData must contain a TrueType or OpenType font.
@@ -226,8 +233,9 @@ void QRawFont::loadFromData(const QByteArray &fontData,
}
/*!
- This function returns a rasterized image of the glyph at a given \a glyphIndex in the underlying
- font, if the QRawFont is valid, otherwise it will return an invalid QImage.
+ This function returns a rasterized image of the glyph at the given
+ \a glyphIndex in the underlying font, using the \a transform specified.
+ If the QRawFont is not valid, this function will return an invalid QImage.
If \a antialiasingType is set to QRawFont::SubPixelAntialiasing, then the resulting image will be
in QImage::Format_RGB32 and the RGB values of each pixel will represent the subpixel opacities of
@@ -435,11 +443,15 @@ int QRawFont::weight() const
}
/*!
- Converts a string of unicode points to glyph indexes using the CMAP table in the
- underlying font. Note that in cases where there are other tables in the font that affect the
- shaping of the text, the returned glyph indexes will not correctly represent the rendering
- of the text. To get the correctly shaped text, you can use QTextLayout to lay out and shape the
- text, and then call QTextLayout::glyphRuns() to get the set of glyph index list and QRawFont pairs.
+ Converts the string of unicode points given by \a text to glyph indexes
+ using the CMAP table in the underlying font, and returns a vector containing
+ the result.
+
+ Note that, in cases where there are other tables in the font that affect the
+ shaping of the text, the returned glyph indexes will not correctly represent
+ the rendering of the text. To get the correctly shaped text, you can use
+ QTextLayout to lay out and shape the text, then call QTextLayout::glyphs()
+ to get the set of glyph index list and QRawFont pairs.
\sa advancesForGlyphIndexes(), glyphIndexesForChars(), QGlyphRun, QTextLayout::glyphRuns(), QTextFragment::glyphRuns()
*/
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 74b1c69..0abafb8 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -600,7 +600,7 @@ Qt::CursorMoveStyle QTextDocument::defaultCursorMoveStyle() const
/*!
\since 4.8
- Set the default cursor movement style.
+ Sets the default cursor movement style to the given \a style.
*/
void QTextDocument::setDefaultCursorMoveStyle(Qt::CursorMoveStyle style)
{
@@ -2553,7 +2553,7 @@ void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block)
const bool emptyBlock = block.begin().atEnd();
if (emptyBlock) {
- html += QLatin1String("-qt-paragraph-type:empty; height:1em;");
+ html += QLatin1String("-qt-paragraph-type:empty;");
}
emitMargins(QString::number(format.topMargin()),
@@ -2709,6 +2709,8 @@ void QTextHtmlExporter::emitBlock(const QTextBlock &block)
emitBlockAttributes(block);
html += QLatin1Char('>');
+ if (block.begin().atEnd())
+ html += "<br />";
QTextBlock::Iterator it = block.begin();
if (fragmentMarkers && !it.atEnd() && block == doc->begin())
diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp
index 042b1d0..0c8860e 100644
--- a/src/gui/text/qtextdocumentfragment.cpp
+++ b/src/gui/text/qtextdocumentfragment.cpp
@@ -545,8 +545,13 @@ void QTextHtmlImporter::import()
}
if (currentNode->isBlock()) {
- if (processBlockNode() == ContinueWithNextNode)
+ QTextHtmlImporter::ProcessNodeResult result = processBlockNode();
+ if (result == ContinueWithNextNode) {
continue;
+ } else if (result == ContinueWithNextSibling) {
+ currentNodeIdx += currentNode->children.size();
+ continue;
+ }
}
if (currentNode->charFormat.isAnchor() && !currentNode->charFormat.anchorName().isEmpty()) {
@@ -1157,7 +1162,7 @@ QTextHtmlImporter::ProcessNodeResult QTextHtmlImporter::processBlockNode()
if (currentNode->isEmptyParagraph) {
hasBlock = false;
- return ContinueWithNextNode;
+ return ContinueWithNextSibling;
}
hasBlock = true;
diff --git a/src/gui/text/qtextdocumentfragment_p.h b/src/gui/text/qtextdocumentfragment_p.h
index bfbec30..227123e 100644
--- a/src/gui/text/qtextdocumentfragment_p.h
+++ b/src/gui/text/qtextdocumentfragment_p.h
@@ -135,7 +135,7 @@ private:
Table scanTable(int tableNodeIdx);
- enum ProcessNodeResult { ContinueWithNextNode, ContinueWithCurrentNode };
+ enum ProcessNodeResult { ContinueWithNextNode, ContinueWithCurrentNode, ContinueWithNextSibling };
void appendBlock(const QTextBlockFormat &format, QTextCharFormat charFmt = QTextCharFormat());
bool appendNodeText();
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index e8e6c98..8ddf3eb 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -319,6 +319,26 @@ static void appendItems(QScriptAnalysis *analysis, int &start, int &stop, const
start = stop;
}
+static QChar::Direction skipBoundryNeutrals(QScriptAnalysis *analysis,
+ const ushort *unicode, int length,
+ int &sor, int &eor, QBidiControl &control)
+{
+ QChar::Direction dir;
+ int level = sor > 0 ? analysis[sor - 1].bidiLevel : control.level;
+ while (sor < length) {
+ dir = QChar::direction(unicode[sor]);
+ // Keep skipping DirBN as if it doesn't exist
+ if (dir != QChar::DirBN)
+ break;
+ analysis[sor++].bidiLevel = level;
+ }
+
+ eor = sor;
+ if (eor == length)
+ dir = control.basicDirection();
+
+ return dir;
+}
// creates the next QScript items.
static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiControl &control)
@@ -430,8 +450,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
case QChar::DirAN:
if (eor >= 0) {
appendItems(analysis, sor, eor, control, dir);
- dir = eor < length ? QChar::direction(unicode[eor]) : control.basicDirection();
- status.eor = dir;
+ status.eor = dir = skipBoundryNeutrals(analysis, unicode, length, sor, eor, control);
} else {
eor = current; status.eor = dir;
}
@@ -455,8 +474,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
}
eor = current - 1;
appendItems(analysis, sor, eor, control, dir);
- dir = eor < length ? QChar::direction(unicode[eor]) : control.basicDirection();
- status.eor = dir;
+ status.eor = dir = skipBoundryNeutrals(analysis, unicode, length, sor, eor, control);
} else {
if(status.eor != QChar::DirL) {
appendItems(analysis, sor, eor, control, dir);
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index a699568..833414f 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -571,6 +571,8 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
\value FontStyleHint Corresponds to the QFont::StyleHint property
\value FontStyleStrategy Corresponds to the QFont::StyleStrategy property
\value FontKerning Specifies whether the font has kerning turned on.
+ \value FontHintingPreference Controls the use of hinting according to values
+ of the QFont::HintingPreference enum.
\omitvalue FirstFontProperty
\omitvalue LastFontProperty
@@ -588,8 +590,13 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
List properties
- \value ListStyle
- \value ListIndent
+ \value ListStyle Specifies the style used for the items in a list,
+ described by values of the QTextListFormat::Style enum.
+ \value ListIndent Specifies the amount of indentation used for a list.
+ \value ListNumberPrefix Defines the text which is prepended to item numbers in
+ numeric lists.
+ \value ListNumberSuffix Defines the text which is appended to item numbers in
+ numeric lists.
Table and frame properties
@@ -1263,16 +1270,18 @@ bool QTextFormat::operator==(const QTextFormat &rhs) const
\value AlignNormal Adjacent characters are positioned in the standard
way for text in the writing system in use.
- \value AlignSuperScript Characters are placed above the baseline for
+ \value AlignSuperScript Characters are placed above the base line for
normal text.
- \value AlignSubScript Characters are placed below the baseline for
+ \value AlignSubScript Characters are placed below the base line for
normal text.
- \value AlignMiddle The center of the object is vertically aligned with the base line.
- Currently, this is only implemented for inline objects.
+ \value AlignMiddle The center of the object is vertically aligned with the
+ base line. Currently, this is only implemented for
+ inline objects.
\value AlignBottom The bottom edge of the object is vertically aligned with
the base line.
\value AlignTop The top edge of the object is vertically aligned with
the base line.
+ \value AlignBaseline The base lines of the characters are aligned.
*/
/*!
@@ -2136,8 +2145,9 @@ QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const
\fn void QTextBlockFormat::setLineHeight(qreal height, int heightType)
\since 4.8
- This sets the line height for the paragraph to the value in height
- which is dependant on heightType, described by the LineHeightTypes enum.
+ Sets the line height for the paragraph to the value given by \a height
+ which is dependent on \a heightType in the way described by the
+ LineHeightTypes enum.
\sa LineHeightTypes, lineHeight(), lineHeightType()
*/
@@ -2147,11 +2157,16 @@ QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const
\fn qreal QTextBlockFormat::lineHeight(qreal scriptLineHeight, qreal scaling) const
\since 4.8
- This returns what the height of the lines in the paragraph will be depending
- on the given height of the script line and the scaling. The value that is returned
- is also dependant on the given LineHeightType of the paragraph as well as the LineHeight
- setting that has been set for the paragraph. The scaling is needed for the heights
- that include a fixed number of pixels, to scale them appropriately for printing.
+ Returns the height of the lines in the paragraph based on the height of the
+ script line given by \a scriptLineHeight and the specified \a scaling
+ factor.
+
+ The value that is returned is also dependent on the given LineHeightType of
+ the paragraph as well as the LineHeight setting that has been set for the
+ paragraph.
+
+ The scaling is needed for heights that include a fixed number of pixels, to
+ scale them appropriately for printing.
\sa LineHeightTypes, setLineHeight(), lineHeightType()
*/
@@ -2237,6 +2252,13 @@ QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const
numbering scheme used for items in the list. Note that lists that use the
decimal numbering scheme begin counting at 1 rather than 0.
+ Style properties can be set to further configure the appearance of list
+ items; for example, the ListNumberPrefix and ListNumberSuffix properties
+ can be used to customize the numbers used in an ordered list so that they
+ appear as (1), (2), (3), etc.:
+
+ \snippet doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp add a styled, ordered list
+
\sa QTextList
*/
@@ -2328,8 +2350,11 @@ QTextListFormat::QTextListFormat(const QTextFormat &fmt)
\fn void QTextListFormat::setNumberPrefix(const QString &numberPrefix)
\since 4.8
- Sets the list format's number prefix. This can be used with all
- sorted list types. It does not have any effect on unsorted list types.
+ Sets the list format's number prefix to the string specified by
+ \a numberPrefix. This can be used with all sorted list types. It does not
+ have any effect on unsorted list types.
+
+ The default prefix is an empty string.
\sa numberPrefix()
*/
@@ -2347,8 +2372,10 @@ QTextListFormat::QTextListFormat(const QTextFormat &fmt)
\fn void QTextListFormat::setNumberSuffix(const QString &numberSuffix)
\since 4.8
- Sets the list format's number suffix. This can be used with all
- sorted list types. It does not have any effect on unsorted list types.
+ Sets the list format's number suffix to the string specified by
+ \a numberSuffix. This can be used with all sorted list types. It does not
+ have any effect on unsorted list types.
+
The default suffix is ".".
\sa numberSuffix()
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 203886b..c1bc846 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -584,7 +584,7 @@ bool QTextLayout::cacheEnabled() const
this option is for widgets like QLineEdit or custom widgets without
a QTextDocument. Default value is Qt::LogicalMoveStyle.
- \sa setCursorMoveStyle()
+ \sa cursorMoveStyle()
*/
void QTextLayout::setCursorMoveStyle(Qt::CursorMoveStyle style)
{
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 8a93c28..2d63f63 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1127,12 +1127,19 @@ void QLineEdit::setDragEnabled(bool b)
behavior applies.
*/
+/*!
+ Returns the movement style for the cursor in the line edit.
+*/
Qt::CursorMoveStyle QLineEdit::cursorMoveStyle() const
{
Q_D(const QLineEdit);
return d->control->cursorMoveStyle();
}
+/*!
+ Sets the movement style for the cursor in the line edit to the given
+ \a style.
+*/
void QLineEdit::setCursorMoveStyle(Qt::CursorMoveStyle style)
{
Q_D(QLineEdit);
diff --git a/src/gui/widgets/qmdiarea.cpp b/src/gui/widgets/qmdiarea.cpp
index fde683d..2fe9706 100644
--- a/src/gui/widgets/qmdiarea.cpp
+++ b/src/gui/widgets/qmdiarea.cpp
@@ -2176,7 +2176,7 @@ void QMdiArea::setTabsClosable(bool closable)
Tabs are not movable by default.
- \sa QTabBar::tabsMovable, setViewMode()
+ \sa QTabBar::movable, setViewMode()
*/
bool QMdiArea::tabsMovable() const
{
diff --git a/src/gui/widgets/qtabwidget.cpp b/src/gui/widgets/qtabwidget.cpp
index ade798f..c6551e5 100644
--- a/src/gui/widgets/qtabwidget.cpp
+++ b/src/gui/widgets/qtabwidget.cpp
@@ -883,7 +883,7 @@ QSize QTabWidget::minimumSizeHint() const
.expandedTo(QApplication::globalStrut());
}
-/*
+/*!
\reimp
*/
int QTabWidget::heightForWidth(int width) const