diff options
author | axis <qt-info@nokia.com> | 2010-03-16 08:47:16 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2010-03-16 08:47:16 (GMT) |
commit | 815af5a5e42f0d9eb7ee85e7e1bf1faae8d3a47c (patch) | |
tree | 5d5e3ebc84dd6866a060b0d5416b6db873905e4e /src/gui | |
parent | 7ca339be57f1b8dbf9e289fae578c110813eb767 (diff) | |
parent | fdcb62d5d6a3e295273042555d2551eb491a5b2d (diff) | |
download | Qt-815af5a5e42f0d9eb7ee85e7e1bf1faae8d3a47c.zip Qt-815af5a5e42f0d9eb7ee85e7e1bf1faae8d3a47c.tar.gz Qt-815af5a5e42f0d9eb7ee85e7e1bf1faae8d3a47c.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt into 4.7-s60
Conflicts:
demos/embedded/anomaly/anomaly.pro
demos/embedded/flightinfo/flightinfo.pro
demos/embedded/lightmaps/lightmaps.pro
demos/embedded/weatherinfo/weatherinfo.pro
examples/network/fortuneclient/fortuneclient.pro
examples/network/fortuneserver/fortuneserver.pro
examples/network/network-chat/network-chat.pro
mkspecs/common/symbian/symbian.conf
mkspecs/features/symbian/platform_paths.prf
qmake/generators/symbian/symmake.cpp
qmake/generators/symbian/symmake.h
src/s60installs/s60installs.pro
Diffstat (limited to 'src/gui')
29 files changed, 216 insertions, 109 deletions
diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index 2d75913..4faa193 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -415,8 +415,15 @@ bool QDialog::event(QEvent *e) result = true; } #else - if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) - adjustPosition(parentWidget()); + if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) { + if (!testAttribute(Qt::WA_Moved)) { + Qt::WindowStates state = windowState(); + adjustPosition(parentWidget()); + setAttribute(Qt::WA_Moved, false); // not really an explicit position + if (state != windowState()) + setWindowState(state); + } + } #endif return result; } diff --git a/src/gui/dialogs/qprintdialog.h b/src/gui/dialogs/qprintdialog.h index ecd50c1..94177ea 100644 --- a/src/gui/dialogs/qprintdialog.h +++ b/src/gui/dialogs/qprintdialog.h @@ -56,7 +56,7 @@ class QPrintDialogPrivate; class QPushButton; class QPrinter; -#if defined (Q_OS_UNIX) && !defined(QTOPIA_PRINTDIALOG) && !defined(Q_WS_MAC) +#if defined (Q_OS_UNIX) && !defined(QTOPIA_PRINTDIALOG) && !defined(Q_WS_MAC) && !defined(Q_OS_SYMBIAN) class QUnixPrintWidgetPrivate; class Q_GUI_EXPORT QUnixPrintWidget : public QWidget diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/gui/dialogs/qprintdialog_unix.cpp index 0487f23..17283f5 100644 --- a/src/gui/dialogs/qprintdialog_unix.cpp +++ b/src/gui/dialogs/qprintdialog_unix.cpp @@ -152,6 +152,9 @@ public: bool checkFields(); void setupPrinter(); void setOptionsPane(QPrintDialogPrivate *pane); +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) + void setCupsProperties(); +#endif // slots void _q_printerChanged(int index); @@ -949,7 +952,7 @@ bool QUnixPrintWidgetPrivate::checkFields() void QUnixPrintWidgetPrivate::_q_btnPropertiesClicked() { - if (propertiesDialog == 0) { + if (!propertiesDialog) { propertiesDialog = new QPrintPropertiesDialog(q); propertiesDialog->setResult(QDialog::Rejected); } @@ -969,6 +972,35 @@ void QUnixPrintWidgetPrivate::_q_btnPropertiesClicked() propertiesDialog->exec(); } +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) +void QUnixPrintWidgetPrivate::setCupsProperties() +{ + if (cups && QCUPSSupport::isAvailable()) { + QPrintEngine *engine = printer->printEngine(); + const ppd_option_t* pageSizes = cups->pageSizes(); + QByteArray cupsPageSize; + for (int i = 0; i < pageSizes->num_choices; ++i) { + if (static_cast<int>(pageSizes->choices[i].marked) == 1) + cupsPageSize = pageSizes->choices[i].choice; + } + engine->setProperty(PPK_CupsStringPageSize, QString::fromLatin1(cupsPageSize)); + engine->setProperty(PPK_CupsOptions, cups->options()); + + QRect pageRect = cups->pageRect(cupsPageSize); + engine->setProperty(PPK_CupsPageRect, pageRect); + + QRect paperRect = cups->paperRect(cupsPageSize); + engine->setProperty(PPK_CupsPaperRect, paperRect); + + for (int ps = 0; ps < QPrinter::NPaperSize; ++ps) { + QPdf::PaperSize size = QPdf::paperSize(QPrinter::PaperSize(ps)); + if (size.width == paperRect.width() && size.height == paperRect.height()) + printer->setPaperSize(static_cast<QPrinter::PaperSize>(ps)); + } + } +} +#endif + void QUnixPrintWidgetPrivate::setupPrinter() { const int printerCount = widget.printers->count(); @@ -993,6 +1025,10 @@ void QUnixPrintWidgetPrivate::setupPrinter() if (propertiesDialog && propertiesDialog->result() == QDialog::Accepted) propertiesDialog->setupPrinter(); +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) + if (!propertiesDialog) + setCupsProperties(); +#endif } diff --git a/src/gui/graphicsview/qgraphicssceneevent.h b/src/gui/graphicsview/qgraphicssceneevent.h index 033a996..c8a0028 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.h +++ b/src/gui/graphicsview/qgraphicssceneevent.h @@ -77,6 +77,8 @@ protected: QGraphicsSceneEvent(QGraphicsSceneEventPrivate &dd, Type type = None); QScopedPointer<QGraphicsSceneEventPrivate> d_ptr; Q_DECLARE_PRIVATE(QGraphicsSceneEvent) +private: + Q_DISABLE_COPY(QGraphicsSceneEvent) }; class QGraphicsSceneMouseEventPrivate; @@ -124,6 +126,7 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneMouseEvent) + Q_DISABLE_COPY(QGraphicsSceneMouseEvent) }; class QGraphicsSceneWheelEventPrivate; @@ -156,6 +159,7 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneWheelEvent) + Q_DISABLE_COPY(QGraphicsSceneWheelEvent) }; class QGraphicsSceneContextMenuEventPrivate; @@ -184,6 +188,7 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneContextMenuEvent) + Q_DISABLE_COPY(QGraphicsSceneContextMenuEvent) }; class QGraphicsSceneHoverEventPrivate; @@ -216,6 +221,7 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneHoverEvent) + Q_DISABLE_COPY(QGraphicsSceneHoverEvent) }; class QGraphicsSceneHelpEventPrivate; @@ -233,6 +239,7 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneHelpEvent) + Q_DISABLE_COPY(QGraphicsSceneHelpEvent) }; class QGraphicsSceneDragDropEventPrivate; @@ -275,12 +282,14 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneDragDropEvent) + Q_DISABLE_COPY(QGraphicsSceneDragDropEvent) }; class QGraphicsSceneResizeEventPrivate; class Q_GUI_EXPORT QGraphicsSceneResizeEvent : public QGraphicsSceneEvent { Q_DECLARE_PRIVATE(QGraphicsSceneResizeEvent) + Q_DISABLE_COPY(QGraphicsSceneResizeEvent) public: QGraphicsSceneResizeEvent(); ~QGraphicsSceneResizeEvent(); @@ -296,6 +305,7 @@ class QGraphicsSceneMoveEventPrivate; class Q_GUI_EXPORT QGraphicsSceneMoveEvent : public QGraphicsSceneEvent { Q_DECLARE_PRIVATE(QGraphicsSceneMoveEvent) + Q_DISABLE_COPY(QGraphicsSceneMoveEvent) public: QGraphicsSceneMoveEvent(); ~QGraphicsSceneMoveEvent(); diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 46fd9d0..702a8bb 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -2549,7 +2549,7 @@ void QTableView::scrollTo(const QModelIndex &index, ScrollHint hint) // check if we really need to do anything if (!d->isIndexValid(index) || (d->model->parent(index) != d->root) - || isIndexHidden(index)) + || isRowHidden(index.row()) || isColumnHidden(index.column())) return; QSpanCollection::Span span; diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 3b2566b..573bac6 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1034,7 +1034,7 @@ void QSymbianControl::HandleResourceChange(int resourceType) qwidget->adjustSize(); qwidget->setAttribute(Qt::WA_Resized, false); //not a user resize } - if (!qwidget->testAttribute(Qt::WA_Moved)) { + if (!qwidget->testAttribute(Qt::WA_Moved) && qwidget->windowType() != Qt::Dialog) { TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); SetPosition(r.iTl); qwidget->setAttribute(Qt::WA_Moved, false); // not really an explicit position diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp index f38e4f5..ae1f60d 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -348,7 +348,8 @@ QCursor::QCursor(const QPixmap &pixmap, int hotX, int hotY) \o B=1 and M=1 gives black. \o B=0 and M=1 gives white. \o B=0 and M=0 gives transparent. - \o B=1 and M=0 gives an XOR'd result. + \o B=1 and M=0 gives an XOR'd result under Windows, undefined + results on all other platforms. \endlist Use the global Qt color Qt::color0 to draw 0-pixels and Qt::color1 to diff --git a/src/gui/kernel/qdesktopwidget_s60.cpp b/src/gui/kernel/qdesktopwidget_s60.cpp index 84e3c5d..e4d0bf3 100644 --- a/src/gui/kernel/qdesktopwidget_s60.cpp +++ b/src/gui/kernel/qdesktopwidget_s60.cpp @@ -88,6 +88,7 @@ QDesktopWidgetPrivate::~QDesktopWidgetPrivate() void QDesktopWidgetPrivate::init(QDesktopWidget *that) { + Q_UNUSED(that); // int screenCount=0; // ### TODO: Implement proper multi-display support diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 735ca7a..cedede1 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -68,12 +68,12 @@ #include <eikappui.h> #ifdef Q_WS_S60 -#include <aknutils.h> // AknLayoutUtils +#include <AknUtils.h> // AknLayoutUtils #include <avkon.hrh> // EEikStatusPaneUidTitle #include <akntitle.h> // CAknTitlePane #include <akncontext.h> // CAknContextPane #include <eikspane.h> // CEikStatusPane -#include <aknpopupfader.h> // MAknFadedComponent and TAknPopupFader +#include <AknPopupFader.h> // MAknFadedComponent and TAknPopupFader #endif QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 4b45abd..a0e4050 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4783,8 +4783,10 @@ void QWidgetPrivate::syncCocoaMask() if (!q->testAttribute(Qt::WA_WState_Created) || !extra) return; - if (extra->hasMask && extra->maskBits.size() != q->size()) { - extra->maskBits = QImage(q->size(), QImage::Format_Mono); + if (extra->hasMask) { + if(extra->maskBits.size() != q->size()) { + extra->maskBits = QImage(q->size(), QImage::Format_Mono); + } extra->maskBits.fill(QColor(Qt::color1).rgba()); extra->maskBits.setNumColors(2); extra->maskBits.setColor(0, QColor(Qt::color0).rgba()); diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 7fb21d2..79702af 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -1037,6 +1037,17 @@ QPoint QWidget::mapFromGlobal(const QPoint &pos) const return widgetPos; } +static Qt::WindowStates effectiveState(Qt::WindowStates state) +{ + if (state & Qt::WindowMinimized) + return Qt::WindowMinimized; + else if (state & Qt::WindowFullScreen) + return Qt::WindowFullScreen; + else if (state & Qt::WindowMaximized) + return Qt::WindowMaximized; + return Qt::WindowNoState; +} + void QWidget::setWindowState(Qt::WindowStates newstate) { Q_D(QWidget); @@ -1052,6 +1063,8 @@ void QWidget::setWindowState(Qt::WindowStates newstate) return; if (isWindow()) { + const bool wasResized = testAttribute(Qt::WA_Resized); + const bool wasMoved = testAttribute(Qt::WA_Moved); QSymbianControl *window = static_cast<QSymbianControl *>(effectiveWinId()); if (window && newstate & Qt::WindowMinimized) { @@ -1090,7 +1103,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) createWinId(); Q_ASSERT(testAttribute(Qt::WA_WState_Created)); // Ensure the initial size is valid, since we store it as normalGeometry below. - if (!testAttribute(Qt::WA_Resized) && !isVisible()) + if (!wasResized && !isVisible()) adjustSize(); QTLWExtra *top = d->topData(); @@ -1105,6 +1118,15 @@ void QWidget::setWindowState(Qt::WindowStates newstate) //restore normal geometry top->normalGeometry = normalGeometry; + + // FixMe QTBUG-8977 + // In some platforms, WA_Resized and WA_Moved are also not set when application window state is + // anything else than normal. In Symbian we can restore them only for normal window state since + // restoring for other modes, will make fluidlauncher to be launched in wrong size (200x100) + if (effectiveState(newstate) == Qt::WindowNoState) { + setAttribute(Qt::WA_Resized, wasResized); + setAttribute(Qt::WA_Moved, wasMoved); + } } data->window_state = newstate; diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 614d2c0..bea2b6e 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -3134,8 +3134,8 @@ SOFTWARE. ************************************************************************/ /* $XFree86: xc/lib/X11/PolyReg.c,v 1.1.1.2.8.2 1998/10/04 15:22:49 hohndel Exp $ */ -#define LARGE_COORDINATE 1000000 -#define SMALL_COORDINATE -LARGE_COORDINATE +#define LARGE_COORDINATE INT_MAX +#define SMALL_COORDINATE INT_MIN /* * InsertEdgeInET diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index 9909643..212a582 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -293,7 +293,8 @@ inline QTransform &QTransform::operator*=(qreal num) affine._dx *= num; affine._dy *= num; m_33 *= num; - m_dirty |= TxScale; + if (m_dirty < TxScale) + m_dirty = TxScale; return *this; } inline QTransform &QTransform::operator/=(qreal div) @@ -316,7 +317,7 @@ inline QTransform &QTransform::operator+=(qreal num) affine._dx += num; affine._dy += num; m_33 += num; - m_dirty |= TxProject; + m_dirty = TxProject; return *this; } inline QTransform &QTransform::operator-=(qreal num) @@ -332,7 +333,7 @@ inline QTransform &QTransform::operator-=(qreal num) affine._dx -= num; affine._dy -= num; m_33 -= num; - m_dirty |= TxProject; + m_dirty = TxProject; return *this; } diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 949b338..b25dce5 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -70,13 +70,13 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget) // We create empty CFbsBitmap here -> it will be resized in setGeometry CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) ); - + QS60PixmapData *data = new QS60PixmapData(QPixmapData::PixmapType); if (data) { data->fromSymbianBitmap(bitmap, true); d_ptr->device = QPixmap(data); } - + setStaticContentsSupport(true); } QS60WindowSurface::~QS60WindowSurface() @@ -89,24 +89,15 @@ void QS60WindowSurface::beginPaint(const QRegion &rgn) if (!qt_widget_private(window())->isOpaque) { QS60PixmapData *pixmapData = static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data()); pixmapData->beginDataAccess(); - QImage &image = pixmapData->image; - QRgb *data = reinterpret_cast<QRgb *>(image.bits()); - const int row_stride = image.bytesPerLine() / 4; + QPainter p(&pixmapData->image); + p.setCompositionMode(QPainter::CompositionMode_Source); const QVector<QRect> rects = rgn.rects(); + const QColor blank = Qt::transparent; for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { - const int x_start = it->x(); - const int width = it->width(); - - const int y_start = it->y(); - const int height = it->height(); - - QRgb *row = data + row_stride * y_start; - for (int y = 0; y < height; ++y) { - qt_memfill(row + x_start, 0U, width); - row += row_stride; - } + p.fillRect(*it, blank); } + pixmapData->endDataAccess(); } } @@ -128,7 +119,7 @@ QImage* QS60WindowSurface::buffer(const QWidget *widget) const QPoint off = offset(widget); QImage *img = &(static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data())->image); - + QRect rect(off, widget->size()); rect &= QRect(QPoint(), img->size()); diff --git a/src/gui/s60framework/qs60maindocument.h b/src/gui/s60framework/qs60maindocument.h index 438b80c..553675f 100644 --- a/src/gui/s60framework/qs60maindocument.h +++ b/src/gui/s60framework/qs60maindocument.h @@ -46,7 +46,7 @@ #ifdef Q_WS_S60 -#include <akndoc.h> +#include <AknDoc.h> class CEikApplication; diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri index df2feec..e177a33 100644 --- a/src/gui/s60framework/s60framework.pri +++ b/src/gui/s60framework/s60framework.pri @@ -5,7 +5,7 @@ minimalAppResource31 = \ "SOURCEPATH s60framework" \ "START RESOURCE s60main.rss" \ "HEADER" \ - "TARGETPATH resource\apps" \ + "TARGETPATH /resource/apps" \ "END" MMP_RULES += minimalAppResource31 diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index cb49fbc..ecac3d6 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -50,17 +50,17 @@ #include "qapplication.h" #include <w32std.h> -#include <aknsconstants.h> +#include <AknsConstants.h> #include <aknconsts.h> -#include <aknsitemid.h> -#include <aknsutils.h> -#include <aknsdrawutils.h> -#include <aknsskininstance.h> -#include <aknsbasicbackgroundcontrolcontext.h> +#include <AknsItemID.h> +#include <AknsUtils.h> +#include <AknsDrawUtils.h> +#include <AknsSkinInstance.h> +#include <AknsBasicBackgroundControlContext.h> #include <avkon.mbg> #include <aknfontaccess.h> #include <aknlayoutfont.h> -#include <aknutils.h> +#include <AknUtils.h> #include <aknnavi.h> #include <gulicon.h> #include <AknBitmapAnimation.h> diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index 676f59e..5084442 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -164,17 +164,17 @@ contains( styles, windowsmobile ) { } contains( styles, s60 ):contains(QT_CONFIG, s60) { - HEADERS += \ - styles/qs60style.h \ - styles/qs60style_p.h - SOURCES += styles/qs60style.cpp - symbian { - SOURCES += styles/qs60style_s60.cpp - LIBS += -laknicon -laknskins -laknskinsrv -lfontutils -legul -lbmpanim - } else { - SOURCES += styles/qs60style_simulated.cpp - RESOURCES += styles/qstyle_s60_simulated.qrc - } + HEADERS += \ + styles/qs60style.h \ + styles/qs60style_p.h + SOURCES += styles/qs60style.cpp + symbian { + SOURCES += styles/qs60style_s60.cpp + LIBS += -lAknIcon -lAKNSKINS -lAKNSKINSRV -lFontUtils -legul -lbmpanim + } else { + SOURCES += styles/qs60style_simulated.cpp + RESOURCES += styles/qstyle_s60_simulated.qrc + } } else { - DEFINES += QT_NO_STYLE_S60 + DEFINES += QT_NO_STYLE_S60 } diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index dca2da5..140cf43 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -3085,7 +3085,8 @@ int QTextFormatCollection::indexForFormat(const QTextFormat &format) f.d = new QTextFormatPrivate; f.d->resolveFont(defaultFnt); - hashes.insert(hash, idx); + if (!hashes.contains(hash, idx)) + hashes.insert(hash, idx); } QT_CATCH(...) { formats.pop_back(); diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index 65b998f..a415180 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -62,8 +62,8 @@ const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592 #ifdef Q_WS_S60 # include <pathinfo.h> // PathInfo # ifdef USE_DOCUMENTHANDLER -# include <documenthandler.h> // CDocumentHandler -# include <aknserverapp.h> +# include <DocumentHandler.h> // CDocumentHandler +# include <AknServerApp.h> # endif #else # warning CDocumentHandler requires support for S60 diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri index cdbb7cc..3074367 100644 --- a/src/gui/util/util.pri +++ b/src/gui/util/util.pri @@ -41,5 +41,5 @@ embedded { symbian { LIBS += -lsendas2 -letext -lapmime - contains(QT_CONFIG, s60): LIBS += -lplatformenv -lcommonui + contains(QT_CONFIG, s60): LIBS += -lplatformenv -lCommonUI } diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index f44858a..806654c 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -1995,16 +1995,19 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*> #ifdef QT_NO_TABBAR const int tabBarShape = 0; #endif - QDockAreaLayoutInfo *info = new QDockAreaLayoutInfo(sep, dockPos, o, - tabBarShape, mainWindow); - QDockAreaLayoutItem item(info); + QDockAreaLayoutItem item(new QDockAreaLayoutInfo(sep, dockPos, o, + tabBarShape, mainWindow)); stream >> item.pos >> item.size >> dummy >> dummy; - if (!info->restoreState(stream, widgets, testing)) + //we need to make sure the element is in the list so the dock widget can eventually be docked correctly + if (!testing) + item_list.append(item); + + //here we need to make sure we change the item in the item_list + QDockAreaLayoutItem &lastItem = testing ? item : item_list.last(); + + if (!lastItem.subinfo->restoreState(stream, widgets, testing)) return false; - if (!testing) { - item_list.append(item); - } } else { return false; } diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp index 2c76a5c..468c111 100644 --- a/src/gui/widgets/qlineedit_p.cpp +++ b/src/gui/widgets/qlineedit_p.cpp @@ -134,7 +134,7 @@ void QLineEditPrivate::_q_selectionChanged() q->initStyleOption(&opt); bool showCursor = control->hasSelectedText() ? q->style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, q): - true; + q->hasFocus(); setCursorVisible(showCursor); } diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index bf926f8..d2eda80 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -65,9 +65,6 @@ QT_BEGIN_NAMESPACE extern OSWindowRef qt_mac_window_for(const QWidget *); // qwidget_mac.cpp QT_END_NAMESPACE #endif -#ifdef QT_SOFTKEYS_ENABLED -#include <private/qsoftkeymanager_p.h> -#endif QT_BEGIN_NAMESPACE @@ -80,9 +77,6 @@ public: #ifdef Q_WS_MAC , useHIToolBar(false) #endif -#ifdef QT_SOFTKEYS_ENABLED - , menuBarAction(0) -#endif #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR) , hasOldCursor(false) , cursorAdjusted(false) #endif @@ -94,9 +88,6 @@ public: #ifdef Q_WS_MAC bool useHIToolBar; #endif -#ifdef QT_SOFTKEYS_ENABLED - QAction *menuBarAction; -#endif void init(); QList<int> hoverSeparator; QPoint hoverPos; @@ -117,10 +108,6 @@ void QMainWindowPrivate::init() const int metric = q->style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q); iconSize = QSize(metric, metric); q->setAttribute(Qt::WA_Hover); -#ifdef QT_SOFTKEYS_ENABLED - menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::MenuSoftKey, q); - menuBarAction->setVisible(false); -#endif } /* @@ -492,13 +479,6 @@ void QMainWindow::setMenuBar(QMenuBar *menuBar) oldMenuBar->deleteLater(); } d->layout->setMenuBar(menuBar); - -#ifdef QT_SOFTKEYS_ENABLED - if (menuBar) - addAction(d->menuBarAction); - else - removeAction(d->menuBarAction); -#endif } /*! @@ -1428,11 +1408,6 @@ bool QMainWindow::event(QEvent *event) } break; #endif -#ifdef QT_SOFTKEYS_ENABLED - case QEvent::LanguageChange: - d->menuBarAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::MenuSoftKey)); - break; -#endif default: break; } diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index 276ffe6..39cbbd8 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -347,7 +347,7 @@ public: void syncAction(QWceMenuAction *); inline void syncAction(QAction *a) { syncAction(findAction(a)); } void removeAction(QWceMenuAction *); - void rebuild(bool reCreate = false); + void rebuild(); inline void removeAction(QAction *a) { removeAction(findAction(a)); } inline QWceMenuAction *findAction(QAction *a) { for(int i = 0; i < actionItems.size(); i++) { diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index e3c52bf..4a9cfed 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -324,6 +324,14 @@ void QMenuBarPrivate::symbianDestroyMenuBar() symbian_menubar = 0; } +void QMenuBarPrivate::reparentMenuBar(QWidget *oldParent, QWidget *newParent) +{ + if (menubars()->contains(oldParent)) { + QMenuBarPrivate *object = menubars()->take(oldParent); + menubars()->insert(newParent, object); + } +} + QMenuBarPrivate::QSymbianMenuBarPrivate::QSymbianMenuBarPrivate(QMenuBarPrivate *menubar) { d = menubar; diff --git a/src/gui/widgets/qmenu_wince.cpp b/src/gui/widgets/qmenu_wince.cpp index 28b6b8b..1577f0a 100644 --- a/src/gui/widgets/qmenu_wince.cpp +++ b/src/gui/widgets/qmenu_wince.cpp @@ -101,7 +101,6 @@ struct qt_SHMENUBARINFO COLORREF clrBk; }; -typedef int (WINAPI *superfunc)(int, int); typedef BOOL (WINAPI *AygCreateMenuBar)(qt_SHMENUBARINFO*); typedef HRESULT (WINAPI *AygEnableSoftKey)(HWND,UINT,BOOL,BOOL); @@ -254,6 +253,12 @@ static void qt_wce_insert_action(HMENU menu, QWceMenuAction *action, bool create } } +// Removes all items from the menu without destroying the handles. +static void qt_wce_clear_menu(HMENU hMenu) +{ + while (RemoveMenu(hMenu, 0, MF_BYPOSITION)); +} + /*! \internal @@ -404,7 +409,8 @@ QMenuPrivate::QWceMenuPrivate::QWceMenuPrivate() { QMenuPrivate::QWceMenuPrivate::~QWceMenuPrivate() { qt_wce_delete_action_list(&actionItems); - menuHandle = 0; + if (menuHandle) + DestroyMenu(menuHandle); } void QMenuPrivate::QWceMenuPrivate::addAction(QAction *a, QWceMenuAction *before) { @@ -439,14 +445,17 @@ HMENU QMenuPrivate::wceMenu(bool create) { if (!wce_menu) wce_menu = new QWceMenuPrivate; if (!wce_menu->menuHandle || create) - wce_menu->rebuild(create); + wce_menu->rebuild(); return wce_menu->menuHandle; } -void QMenuPrivate::QWceMenuPrivate::rebuild(bool reCreate) { - if (menuHandle && !reCreate) - DestroyMenu(menuHandle); - menuHandle = CreatePopupMenu(); +void QMenuPrivate::QWceMenuPrivate::rebuild() +{ + if (!menuHandle) + menuHandle = CreatePopupMenu(); + else + qt_wce_clear_menu(menuHandle); + for (int i = 0; i < actionItems.size(); ++i) { QWceMenuAction *action = actionItems.at(i); action->menuHandle = menuHandle; @@ -522,6 +531,7 @@ void QMenuBarPrivate::QWceMenuBarPrivate::rebuild() { resourceHandle = IDR_MAIN_MENU5; } Q_ASSERT_X(menubarHandle, "rebuild !created", "menubar already deleted"); + qt_wce_clear_menu(menuHandle); DestroyWindow(menubarHandle); menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), resourceHandle); Q_ASSERT_X(menubarHandle, "rebuild classic menu", "cannot create menubar from resource"); @@ -563,6 +573,7 @@ void QMenuBarPrivate::QWceMenuBarPrivate::rebuild() { leftButtonIsMenu = (leftButtonAction && leftButtonAction->menu()); Q_ASSERT_X(menubarHandle, "rebuild !created", "menubar already deleted"); + qt_wce_clear_menu(menuHandle); DestroyWindow(menubarHandle); if (leftButtonIsMenu) { menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), IDR_MAIN_MENU2); diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 9caadb7..13aa02b 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -71,6 +71,10 @@ extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp #endif +#ifdef QT_SOFTKEYS_ENABLED +#include <private/qsoftkeymanager_p.h> +#endif + QT_BEGIN_NAMESPACE class QMenuBarExtension : public QToolButton @@ -740,17 +744,14 @@ void QMenuBarPrivate::init() QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); } #endif -#ifdef Q_WS_S60 - symbianCreateMenuBar(q->parentWidget()); - if(symbian_menubar) - q->hide(); -#endif - q->setBackgroundRole(QPalette::Button); oldWindow = oldParent = 0; #ifdef QT3_SUPPORT doAutoResize = false; #endif +#ifdef QT_SOFTKEYS_ENABLED + menuBarAction = 0; +#endif handleReparent(); q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q)); @@ -1384,10 +1385,38 @@ void QMenuBarPrivate::handleReparent() wce_menubar->rebuild(); #endif #ifdef Q_WS_S60 - if (symbian_menubar) + + // Construct symbian_menubar when this code path is entered first time + // and when newParent != NULL + if (!symbian_menubar) + symbianCreateMenuBar(newParent); + + // Reparent and rebuild menubar when parent is changed + if (symbian_menubar) { + if (oldParent != newParent) + reparentMenuBar(oldParent, newParent); + q->hide(); symbian_menubar->rebuild(); -#endif + } +#ifdef QT_SOFTKEYS_ENABLED + // Constuct menuBarAction when this code path is entered first time + if (!menuBarAction) { + if (newParent) { + menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::MenuSoftKey, newParent); + menuBarAction->setVisible(false); + newParent->addAction(menuBarAction); + } + } else { + // If reparenting i.e. we already have menuBarAction, remove it from old parent + // and add for a new parent + if (oldParent) + oldParent->removeAction(menuBarAction); + if (newParent) + newParent->addAction(menuBarAction); + } +#endif // QT_SOFTKEYS_ENABLED +#endif // Q_WS_S60 } #ifdef QT3_SUPPORT @@ -1440,7 +1469,13 @@ void QMenuBar::changeEvent(QEvent *e) || e->type() == QEvent::ApplicationFontChange) { d->itemsDirty = true; d->updateGeometries(); +#ifdef QT_SOFTKEYS_ENABLED + } else if (e->type() == QEvent::LanguageChange) { + if (d->menuBarAction) + d->menuBarAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::MenuSoftKey)); +#endif } + QWidget::changeEvent(e); } diff --git a/src/gui/widgets/qmenubar_p.h b/src/gui/widgets/qmenubar_p.h index 819aee4..82070fe 100644 --- a/src/gui/widgets/qmenubar_p.h +++ b/src/gui/widgets/qmenubar_p.h @@ -244,6 +244,7 @@ public: #ifdef Q_WS_S60 void symbianCreateMenuBar(QWidget *); void symbianDestroyMenuBar(); + void reparentMenuBar(QWidget *oldParent, QWidget *newParent); struct QSymbianMenuBarPrivate { QList<QSymbianMenuAction*> actionItems; QMenuBarPrivate *d; @@ -268,7 +269,9 @@ public: } *symbian_menubar; static int symbianCommands(int command); - +#ifdef QT_SOFTKEYS_ENABLED + QAction *menuBarAction; +#endif #endif }; #endif |