diff options
Diffstat (limited to 'src/gui')
260 files changed, 1122 insertions, 972 deletions
diff --git a/src/gui/accessible/qaccessiblewidget.cpp b/src/gui/accessible/qaccessiblewidget.cpp index 447edc1..2d09c9c 100644 --- a/src/gui/accessible/qaccessiblewidget.cpp +++ b/src/gui/accessible/qaccessiblewidget.cpp @@ -269,7 +269,7 @@ QT_END_INCLUDE_NAMESPACE class QACConnectionObject : public QObject { - Q_DECLARE_PRIVATE(QObject) + Q_DECLARE_SCOPED_PRIVATE(QObject) public: inline bool isSender(const QObject *receiver, const char *signal) const { return d_func()->isSender(receiver, signal); } diff --git a/src/gui/dialogs/qabstractpagesetupdialog.h b/src/gui/dialogs/qabstractpagesetupdialog.h index 7a3bb48..ba6b452 100644 --- a/src/gui/dialogs/qabstractpagesetupdialog.h +++ b/src/gui/dialogs/qabstractpagesetupdialog.h @@ -58,7 +58,7 @@ class QPrinter; // ### Qt 5: Remove this class class Q_GUI_EXPORT QAbstractPageSetupDialog : public QDialog { - Q_DECLARE_PRIVATE(QAbstractPageSetupDialog) + Q_DECLARE_SCOPED_PRIVATE(QAbstractPageSetupDialog) Q_OBJECT public: diff --git a/src/gui/dialogs/qabstractprintdialog.h b/src/gui/dialogs/qabstractprintdialog.h index 272d1b1..0a94034 100644 --- a/src/gui/dialogs/qabstractprintdialog.h +++ b/src/gui/dialogs/qabstractprintdialog.h @@ -58,7 +58,7 @@ class QPrinter; // ### Qt 5: remove this class class Q_GUI_EXPORT QAbstractPrintDialog : public QDialog { - Q_DECLARE_PRIVATE(QAbstractPrintDialog) + Q_DECLARE_SCOPED_PRIVATE(QAbstractPrintDialog) Q_OBJECT public: diff --git a/src/gui/dialogs/qcolordialog.h b/src/gui/dialogs/qcolordialog.h index 2c107bd..d0aeec7 100644 --- a/src/gui/dialogs/qcolordialog.h +++ b/src/gui/dialogs/qcolordialog.h @@ -57,7 +57,7 @@ class QColorDialogPrivate; class Q_GUI_EXPORT QColorDialog : public QDialog { Q_OBJECT - Q_DECLARE_PRIVATE(QColorDialog) + Q_DECLARE_SCOPED_PRIVATE(QColorDialog) Q_ENUMS(ColorDialogOption) Q_PROPERTY(QColor currentColor READ currentColor WRITE setCurrentColor NOTIFY currentColorChanged) diff --git a/src/gui/dialogs/qdialog.h b/src/gui/dialogs/qdialog.h index 8479994..0b5b326 100644 --- a/src/gui/dialogs/qdialog.h +++ b/src/gui/dialogs/qdialog.h @@ -121,7 +121,7 @@ protected: void adjustPosition(QWidget*); private: - Q_DECLARE_PRIVATE(QDialog) + Q_DECLARE_SCOPED_PRIVATE(QDialog) Q_DISABLE_COPY(QDialog) #ifdef Q_WS_WINCE_WM diff --git a/src/gui/dialogs/qerrormessage.h b/src/gui/dialogs/qerrormessage.h index 9721f46..1d79f78 100644 --- a/src/gui/dialogs/qerrormessage.h +++ b/src/gui/dialogs/qerrormessage.h @@ -57,7 +57,7 @@ class QErrorMessagePrivate; class Q_GUI_EXPORT QErrorMessage: public QDialog { Q_OBJECT - Q_DECLARE_PRIVATE(QErrorMessage) + Q_DECLARE_SCOPED_PRIVATE(QErrorMessage) public: explicit QErrorMessage(QWidget* parent = 0); ~QErrorMessage(); diff --git a/src/gui/dialogs/qfiledialog.h b/src/gui/dialogs/qfiledialog.h index 70ee720..987e436 100644 --- a/src/gui/dialogs/qfiledialog.h +++ b/src/gui/dialogs/qfiledialog.h @@ -283,7 +283,7 @@ protected: void changeEvent(QEvent *e); private: - Q_DECLARE_PRIVATE(QFileDialog) + Q_DECLARE_SCOPED_PRIVATE(QFileDialog) Q_DISABLE_COPY(QFileDialog) Q_PRIVATE_SLOT(d_func(), void _q_pathChanged(const QString &)) diff --git a/src/gui/dialogs/qfilesystemmodel.h b/src/gui/dialogs/qfilesystemmodel.h index 769463c..5ab49ff 100644 --- a/src/gui/dialogs/qfilesystemmodel.h +++ b/src/gui/dialogs/qfilesystemmodel.h @@ -151,7 +151,7 @@ protected: bool event(QEvent *event); private: - Q_DECLARE_PRIVATE(QFileSystemModel) + Q_DECLARE_SCOPED_PRIVATE(QFileSystemModel) Q_DISABLE_COPY(QFileSystemModel) Q_PRIVATE_SLOT(d_func(), void _q_directoryChanged(const QString &directory, const QStringList &list)) diff --git a/src/gui/dialogs/qfontdialog.h b/src/gui/dialogs/qfontdialog.h index 6e0f1a0..4c80194 100644 --- a/src/gui/dialogs/qfontdialog.h +++ b/src/gui/dialogs/qfontdialog.h @@ -59,7 +59,7 @@ class QFontDialogPrivate; class Q_GUI_EXPORT QFontDialog : public QDialog { Q_OBJECT - Q_DECLARE_PRIVATE(QFontDialog) + Q_DECLARE_SCOPED_PRIVATE(QFontDialog) Q_ENUMS(FontDialogOption) Q_PROPERTY(QFont currentFont READ currentFont WRITE setCurrentFont NOTIFY currentFontChanged) Q_PROPERTY(FontDialogOptions options READ options WRITE setOptions) diff --git a/src/gui/dialogs/qinputdialog.h b/src/gui/dialogs/qinputdialog.h index 401b328..edeaadd 100644 --- a/src/gui/dialogs/qinputdialog.h +++ b/src/gui/dialogs/qinputdialog.h @@ -59,7 +59,7 @@ class QInputDialogPrivate; class Q_GUI_EXPORT QInputDialog : public QDialog { Q_OBJECT - Q_DECLARE_PRIVATE(QInputDialog) + Q_DECLARE_SCOPED_PRIVATE(QInputDialog) // Q_ENUMS(InputMode InputDialogOption) QDOC_PROPERTY(InputMode inputMode READ inputMode WRITE setInputMode) QDOC_PROPERTY(QString labelText READ labelText WRITE setLabelText) diff --git a/src/gui/dialogs/qmessagebox.h b/src/gui/dialogs/qmessagebox.h index 048455e..d24d466 100644 --- a/src/gui/dialogs/qmessagebox.h +++ b/src/gui/dialogs/qmessagebox.h @@ -336,7 +336,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked(QAbstractButton *)) Q_DISABLE_COPY(QMessageBox) - Q_DECLARE_PRIVATE(QMessageBox) + Q_DECLARE_SCOPED_PRIVATE(QMessageBox) }; Q_DECLARE_OPERATORS_FOR_FLAGS(QMessageBox::StandardButtons) diff --git a/src/gui/dialogs/qpagesetupdialog.h b/src/gui/dialogs/qpagesetupdialog.h index 43e316d..1757c32 100644 --- a/src/gui/dialogs/qpagesetupdialog.h +++ b/src/gui/dialogs/qpagesetupdialog.h @@ -57,7 +57,7 @@ class QPageSetupDialogPrivate; class Q_GUI_EXPORT QPageSetupDialog : public QAbstractPageSetupDialog { Q_OBJECT - Q_DECLARE_PRIVATE(QPageSetupDialog) + Q_DECLARE_SCOPED_PRIVATE(QPageSetupDialog) Q_ENUMS(PageSetupDialogOption) Q_PROPERTY(PageSetupDialogOptions options READ options WRITE setOptions) diff --git a/src/gui/dialogs/qprintdialog.h b/src/gui/dialogs/qprintdialog.h index e5a90cc..5af70b3 100644 --- a/src/gui/dialogs/qprintdialog.h +++ b/src/gui/dialogs/qprintdialog.h @@ -81,7 +81,7 @@ private: class Q_GUI_EXPORT QPrintDialog : public QAbstractPrintDialog { Q_OBJECT - Q_DECLARE_PRIVATE(QPrintDialog) + Q_DECLARE_SCOPED_PRIVATE(QPrintDialog) Q_ENUMS(PrintDialogOption) Q_PROPERTY(PrintDialogOptions options READ options WRITE setOptions) diff --git a/src/gui/dialogs/qprintpreviewdialog.h b/src/gui/dialogs/qprintpreviewdialog.h index 85ed517..5836e5a 100644 --- a/src/gui/dialogs/qprintpreviewdialog.h +++ b/src/gui/dialogs/qprintpreviewdialog.h @@ -58,7 +58,7 @@ class QPrintPreviewDialogPrivate; class Q_GUI_EXPORT QPrintPreviewDialog : public QDialog { Q_OBJECT - Q_DECLARE_PRIVATE(QPrintPreviewDialog) + Q_DECLARE_SCOPED_PRIVATE(QPrintPreviewDialog) public: explicit QPrintPreviewDialog(QWidget *parent = 0, Qt::WindowFlags flags = 0); diff --git a/src/gui/dialogs/qprogressdialog.h b/src/gui/dialogs/qprogressdialog.h index 1118c45..41a825a 100644 --- a/src/gui/dialogs/qprogressdialog.h +++ b/src/gui/dialogs/qprogressdialog.h @@ -61,7 +61,7 @@ class QProgressDialogPrivate; class Q_GUI_EXPORT QProgressDialog : public QDialog { Q_OBJECT - Q_DECLARE_PRIVATE(QProgressDialog) + Q_DECLARE_SCOPED_PRIVATE(QProgressDialog) Q_PROPERTY(bool wasCanceled READ wasCanceled) Q_PROPERTY(int minimum READ minimum WRITE setMinimum) Q_PROPERTY(int maximum READ maximum WRITE setMaximum) diff --git a/src/gui/dialogs/qwizard.h b/src/gui/dialogs/qwizard.h index d1f9cf7..a8976c4 100644 --- a/src/gui/dialogs/qwizard.h +++ b/src/gui/dialogs/qwizard.h @@ -194,7 +194,7 @@ protected: private: Q_DISABLE_COPY(QWizard) - Q_DECLARE_PRIVATE(QWizard) + Q_DECLARE_SCOPED_PRIVATE(QWizard) Q_PRIVATE_SLOT(d_func(), void _q_emitCustomButtonClicked()) Q_PRIVATE_SLOT(d_func(), void _q_updateButtonStates()) Q_PRIVATE_SLOT(d_func(), void _q_handleFieldObjectDestroyed(QObject *)) @@ -246,7 +246,7 @@ protected: private: Q_DISABLE_COPY(QWizardPage) - Q_DECLARE_PRIVATE(QWizardPage) + Q_DECLARE_SCOPED_PRIVATE(QWizardPage) Q_PRIVATE_SLOT(d_func(), void _q_maybeEmitCompleteChanged()) Q_PRIVATE_SLOT(d_func(), void _q_updateCachedCompleteState()) diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp index 1def47f..41b581f 100644 --- a/src/gui/dialogs/qwizard_win.cpp +++ b/src/gui/dialogs/qwizard_win.cpp @@ -429,7 +429,7 @@ void QVistaHelper::setWindowPosHack() class QHackWidget : public QWidget { public: - Q_DECLARE_PRIVATE(QWidget) + Q_DECLARE_SCOPED_PRIVATE(QWidget) QTLWExtra* topData() { return d_func()->topData(); } }; diff --git a/src/gui/embedded/qdirectpainter_qws.h b/src/gui/embedded/qdirectpainter_qws.h index eddde10..a7f82f1 100644 --- a/src/gui/embedded/qdirectpainter_qws.h +++ b/src/gui/embedded/qdirectpainter_qws.h @@ -57,7 +57,7 @@ class QWSEmbedEvent; class Q_GUI_EXPORT QDirectPainter : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QDirectPainter) + Q_DECLARE_SCOPED_PRIVATE(QDirectPainter) public: enum SurfaceFlag { NonReserved = 0, diff --git a/src/gui/embedded/qscreen_qws.cpp b/src/gui/embedded/qscreen_qws.cpp index 05771ff..af53cd7 100644 --- a/src/gui/embedded/qscreen_qws.cpp +++ b/src/gui/embedded/qscreen_qws.cpp @@ -2420,7 +2420,7 @@ void QScreen::exposeRegion(QRegion r, int windowIndex) #endif compose(0, r, blendRegion, &blendBuffer, changing); - if (blendBuffer) { + if (blendBuffer && !blendBuffer->isNull()) { const QPoint offset = blendRegion.boundingRect().topLeft(); #ifndef QT_NO_QWS_CURSOR if (qt_screencursor && !qt_screencursor->isAccelerated()) { diff --git a/src/gui/embedded/qtransportauth_qws.h b/src/gui/embedded/qtransportauth_qws.h index d8753fe..e633a90 100644 --- a/src/gui/embedded/qtransportauth_qws.h +++ b/src/gui/embedded/qtransportauth_qws.h @@ -169,7 +169,7 @@ private: ~QTransportAuth(); friend class QAuthDevice; - Q_DECLARE_PRIVATE(QTransportAuth) + Q_DECLARE_SCOPED_PRIVATE(QTransportAuth) }; class Q_GUI_EXPORT RequestAnalyzer diff --git a/src/gui/embedded/qwindowsystem_qws.cpp b/src/gui/embedded/qwindowsystem_qws.cpp index 9545051..7384817 100644 --- a/src/gui/embedded/qwindowsystem_qws.cpp +++ b/src/gui/embedded/qwindowsystem_qws.cpp @@ -1761,10 +1761,16 @@ void QWSServerPrivate::cleanupFonts(bool force) #if defined(QWS_DEBUG_FONTCLEANUP) qDebug() << "removing unused font file" << fontName; #endif - QFile::remove(QFile::decodeName(fontName)); - sendFontRemovedEvent(fontName); - - it = fontReferenceCount.erase(it); + QT_TRY { + QFile::remove(QFile::decodeName(fontName)); + sendFontRemovedEvent(fontName); + + it = fontReferenceCount.erase(it); + } QT_CATCH(...) { + // so we were not able to remove the font. + // don't be angry and just continue with the next ones. + ++it; + } } } diff --git a/src/gui/embedded/qwindowsystem_qws.h b/src/gui/embedded/qwindowsystem_qws.h index 3cda9f6..04cd756 100644 --- a/src/gui/embedded/qwindowsystem_qws.h +++ b/src/gui/embedded/qwindowsystem_qws.h @@ -214,7 +214,7 @@ class Q_GUI_EXPORT QWSServer : public QObject friend class QWSDisplay; friend class QWSInputMethod; Q_OBJECT - Q_DECLARE_PRIVATE(QWSServer) + Q_DECLARE_SCOPED_PRIVATE(QWSServer) public: explicit QWSServer(int flags = 0, QObject *parent=0); #ifdef QT3_SUPPORT @@ -443,7 +443,7 @@ class QWSConvertSelectionCommand; class Q_GUI_EXPORT QWSClient : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QWSClient) + Q_DECLARE_SCOPED_PRIVATE(QWSClient) public: QWSClient(QObject* parent, QWS_SOCK_BASE *, int id); ~QWSClient(); diff --git a/src/gui/embedded/qwsembedwidget.h b/src/gui/embedded/qwsembedwidget.h index 8313c38..d880454 100644 --- a/src/gui/embedded/qwsembedwidget.h +++ b/src/gui/embedded/qwsembedwidget.h @@ -71,7 +71,7 @@ protected: void showEvent(QShowEvent *event); private: - Q_DECLARE_PRIVATE(QWSEmbedWidget) + Q_DECLARE_SCOPED_PRIVATE(QWSEmbedWidget) }; QT_END_NAMESPACE diff --git a/src/gui/embedded/qwsmanager_qws.h b/src/gui/embedded/qwsmanager_qws.h index 5a4312c..86aadc9 100644 --- a/src/gui/embedded/qwsmanager_qws.h +++ b/src/gui/embedded/qwsmanager_qws.h @@ -66,7 +66,7 @@ class QWSManagerPrivate; class Q_GUI_EXPORT QWSManager : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QWSManager) + Q_DECLARE_SCOPED_PRIVATE(QWSManager) public: explicit QWSManager(QWidget *); ~QWSManager(); diff --git a/src/gui/graphicsview/qgraphicsgridlayout.h b/src/gui/graphicsview/qgraphicsgridlayout.h index b9db03e..faa91b3 100644 --- a/src/gui/graphicsview/qgraphicsgridlayout.h +++ b/src/gui/graphicsview/qgraphicsgridlayout.h @@ -127,7 +127,7 @@ public: private: Q_DISABLE_COPY(QGraphicsGridLayout) - Q_DECLARE_PRIVATE(QGraphicsGridLayout) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsGridLayout) }; inline void QGraphicsGridLayout::addItem(QGraphicsLayoutItem *aitem, int arow, int acolumn, Qt::Alignment aalignment) diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 3e7224d..2210323 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -428,7 +428,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsItem) - Q_DECLARE_PRIVATE(QGraphicsItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsItem) friend class QGraphicsItemGroup; friend class QGraphicsScene; friend class QGraphicsScenePrivate; @@ -568,7 +568,7 @@ protected: private: Q_DISABLE_COPY(QAbstractGraphicsShapeItem) - Q_DECLARE_PRIVATE(QAbstractGraphicsShapeItem) + Q_DECLARE_SCOPED_PRIVATE(QAbstractGraphicsShapeItem) }; class QGraphicsPathItemPrivate; @@ -611,7 +611,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsPathItem) - Q_DECLARE_PRIVATE(QGraphicsPathItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsPathItem) }; class QGraphicsRectItemPrivate; @@ -661,7 +661,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsRectItem) - Q_DECLARE_PRIVATE(QGraphicsRectItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsRectItem) }; inline void QGraphicsRectItem::setRect(qreal ax, qreal ay, qreal w, qreal h) @@ -720,7 +720,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsEllipseItem) - Q_DECLARE_PRIVATE(QGraphicsEllipseItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsEllipseItem) }; inline void QGraphicsEllipseItem::setRect(qreal ax, qreal ay, qreal w, qreal h) @@ -770,7 +770,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsPolygonItem) - Q_DECLARE_PRIVATE(QGraphicsPolygonItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsPolygonItem) }; class QGraphicsLineItemPrivate; @@ -824,7 +824,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsLineItem) - Q_DECLARE_PRIVATE(QGraphicsLineItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsLineItem) }; class QGraphicsPixmapItemPrivate; @@ -883,7 +883,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsPixmapItem) - Q_DECLARE_PRIVATE(QGraphicsPixmapItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsPixmapItem) }; inline void QGraphicsPixmapItem::setOffset(qreal ax, qreal ay) @@ -1039,7 +1039,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsSimpleTextItem) - Q_DECLARE_PRIVATE(QGraphicsSimpleTextItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSimpleTextItem) }; class QGraphicsItemGroupPrivate; @@ -1068,7 +1068,7 @@ public: private: Q_DISABLE_COPY(QGraphicsItemGroup) - Q_DECLARE_PRIVATE(QGraphicsItemGroup) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsItemGroup) }; template <class T> inline T qgraphicsitem_cast(QGraphicsItem *item) diff --git a/src/gui/graphicsview/qgraphicslayout.h b/src/gui/graphicsview/qgraphicslayout.h index 7c758bc..d2c45ab 100644 --- a/src/gui/graphicsview/qgraphicslayout.h +++ b/src/gui/graphicsview/qgraphicslayout.h @@ -81,7 +81,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsLayout) - Q_DECLARE_PRIVATE(QGraphicsLayout) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsLayout) friend class QGraphicsWidget; }; diff --git a/src/gui/graphicsview/qgraphicslayoutitem.h b/src/gui/graphicsview/qgraphicslayoutitem.h index 60f894f..156c843 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.h +++ b/src/gui/graphicsview/qgraphicslayoutitem.h @@ -117,7 +117,7 @@ protected: private: QSizeF *effectiveSizeHints(const QSizeF &constraint) const; - Q_DECLARE_PRIVATE(QGraphicsLayoutItem) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsLayoutItem) friend class QGraphicsLayout; }; diff --git a/src/gui/graphicsview/qgraphicslinearlayout.h b/src/gui/graphicsview/qgraphicslinearlayout.h index f469680..91335db 100644 --- a/src/gui/graphicsview/qgraphicslinearlayout.h +++ b/src/gui/graphicsview/qgraphicslinearlayout.h @@ -108,7 +108,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsLinearLayout) - Q_DECLARE_PRIVATE(QGraphicsLinearLayout) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsLinearLayout) }; #endif diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h index c0c6e75..c2f7a22 100644 --- a/src/gui/graphicsview/qgraphicsscene.h +++ b/src/gui/graphicsview/qgraphicsscene.h @@ -291,7 +291,7 @@ Q_SIGNALS: void selectionChanged(); private: - Q_DECLARE_PRIVATE(QGraphicsScene) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsScene) Q_DISABLE_COPY(QGraphicsScene) Q_PRIVATE_SLOT(d_func(), void _q_emitUpdated()) Q_PRIVATE_SLOT(d_func(), void _q_polishItems()) diff --git a/src/gui/graphicsview/qgraphicssceneevent.h b/src/gui/graphicsview/qgraphicssceneevent.h index ea17f9d..0445810 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.h +++ b/src/gui/graphicsview/qgraphicssceneevent.h @@ -76,7 +76,7 @@ public: protected: QGraphicsSceneEvent(QGraphicsSceneEventPrivate &dd, Type type = None); QScopedPointer<QGraphicsSceneEventPrivate> d_ptr; - Q_DECLARE_PRIVATE(QGraphicsSceneEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneEvent) }; class QGraphicsSceneMouseEventPrivate; @@ -123,7 +123,7 @@ public: void setModifiers(Qt::KeyboardModifiers modifiers); private: - Q_DECLARE_PRIVATE(QGraphicsSceneMouseEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneMouseEvent) }; class QGraphicsSceneWheelEventPrivate; @@ -155,7 +155,7 @@ public: void setOrientation(Qt::Orientation orientation); private: - Q_DECLARE_PRIVATE(QGraphicsSceneWheelEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneWheelEvent) }; class QGraphicsSceneContextMenuEventPrivate; @@ -183,7 +183,7 @@ public: void setReason(Reason reason); private: - Q_DECLARE_PRIVATE(QGraphicsSceneContextMenuEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneContextMenuEvent) }; class QGraphicsSceneHoverEventPrivate; @@ -215,7 +215,7 @@ public: void setModifiers(Qt::KeyboardModifiers modifiers); private: - Q_DECLARE_PRIVATE(QGraphicsSceneHoverEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneHoverEvent) }; class QGraphicsSceneHelpEventPrivate; @@ -232,7 +232,7 @@ public: void setScreenPos(const QPoint &pos); private: - Q_DECLARE_PRIVATE(QGraphicsSceneHelpEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneHelpEvent) }; class QGraphicsSceneDragDropEventPrivate; @@ -274,13 +274,13 @@ public: void setMimeData(const QMimeData *data); private: - Q_DECLARE_PRIVATE(QGraphicsSceneDragDropEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneDragDropEvent) }; class QGraphicsSceneResizeEventPrivate; class Q_GUI_EXPORT QGraphicsSceneResizeEvent : public QGraphicsSceneEvent { - Q_DECLARE_PRIVATE(QGraphicsSceneResizeEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneResizeEvent) public: QGraphicsSceneResizeEvent(); ~QGraphicsSceneResizeEvent(); @@ -295,7 +295,7 @@ public: class QGraphicsSceneMoveEventPrivate; class Q_GUI_EXPORT QGraphicsSceneMoveEvent : public QGraphicsSceneEvent { - Q_DECLARE_PRIVATE(QGraphicsSceneMoveEvent) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsSceneMoveEvent) public: QGraphicsSceneMoveEvent(); ~QGraphicsSceneMoveEvent(); diff --git a/src/gui/graphicsview/qgraphicsview.h b/src/gui/graphicsview/qgraphicsview.h index 1285e45..425f174 100644 --- a/src/gui/graphicsview/qgraphicsview.h +++ b/src/gui/graphicsview/qgraphicsview.h @@ -269,7 +269,7 @@ protected: const QStyleOptionGraphicsItem options[]); private: - Q_DECLARE_PRIVATE(QGraphicsView) + Q_DECLARE_SCOPED_PRIVATE(QGraphicsView) Q_DISABLE_COPY(QGraphicsView) #ifndef QT_NO_CURSOR Q_PRIVATE_SLOT(d_func(), void _q_setViewportCursor(const QCursor &)) diff --git a/src/gui/image/qimageiohandler.h b/src/gui/image/qimageiohandler.h index 50508c0..97b2ba2 100644 --- a/src/gui/image/qimageiohandler.h +++ b/src/gui/image/qimageiohandler.h @@ -60,7 +60,7 @@ class QVariant; class QImageIOHandlerPrivate; class Q_GUI_EXPORT QImageIOHandler { - Q_DECLARE_PRIVATE(QImageIOHandler) + Q_DECLARE_SCOPED_PRIVATE(QImageIOHandler) public: QImageIOHandler(); virtual ~QImageIOHandler(); diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h index afee789..eda5aa1 100644 --- a/src/gui/image/qmovie.h +++ b/src/gui/image/qmovie.h @@ -74,7 +74,7 @@ class QMoviePrivate; class Q_GUI_EXPORT QMovie : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QMovie) + Q_DECLARE_SCOPED_PRIVATE(QMovie) Q_ENUMS(MovieState CacheMode) Q_PROPERTY(int speed READ speed WRITE setSpeed) Q_PROPERTY(CacheMode cacheMode READ cacheMode WRITE setCacheMode) diff --git a/src/gui/image/qpaintengine_pic_p.h b/src/gui/image/qpaintengine_pic_p.h index 1e6413e..2aaa5f0 100644 --- a/src/gui/image/qpaintengine_pic_p.h +++ b/src/gui/image/qpaintengine_pic_p.h @@ -65,7 +65,7 @@ class QBuffer; class QPicturePaintEngine : public QPaintEngine { - Q_DECLARE_PRIVATE(QPicturePaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QPicturePaintEngine) public: QPicturePaintEngine(); ~QPicturePaintEngine(); diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h index c323f0e..4d9af37 100644 --- a/src/gui/image/qpicture.h +++ b/src/gui/image/qpicture.h @@ -56,7 +56,7 @@ QT_MODULE(Gui) class QPicturePrivate; class Q_GUI_EXPORT QPicture : public QPaintDevice { - Q_DECLARE_PRIVATE(QPicture) + Q_DECLARE_SCOPED_PRIVATE(QPicture) public: explicit QPicture(int formatVersion = -1); QPicture(const QPicture &); diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 44181d1..1bcb846 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -261,7 +261,12 @@ QPixmap::QPixmap(const QString& fileName, const char *format, Qt::ImageConversio if (!qt_pixmap_thread_test()) return; - load(fileName, format, flags); + QT_TRY { + load(fileName, format, flags); + } QT_CATCH(...) { + deref(); + QT_RETHROW; + } } /*! @@ -309,12 +314,17 @@ QPixmap::QPixmap(const char * const xpm[]) if (!xpm) return; - QImage image(xpm); - if (!image.isNull()) { - if (data->pixelType() == QPixmapData::BitmapType) - *this = QBitmap::fromImage(image); - else - *this = fromImage(image); + QT_TRY { + QImage image(xpm); + if (!image.isNull()) { + if (data->pixelType() == QPixmapData::BitmapType) + *this = QBitmap::fromImage(image); + else + *this = fromImage(image); + } + } QT_CATCH(...) { + deref(); + QT_RETHROW; } } #endif @@ -1894,7 +1904,6 @@ int QPixmap::defaultDepth() #elif defined(Q_OS_SYMBIAN) return S60->screenDepth; #endif - } /*! diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 9cc896b..e0d952a 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -172,9 +172,13 @@ void QRasterPixmapData::fromImage(const QImage &sourceImage, } } #endif - w = image.d->width; - h = image.d->height; - d = image.d->depth; + if (image.d) { + w = image.d->width; + h = image.d->height; + d = image.d->depth; + } else { + w = h = d = 0; + } is_null = (w <= 0 || h <= 0); setSerialNumber(image.serialNumber()); diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 132e26e..0460c30 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -82,7 +82,7 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h ) return QPixmap(); TDisplayMode displayMode = screenDevice->DisplayMode(); - CFbsBitmap* temporary = new (ELeave) CFbsBitmap(); + CFbsBitmap* temporary = q_check_ptr(new CFbsBitmap()); // CBase derived object needs check on new TInt error = temporary->Create(srcRect.Size(), displayMode); if (error == KErrNone) error = screenDevice->CopyScreenToBitmap(temporary, srcRect); @@ -171,7 +171,7 @@ CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const return 0; } - CFbsBitmap* bitmap = new (ELeave) CFbsBitmap(); + CFbsBitmap* bitmap = q_check_ptr(new CFbsBitmap()); // CBase derived object needs check on new TSize size(width(), height()); if (bitmap->Create(size, mode) != KErrNone) { CBase::Delete(bitmap); diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index b4a3a49..aedc90c 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -368,7 +368,8 @@ void QPMCache::resizeKeyArray(int size) { if (size <= keyArraySize || size == 0) return; - keyArray = reinterpret_cast<int *>(realloc(keyArray, size * sizeof(int))); + keyArray = q_check_ptr(reinterpret_cast<int *>(realloc(keyArray, + size * sizeof(int)))); for (int i = keyArraySize; i != size; ++i) keyArray[i] = i + 1; keyArraySize = size; diff --git a/src/gui/image/qpixmapfilter_p.h b/src/gui/image/qpixmapfilter_p.h index 51292b3..83fc1b9 100644 --- a/src/gui/image/qpixmapfilter_p.h +++ b/src/gui/image/qpixmapfilter_p.h @@ -70,7 +70,7 @@ class QPixmapFilterPrivate; class Q_GUI_EXPORT QPixmapFilter : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QPixmapFilter) + Q_DECLARE_SCOPED_PRIVATE(QPixmapFilter) public: virtual ~QPixmapFilter() = 0; @@ -98,7 +98,7 @@ class QPixmapConvolutionFilterPrivate; class Q_GUI_EXPORT QPixmapConvolutionFilter : public QPixmapFilter { Q_OBJECT - Q_DECLARE_PRIVATE(QPixmapConvolutionFilter) + Q_DECLARE_SCOPED_PRIVATE(QPixmapConvolutionFilter) public: QPixmapConvolutionFilter(QObject *parent = 0); @@ -122,7 +122,7 @@ class QPixmapColorizeFilterPrivate; class Q_GUI_EXPORT QPixmapColorizeFilter : public QPixmapFilter { Q_OBJECT - Q_DECLARE_PRIVATE(QPixmapColorizeFilter) + Q_DECLARE_SCOPED_PRIVATE(QPixmapColorizeFilter) public: QPixmapColorizeFilter(QObject *parent = 0); @@ -138,7 +138,7 @@ class QPixmapDropShadowFilterPrivate; class Q_GUI_EXPORT QPixmapDropShadowFilter : public QPixmapFilter { Q_OBJECT - Q_DECLARE_PRIVATE(QPixmapDropShadowFilter) + Q_DECLARE_SCOPED_PRIVATE(QPixmapDropShadowFilter) public: QPixmapDropShadowFilter(QObject *parent = 0); diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index d754763..e63f045 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -121,6 +121,7 @@ public: private: void DoCommitFepInlineEditL(); MCoeFepAwareTextEditor_Extension1* Extension1(TBool& aSetToTrue); + void ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType); // From MCoeFepAwareTextEditor_Extension1 public: diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index c03426f..2ef1175 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE QCoeFepInputContext::QCoeFepInputContext(QObject *parent) : QInputContext(parent), - m_fepState(new (ELeave) CAknEdwinState), + m_fepState(q_check_ptr(new CAknEdwinState)), // CBase derived object needs check on new m_lastImHints(Qt::ImhNone), m_textCapabilities(TCoeInputCapabilities::EAllText), m_isEditing(false), @@ -100,6 +100,11 @@ void QCoeFepInputContext::reset() CCoeEnv::Static()->Fep()->CancelTransaction(); } +void QCoeFepInputContext::ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType) +{ + QT_TRAP_THROWING(m_fepState->ReportAknEdStateEventL(QT_EAknCursorPositionChanged)); +} + void QCoeFepInputContext::update() { updateHints(false); @@ -112,7 +117,7 @@ void QCoeFepInputContext::update() // Don't be fooled (as I was) by the name of this enumeration. // What it really does is tell the virtual keyboard UI that the text has been // updated and it should be reflected in the internal display of the VK. - m_fepState->ReportAknEdStateEventL(QT_EAknCursorPositionChanged); + ReportAknEdStateEvent(QT_EAknCursorPositionChanged); } void QCoeFepInputContext::setFocusWidget(QWidget *w) @@ -394,7 +399,7 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) flags = EAknEditorAllInputModes; } m_fepState->SetPermittedInputModes(flags); - m_fepState->ReportAknEdStateEventL(MAknEdStateObserver::EAknEdwinStateInputModeUpdate); + ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateInputModeUpdate); if (hints & ImhPreferLowercase) { m_fepState->SetDefaultCase(EAknEditorLowerCase); @@ -423,7 +428,7 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) } } m_fepState->SetPermittedCases(flags); - m_fepState->ReportAknEdStateEventL(MAknEdStateObserver::EAknEdwinStateCaseModeUpdate); + ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateCaseModeUpdate); flags = 0; if (hints & ImhUppercaseOnly && !(hints & ImhLowercaseOnly) @@ -435,7 +440,7 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) flags |= EAknEditorFlagNoT9; } m_fepState->SetFlags(flags); - m_fepState->ReportAknEdStateEventL(MAknEdStateObserver::EAknEdwinStateFlagsUpdate); + ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateFlagsUpdate); if (hints & ImhFormattedNumbersOnly) { flags = EAknEditorCalculatorNumberModeKeymap; @@ -525,7 +530,7 @@ void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText, m_cursorVisibility = aCursorVisibility ? 1 : 0; m_inlinePosition = aPositionOfInsertionPointInInlineText; - m_preeditString = qt_TDesC2QStringL(aInitialInlineText); + m_preeditString = qt_TDesC2QString(aInitialInlineText); m_formatRetriever = &aInlineTextFormatRetriever; m_pointerHandler = &aPointerEventHandlerDuringInlineEdit; @@ -555,7 +560,7 @@ void QCoeFepInputContext::UpdateFepInlineTextL(const TDesC& aNewInlineText, m_inlinePosition, m_cursorVisibility, QVariant())); - m_preeditString = qt_TDesC2QStringL(aNewInlineText); + m_preeditString = qt_TDesC2QString(aNewInlineText); QInputMethodEvent event(m_preeditString, attributes); sendEvent(event); } diff --git a/src/gui/inputmethod/qinputcontext.h b/src/gui/inputmethod/qinputcontext.h index e4e5f9d..87112b5 100644 --- a/src/gui/inputmethod/qinputcontext.h +++ b/src/gui/inputmethod/qinputcontext.h @@ -83,7 +83,7 @@ class QInputContextPrivate; class Q_GUI_EXPORT QInputContext : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QInputContext) + Q_DECLARE_SCOPED_PRIVATE(QInputContext) public: explicit QInputContext(QObject* parent = 0); virtual ~QInputContext(); diff --git a/src/gui/inputmethod/qmacinputcontext_p.h b/src/gui/inputmethod/qmacinputcontext_p.h index 4fcba9a..69ac3e8 100644 --- a/src/gui/inputmethod/qmacinputcontext_p.h +++ b/src/gui/inputmethod/qmacinputcontext_p.h @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE class Q_GUI_EXPORT QMacInputContext : public QInputContext { Q_OBJECT - //Q_DECLARE_PRIVATE(QMacInputContext) + //Q_DECLARE_SCOPED_PRIVATE(QMacInputContext) void createTextDocument(); public: explicit QMacInputContext(QObject* parent = 0); diff --git a/src/gui/itemviews/qabstractitemview.h b/src/gui/itemviews/qabstractitemview.h index da6f0ea..4f2aa1d 100644 --- a/src/gui/itemviews/qabstractitemview.h +++ b/src/gui/itemviews/qabstractitemview.h @@ -345,7 +345,7 @@ protected: #endif private: - Q_DECLARE_PRIVATE(QAbstractItemView) + Q_DECLARE_SCOPED_PRIVATE(QAbstractItemView) Q_DISABLE_COPY(QAbstractItemView) Q_PRIVATE_SLOT(d_func(), void _q_columnsAboutToBeRemoved(const QModelIndex&, int, int)) Q_PRIVATE_SLOT(d_func(), void _q_columnsRemoved(const QModelIndex&, int, int)) diff --git a/src/gui/itemviews/qabstractproxymodel.h b/src/gui/itemviews/qabstractproxymodel.h index 8a703da..356d923 100644 --- a/src/gui/itemviews/qabstractproxymodel.h +++ b/src/gui/itemviews/qabstractproxymodel.h @@ -87,7 +87,7 @@ protected: QAbstractProxyModel(QAbstractProxyModelPrivate &, QObject *parent); private: - Q_DECLARE_PRIVATE(QAbstractProxyModel) + Q_DECLARE_SCOPED_PRIVATE(QAbstractProxyModel) Q_DISABLE_COPY(QAbstractProxyModel) Q_PRIVATE_SLOT(d_func(), void _q_sourceModelDestroyed()) }; diff --git a/src/gui/itemviews/qcolumnview.h b/src/gui/itemviews/qcolumnview.h index f8697e9..df5b84e 100644 --- a/src/gui/itemviews/qcolumnview.h +++ b/src/gui/itemviews/qcolumnview.h @@ -106,7 +106,7 @@ protected: void initializeColumn(QAbstractItemView *column) const; private: - Q_DECLARE_PRIVATE(QColumnView) + Q_DECLARE_SCOPED_PRIVATE(QColumnView) Q_DISABLE_COPY(QColumnView) Q_PRIVATE_SLOT(d_func(), void _q_gripMoved(int)) Q_PRIVATE_SLOT(d_func(), void _q_changeCurrentColumn()) diff --git a/src/gui/itemviews/qcolumnviewgrip_p.h b/src/gui/itemviews/qcolumnviewgrip_p.h index 4dc35ec..8e670e9 100644 --- a/src/gui/itemviews/qcolumnviewgrip_p.h +++ b/src/gui/itemviews/qcolumnviewgrip_p.h @@ -82,7 +82,7 @@ protected: void mousePressEvent(QMouseEvent *event); private: - Q_DECLARE_PRIVATE(QColumnViewGrip) + Q_DECLARE_SCOPED_PRIVATE(QColumnViewGrip) Q_DISABLE_COPY(QColumnViewGrip) }; diff --git a/src/gui/itemviews/qdatawidgetmapper.h b/src/gui/itemviews/qdatawidgetmapper.h index 2df7b69..2773b59 100644 --- a/src/gui/itemviews/qdatawidgetmapper.h +++ b/src/gui/itemviews/qdatawidgetmapper.h @@ -111,7 +111,7 @@ Q_SIGNALS: void currentIndexChanged(int index); private: - Q_DECLARE_PRIVATE(QDataWidgetMapper) + Q_DECLARE_SCOPED_PRIVATE(QDataWidgetMapper) Q_DISABLE_COPY(QDataWidgetMapper) Q_PRIVATE_SLOT(d_func(), void _q_dataChanged(const QModelIndex &, const QModelIndex &)) Q_PRIVATE_SLOT(d_func(), void _q_commitData(QWidget *)) diff --git a/src/gui/itemviews/qdirmodel.h b/src/gui/itemviews/qdirmodel.h index 719d551..1f28cc9 100644 --- a/src/gui/itemviews/qdirmodel.h +++ b/src/gui/itemviews/qdirmodel.h @@ -146,7 +146,7 @@ protected: friend class QFileDialogPrivate; private: - Q_DECLARE_PRIVATE(QDirModel) + Q_DECLARE_SCOPED_PRIVATE(QDirModel) Q_DISABLE_COPY(QDirModel) Q_PRIVATE_SLOT(d_func(), void _q_refresh()) }; diff --git a/src/gui/itemviews/qfileiconprovider.h b/src/gui/itemviews/qfileiconprovider.h index 165e30f..dd1bedd 100644 --- a/src/gui/itemviews/qfileiconprovider.h +++ b/src/gui/itemviews/qfileiconprovider.h @@ -67,7 +67,7 @@ public: virtual QString type(const QFileInfo &info) const; private: - Q_DECLARE_PRIVATE(QFileIconProvider) + Q_DECLARE_SCOPED_PRIVATE(QFileIconProvider) QScopedPointer<QFileIconProviderPrivate> d_ptr; Q_DISABLE_COPY(QFileIconProvider) }; diff --git a/src/gui/itemviews/qheaderview.h b/src/gui/itemviews/qheaderview.h index 3a66c9a..0690fa0 100644 --- a/src/gui/itemviews/qheaderview.h +++ b/src/gui/itemviews/qheaderview.h @@ -228,7 +228,7 @@ protected: private: Q_PRIVATE_SLOT(d_func(), void _q_sectionsRemoved(const QModelIndex &parent, int logicalFirst, int logicalLast)) Q_PRIVATE_SLOT(d_func(), void _q_layoutAboutToBeChanged()) - Q_DECLARE_PRIVATE(QHeaderView) + Q_DECLARE_SCOPED_PRIVATE(QHeaderView) Q_DISABLE_COPY(QHeaderView) }; diff --git a/src/gui/itemviews/qitemdelegate.h b/src/gui/itemviews/qitemdelegate.h index d46481c..a6f0ba1 100644 --- a/src/gui/itemviews/qitemdelegate.h +++ b/src/gui/itemviews/qitemdelegate.h @@ -126,7 +126,7 @@ protected: const QFont &font, const QString &text) const; private: - Q_DECLARE_PRIVATE(QItemDelegate) + Q_DECLARE_SCOPED_PRIVATE(QItemDelegate) Q_DISABLE_COPY(QItemDelegate) Q_PRIVATE_SLOT(d_func(), void _q_commitDataAndCloseEditor(QWidget*)) diff --git a/src/gui/itemviews/qitemselectionmodel.h b/src/gui/itemviews/qitemselectionmodel.h index e6a99a6..bc9f61c 100644 --- a/src/gui/itemviews/qitemselectionmodel.h +++ b/src/gui/itemviews/qitemselectionmodel.h @@ -125,7 +125,7 @@ class QItemSelectionModelPrivate; class Q_GUI_EXPORT QItemSelectionModel : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QItemSelectionModel) + Q_DECLARE_SCOPED_PRIVATE(QItemSelectionModel) Q_FLAGS(SelectionFlags) public: diff --git a/src/gui/itemviews/qlistview.h b/src/gui/itemviews/qlistview.h index 75dff40..a098427 100644 --- a/src/gui/itemviews/qlistview.h +++ b/src/gui/itemviews/qlistview.h @@ -190,7 +190,7 @@ private: friend class QAccessibleItemView; int visualIndex(const QModelIndex &index) const; - Q_DECLARE_PRIVATE(QListView) + Q_DECLARE_SCOPED_PRIVATE(QListView) Q_DISABLE_COPY(QListView) }; diff --git a/src/gui/itemviews/qlistwidget.h b/src/gui/itemviews/qlistwidget.h index afcc331..d2f2f06 100644 --- a/src/gui/itemviews/qlistwidget.h +++ b/src/gui/itemviews/qlistwidget.h @@ -291,7 +291,7 @@ private: void setModel(QAbstractItemModel *model); Qt::SortOrder sortOrder() const; - Q_DECLARE_PRIVATE(QListWidget) + Q_DECLARE_SCOPED_PRIVATE(QListWidget) Q_DISABLE_COPY(QListWidget) Q_PRIVATE_SLOT(d_func(), void _q_emitItemPressed(const QModelIndex &index)) diff --git a/src/gui/itemviews/qproxymodel.h b/src/gui/itemviews/qproxymodel.h index 62cf33e..420753c 100644 --- a/src/gui/itemviews/qproxymodel.h +++ b/src/gui/itemviews/qproxymodel.h @@ -119,7 +119,7 @@ protected: void disconnectFromModel(const QAbstractItemModel *model) const; private: - Q_DECLARE_PRIVATE(QProxyModel) + Q_DECLARE_SCOPED_PRIVATE(QProxyModel) Q_DISABLE_COPY(QProxyModel) Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(const QModelIndex&,const QModelIndex&)) diff --git a/src/gui/itemviews/qsortfilterproxymodel.h b/src/gui/itemviews/qsortfilterproxymodel.h index 0bd084e..b179559 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.h +++ b/src/gui/itemviews/qsortfilterproxymodel.h @@ -172,7 +172,7 @@ public: QStringList mimeTypes() const; Qt::DropActions supportedDropActions() const; private: - Q_DECLARE_PRIVATE(QSortFilterProxyModel) + Q_DECLARE_SCOPED_PRIVATE(QSortFilterProxyModel) Q_DISABLE_COPY(QSortFilterProxyModel) Q_PRIVATE_SLOT(d_func(), void _q_sourceDataChanged(const QModelIndex &source_top_left, const QModelIndex &source_bottom_right)) diff --git a/src/gui/itemviews/qstandarditemmodel.h b/src/gui/itemviews/qstandarditemmodel.h index c470b80..7e76a4a 100644 --- a/src/gui/itemviews/qstandarditemmodel.h +++ b/src/gui/itemviews/qstandarditemmodel.h @@ -245,7 +245,7 @@ protected: void emitDataChanged(); private: - Q_DECLARE_PRIVATE(QStandardItem) + Q_DECLARE_SCOPED_PRIVATE(QStandardItem) friend class QStandardItemModelPrivate; friend class QStandardItemModel; }; @@ -422,7 +422,7 @@ private: friend class QStandardItemPrivate; friend class QStandardItem; Q_DISABLE_COPY(QStandardItemModel) - Q_DECLARE_PRIVATE(QStandardItemModel) + Q_DECLARE_SCOPED_PRIVATE(QStandardItemModel) Q_PRIVATE_SLOT(d_func(), void _q_emitItemChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)) diff --git a/src/gui/itemviews/qstyleditemdelegate.h b/src/gui/itemviews/qstyleditemdelegate.h index ccb1024..2f31387 100644 --- a/src/gui/itemviews/qstyleditemdelegate.h +++ b/src/gui/itemviews/qstyleditemdelegate.h @@ -101,7 +101,7 @@ protected: const QStyleOptionViewItem &option, const QModelIndex &index); private: - Q_DECLARE_PRIVATE(QStyledItemDelegate) + Q_DECLARE_SCOPED_PRIVATE(QStyledItemDelegate) Q_DISABLE_COPY(QStyledItemDelegate) Q_PRIVATE_SLOT(d_func(), void _q_commitDataAndCloseEditor(QWidget*)) diff --git a/src/gui/itemviews/qtableview.h b/src/gui/itemviews/qtableview.h index c09186c..7e4ba54 100644 --- a/src/gui/itemviews/qtableview.h +++ b/src/gui/itemviews/qtableview.h @@ -178,7 +178,7 @@ private: friend class QAccessibleItemView; int visualIndex(const QModelIndex &index) const; - Q_DECLARE_PRIVATE(QTableView) + Q_DECLARE_SCOPED_PRIVATE(QTableView) Q_DISABLE_COPY(QTableView) Q_PRIVATE_SLOT(d_func(), void _q_selectRow(int)) Q_PRIVATE_SLOT(d_func(), void _q_selectColumn(int)) diff --git a/src/gui/itemviews/qtablewidget.h b/src/gui/itemviews/qtablewidget.h index 6c25ba0..1963df8 100644 --- a/src/gui/itemviews/qtablewidget.h +++ b/src/gui/itemviews/qtablewidget.h @@ -336,7 +336,7 @@ protected: private: void setModel(QAbstractItemModel *model); - Q_DECLARE_PRIVATE(QTableWidget) + Q_DECLARE_SCOPED_PRIVATE(QTableWidget) Q_DISABLE_COPY(QTableWidget) Q_PRIVATE_SLOT(d_func(), void _q_emitItemPressed(const QModelIndex &index)) diff --git a/src/gui/itemviews/qtreeview.h b/src/gui/itemviews/qtreeview.h index 4411781..876bc12 100644 --- a/src/gui/itemviews/qtreeview.h +++ b/src/gui/itemviews/qtreeview.h @@ -221,7 +221,7 @@ private: friend class QAccessibleItemView; int visualIndex(const QModelIndex &index) const; - Q_DECLARE_PRIVATE(QTreeView) + Q_DECLARE_SCOPED_PRIVATE(QTreeView) Q_DISABLE_COPY(QTreeView) #ifndef QT_NO_ANIMATION Q_PRIVATE_SLOT(d_func(), void _q_endAnimatedOperation()) diff --git a/src/gui/itemviews/qtreewidget.h b/src/gui/itemviews/qtreewidget.h index 3266725..b640a7a 100644 --- a/src/gui/itemviews/qtreewidget.h +++ b/src/gui/itemviews/qtreewidget.h @@ -367,7 +367,7 @@ protected: private: void setModel(QAbstractItemModel *model); - Q_DECLARE_PRIVATE(QTreeWidget) + Q_DECLARE_SCOPED_PRIVATE(QTreeWidget) Q_DISABLE_COPY(QTreeWidget) Q_PRIVATE_SLOT(d_func(), void _q_emitItemPressed(const QModelIndex &index)) diff --git a/src/gui/itemviews/qtreewidget_p.h b/src/gui/itemviews/qtreewidget_p.h index 145916a..6d62062 100644 --- a/src/gui/itemviews/qtreewidget_p.h +++ b/src/gui/itemviews/qtreewidget_p.h @@ -162,7 +162,7 @@ private: bool isChanging() const; private: - Q_DECLARE_PRIVATE(QTreeModel) + Q_DECLARE_SCOPED_PRIVATE(QTreeModel) public: struct SkipSorting { diff --git a/src/gui/itemviews/qtreewidgetitemiterator.h b/src/gui/itemviews/qtreewidgetitemiterator.h index eff9fdb..ce0b610 100644 --- a/src/gui/itemviews/qtreewidgetitemiterator.h +++ b/src/gui/itemviews/qtreewidgetitemiterator.h @@ -109,7 +109,7 @@ private: QScopedPointer<QTreeWidgetItemIteratorPrivate> d_ptr; QTreeWidgetItem *current; IteratorFlags flags; - Q_DECLARE_PRIVATE(QTreeWidgetItemIterator) + Q_DECLARE_SCOPED_PRIVATE(QTreeWidgetItemIterator) }; inline const QTreeWidgetItemIterator QTreeWidgetItemIterator::operator++(int) diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 530b146..1766ecd 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -107,7 +107,7 @@ symbian { kernel/qclipboard_s60.cpp\ kernel/qdnd_s60.cpp \ kernel/qsound_s60.cpp - + HEADERS += \ kernel/qt_s60_p.h \ kernel/qeventdispatcher_s60_p.h @@ -191,7 +191,7 @@ embedded { qcocoaview_mac_p.h \ qcocoaapplication_mac_p.h \ qcocoaapplicationdelegate_mac_p.h \ - qmultitouch_mac_p.h + qmultitouch_mac_p.h OBJECTIVE_SOURCES += \ kernel/qcursor_mac.mm \ @@ -209,7 +209,7 @@ embedded { kernel/qt_cocoa_helpers_mac.mm \ kernel/qdesktopwidget_mac.mm \ kernel/qeventdispatcher_mac.mm \ - kernel/qcocoawindowcustomthemeframe_mac.mm \ + kernel/qcocoawindowcustomthemeframe_mac.mm \ kernel/qmultitouch_mac.mm \ HEADERS += \ @@ -218,10 +218,10 @@ embedded { kernel/qcocoaapplicationdelegate_mac_p.h \ kernel/qeventdispatcher_mac_p.h - MENU_NIB.files = mac/qt_menu.nib - MENU_NIB.path = Resources + MENU_NIB.files = mac/qt_menu.nib + MENU_NIB.path = Resources MENU_NIB.version = Versions - QMAKE_BUNDLE_DATA += MENU_NIB + QMAKE_BUNDLE_DATA += MENU_NIB RESOURCES += mac/macresources.qrc LIBS += -framework AppKit diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index afe6269..53cbc64 100644 --- a/src/gui/kernel/qaction.cpp +++ b/src/gui/kernel/qaction.cpp @@ -1414,7 +1414,7 @@ QAction::MenuRole QAction::menuRole() const This indicates what softkey action this action is. Usually used on mobile platforms to map QActions to hardware keys. - + The softkey role can be changed any time. */ void QAction::setSoftKeyRole(SoftKeyRole softKeyRole) diff --git a/src/gui/kernel/qaction.h b/src/gui/kernel/qaction.h index 68f88c5..ef32a33 100644 --- a/src/gui/kernel/qaction.h +++ b/src/gui/kernel/qaction.h @@ -64,7 +64,7 @@ class QGraphicsWidget; class Q_GUI_EXPORT QAction : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QAction) + Q_DECLARE_SCOPED_PRIVATE(QAction) Q_ENUMS(MenuRole) Q_ENUMS(SoftKeyRole) diff --git a/src/gui/kernel/qactiongroup.h b/src/gui/kernel/qactiongroup.h index e42c2e5..07bdbda 100644 --- a/src/gui/kernel/qactiongroup.h +++ b/src/gui/kernel/qactiongroup.h @@ -57,7 +57,7 @@ class QActionGroupPrivate; class Q_GUI_EXPORT QActionGroup : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QActionGroup) + Q_DECLARE_SCOPED_PRIVATE(QActionGroup) Q_PROPERTY(bool exclusive READ isExclusive WRITE setExclusive) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 7acba93..7aeab39 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -850,7 +850,7 @@ extern int qUnregisterGuiStateMachine(); void QApplicationPrivate::initialize() { QWidgetPrivate::mapper = new QWidgetMapper; - QWidgetPrivate::uncreatedWidgets = new QWidgetSet; + QWidgetPrivate::allWidgets = new QWidgetSet; if (qt_appType != QApplication::Tty) (void) QApplication::style(); // trigger creation of application style // trigger registering of QVariant's GUI types @@ -994,23 +994,13 @@ QApplication::~QApplication() qt_clipboard = 0; #endif - // delete widget mapper - if (QWidgetPrivate::mapper) { - QWidgetMapper * myMapper = QWidgetPrivate::mapper; - QWidgetPrivate::mapper = 0; - for (QWidgetMapper::ConstIterator it = myMapper->constBegin(); - it != myMapper->constEnd(); ++it) { - register QWidget *w = *it; - if (!w->parent()) // window - w->destroy(true, true); - } - delete myMapper; - } + delete QWidgetPrivate::mapper; + QWidgetPrivate::mapper = 0; - // delete uncreated widgets - if (QWidgetPrivate::uncreatedWidgets) { - QWidgetSet *mySet = QWidgetPrivate::uncreatedWidgets; - QWidgetPrivate::uncreatedWidgets = 0; + // delete all widgets + if (QWidgetPrivate::allWidgets) { + QWidgetSet *mySet = QWidgetPrivate::allWidgets; + QWidgetPrivate::allWidgets = 0; for (QWidgetSet::ConstIterator it = mySet->constBegin(); it != mySet->constEnd(); ++it) { register QWidget *w = *it; if (!w->parent()) // window @@ -2036,12 +2026,9 @@ QWidgetList QApplication::topLevelWidgets() QWidgetList QApplication::allWidgets() { - QWidgetList list; - if (QWidgetPrivate::mapper) - list += QWidgetPrivate::mapper->values(); - if (QWidgetPrivate::uncreatedWidgets) - list += QWidgetPrivate::uncreatedWidgets->toList(); - return list; + if (QWidgetPrivate::allWidgets) + return QWidgetPrivate::allWidgets->toList(); + return QWidgetList(); } /*! diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index fcb3a7c..88a01fe 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -363,7 +363,7 @@ public: private: Q_DISABLE_COPY(QApplication) - Q_DECLARE_PRIVATE(QApplication) + Q_DECLARE_SCOPED_PRIVATE(QApplication) friend class QGraphicsWidget; friend class QGraphicsScene; diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index 0f41025..e4e7951 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -680,7 +680,7 @@ void QWSDisplay::Data::sendSynchronousCommand(QWSCommand & cmd) int QWSDisplay::Data::takeId() { int unusedIdCount = unused_identifiers.count(); - if (unusedIdCount == 10) + if (unusedIdCount <= 10) create(15); if (unusedIdCount == 0) { create(1); // Make sure we have an incoming id to wait for, just in case we're recursive @@ -3773,4 +3773,14 @@ void QApplicationPrivate::initializeMultitouch_sys() void QApplicationPrivate::cleanupMultitouch_sys() { } +/* \internal + This is used to clean up the qws server + in case the QApplication constructor threw an exception +*/ +QWSServerCleaner::~QWSServerCleaner() +{ + if (qwsServer && qws_single_process) + QWSServer::closedown(); +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index d47747f..c831dad 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -76,13 +76,18 @@ QT_BEGIN_NAMESPACE static bool appNoGrab = false; // Grabbing enabled #endif -Q_GUI_EXPORT QS60Data *qt_s60Data = 0; +Q_GLOBAL_STATIC(QS60Data, qt_s60Data); extern bool qt_sendSpontaneousEvent(QObject*,QEvent*); extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp QWidget *qt_button_down = 0; // widget got last button-down +QS60Data* qGlobalS60Data() +{ + return qt_s60Data(); +} + bool qt_nograb() // application no-grab option { #if defined(QT_DEBUG) @@ -119,7 +124,7 @@ private: QS60Beep::~QS60Beep() { - delete iToneUtil; + delete iToneUtil; } QS60Beep* QS60Beep::NewL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration) @@ -148,7 +153,7 @@ void QS60Beep::Play() iState=EBeepPrepared; } } - + iToneUtil->Play(); iState=EBeepPlaying; } @@ -290,7 +295,7 @@ void QLongTapTimer::PointerEventL(const TPointerEvent& event) Cancel(); m_event = event; if (event.iType == TPointerEvent::EButton1Down) - { + { m_pressedCoordinates = QPoint(event.iPosition.iX,event.iPosition.iY); // must be same as KLongTapDelay in aknlongtapdetector.h After(800000); @@ -361,7 +366,7 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) } if (type == QMouseEvent::None) return; - + // store events for later sending/saving QWidget *alienWidget; typedef QPair<QWidget*,QMouseEvent> Event; @@ -370,7 +375,7 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) QPoint widgetPos = QPoint(pEvent.iPosition.iX, pEvent.iPosition.iY); TPoint controlScreenPos = PositionRelativeToScreen(); QPoint globalPos = QPoint(controlScreenPos.iX, controlScreenPos.iY) + widgetPos; - + if (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick) { // get the button press target @@ -401,7 +406,7 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) events.append(Event(S60->lastPointerEventTarget,mEventLeave)); } QMouseEvent mEventEnter(QEvent::Enter, alienWidget->mapFromGlobal(globalPos), globalPos, - button, QApplicationPrivate::mouse_buttons, mapToQtModifiers(pEvent.iModifiers)); + button, QApplicationPrivate::mouse_buttons, mapToQtModifiers(pEvent.iModifiers)); events.append(Event(alienWidget,mEventEnter)); } @@ -441,7 +446,7 @@ void QSymbianControl::sendMouseEvent(QWidget *widget, QMouseEvent *mEvent) TKeyResponse QSymbianControl::OfferKeyEventL(const TKeyEvent& keyEvent, TEventCode type) { TKeyResponse r = EKeyWasNotConsumed; - QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(r = OfferKeyEvent(keyEvent, type)); + QT_TRYCATCH_LEAVING(r = OfferKeyEvent(keyEvent, type)); return r; } @@ -667,14 +672,14 @@ void QSymbianControl::HandleResourceChange(int resourceType) { switch (resourceType) { case KInternalStatusPaneChange: - qwidget->d_func()->setWindowIcon_sys(true); - break; + qwidget->d_func()->setWindowIcon_sys(true); + break; case KUidValueCoeFontChangeEvent: // font change event break; #ifdef Q_WS_S60 case KEikDynamicLayoutVariantSwitch: - { + { if (qwidget->isFullScreen()) { SetExtentToWholeScreen(); } else if (qwidget->isMaximized()) { @@ -706,8 +711,6 @@ TTypeUid::Ptr QSymbianControl::MopSupplyObject(TTypeUid id) void qt_init(QApplicationPrivate * /* priv */, int) { - S60 = new QS60Data; - #ifdef QT_NO_DEBUG if (!qgetenv("QT_S60_AUTO_FLUSH_WSERV").isEmpty()) #endif @@ -723,12 +726,6 @@ void qt_init(QApplicationPrivate * /* priv */, int) TSecureId securId = me.SecureId(); S60->uid = securId.operator TUid(); - // New code to configure the window group name such that window server knows the associated application's UID - CApaWindowGroupName *wgn = CApaWindowGroupName::NewL(S60->wsSession()); - wgn->SetAppUid(S60->uid); - User::LeaveIfError(wgn->SetWindowGroupName((S60->windowGroup()))); - delete wgn; - /* ### Commented out for now as parameter handling not needed in SOS(yet). Code below will break testlib with -o flag int argc = priv->argc; @@ -947,10 +944,10 @@ void QApplication::beep() QS60Beep* beep=NULL; TRAPD(err, beep=QS60Beep::NewL(frequency, duration)); if(!err) { - beep->Play(); + beep->Play(); } delete beep; - beep=NULL; + beep=NULL; } int QApplication::s60ProcessEvent(TWsEvent *event) @@ -1084,8 +1081,8 @@ void QApplication::symbianResourceChange(int type) case KEikDynamicLayoutVariantSwitch: { if (S60) - S60->updateScreenSize(); - + S60->updateScreenSize(); + #ifndef QT_NO_STYLE_S60 QS60Style *s60Style = 0; @@ -1099,7 +1096,7 @@ void QApplication::symbianResourceChange(int type) if (s60Style) s60Style->handleDynamicLayoutVariantSwitch(); -#endif +#endif } break; @@ -1107,7 +1104,7 @@ void QApplication::symbianResourceChange(int type) case KAknsMessageSkinChange: if (QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style())) s60Style->handleSkinChange(); - break; + break; #endif #endif // Q_WS_S60 default: @@ -1178,5 +1175,3 @@ void QSessionManager::cancel() } #endif //QT_NO_SESSIONMANAGER QT_END_NAMESPACE - - diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index d5c820c..8eeac65 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -1098,7 +1098,7 @@ static void qWinProcessConfigRequests() // perform requests in qu class QGuiEventDispatcherWin32 : public QEventDispatcherWin32 { - Q_DECLARE_PRIVATE(QEventDispatcherWin32) + Q_DECLARE_SCOPED_PRIVATE(QEventDispatcherWin32) public: QGuiEventDispatcherWin32(QObject *parent = 0); bool processEvents(QEventLoop::ProcessEventsFlags flags); diff --git a/src/gui/kernel/qboxlayout.cpp b/src/gui/kernel/qboxlayout.cpp index 23d20ff..a7802af 100644 --- a/src/gui/kernel/qboxlayout.cpp +++ b/src/gui/kernel/qboxlayout.cpp @@ -925,9 +925,15 @@ void QBoxLayout::insertSpacing(int index, int size) else b = QLayoutPrivate::createSpacerItem(this, 0, size, QSizePolicy::Minimum, QSizePolicy::Fixed); - QBoxLayoutItem *it = new QBoxLayoutItem(b); - it->magic = true; - d->list.insert(index, it); + QT_TRY { + QBoxLayoutItem *it = new QBoxLayoutItem(b); + it->magic = true; + d->list.insert(index, it); + + } QT_CATCH(...) { + delete b; + QT_RETHROW; + } invalidate(); } @@ -1027,8 +1033,21 @@ void QBoxLayout::insertWidget(int index, QWidget *widget, int stretch, index = d->list.count(); QWidgetItem *b = QLayoutPrivate::createWidgetItem(this, widget); b->setAlignment(alignment); - QBoxLayoutItem *it = new QBoxLayoutItem(b, stretch); - d->list.insert(index, it); + + QBoxLayoutItem *it; + QT_TRY{ + it = new QBoxLayoutItem(b, stretch); + } QT_CATCH(...) { + delete b; + QT_RETHROW; + } + + QT_TRY{ + d->list.insert(index, it); + } QT_CATCH(...) { + delete it; + QT_RETHROW; + } invalidate(); } diff --git a/src/gui/kernel/qboxlayout.h b/src/gui/kernel/qboxlayout.h index f463c31..c399b8d 100644 --- a/src/gui/kernel/qboxlayout.h +++ b/src/gui/kernel/qboxlayout.h @@ -60,7 +60,7 @@ class QBoxLayoutPrivate; class Q_GUI_EXPORT QBoxLayout : public QLayout { Q_OBJECT - Q_DECLARE_PRIVATE(QBoxLayout) + Q_DECLARE_SCOPED_PRIVATE(QBoxLayout) public: enum Direction { LeftToRight, RightToLeft, TopToBottom, BottomToTop, Down = TopToBottom, Up = BottomToTop }; diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h index 8241812..68fbf33 100644 --- a/src/gui/kernel/qclipboard.h +++ b/src/gui/kernel/qclipboard.h @@ -62,7 +62,7 @@ class QClipboardPrivate; class Q_GUI_EXPORT QClipboard : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QClipboard) + Q_DECLARE_SCOPED_PRIVATE(QClipboard) private: QClipboard(QObject *parent); ~QClipboard(); diff --git a/src/gui/kernel/qclipboard_s60.cpp b/src/gui/kernel/qclipboard_s60.cpp index db5e7f3..5536438 100644 --- a/src/gui/kernel/qclipboard_s60.cpp +++ b/src/gui/kernel/qclipboard_s60.cpp @@ -76,10 +76,10 @@ public: QMimeData* source() { return src; } bool connected() - { return connection; } + { return connection; } void clear(); RFs fsSession(); - + private: QMimeData* src; @@ -134,7 +134,7 @@ static QClipboardData *clipboardData() delete internalCbData; internalCbData = 0; } - else + else { qAddPostRoutine(cleanupClipboardData); } @@ -143,8 +143,10 @@ static QClipboardData *clipboardData() return internalCbData; } -void writeToStream(const QMimeData* aData, RWriteStream& aStream) +void writeToStreamLX(const QMimeData* aData, RWriteStream& aStream) { + // This function both leaves and throws exceptions. There must be no destructor + // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects. QStringList headers = aData->formats(); aStream << TCardinality(headers.count()); for (QStringList::const_iterator iter= headers.constBegin();iter != headers.constEnd();iter++) @@ -159,13 +161,15 @@ void writeToStream(const QMimeData* aData, RWriteStream& aStream) aStream << TCardinality(ba.size()); aStream.WriteL(reinterpret_cast<const uchar*>(ba.constData()),ba.size()); CleanupStack::PopAndDestroy(stringData); - } + } } -void readFromStream(QMimeData* aData,RReadStream& aStream) +void readFromStreamLX(QMimeData* aData,RReadStream& aStream) { + // This function both leaves and throws exceptions. There must be no destructor + // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects. TCardinality mimeTypeCount; - aStream >> mimeTypeCount; + aStream >> mimeTypeCount; for (int i = 0; i< mimeTypeCount;i++) { // mime type @@ -173,6 +177,7 @@ void readFromStream(QMimeData* aData,RReadStream& aStream) aStream >> mimeTypeSize; HBufC* mimeTypeBuf = HBufC::NewLC(aStream,mimeTypeSize); QString mimeType = QString::fromUtf16(mimeTypeBuf->Des().Ptr(),mimeTypeBuf->Length()); + CleanupStack::PopAndDestroy(mimeTypeBuf); // mime data TCardinality dataSize; aStream >> dataSize; @@ -182,8 +187,6 @@ void readFromStream(QMimeData* aData,RReadStream& aStream) ba.data_ptr()->size = dataSize; qDebug() << "paste from clipboard mime: " << mimeType << " data: " << ba; aData->setData(mimeType,ba); - CleanupStack::PopAndDestroy(mimeTypeBuf); - } } @@ -210,14 +213,14 @@ const QMimeData* QClipboard::mimeData(Mode mode) const RStoreReadStream stream; TStreamId stid = (cb->StreamDictionary()).At(KQtCbDataStream); stream.OpenLC(cb->Store(),stid); - readFromStream(d->source(),stream); + QT_TRYCATCH_LEAVING(readFromStreamLX(d->source(),stream)); CleanupStack::PopAndDestroy(2,cb); return d->source(); }); if (err != KErrNone){ qDebug()<< "clipboard is empty/err: " << err; } - + } return 0; } @@ -235,7 +238,7 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode) CClipboard* cb = CClipboard::NewForWritingLC(fs); RStoreWriteStream stream; TStreamId stid = stream.CreateLC(cb->Store()); - writeToStream(src,stream); + QT_TRYCATCH_LEAVING(writeToStreamLX(src,stream)); d->setSource(src); stream.CommitL(); (cb->StreamDictionary()).AssignL(KQtCbDataStream,stid); @@ -246,7 +249,7 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode) qDebug()<< "clipboard write err :" << err; } } - emitChanged(QClipboard::Clipboard); + emitChanged(QClipboard::Clipboard); } bool QClipboard::supportsMode(Mode mode) const diff --git a/src/gui/kernel/qdesktopwidget.h b/src/gui/kernel/qdesktopwidget.h index a21ae9d..785f6c4 100644 --- a/src/gui/kernel/qdesktopwidget.h +++ b/src/gui/kernel/qdesktopwidget.h @@ -96,7 +96,7 @@ protected: private: Q_DISABLE_COPY(QDesktopWidget) - Q_DECLARE_PRIVATE(QDesktopWidget) + Q_DECLARE_SCOPED_PRIVATE(QDesktopWidget) friend class QApplication; friend class QApplicationPrivate; diff --git a/src/gui/kernel/qdesktopwidget_x11.cpp b/src/gui/kernel/qdesktopwidget_x11.cpp index 1555fc0..5bc4c0c 100644 --- a/src/gui/kernel/qdesktopwidget_x11.cpp +++ b/src/gui/kernel/qdesktopwidget_x11.cpp @@ -197,7 +197,7 @@ void QDesktopWidgetPrivate::init() if (screens) { // leaks QWidget* pointers on purpose, can't delete them as pointer escapes - screens = (QWidget**) realloc(screens, j * sizeof(QWidget*)); + screens = q_check_ptr((QWidget**) realloc(screens, j * sizeof(QWidget*))); if (j > screenCount) memset(&screens[screenCount], 0, (j-screenCount) * sizeof(QWidget*)); } diff --git a/src/gui/kernel/qdnd_s60.cpp b/src/gui/kernel/qdnd_s60.cpp index c459f8f..c7656b0 100644 --- a/src/gui/kernel/qdnd_s60.cpp +++ b/src/gui/kernel/qdnd_s60.cpp @@ -94,8 +94,8 @@ class QShapedPixmapWidget public: QShapedPixmapWidget(RWsSession aWsSession,RWindowTreeNode* aNode) { - sprite = RWsSprite(aWsSession); - cursorSprite.iBitmap = 0; + sprite = RWsSprite(aWsSession); + cursorSprite.iBitmap = 0; cursorSprite.iMaskBitmap = 0; cursorSprite.iInvertMask = EFalse; cursorSprite.iOffset = TPoint(0,0); @@ -127,8 +127,8 @@ public: //### heaplock centralized. QImage temp = pm.toImage(); QSize size = pm.size(); - temp.bits(); - CFbsBitmap *curbm = new (ELeave) CFbsBitmap(); + temp.bits(); + CFbsBitmap *curbm = q_check_ptr(new CFbsBitmap()); // CBase derived object needs check on new curbm->Create(TSize(size.width(),size.height()),EColor16MA); curbm->LockHeap(ETrue); memcpy((uchar*)curbm->DataAddress(),temp.bits(),temp.numBytes()); @@ -188,7 +188,7 @@ bool QDragManager::eventFilter(QObject *o, QEvent *e) switch(e->type()) { case QEvent::MouseButtonPress: { - } + } case QEvent::MouseMove: { if (!object) { //#### this should not happen @@ -211,7 +211,7 @@ bool QDragManager::eventFilter(QObject *o, QEvent *e) if (!cw) return true; TPoint windowPos = cw->effectiveWinId()->PositionRelativeToScreen(); - qt_symbian_dnd_deco->sprite.SetPosition(TPoint(me->globalX()- windowPos.iX,me->globalY()- windowPos.iY)); + qt_symbian_dnd_deco->sprite.SetPosition(TPoint(me->globalX()- windowPos.iX,me->globalY()- windowPos.iY)); while (cw && !cw->acceptDrops() && !cw->isWindow()) cw = cw->parentWidget(); @@ -318,7 +318,7 @@ Qt::DropAction QDragManager::drag(QDrag *o) object->d_func()->target = 0; TPoint windowPos = source()->effectiveWinId()->PositionRelativeToScreen(); qt_symbian_dnd_deco->sprite.SetPosition(TPoint(QCursor::pos().x()- windowPos.iX ,QCursor::pos().y() - windowPos.iY)); - + QPoint hotspot = drag_object->hotSpot(); qt_symbian_dnd_deco->cursorSprite.iOffset = TPoint(- hotspot.x(),- hotspot.y()); qt_symbian_dnd_deco->sprite.UpdateMember(0,qt_symbian_dnd_deco->cursorSprite); diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index 7b445ea..410d1a9 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -316,7 +316,7 @@ static XdndData xdnd_data = { 0, 0 }; class QExtraWidget : public QWidget { - Q_DECLARE_PRIVATE(QWidget) + Q_DECLARE_SCOPED_PRIVATE(QWidget) public: inline QWExtra* extraData(); inline QTLWExtra* topData(); diff --git a/src/gui/kernel/qdrag.h b/src/gui/kernel/qdrag.h index b49d82a..7e54b51 100644 --- a/src/gui/kernel/qdrag.h +++ b/src/gui/kernel/qdrag.h @@ -61,7 +61,7 @@ class QDragManager; class Q_GUI_EXPORT QDrag : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QDrag) + Q_DECLARE_SCOPED_PRIVATE(QDrag) public: explicit QDrag(QWidget *dragSource); ~QDrag(); diff --git a/src/gui/kernel/qeventdispatcher_glib_qws_p.h b/src/gui/kernel/qeventdispatcher_glib_qws_p.h index 826661e..f0751be 100644 --- a/src/gui/kernel/qeventdispatcher_glib_qws_p.h +++ b/src/gui/kernel/qeventdispatcher_glib_qws_p.h @@ -62,7 +62,7 @@ class QWSEventDispatcherGlibPrivate; class QWSEventDispatcherGlib : public QEventDispatcherGlib { Q_OBJECT - Q_DECLARE_PRIVATE(QWSEventDispatcherGlib) + Q_DECLARE_SCOPED_PRIVATE(QWSEventDispatcherGlib) public: explicit QWSEventDispatcherGlib(QObject *parent = 0); diff --git a/src/gui/kernel/qeventdispatcher_mac_p.h b/src/gui/kernel/qeventdispatcher_mac_p.h index 88663c6..1986c4c 100644 --- a/src/gui/kernel/qeventdispatcher_mac_p.h +++ b/src/gui/kernel/qeventdispatcher_mac_p.h @@ -108,7 +108,7 @@ class QEventDispatcherMacPrivate; class QEventDispatcherMac : public QAbstractEventDispatcher { Q_OBJECT - Q_DECLARE_PRIVATE(QEventDispatcherMac) + Q_DECLARE_SCOPED_PRIVATE(QEventDispatcherMac) public: explicit QEventDispatcherMac(QObject *parent = 0); diff --git a/src/gui/kernel/qeventdispatcher_qws_p.h b/src/gui/kernel/qeventdispatcher_qws_p.h index b83fa10..982ed58 100644 --- a/src/gui/kernel/qeventdispatcher_qws_p.h +++ b/src/gui/kernel/qeventdispatcher_qws_p.h @@ -62,7 +62,7 @@ class QEventDispatcherQWSPrivate; class QEventDispatcherQWS : public QEventDispatcherUNIX { Q_OBJECT - Q_DECLARE_PRIVATE(QEventDispatcherQWS) + Q_DECLARE_SCOPED_PRIVATE(QEventDispatcherQWS) public: explicit QEventDispatcherQWS(QObject *parent = 0); diff --git a/src/gui/kernel/qeventdispatcher_s60.cpp b/src/gui/kernel/qeventdispatcher_s60.cpp index 51878df..2fea8a4 100644 --- a/src/gui/kernel/qeventdispatcher_s60.cpp +++ b/src/gui/kernel/qeventdispatcher_s60.cpp @@ -76,7 +76,7 @@ bool QEventDispatcherS60::processEvents ( QEventLoop::ProcessEventsFlags flags ) m_noInputEvents = oldNoInputEventsValue; } QT_CATCH (const std::exception& ex) { #ifndef QT_NO_EXCEPTIONS - CActiveScheduler::Current()->Error(qt_translateExceptionToSymbianError(ex)); + CActiveScheduler::Current()->Error(qt_exception2SymbianError(ex)); #endif } diff --git a/src/gui/kernel/qeventdispatcher_x11_p.h b/src/gui/kernel/qeventdispatcher_x11_p.h index 9a54c36..b4c553d 100644 --- a/src/gui/kernel/qeventdispatcher_x11_p.h +++ b/src/gui/kernel/qeventdispatcher_x11_p.h @@ -62,7 +62,7 @@ class QEventDispatcherX11Private; class QEventDispatcherX11 : public QEventDispatcherUNIX { Q_OBJECT - Q_DECLARE_PRIVATE(QEventDispatcherX11) + Q_DECLARE_SCOPED_PRIVATE(QEventDispatcherX11) public: explicit QEventDispatcherX11(QObject *parent = 0); diff --git a/src/gui/kernel/qformlayout.h b/src/gui/kernel/qformlayout.h index b560e85..0143711 100644 --- a/src/gui/kernel/qformlayout.h +++ b/src/gui/kernel/qformlayout.h @@ -56,7 +56,7 @@ class Q_GUI_EXPORT QFormLayout : public QLayout { Q_OBJECT Q_ENUMS(FormStyle FieldGrowthPolicy RowWrapPolicy ItemRole) - Q_DECLARE_PRIVATE(QFormLayout) + Q_DECLARE_SCOPED_PRIVATE(QFormLayout) Q_PROPERTY(FieldGrowthPolicy fieldGrowthPolicy READ fieldGrowthPolicy WRITE setFieldGrowthPolicy RESET resetFieldGrowthPolicy) Q_PROPERTY(RowWrapPolicy rowWrapPolicy READ rowWrapPolicy WRITE setRowWrapPolicy RESET resetRowWrapPolicy) Q_PROPERTY(Qt::Alignment labelAlignment READ labelAlignment WRITE setLabelAlignment RESET resetLabelAlignment) diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index 1cd9cae..8390d11 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -60,7 +60,7 @@ class QGesturePrivate; class Q_GUI_EXPORT QGesture : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QGesture) + Q_DECLARE_SCOPED_PRIVATE(QGesture) Q_PROPERTY(Qt::GestureState state READ state) diff --git a/src/gui/kernel/qgridlayout.h b/src/gui/kernel/qgridlayout.h index 89a04a4..2b5299e 100644 --- a/src/gui/kernel/qgridlayout.h +++ b/src/gui/kernel/qgridlayout.h @@ -60,7 +60,7 @@ class QGridLayoutPrivate; class Q_GUI_EXPORT QGridLayout : public QLayout { Q_OBJECT - Q_DECLARE_PRIVATE(QGridLayout) + Q_DECLARE_SCOPED_PRIVATE(QGridLayout) QDOC_PROPERTY(int horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing) QDOC_PROPERTY(int verticalSpacing READ verticalSpacing WRITE setVerticalSpacing) diff --git a/src/gui/kernel/qguieventdispatcher_glib_p.h b/src/gui/kernel/qguieventdispatcher_glib_p.h index 65d233e..8543836 100644 --- a/src/gui/kernel/qguieventdispatcher_glib_p.h +++ b/src/gui/kernel/qguieventdispatcher_glib_p.h @@ -62,7 +62,7 @@ class QGuiEventDispatcherGlibPrivate; class QGuiEventDispatcherGlib : public QEventDispatcherGlib { Q_OBJECT - Q_DECLARE_PRIVATE(QGuiEventDispatcherGlib) + Q_DECLARE_SCOPED_PRIVATE(QGuiEventDispatcherGlib) public: explicit QGuiEventDispatcherGlib(QObject *parent = 0); diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp index 8eee665..ad293bd 100644 --- a/src/gui/kernel/qkeymapper_mac.cpp +++ b/src/gui/kernel/qkeymapper_mac.cpp @@ -563,7 +563,7 @@ QKeyMapperPrivate::QKeyMapperPrivate() QKeyMapperPrivate::~QKeyMapperPrivate() { - clearMappings(); + deleteLayouts(); } bool @@ -658,7 +658,7 @@ QKeyMapperPrivate::updateKeyboard() } void -QKeyMapperPrivate::clearMappings() +QKeyMapperPrivate::deleteLayouts() { keyboard_mode = NullMode; for (int i = 0; i < 255; ++i) { @@ -667,6 +667,12 @@ QKeyMapperPrivate::clearMappings() keyLayout[i] = 0; } } +} + +void +QKeyMapperPrivate::clearMappings() +{ + deleteLayouts(); updateKeyboard(); } diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h index ba1fcfe..6c12b0f 100644 --- a/src/gui/kernel/qkeymapper_p.h +++ b/src/gui/kernel/qkeymapper_p.h @@ -85,7 +85,7 @@ public: private: friend QKeyMapperPrivate *qt_keymapper_private(); - Q_DECLARE_PRIVATE(QKeyMapper) + Q_DECLARE_SCOPED_PRIVATE(QKeyMapper) Q_DISABLE_COPY(QKeyMapper) }; @@ -161,6 +161,7 @@ public: bool translateKeyEvent(QWidget *receiver, const MSG &msg, bool grab); void updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32 scancode, quint32 vk_key); bool isADeadKey(unsigned int vk_key, unsigned int modifiers); + void deleteLayouts(); KeyboardLayoutItem *keyLayout[256]; @@ -189,6 +190,7 @@ public: bool updateKeyboard(); void updateKeyMap(EventHandlerCallRef, EventRef, void *); bool translateKeyEvent(QWidget *, EventHandlerCallRef, EventRef, void *, bool); + void deleteLayouts(); enum { NullMode, UnicodeMode, OtherMode } keyboard_mode; union { diff --git a/src/gui/kernel/qkeymapper_win.cpp b/src/gui/kernel/qkeymapper_win.cpp index 0998631..bd55411 100644 --- a/src/gui/kernel/qkeymapper_win.cpp +++ b/src/gui/kernel/qkeymapper_win.cpp @@ -582,10 +582,10 @@ QKeyMapperPrivate::QKeyMapperPrivate() QKeyMapperPrivate::~QKeyMapperPrivate() { - clearMappings(); + deleteLayouts(); } -void QKeyMapperPrivate::clearMappings() +void QKeyMapperPrivate::deleteLayouts() { for (int i = 0; i < 255; ++i) { if (keyLayout[i]) { @@ -593,6 +593,11 @@ void QKeyMapperPrivate::clearMappings() keyLayout[i] = 0; } } +} + +void QKeyMapperPrivate::clearMappings() +{ + deleteLayouts(); /* MAKELCID()'s first argument is a WORD, and GetKeyboardLayout() * returns a DWORD. */ diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 6563dae..e2a5b27 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -753,7 +753,9 @@ QKeySequence::QKeySequence(StandardKey key) */ QKeySequence::QKeySequence() { - d = new QKeySequencePrivate(); + static QKeySequencePrivate shared_empty; + d = &shared_empty; + d->ref.ref(); } /*! diff --git a/src/gui/kernel/qlayout.h b/src/gui/kernel/qlayout.h index 4f46c1d..ec95ca8 100644 --- a/src/gui/kernel/qlayout.h +++ b/src/gui/kernel/qlayout.h @@ -89,7 +89,7 @@ class QLayoutPrivate; class Q_GUI_EXPORT QLayout : public QObject, public QLayoutItem { Q_OBJECT - Q_DECLARE_PRIVATE(QLayout) + Q_DECLARE_SCOPED_PRIVATE(QLayout) Q_ENUMS(SizeConstraint) Q_PROPERTY(int margin READ margin WRITE setMargin) diff --git a/src/gui/kernel/qsessionmanager.h b/src/gui/kernel/qsessionmanager.h index f27dbaa..0a55d0c 100644 --- a/src/gui/kernel/qsessionmanager.h +++ b/src/gui/kernel/qsessionmanager.h @@ -60,7 +60,7 @@ class QSessionManagerPrivate; class Q_GUI_EXPORT QSessionManager : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QSessionManager) + Q_DECLARE_SCOPED_PRIVATE(QSessionManager) QSessionManager(QApplication *app, QString &id, QString &key); ~QSessionManager(); public: diff --git a/src/gui/kernel/qshortcut.h b/src/gui/kernel/qshortcut.h index c81ce7c..7b79faa 100644 --- a/src/gui/kernel/qshortcut.h +++ b/src/gui/kernel/qshortcut.h @@ -57,7 +57,7 @@ class QShortcutPrivate; class Q_GUI_EXPORT QShortcut : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QShortcut) + Q_DECLARE_SCOPED_PRIVATE(QShortcut) Q_PROPERTY(QKeySequence key READ key WRITE setKey) Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h index 8962ac7..53a39ec 100644 --- a/src/gui/kernel/qshortcutmap_p.h +++ b/src/gui/kernel/qshortcutmap_p.h @@ -74,7 +74,7 @@ class QObject; class QShortcutMap { - Q_DECLARE_PRIVATE(QShortcutMap) + Q_DECLARE_SCOPED_PRIVATE(QShortcutMap) public: QShortcutMap(); ~QShortcutMap(); diff --git a/src/gui/kernel/qsound.h b/src/gui/kernel/qsound.h index 22cfdde..eeef047 100644 --- a/src/gui/kernel/qsound.h +++ b/src/gui/kernel/qsound.h @@ -82,7 +82,7 @@ public: static inline QT3_SUPPORT bool available() { return isAvailable(); } #endif private: - Q_DECLARE_PRIVATE(QSound) + Q_DECLARE_SCOPED_PRIVATE(QSound) friend class QAuServer; }; diff --git a/src/gui/kernel/qsound_s60.cpp b/src/gui/kernel/qsound_s60.cpp index c9eedf5..75458ec 100644 --- a/src/gui/kernel/qsound_s60.cpp +++ b/src/gui/kernel/qsound_s60.cpp @@ -65,22 +65,22 @@ public: void play(); void stop(); - + inline QSound* sound() const { return m_sound; } - + public: // from MMdaAudioPlayerCallback void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration); - void MapcPlayComplete(TInt aError); + void MapcPlayComplete(TInt aError); private: QSound *m_sound; - QAuServerS60 *m_server; + QAuServerS60 *m_server; bool m_prepared; - bool m_playCalled; - CMdaAudioPlayerUtility* m_playUtility; + bool m_playCalled; + CMdaAudioPlayerUtility* m_playUtility; }; - + class QAuServerS60 : public QAuServer { public: @@ -103,11 +103,11 @@ public: } bool okay() { return true; } - + protected: - void playCompleted(QAuBucketS60* bucket, int error) + void playCompleted(QAuBucketS60* bucket, int error) { - QSound *sound = bucket->sound(); + QSound *sound = bucket->sound(); if(!error) { // We need to handle repeats by ourselves, since with Symbian API we don't // know how many loops have been played when user asks it @@ -119,14 +119,14 @@ protected: // in order that QSound::isFinished will return true; while(decLoop(sound)) {} } - } + } protected: QAuBucketS60* bucket( QSound *s ) { return (QAuBucketS60*)QAuServer::bucket( s ); } - + friend class QAuBucketS60; }; @@ -160,32 +160,32 @@ void QAuBucketS60::play() { if(m_prepared) { // OpenFileL call is completed we can start playing immediately - m_playUtility->Play(); + m_playUtility->Play(); } else { m_playCalled = true; } - + } void QAuBucketS60::stop() { m_playCalled = false; - m_playUtility->Stop(); + m_playUtility->Stop(); } void QAuBucketS60::MapcPlayComplete(TInt aError) { m_server->playCompleted(this, aError); } - -void QAuBucketS60::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/) + +void QAuBucketS60::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/) { if(aError) { m_server->playCompleted(this, aError); } else { - m_prepared = true; + m_prepared = true; if(m_playCalled){ - play(); + play(); } } } @@ -196,7 +196,7 @@ QAuBucketS60::~QAuBucketS60() m_playUtility->Stop(); m_playUtility->Close(); } - + delete m_playUtility; } diff --git a/src/gui/kernel/qstackedlayout.h b/src/gui/kernel/qstackedlayout.h index d14b2ab..ab215fa 100644 --- a/src/gui/kernel/qstackedlayout.h +++ b/src/gui/kernel/qstackedlayout.h @@ -55,7 +55,7 @@ class QStackedLayoutPrivate; class Q_GUI_EXPORT QStackedLayout : public QLayout { Q_OBJECT - Q_DECLARE_PRIVATE(QStackedLayout) + Q_DECLARE_SCOPED_PRIVATE(QStackedLayout) Q_ENUMS(StackingMode) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged) Q_PROPERTY(StackingMode stackingMode READ stackingMode WRITE setStackingMode) diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index bcbe48f..f6dd2e1 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -73,18 +73,13 @@ #include <akncontext.h> // CAknContextPane #include <eikspane.h> // CEikStatusPane #endif - + QT_BEGIN_NAMESPACE -// Application internal HandleResourceChangeL events, +// Application internal HandleResourceChangeL events, // system evens seems to start with 0x10 const TInt KInternalStatusPaneChange = 0x50000000; -struct QS60Data; -extern QS60Data *qt_s60Data; - -#define S60 qt_s60Data - class QS60Data { public: @@ -114,10 +109,13 @@ public: #endif }; +QS60Data* qGlobalS60Data(); +#define S60 qGlobalS60Data() + class QAbstractLongTapObserver { public: - virtual void HandleLongTapEventL( const TPoint& aPenEventLocation, + virtual void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation ) = 0; }; class QLongTapTimer; @@ -241,7 +239,7 @@ inline CEikButtonGroupContainer* QS60Data::buttonGroupContainer() static inline QFont qt_TFontSpec2QFontL(const TFontSpec &fontSpec) { return QFont( - qt_TDesC2QStringL(fontSpec.iTypeface.iName), + qt_TDesC2QString(fontSpec.iTypeface.iName), fontSpec.iHeight / KTwipsPerPoint, fontSpec.iFontStyle.StrokeWeight() == EStrokeWeightNormal ? QFont::Normal : QFont::Bold, fontSpec.iFontStyle.Posture() == EPostureItalic diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index d7c89a6..e990358 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -896,22 +896,22 @@ void QWidget::setAutoFillBackground(bool enabled) \endlist \sa QEvent, QPainter, QGridLayout, QBoxLayout - + \section1 SoftKeys \since 4.6 \preliminary - Softkeys API is a platform independent way of mapping actions to (hardware)keys + Softkeys API is a platform independent way of mapping actions to (hardware)keys and toolbars provided by the underlying platform. - - There are three major use cases supported. First one is a mobile device + + There are three major use cases supported. First one is a mobile device with keypad navigation and no touch ui. Second use case is a mobile - device with touch ui. Third use case is desktop. For now the softkey API is + device with touch ui. Third use case is desktop. For now the softkey API is only implemented for Series60. - - QActions are set to widget(s) via softkey API. Actions in focused widget are + + QActions are set to widget(s) via softkey API. Actions in focused widget are mapped to native toolbar or hardware keys. Even though the API allows to set - any amount of widgets there might be physical restrictions to amount of + any amount of widgets there might be physical restrictions to amount of softkeys that can be used by the device. \o Series60: For series60 menu button is automatically mapped to left @@ -919,11 +919,11 @@ void QWidget::setAutoFillBackground(bool enabled) \sa softKeys() \sa setSoftKey() - + */ -QWidgetMapper *QWidgetPrivate::mapper = 0; // widget with wid -QWidgetSet *QWidgetPrivate::uncreatedWidgets = 0; // widgets with no wid +QWidgetMapper *QWidgetPrivate::mapper = 0; // widget with wid +QWidgetSet *QWidgetPrivate::allWidgets = 0; // widgets with no wid /***************************************************************************** @@ -969,7 +969,7 @@ struct QWidgetExceptionCleaner static inline void cleanup(QWidget *that, QWidgetPrivate *d) { #ifndef QT_NO_EXCEPTIONS - QWidgetPrivate::uncreatedWidgets->remove(that); + QWidgetPrivate::allWidgets->remove(that); if (d->focus_next != that) { if (d->focus_next) d->focus_next->d_func()->focus_prev = d->focus_prev; @@ -1121,8 +1121,8 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) if (QApplication::type() == QApplication::Tty) qFatal("QWidget: Cannot create a QWidget when no GUI is being used"); - Q_ASSERT(uncreatedWidgets); - uncreatedWidgets->insert(q); + Q_ASSERT(allWidgets); + allWidgets->insert(q); QWidget *desktopWidget = 0; if (parentWidget && parentWidget->windowType() == Qt::Desktop) { @@ -1415,15 +1415,31 @@ QWidget::~QWidget() } #endif - clearFocus(); + QT_TRY { + clearFocus(); + } QT_CATCH(...) { + // swallow this problem because we are in a destructor + } d->setDirtyOpaqueRegion(); - if (isWindow() && isVisible() && internalWinId()) - d->close_helper(QWidgetPrivate::CloseNoEvent); + if (isWindow() && isVisible() && internalWinId()) { + QT_TRY { + d->close_helper(QWidgetPrivate::CloseNoEvent); + } QT_CATCH(...) { + // if we're out of memory, at least hide the window. + QT_TRY { + hide(); + } QT_CATCH(...) { + // and if that also doesn't work, then give up + } + } + } + #if defined(Q_WS_WIN) || defined(Q_WS_X11) - else if (!internalWinId() && isVisible()) + else if (!internalWinId() && isVisible()) { qApp->d_func()->sendSyntheticEnterLeave(this); + } #endif if (QWidgetBackingStore *bs = d->maybeBackingStore()) { @@ -1449,12 +1465,15 @@ QWidget::~QWidget() QApplication::removePostedEvents(this); - destroy(); // platform-dependent cleanup - + QT_TRY { + destroy(); // platform-dependent cleanup + } QT_CATCH(...) { + // if this fails we can't do anything about it but at least we are not allowed to throw. + } --QWidgetPrivate::instanceCounter; - if (QWidgetPrivate::uncreatedWidgets) // might have been deleted by ~QApplication - QWidgetPrivate::uncreatedWidgets->remove(this); + if (QWidgetPrivate::allWidgets) // might have been deleted by ~QApplication + QWidgetPrivate::allWidgets->remove(this); QEvent e(QEvent::Destroy); QCoreApplication::sendEvent(this, &e); @@ -1474,7 +1493,6 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier bool userDesktopWidget = qt_desktopWidget != 0 && qt_desktopWidget != q && q->windowType() == Qt::Desktop; if (mapper && data.winid && !userDesktopWidget) { mapper->remove(data.winid); - uncreatedWidgets->insert(q); } data.winid = id; @@ -1483,7 +1501,6 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier #endif if (mapper && id && !userDesktopWidget) { mapper->insert(data.winid, q); - uncreatedWidgets->remove(q); } } @@ -4681,8 +4698,9 @@ void QWidget::setCursor(const QCursor &cursor) #endif { d->createExtra(); + QCursor *newCursor = new QCursor(cursor); delete d->extra->curs; - d->extra->curs = new QCursor(cursor); + d->extra->curs = newCursor; } setAttribute(Qt::WA_SetCursor); d->setCursor_sys(cursor); @@ -5383,6 +5401,17 @@ QString QWidget::windowTitle() const return QString(); } +/*! + Returns a modified window title with the [*] place holder + replaced according to the rules described in QWidget::setWindowTitle + + This function assumes that "[*]" can be quoted by another + "[*]", so it will replace two place holders by one and + a single last one by either "*" or nothing depending on + the modified flag. + + \internal +*/ QString qt_setWindowTitle_helperHelper(const QString &title, const QWidget *widget) { Q_ASSERT(widget); @@ -5394,16 +5423,21 @@ QString qt_setWindowTitle_helperHelper(const QString &title, const QWidget *widg QString cap = title; #endif - QString placeHolder(QLatin1String("[*]")); + if (cap.isEmpty()) + return cap; + + QLatin1String placeHolder("[*]"); + int placeHolderLength = 3; // QLatin1String doesn't have length() int index = cap.indexOf(placeHolder); + // here the magic begins while (index != -1) { - index += placeHolder.length(); + index += placeHolderLength; int count = 1; while (cap.indexOf(placeHolder, index) == index) { ++count; - index += placeHolder.length(); + index += placeHolderLength; } if (count%2) { // odd number of [*] -> replace last one @@ -5418,7 +5452,7 @@ QString qt_setWindowTitle_helperHelper(const QString &title, const QWidget *widg index = cap.indexOf(placeHolder, index); } - cap.replace(QLatin1String("[*][*]"), QLatin1String("[*]")); + cap.replace(QLatin1String("[*][*]"), placeHolder); return cap; } @@ -5756,7 +5790,7 @@ void QWidget::setFocus(Qt::FocusReason reason) if (!isEnabled()) return; - + QWidget *f = this; while (f->d_func()->extra && f->d_func()->extra->focus_proxy) f = f->d_func()->extra->focus_proxy; @@ -11639,7 +11673,7 @@ void QWidget::clearMask() /*! \preliminary \since 4.6 - + Returns the (possibly empty) list of this widget's softkeys. Returned list cannot be changed. Softkeys should be added and removed via method called setSoftKeys @@ -11660,7 +11694,7 @@ const QList<QAction*>& QWidget::softKeys() const /*! \preliminary \since 4.6 - + Sets the softkey \a softkey to this widget's list of softkeys, Setting 0 as softkey will clear all the existing softkeys set to the widget diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index c73f633..c5c10b6 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -142,7 +142,7 @@ class QWidgetPrivate; class Q_GUI_EXPORT QWidget : public QObject, public QPaintDevice { Q_OBJECT - Q_DECLARE_PRIVATE(QWidget) + Q_DECLARE_SCOPED_PRIVATE(QWidget) Q_PROPERTY(bool modal READ isModal) Q_PROPERTY(Qt::WindowModality windowModality READ windowModality WRITE setWindowModality) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 78df09d..070110d 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2556,7 +2556,11 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) qt_mac_destructWindow(window); } } - d->setWinId(0); + QT_TRY { + d->setWinId(0); + } QT_CATCH (const std::bad_alloc &) { + // swallow - destructors must not throw + } } } diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 1d9689e..1122154 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -490,10 +490,11 @@ public: QWidgetItemV2 *widgetItem; QPaintEngine *extraPaintEngine; mutable const QMetaObject *polished; - // All widgets are initially added into the uncreatedWidgets set. Once - // they receive a window id they are removed and added to the mapper + // All widgets are added into the allWidgets set. Once + // they receive a window id they are also added to the mapper. + // This should just ensure that all widgets are deleted by QApplication static QWidgetMapper *mapper; - static QWidgetSet *uncreatedWidgets; + static QWidgetSet *allWidgets; #if !defined(QT_NO_IM) QPointer<QInputContext> ic; Qt::InputMethodHints imHints; diff --git a/src/gui/kernel/qwidget_qws.cpp b/src/gui/kernel/qwidget_qws.cpp index 4ded5cf..eacf656 100644 --- a/src/gui/kernel/qwidget_qws.cpp +++ b/src/gui/kernel/qwidget_qws.cpp @@ -298,11 +298,16 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) d->hide_sys(); } if (destroyWindow && isWindow()) { - d->extra->topextra->backingStore->windowSurface->setGeometry(QRect()); + if (d->extra && d->extra->topextra && d->extra->topextra->backingStore) + d->extra->topextra->backingStore->windowSurface->setGeometry(QRect()); qwsDisplay()->destroyRegion(internalWinId()); } } - d->setWinId(0); + QT_TRY { + d->setWinId(0); + } QT_CATCH (const std::bad_alloc &) { + // swallow - destructors must not throw + } } } diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 5b05e55..ddd2f4c 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -89,7 +89,7 @@ void QWidgetPrivate::setSoftKeys_sys(const QList<QAction*> &softkeys) return; } CEikButtonGroupContainer* nativeContainer = S60->buttonGroupContainer(); - nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); + QT_TRAP_THROWING(nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS)); int position = -1; int command; @@ -137,12 +137,12 @@ void QWidgetPrivate::setSoftKeys_sys(const QList<QAction*> &softkeys) if (position != -1) { TPtrC text = qt_QString2TPtrC(softKeyAction->text()); - nativeContainer->SetCommandL(position, command, text); + QT_TRAP_THROWING(nativeContainer->SetCommandL(position, command, text)); } } if (needsExitButton) - nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QObject::tr("Exit"))); + QT_TRAP_THROWING(nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QObject::tr("Exit")))); nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation #else @@ -310,9 +310,17 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de } else if (topLevel) { if (!q->testAttribute(Qt::WA_Moved) && !q->testAttribute(Qt::WA_DontShowOnScreen)) data.crect.moveTopLeft(QPoint(clientRect.iTl.iX, clientRect.iTl.iY)); - QSymbianControl *control= new QSymbianControl(q); - control->ConstructL(true,desktop); + QSymbianControl *control= q_check_ptr(new QSymbianControl(q)); + QT_TRAP_THROWING(control->ConstructL(true,desktop)); if (!desktop) { + TInt stackingFlags; + if ((q->windowType() & Qt::Popup) == Qt::Popup) { + stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus; + } else { + stackingFlags = ECoeStackFlagStandard; + } + control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags); + QTLWExtra *topExtra = topData(); topExtra->rwindow = control->DrawableWindow(); // Request mouse move events. @@ -340,10 +348,19 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de control->SetRect(TRect(TPoint(x, y), TSize(w, h))); } else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create native child widget QSymbianControl *control = new QSymbianControl(q); - control->ConstructL(!parentWidget); + QT_TRAP_THROWING(control->ConstructL(!parentWidget)); + + TInt stackingFlags; + if ((q->windowType() & Qt::Popup) == Qt::Popup) { + stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus; + } else { + stackingFlags = ECoeStackFlagStandard; + } + control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags); + setWinId(control); WId parentw = parentWidget->effectiveWinId(); - control->SetContainerWindowL(*parentw); + QT_TRAP_THROWING(control->SetContainerWindowL(*parentw)); q->setAttribute(Qt::WA_WState_Created); int x, y, w, h; @@ -378,17 +395,11 @@ void QWidgetPrivate::show_sys() WId id = q->internalWinId(); if (!extra->topextra->activated) { - id->ActivateL(); + QT_TRAP_THROWING(id->ActivateL()); extra->topextra->activated = 1; } - TInt stackingFlags; - if ((q->windowType() & Qt::Popup) == Qt::Popup) { - stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus; - } else { - stackingFlags = ECoeStackFlagStandard; - } - id->ControlEnv()->AppUi()->AddToStackL(id, ECoeStackPriorityDefault, stackingFlags); id->MakeVisible(true); + id->SetFocus(true); // Force setting of the icon after window is made visible, // this is needed even WA_SetWindowIcon is not set, as in that case we need @@ -406,10 +417,9 @@ void QWidgetPrivate::hide_sys() deactivateWidgetCleanup(); WId id = q->internalWinId(); if (q->isWindow() && id) { - if(id->IsFocused()) // Avoid unnecessry calls to FocusChanged() + if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() id->SetFocus(false); id->MakeVisible(false); - id->ControlEnv()->AppUi()->RemoveFromStack(id); if (QWidgetBackingStore *bs = maybeBackingStore()) bs->releaseBuffer(); } else { @@ -544,7 +554,8 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) // destroyed when emitting the child remove event below. See QWorkspace. if (wasCreated && old_winid) { old_winid->MakeVisible(false); - old_winid->ControlEnv()->AppUi()->RemoveFromStack(old_winid); + if(old_winid->IsFocused()) // Avoid unnecessary calls to FocusChanged() + old_winid->SetFocus(false); old_winid->SetParent(0); } @@ -608,9 +619,9 @@ void QWidgetPrivate::s60UpdateIsOpaque() } } -CFbsBitmap* qt_pixmapToNativeBitmapL(QPixmap pixmap, bool invert) +CFbsBitmap* qt_pixmapToNativeBitmap(QPixmap pixmap, bool invert) { - CFbsBitmap* fbsBitmap = new(ELeave)CFbsBitmap; + CFbsBitmap* fbsBitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new TSize size(pixmap.size().width(), pixmap.size().height()); TDisplayMode mode(EColor16MU); @@ -621,7 +632,7 @@ CFbsBitmap* qt_pixmapToNativeBitmapL(QPixmap pixmap, bool invert) // Will fix later on when native pixmap is implemented switch(pixmap.depth()) { case 1: - mode = EGray2; + mode = EGray2; break; case 4: mode = EColor16; @@ -646,12 +657,12 @@ CFbsBitmap* qt_pixmapToNativeBitmapL(QPixmap pixmap, bool invert) break; } - User::LeaveIfError(fbsBitmap->Create(size, mode)); + qt_throwIfError(fbsBitmap->Create(size, mode)); fbsBitmap->LockHeap(); QImage image = pixmap.toImage(); if(invert) - image.invertPixels(); + image.invertPixels(); int height = pixmap.size().height(); for(int i=0;i<height;i++ ) @@ -695,26 +706,26 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) // Convert to CFbsBitmp // TODO: When QPixmap is adapted to use native CFbsBitmap, // it could be set directly to context pane - CFbsBitmap* nBitmap = qt_pixmapToNativeBitmapL(pm, false); - CFbsBitmap* nMask = qt_pixmapToNativeBitmapL(mask, true); + CFbsBitmap* nBitmap = qt_pixmapToNativeBitmap(pm, false); + CFbsBitmap* nMask = qt_pixmapToNativeBitmap(mask, true); contextPane->SetPicture(nBitmap,nMask); } else { // Icon set to null -> set context pane picture to default - contextPane->SetPictureToDefaultL(); + QT_TRAP_THROWING(contextPane->SetPictureToDefaultL()); } } else { // Context pane does not exist, try setting small icon to title pane TRect titlePaneRect; TBool found = AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::ETitlePane, titlePaneRect ); - CAknTitlePane* titlePane = S60->titlePane(); + CAknTitlePane* titlePane = S60->titlePane(); if (found && titlePane) { // We have title pane with valid metrics - // The API to get title_pane graphics size is not public -> assume square space based + // The API to get title_pane graphics size is not public -> assume square space based // on titlebar font height. CAknBitmap would be optimum, wihtout setting the size, since // then title pane would automatically scale the bitmap. Unfortunately it is not public API const CFont * font = AknLayoutUtils::FontFromId(EAknLogicalFontTitleFont); TSize iconSize(font->HeightInPixels(), font->HeightInPixels()); - + QIcon icon = q->windowIcon(); if (!icon.isNull()) { // Valid icon -> set it as an title pane small picture @@ -729,8 +740,8 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) // Convert to CFbsBitmp // TODO: When QPixmap is adapted to use native CFbsBitmap, // it could be set directly to context pane - CFbsBitmap* nBitmap = qt_pixmapToNativeBitmapL(pm, false); - CFbsBitmap* nMask = qt_pixmapToNativeBitmapL(mask, true); + CFbsBitmap* nBitmap = qt_pixmapToNativeBitmap(pm, false); + CFbsBitmap* nMask = qt_pixmapToNativeBitmap(mask, true); titlePane->SetSmallPicture( nBitmap, nMask, ETrue ); } else { @@ -739,7 +750,7 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) } } } - + #else Q_UNUSED(forceReset) #endif @@ -752,8 +763,12 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption) if (q->isWindow()) { Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); CAknTitlePane* titlePane = S60->titlePane(); - if(titlePane) - titlePane->SetTextL(qt_QString2TPtrC(caption)); + if(titlePane) { + if(caption.isEmpty()) + titlePane->SetTextToDefaultL(); + else + QT_TRAP_THROWING(titlePane->SetTextL(qt_QString2TPtrC(caption))); + } } #else Q_UNUSED(caption) @@ -1028,14 +1043,16 @@ void QWidget::setWindowState(Qt::WindowStates newstate) if (newstate & Qt::WindowMinimized) { if (isVisible()) { WId id = effectiveWinId(); + if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() + id->SetFocus(false); id->MakeVisible(false); - id->ControlEnv()->AppUi()->RemoveFromStack(id); } } else { if (isVisible()) { WId id = effectiveWinId(); id->MakeVisible(true); - id->ControlEnv()->AppUi()->AddToStackL(id); + if(!id->IsFocused()) // Avoid unnecessary calls to FocusChanged() + id->SetFocus(true); } const QRect normalGeometry = geometry(); const QRect r = top->normalGeometry; @@ -1100,11 +1117,17 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) if (wid) { QWidget *widget = QWidget::find(wid); QApplication::setActiveWindow(widget); + // Reset global window title for focusing window + widget->d_func()->setWindowTitle_sys(widget->windowTitle()); } } - d->setWinId(0); + QT_TRY { + d->setWinId(0); + } QT_CATCH (const std::bad_alloc &) { + // swallow - destructors must not throw + } } } diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index b11b661..d5ce40b 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -558,7 +558,11 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) } #endif - d->setWinId(0); + QT_TRY { + d->setWinId(0); + } QT_CATCH (const std::bad_alloc &) { + // swallow - destructors must not throw + } } } diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 2a3d2f3..2bb3626 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -1008,7 +1008,11 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) if (destroyWindow) qt_XDestroyWindow(this, X11->display, data->winid); } - d->setWinId(0); + QT_TRY { + d->setWinId(0); + } QT_CATCH (const std::bad_alloc &) { + // swallow - destructors must not throw + } extern void qPRCleanup(QWidget *widget); // from qapplication_x11.cpp if (testAttribute(Qt::WA_WState_Reparented)) diff --git a/src/gui/kernel/qwidgetaction.h b/src/gui/kernel/qwidgetaction.h index 4ec489e..a39b281 100644 --- a/src/gui/kernel/qwidgetaction.h +++ b/src/gui/kernel/qwidgetaction.h @@ -57,7 +57,7 @@ class QWidgetActionPrivate; class Q_GUI_EXPORT QWidgetAction : public QAction { Q_OBJECT - Q_DECLARE_PRIVATE(QWidgetAction) + Q_DECLARE_SCOPED_PRIVATE(QWidgetAction) public: explicit QWidgetAction(QObject *parent); diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index 359434e..cce28c4 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -270,7 +270,7 @@ const int XButtonRelease = ButtonRelease; // need to to inspect window()'s embedded state. class QHackWidget : public QWidget { - Q_DECLARE_PRIVATE(QWidget) + Q_DECLARE_SCOPED_PRIVATE(QWidget) public: QTLWExtra* topData() { return d_func()->topData(); } }; diff --git a/src/gui/kernel/qx11embed_x11.h b/src/gui/kernel/qx11embed_x11.h index 8659ed6..0d67c23 100644 --- a/src/gui/kernel/qx11embed_x11.h +++ b/src/gui/kernel/qx11embed_x11.h @@ -80,7 +80,7 @@ protected: void resizeEvent(QResizeEvent *); private: - Q_DECLARE_PRIVATE(QX11EmbedWidget) + Q_DECLARE_SCOPED_PRIVATE(QX11EmbedWidget) Q_DISABLE_COPY(QX11EmbedWidget) }; @@ -121,7 +121,7 @@ protected: bool event(QEvent *); private: - Q_DECLARE_PRIVATE(QX11EmbedContainer) + Q_DECLARE_SCOPED_PRIVATE(QX11EmbedContainer) Q_DISABLE_COPY(QX11EmbedContainer) }; diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 4121be6..2f5b2d6 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -229,7 +229,7 @@ contains(QMAKE_MAC_XARCH, no) { win32-g++|!win32:!*-icc* { mmx { - mmx_compiler.commands = $$QMAKE_CXX -c -Winline + mmx_compiler.commands = $$QMAKE_CXX -c -Winline mac { mmx_compiler.commands += -Xarch_i386 -mmmx @@ -371,7 +371,7 @@ symbian { "SOURCE qblendfunctions_armv6_rvct.s" \ "SOURCE qdrawhelper_armv6_rvct.s" \ "$${LITERAL_HASH}endif" - + MMP_RULES += armccIfdefBlock QMAKE_CXXFLAGS.ARMCC *= -O3 } diff --git a/src/gui/painting/qblendfunctions_armv6_rvct.s b/src/gui/painting/qblendfunctions_armv6_rvct.s index 312bd07..64d5aa5 100644 --- a/src/gui/painting/qblendfunctions_armv6_rvct.s +++ b/src/gui/painting/qblendfunctions_armv6_rvct.s @@ -54,13 +54,13 @@ ARM PRESERVE8 - INCLUDE qdrawhelper_armv6_rvct.inc + INCLUDE qdrawhelper_armv6_rvct.inc ;----------------------------------------------------------------------------- ; qt_blend_rgb32_on_rgb32_arm -; -; @brief +; +; @brief ; ; @param dest Destination pixels (r0) ; @param dbpl Destination bytes per line (r1) @@ -69,25 +69,25 @@ ; @param w Width (s0 -> r4) ; @param h Height (s1 -> r5) ; @param const_alpha Constant alpha (s2 -> r6) -; +; ;--------------------------------------------------------------------------- qt_blend_rgb32_on_rgb32_armv6 Function stmfd sp!, {r4-r12, r14} - + ; read arguments off the stack add r8, sp, #10 * 4 ldmia r8, {r9-r11} - + ; Reorganize registers - + mov r4, r10 mov r5, r1 mov r6, r3 - + mov r1, r2 mov r2, r9 mov r3, r11 - + ; Now we have registers ; @param dest Destination pixels (r0) ; @param src Source pixels (r1) @@ -96,53 +96,53 @@ qt_blend_rgb32_on_rgb32_armv6 Function ; @param h Height (r4) ; @param dbpl Destination bytes per line (r5) ; @param sbpl Source bytes per line (r6) - + cmp r3, #256 ; test if we have fully opaque constant alpha value bne rgb32_blend_const_alpha ; branch if not - + rgb32_blend_loop subs r4, r4, #1 bmi rgb32_blend_exit ; while(h--) - -rgb321 PixCpySafe r0, r1, r2 + +rgb321 PixCpySafe r0, r1, r2 add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl + add r1, r1, r6 ; src = src + sbpl + + b rgb32_blend_loop + - b rgb32_blend_loop - - rgb32_blend_const_alpha ;ldr r14, =ComponentHalf ; load 0x800080 to r14 mov r14, #0x800000 add r14, r14, #0x80 - + sub r3, r3, #1 ; const_alpha -= 1; rgb32_blend_loop_const_alpha subs r4, r4, #1 bmi rgb32_blend_exit ; while(h--) - + rgb322 BlendRowSafe PixelSourceOverConstAlpha add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl + add r1, r1, r6 ; src = src + sbpl b rgb32_blend_loop_const_alpha - -rgb32_blend_exit - + +rgb32_blend_exit + ldmfd sp!, {r4-r12, pc} ; pop and return - - - + + + ;----------------------------------------------------------------------------- ; qt_blend_argb32_on_argb32_arm -; -; @brief +; +; @brief ; ; @param dest Destination pixels (r0) ; @param dbpl Destination bytes per line (r1) @@ -151,25 +151,25 @@ rgb32_blend_exit ; @param w Width (s0 -> r4) ; @param h Height (s1 -> r5) ; @param const_alpha Constant alpha (s2 -> r6) -; +; ;--------------------------------------------------------------------------- qt_blend_argb32_on_argb32_armv6 Function stmfd sp!, {r4-r12, r14} - + ; read arguments off the stack add r8, sp, #10 * 4 ldmia r8, {r9-r11} - + ; Reorganize registers - + mov r4, r10 mov r5, r1 mov r6, r3 - + mov r1, r2 mov r2, r9 mov r3, r11 - + ; Now we have registers ; @param dest Destination pixels (r0) ; @param src Source pixels (r1) @@ -178,14 +178,14 @@ qt_blend_argb32_on_argb32_armv6 Function ; @param h Height (r4) ; @param dbpl Destination bytes per line (r5) ; @param sbpl Source bytes per line (r6) - + ;ldr r14, =ComponentHalf ; load 0x800080 to r14 mov r14, #0x800000 add r14, r14, #0x80 - + cmp r3, #256 ; test if we have fully opaque constant alpha value bne argb32_blend_const_alpha ; branch if not - + argb32_blend_loop subs r4, r4, #1 @@ -194,10 +194,10 @@ argb32_blend_loop argb321 BlendRowSafe PixelSourceOver add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl + add r1, r1, r6 ; src = src + sbpl b argb32_blend_loop - + argb32_blend_const_alpha sub r3, r3, #1 ; const_alpha -= 1; @@ -206,18 +206,17 @@ argb32_blend_loop_const_alpha subs r4, r4, #1 bmi argb32_blend_exit ; while(h--) - + argb322 BlendRowSafe PixelSourceOverConstAlpha add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl + add r1, r1, r6 ; src = src + sbpl b argb32_blend_loop_const_alpha - -argb32_blend_exit - + +argb32_blend_exit + ldmfd sp!, {r4-r12, pc} ; pop and return - - + + END ; File end - diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index 519e02e..97cbecc 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -230,7 +230,7 @@ struct QGradientBrushData : public QBrushData QGradient gradient; }; -struct QBrushDataPointerHandler +struct QBrushDataPointerDeleter { static inline void deleteData(QBrushData *d) { @@ -254,12 +254,6 @@ struct QBrushDataPointerHandler deleteData(d); } } - - static inline void reset(QBrushData *&d, QBrushData *other) - { - cleanup(d); - d = other; - } }; /*! @@ -580,7 +574,7 @@ QBrush::~QBrush() void QBrush::cleanUp(QBrushData *x) { - QBrushDataPointerHandler::deleteData(x); + QBrushDataPointerDeleter::deleteData(x); } diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h index fdb3a8a..a9fbc75 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -71,7 +71,7 @@ struct QBrushData; class QPixmap; class QGradient; class QVariant; -struct QBrushDataPointerHandler; +struct QBrushDataPointerDeleter; class Q_GUI_EXPORT QBrush { @@ -137,7 +137,7 @@ private: friend bool Q_GUI_EXPORT qHasPixmapTexture(const QBrush& brush); void detach(Qt::BrushStyle newStyle); void init(const QColor &color, Qt::BrushStyle bs); - QScopedCustomPointer<QBrushData, QBrushDataPointerHandler> d; + QCustomScopedPointer<QBrushData, QBrushDataPointerDeleter> d; void cleanUp(QBrushData *x); public: diff --git a/src/gui/painting/qcolormap_s60.cpp b/src/gui/painting/qcolormap_s60.cpp index 1b58598..29d340f 100644 --- a/src/gui/painting/qcolormap_s60.cpp +++ b/src/gui/painting/qcolormap_s60.cpp @@ -105,4 +105,3 @@ QColormap &QColormap::operator=(const QColormap &colormap) { qAtomicAssign(d, colormap.d); return *this; } QT_END_NAMESPACE - diff --git a/src/gui/painting/qdrawhelper_armv6_rvct.inc b/src/gui/painting/qdrawhelper_armv6_rvct.inc index b3e0605..1cb316a 100644 --- a/src/gui/painting/qdrawhelper_armv6_rvct.inc +++ b/src/gui/painting/qdrawhelper_armv6_rvct.inc @@ -52,10 +52,10 @@ ;----------------------------------------------------------------------------- ; Globals. -; Earch marcro expects that caller has loaded 0x800080 to r14. +; Earch marcro expects that caller has loaded 0x800080 to r14. ;----------------------------------------------------------------------------- -ComponentHalf EQU 0x800080 +ComponentHalf EQU 0x800080 ;----------------------------------------------------------------------------- ; ARM assembly implementations of accelerated graphics operations. @@ -65,7 +65,7 @@ ComponentHalf EQU 0x800080 ; - r0 = Target buffer pointer ; - r1 = Source buffer pointer ; - r2 = Length of the buffer to blend -; - r3 = Constant alpha for source buffer +; - r3 = Constant alpha for source buffer ; ;----------------------------------------------------------------------------- @@ -78,8 +78,8 @@ $func Function CODE32 $func MEND - - + + ;----------------------------------------------------------------------------- ; Armv6 boosted implementation of BYTE_MUL(...) function found in qdrawhelper_p.h. ; @@ -98,29 +98,29 @@ $func ; uint r8 = (x & 0xff00ff) * a + 0x800080 uxtb16 r8, $x ; r8 = r8 & 0x00FF00FF mla r8, r8, $a, r14 - + ; x = ((r >> 8) & 0xff00ff) * a + 0x800080 uxtb16 $x, $x, ror #8 mla $x, $x, $a, r14 - + ; r8 = (r8 + ((r8 >> 8) & 0xff00ff) ) >> 8 ; r8 &= 0xff00ff uxtab16 r8, r8, r8, ror #8 uxtb16 r8, r8, ror #8 - + ; x = x + ((x >>8) & 0xff00ff) uxtab16 $x, $x, $x, ror #8 - + ; x &= 0xff00ff00 ; x |= r8 uxtb16 $x, $x, ror #8 orr $dst, r8, $x, lsl #8 - + MEND - + ;----------------------------------------------------------------------------- -; Armv6 boosted implementation of INTERPOLATE_PIXEL_255(...) function found in +; Armv6 boosted implementation of INTERPOLATE_PIXEL_255(...) function found in ; qdrawhelper_p.h. ; ; @param dst Destination register where to store the result @@ -129,7 +129,7 @@ $func ; @param y Second value to multiply ; @param b Multiplicator byte for second value ; @param r14 Component half 0x800080 -; +; ; ; @note Trashes x, r8, r14 ;----------------------------------------------------------------------------- @@ -143,40 +143,40 @@ $func ; uint r8 = (((x & 0xff00ff) * a) + 0x800080) uxtb16 r8, $x ; r8 = r8 & 0x00FF00FF mla r8, r8, $a, r14 - + ; x = ((((x >> 8) & 0xff00ff) * a) + 0x800080) uxtb16 $x, $x, ror #8 mla $x, $x, $a, r14 - + ; Now we are trashing r14 to free it for other purposes - + ; uint r14 = (y & 0xff00ff) * b uxtb16 r14, $y ; r14 = y & 0x00FF00FF mul r14, r14, $b - + ; r8 = r8 + r14 add r8, r8, r14 - + ; r8 = (r8 + ((r8 >> 8) & 0xff00ff) ) >> 8 ; r8 &= 0xff00ff uxtab16 r8, r8, r8, ror #8 uxtb16 r8, r8, ror #8 - + ; r14 = ((y >> 8) & 0xff00ff) * b uxtb16 r14, $y, ror #8 ; r14 = ((y >> 8) & 0xFF00FF) mul r14, r14, $b - + ; x = x + r14 add $x, $x, r14 - + ; x = x + ((x >>8) & 0xff00ff) uxtab16 $x, $x, $x, ror #8 - + ; x &= 0xff00ff00 ; x |= r8 uxtb16 $x, $x, ror #8 orr $dst, r8, $x, lsl #8 - + MEND ;----------------------------------------------------------------------------- @@ -184,19 +184,19 @@ $func ;----------------------------------------------------------------------------- MACRO $label Blend4Pixels $BlendPixel - - ; Blend first 4 pixels - + + ; Blend first 4 pixels + ldmia r1!, {r4-r7} ldm r0, {r9-r12} - + b4p1_$label $BlendPixel r9, r4, r3 b4p2_$label $BlendPixel r10, r5, r3 b4p3_$label $BlendPixel r11, r6, r3 b4p4_$label $BlendPixel r12, r7, r3 - + stmia r0!, {r9-r12} - + MEND ;----------------------------------------------------------------------------- @@ -204,43 +204,43 @@ b4p4_$label $BlendPixel r12, r7, r3 ;----------------------------------------------------------------------------- MACRO $label Blend8Pixels $BlendPixel - + b8p1_$label Blend4Pixels $BlendPixel -b8p2_$label Blend4Pixels $BlendPixel - +b8p2_$label Blend4Pixels $BlendPixel + MEND - + ;----------------------------------------------------------------------------- ; ;----------------------------------------------------------------------------- MACRO $label Blend16Pixels $BlendPixel - + b16p1_$label Blend8Pixels $BlendPixel -b16p2_$label Blend8Pixels $BlendPixel - +b16p2_$label Blend8Pixels $BlendPixel + MEND - + ;----------------------------------------------------------------------------- ; ;----------------------------------------------------------------------------- MACRO $label Blend32Pixels $BlendPixel - + b32p1_$label Blend16Pixels $BlendPixel -b32p2_$label Blend16Pixels $BlendPixel - +b32p2_$label Blend16Pixels $BlendPixel + MEND ;----------------------------------------------------------------------------- -; A macro for source over compositing one row of pixels and saving the results +; A macro for source over compositing one row of pixels and saving the results ; to destination buffer. ; ; @param dest Destination buffer (r0) ; @param src Source buffer (r1) ; @param length Length (r2) ; @param const_alpha Constant alpha (r3) -; @param r14 Component Half (0x800080) (r14) +; @param r14 Component Half (0x800080) (r14) ; ; @note Advances r0, r1 ; @note Trashes r2, r4-r12 @@ -260,73 +260,73 @@ brp1_$label Blend32Pixels $BlendPixel b bloop_$label b_remaining_$label - + ; Remaining 31 pixels - + addmi r2, r2, #32 ; Blend 16 pixels tst r2, #16 beq b_remaining8_$label - + brp2_$label Blend16Pixels $BlendPixel - -b_remaining8_$label - + +b_remaining8_$label + ; Blend 8 pixels tst r2, #8 beq b_remaining4_$label - -brp3_$label Blend8Pixels $BlendPixel - -b_remaining4_$label - + +brp3_$label Blend8Pixels $BlendPixel + +b_remaining4_$label + ; Blend 4 pixels tst r2, #4 beq b_remaining3_$label - -brp4_$label Blend4Pixels $BlendPixel + +brp4_$label Blend4Pixels $BlendPixel b_remaining3_$label ; Remaining 3 pixels - + tst r2, #2 beq b_last_$label - + ldmia r1!, {r4-r5} ldm r0, {r9-r10} - + brp5_$label $BlendPixel r9, r4, r3 brp6_$label $BlendPixel r10, r5, r3 - + stmia r0!, {r9-r10} b_last_$label - + tst r2, #1 beq bexit_$label - + ldr r4, [r1] ldr r9, [r0] bpl_$label $BlendPixel r9, r4, r3 - + str r9, [r0] bexit_$label MEND - + ;----------------------------------------------------------------------------- -; A macro for source over compositing one row of pixels and saving the results +; A macro for source over compositing one row of pixels and saving the results ; to destination buffer. Restores all registers. ; ; @param dest Destination buffer (r0) ; @param src Source buffer (r1) ; @param length Length (r2) ; @param const_alpha Constant alpha (r3) -; @param r14 Component Half (0x800080) (r14) +; @param r14 Component Half (0x800080) (r14) ; ; @note Advances r0, r1 ; @note Trashes r2, r4-r12 @@ -336,16 +336,16 @@ $label BlendRowSafe $BlendPixel stmfd sp!, {r0-r6} ; Preserves registers only up to r6 -brs_$label BlendRow $BlendPixel +brs_$label BlendRow $BlendPixel ldmfd sp!, {r0-r6} - MEND - + MEND + ;----------------------------------------------------------------------------- -; Pix Copy. -; NOTE! Cache line size of ARM1136JF-S and ARM1136J-S is 32 bytes (8 pixels). +; Pix Copy. +; NOTE! Cache line size of ARM1136JF-S and ARM1136J-S is 32 bytes (8 pixels). ; ; @param dst Destination pixels (r0) ; @param src Source pixels (r1) @@ -369,7 +369,7 @@ pcpy_loop_$label pcpy_remaining_$label ; Copy up to 7 remaining pixels - + ; Copy 4 pixels tst $len, #4 ldmneia $src!, {r3-r6} @@ -384,9 +384,9 @@ pcpy_remaining_$label strne r3, [$dst] MEND - + ;----------------------------------------------------------------------------- -; General Pix Copy. Maximum 8 pixels at time. Restores all registers. +; General Pix Copy. Maximum 8 pixels at time. Restores all registers. ; ; @param dst Destination pixels (r0) ; @param src Source pixels (r1) @@ -402,10 +402,10 @@ $label PixCpySafe $dst, $src, $len pcs_$label PixCpy $dst, $src, $len ldmfd sp!, {r0-r6} ; pop - + MEND - - + + ;----------------------------------------------------------------------------- ; A macro for source over compositing one pixel and saving the result to ; dst register. @@ -422,7 +422,7 @@ $label PixelSourceOver $dst, $src, $const_alpha ; Negate src and extract alpha mvn $const_alpha, $src ; bitwise not - uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24); + uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24); ;cmp $const_alpha, #255 ; test for full transparency ( negated ) ;beq exit_$label @@ -430,12 +430,12 @@ $label PixelSourceOver $dst, $src, $const_alpha moveq $dst, $src beq exit_$label - ByteMul $dst, $dst, $const_alpha + ByteMul $dst, $dst, $const_alpha add $dst, $src, $dst - + exit_$label MEND - + ;----------------------------------------------------------------------------- ; A macro for source over compositing one pixel and saving the result to ; dst register. @@ -457,7 +457,7 @@ $label PixelSourceOverConstAlpha $dst, $src, $const_alpha ; Negate src and extract alpha mvn $const_alpha, $src ; bitwise not - uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24); + uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24); ByteMul $dst, $dst, $const_alpha @@ -466,8 +466,8 @@ $label PixelSourceOverConstAlpha $dst, $src, $const_alpha ; recover alpha ldmfd sp!, {$const_alpha} - MEND - + MEND + ;----------------------------------------------------------------------------- ; A macro for source over compositing one pixel and saving the result to ; a register. @@ -491,6 +491,6 @@ $label PixelSourceConstAlpha $dst, $src, $const_alpha ; recover r2 and r14 ldmfd sp!, {r2, r14} - MEND - + MEND + END ; File end diff --git a/src/gui/painting/qdrawhelper_armv6_rvct.s b/src/gui/painting/qdrawhelper_armv6_rvct.s index 3ffe48b..dd29f80 100644 --- a/src/gui/painting/qdrawhelper_armv6_rvct.s +++ b/src/gui/painting/qdrawhelper_armv6_rvct.s @@ -52,22 +52,22 @@ ARM PRESERVE8 - + INCLUDE qdrawhelper_armv6_rvct.inc - + ;----------------------------------------------------------------------------- ; qt_memfill32_armv6 -; +; ; @brief Not yet in use! ; ; @param dest Destination buffer (r0) ; @param value Value (r1) ; @param count Count (r2) -; +; ;--------------------------------------------------------------------------- qt_memfill32_armv6 Function stmfd sp!, {r4-r12, r14} - + mov r3, r1 mov r4, r1 mov r5, r1 @@ -75,7 +75,7 @@ qt_memfill32_armv6 Function mov r7, r1 mov r8, r1 mov r9, r1 - + mfill_loop ; Fill 32 pixels per loop iteration subs r2, r2, #32 @@ -88,16 +88,16 @@ mfill_loop mfill_remaining ; Fill up to 31 remaining pixels - + ; Fill 16 pixels tst r2, #16 stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - + ; Fill 8 pixels tst r2, #8 stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - + ; Fill 4 pixels tst r2, #4 stmneia r0!, {r1, r3, r4, r5} @@ -109,31 +109,31 @@ mfill_remaining ; Fill last one tst r2, #1 strne r1, [r0] - + ldmfd sp!, {r4-r12, pc} ; pop and return - + ;----------------------------------------------------------------------------- ; comp_func_Source_arm -; -; @brief +; +; @brief ; ; @param dest Destination buffer (r0) ; @param src Source buffer (r1) ; @param length Length (r2) ; @param const_alpha Constant alpha (r3) -; +; ;--------------------------------------------------------------------------- comp_func_Source_armv6 Function stmfd sp!, {r4-r12, r14} - + cmp r3, #255 ; if(r3 == 255) bne src2 ; branch if not - + src1 PixCpy r0, r1, r2 ldmfd sp!, {r4-r12, pc} ; pop and return -src2 +src2 ;ldr r14, =ComponentHalf ; load 0x800080 to r14 mov r14, #0x800000 add r14, r14, #0x80 @@ -144,35 +144,34 @@ src22 BlendRow PixelSourceConstAlpha ;----------------------------------------------------------------------------- ; comp_func_SourceOver_arm -; -; @brief +; +; @brief ; ; @param dest Destination buffer (r0) ; @param src Source buffer (r1) ; @param length Length (r2) ; @param const_alpha Constant alpha (r3) -; +; ;--------------------------------------------------------------------------- comp_func_SourceOver_armv6 Function stmfd sp!, {r4-r12, r14} - + ;ldr r14, =ComponentHalf ; load 0x800080 to r14 mov r14, #0x800000 add r14, r14, #0x80 - + cmp r3, #255 ; if(r3 == 255) bne srcovr2 ; branch if not - + srcovr1 BlendRow PixelSourceOver - + ldmfd sp!, {r4-r12, pc} ; pop and return srcovr2 - + srcovr22 BlendRow PixelSourceOverConstAlpha ldmfd sp!, {r4-r12, pc} ; pop and return - - END ; File end - + + END ; File end diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c index 6ab7055..7a7adcf 100644 --- a/src/gui/painting/qgrayraster.c +++ b/src/gui/painting/qgrayraster.c @@ -1882,6 +1882,10 @@ if (memory) fprintf(stderr, "gray_raster_new(), memory ignored"); memory = malloc(sizeof(TRaster)); + if (!memory) { + *araster = 0; + return ErrRaster_Memory_Overflow; + } QT_FT_MEM_ZERO(memory, sizeof(TRaster)); *araster = (QT_FT_Raster) memory; diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h index 92aa506..6460afa 100644 --- a/src/gui/painting/qpaintengine.h +++ b/src/gui/painting/qpaintengine.h @@ -89,7 +89,7 @@ Q_DECLARE_TYPEINFO(QTextItem, Q_PRIMITIVE_TYPE); class Q_GUI_EXPORT QPaintEngine { - Q_DECLARE_PRIVATE(QPaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QPaintEngine) public: enum PaintEngineFeature { PrimitiveTransform = 0x00000001, // Can transform primitives brushes diff --git a/src/gui/painting/qpaintengine_alpha_p.h b/src/gui/painting/qpaintengine_alpha_p.h index 7f45ad6..1a0b1ac 100644 --- a/src/gui/painting/qpaintengine_alpha_p.h +++ b/src/gui/painting/qpaintengine_alpha_p.h @@ -62,7 +62,7 @@ class QAlphaPaintEnginePrivate; class QAlphaPaintEngine : public QPaintEngine { - Q_DECLARE_PRIVATE(QAlphaPaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QAlphaPaintEngine) public: ~QAlphaPaintEngine(); diff --git a/src/gui/painting/qpaintengine_mac_p.h b/src/gui/painting/qpaintengine_mac_p.h index 20a4a08..42a55c4 100644 --- a/src/gui/painting/qpaintengine_mac_p.h +++ b/src/gui/painting/qpaintengine_mac_p.h @@ -69,7 +69,7 @@ extern int qt_defaultDpiY(); class QCoreGraphicsPaintEnginePrivate; class QCoreGraphicsPaintEngine : public QPaintEngine { - Q_DECLARE_PRIVATE(QCoreGraphicsPaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QCoreGraphicsPaintEngine) public: QCoreGraphicsPaintEngine(); diff --git a/src/gui/painting/qpaintengine_preview_p.h b/src/gui/painting/qpaintengine_preview_p.h index 9f96d40..d8e2b08 100644 --- a/src/gui/painting/qpaintengine_preview_p.h +++ b/src/gui/painting/qpaintengine_preview_p.h @@ -65,7 +65,7 @@ class QPreviewPaintEnginePrivate; class QPreviewPaintEngine : public QPaintEngine, public QPrintEngine { - Q_DECLARE_PRIVATE(QPreviewPaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QPreviewPaintEngine) public: QPreviewPaintEngine(); ~QPreviewPaintEngine(); diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index d9af3f6..4aaa799 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -347,30 +347,33 @@ void QRasterPaintEngine::init() Q_CHECK_PTR(d->rasterPoolBase); // The antialiasing raster. - d->grayRaster = new QT_FT_Raster; - qt_ft_grays_raster.raster_new(0, d->grayRaster); - qt_ft_grays_raster.raster_reset(*d->grayRaster, d->rasterPoolBase, d->rasterPoolSize); + d->grayRaster.reset(new QT_FT_Raster); + Q_CHECK_PTR(d->grayRaster.data()); + if (qt_ft_grays_raster.raster_new(0, d->grayRaster.data())) + QT_THROW(std::bad_alloc()); // an error creating the raster is caused by a bad malloc - d->rasterizer = new QRasterizer; - d->rasterBuffer = new QRasterBuffer(); - d->outlineMapper = new QOutlineMapper; + + qt_ft_grays_raster.raster_reset(*d->grayRaster.data(), d->rasterPoolBase, d->rasterPoolSize); + + d->rasterizer.reset(new QRasterizer); + d->rasterBuffer.reset(new QRasterBuffer()); + d->outlineMapper.reset(new QOutlineMapper); d->outlinemapper_xform_dirty = true; d->basicStroker.setMoveToHook(qt_ft_outline_move_to); d->basicStroker.setLineToHook(qt_ft_outline_line_to); d->basicStroker.setCubicToHook(qt_ft_outline_cubic_to); - d->dashStroker = 0; - d->baseClip = new QClipData(d->device->height()); + d->baseClip.reset(new QClipData(d->device->height())); d->baseClip->setClipRect(QRect(0, 0, d->device->width(), d->device->height())); - d->image_filler.init(d->rasterBuffer, this); + d->image_filler.init(d->rasterBuffer.data(), this); d->image_filler.type = QSpanData::Texture; - d->image_filler_xform.init(d->rasterBuffer, this); + d->image_filler_xform.init(d->rasterBuffer.data(), this); d->image_filler_xform.type = QSpanData::Texture; - d->solid_color_filler.init(d->rasterBuffer, this); + d->solid_color_filler.init(d->rasterBuffer.data(), this); d->solid_color_filler.type = QSpanData::Solid; d->deviceDepth = d->device->depth(); @@ -439,15 +442,7 @@ QRasterPaintEngine::~QRasterPaintEngine() free(d->rasterPoolBase); #endif - qt_ft_grays_raster.raster_done(*d->grayRaster); - delete d->grayRaster; - - delete d->rasterBuffer; - delete d->outlineMapper; - delete d->rasterizer; - delete d->dashStroker; - - delete d->baseClip; + qt_ft_grays_raster.raster_done(*d->grayRaster.data()); } /*! @@ -483,12 +478,12 @@ bool QRasterPaintEngine::begin(QPaintDevice *device) d->rasterizer->setClipRect(d->deviceRect); - s->penData.init(d->rasterBuffer, this); + s->penData.init(d->rasterBuffer.data(), this); s->penData.setup(s->pen.brush(), s->intOpacity, s->composition_mode); s->stroker = &d->basicStroker; d->basicStroker.setClipRect(d->deviceRect); - s->brushData.init(d->rasterBuffer, this); + s->brushData.init(d->rasterBuffer.data(), this); s->brushData.setup(s->brush, s->intOpacity, s->composition_mode); d->rasterBuffer->compositionMode = QPainter::CompositionMode_SourceOver; @@ -552,8 +547,7 @@ bool QRasterPaintEngine::end() void QRasterPaintEngine::releaseBuffer() { Q_D(QRasterPaintEngine); - delete d->rasterBuffer; - d->rasterBuffer = new QRasterBuffer; + d->rasterBuffer.reset(new QRasterBuffer); } /*! @@ -797,8 +791,8 @@ void QRasterPaintEngine::updatePen(const QPen &pen) if(pen_style == Qt::SolidLine) { s->stroker = &d->basicStroker; } else if (pen_style != Qt::NoPen) { - if (!d->dashStroker) - d->dashStroker = new QDashStroker(&d->basicStroker); + if (!d->dashStroker.data()) + d->dashStroker.reset(new QDashStroker(&d->basicStroker)); if (pen.isCosmetic()) { d->dashStroker->setClipRect(d->deviceRect); } else { @@ -808,7 +802,7 @@ void QRasterPaintEngine::updatePen(const QPen &pen) } d->dashStroker->setDashPattern(pen.dashPattern()); d->dashStroker->setDashOffset(pen.dashOffset()); - s->stroker = d->dashStroker; + s->stroker = d->dashStroker.data(); } else { s->stroker = 0; } @@ -1244,7 +1238,7 @@ void QRasterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) qrasterpaintengine_state_setNoClip(s); } else { - QClipData *base = d->baseClip; + QClipData *base = d->baseClip.data(); // Intersect with current clip when available... if (op == Qt::IntersectClip && s->clip) @@ -1369,7 +1363,7 @@ void QRasterPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) QRasterPaintEngineState *s = state(); const QClipData *clip = d->clip(); - const QClipData *baseClip = d->baseClip; + const QClipData *baseClip = d->baseClip.data(); if (op == Qt::NoClip) { qrasterpaintengine_state_setNoClip(s); @@ -1437,7 +1431,7 @@ void QRasterPaintEngine::fillPath(const QPainterPath &path, QSpanData *fillData) } ensureOutlineMapper(); - d->rasterize(d->outlineMapper->convertPath(path), blend, fillData, d->rasterBuffer); + d->rasterize(d->outlineMapper->convertPath(path), blend, fillData, d->rasterBuffer.data()); } static void fillRect_normalized(const QRect &r, QSpanData *data, @@ -1867,7 +1861,7 @@ void QRasterPaintEngine::fill(const QVectorPath &path, const QBrush &brush) // } ensureOutlineMapper(); - d->rasterize(d->outlineMapper->convertPath(path), blend, &s->brushData, d->rasterBuffer); + d->rasterize(d->outlineMapper->convertPath(path), blend, &s->brushData, d->rasterBuffer.data()); } void QRasterPaintEngine::fillRect(const QRectF &r, QSpanData *data) @@ -2034,7 +2028,7 @@ void QRasterPaintEngine::fillPolygon(const QPointF *points, int pointCount, Poly // scanconvert. ProcessSpans brushBlend = d->getBrushFunc(d->outlineMapper->controlPointRect, &s->brushData); - d->rasterize(outline, brushBlend, &s->brushData, d->rasterBuffer); + d->rasterize(outline, brushBlend, &s->brushData, d->rasterBuffer.data()); } /*! @@ -2130,7 +2124,7 @@ void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, Polyg // scanconvert. ProcessSpans brushBlend = d->getBrushFunc(d->outlineMapper->controlPointRect, &s->brushData); - d->rasterize(d->outlineMapper->outline(), brushBlend, &s->brushData, d->rasterBuffer); + d->rasterize(d->outlineMapper->outline(), brushBlend, &s->brushData, d->rasterBuffer.data()); d->outlineMapper->setCoordinateRounding(false); } } @@ -2755,7 +2749,7 @@ void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx if (!s->penData.blend) return; - QRasterBuffer *rb = d->rasterBuffer; + QRasterBuffer *rb = d->rasterBuffer.data(); const QRect rect(rx, ry, w, h); const QClipData *clip = d->clip(); @@ -4017,7 +4011,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, rasterParams.flags |= (QT_FT_RASTER_FLAG_AA | QT_FT_RASTER_FLAG_DIRECT); rasterParams.gray_spans = callback; - error = qt_ft_grays_raster.raster_render(*grayRaster, &rasterParams); + error = qt_ft_grays_raster.raster_render(*grayRaster.data(), &rasterParams); // Out of memory, reallocate some more and try again... if (error == -6) { // -6 is Result_err_OutOfMemory @@ -4044,9 +4038,9 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, #endif Q_CHECK_PTR(rasterPoolBase); // note: we just freed the old rasterPoolBase. I hope it's not fatal. - qt_ft_grays_raster.raster_done(*grayRaster); - qt_ft_grays_raster.raster_new(0, grayRaster); - qt_ft_grays_raster.raster_reset(*grayRaster, rasterPoolBase, rasterPoolSize); + qt_ft_grays_raster.raster_done(*grayRaster.data()); + qt_ft_grays_raster.raster_new(0, grayRaster.data()); + qt_ft_grays_raster.raster_reset(*grayRaster.data(), rasterPoolBase, rasterPoolSize); } else { done = true; } @@ -4080,6 +4074,8 @@ QImage QRasterBuffer::colorizeBitmap(const QImage &image, const QColor &color) for (int y=0; y<height; ++y) { uchar *source = sourceImage.scanLine(y); QRgb *target = reinterpret_cast<QRgb *>(dest.scanLine(y)); + if (!source || !target) + QT_THROW(std::bad_alloc()); // we must have run out of memory for (int x=0; x < width; ++x) target[x] = (source[x>>3] >> (x&7)) & 1 ? fg : bg; } @@ -4283,7 +4279,7 @@ void QClipData::initialize() Q_CHECK_PTR(m_clipLines); QT_TRY { m_spans = (QSpan *)malloc(clipSpanHeight*sizeof(QSpan)); - allocated = clipSpanHeight; + allocated = clipSpanHeight; Q_CHECK_PTR(m_spans); QT_TRY { @@ -4323,9 +4319,7 @@ void QClipData::initialize() { // resize const int maxSpans = (ymax - ymin) * numRects; if (maxSpans > allocated) { - QSpan *newSpans = (QSpan *)realloc(m_spans, maxSpans * sizeof(QSpan)); - Q_CHECK_PTR(newSpans); - m_spans = newSpans; + m_spans = q_check_ptr((QSpan *)realloc(m_spans, maxSpans * sizeof(QSpan))); allocated = maxSpans; } } @@ -4377,11 +4371,13 @@ void QClipData::initialize() } } QT_CATCH(...) { - free(m_spans); + free(m_spans); // have to free m_spans again or someone might think that we were successfully initialized. + m_spans = 0; QT_RETHROW; } } QT_CATCH(...) { - free(m_clipLines); + free(m_clipLines); // same for clipLines + m_clipLines = 0; QT_RETHROW; } } @@ -4657,9 +4653,7 @@ static void qt_span_clip(int count, const QSpan *spans, void *userData) &newspans, newClip->allocated - newClip->count); newClip->count = newspans - newClip->m_spans; if (spans < end) { - QSpan *newSpan = (QSpan *)realloc(newClip->m_spans, newClip->allocated*2*sizeof(QSpan)); - Q_CHECK_PTR(newSpan); - newClip->m_spans = newSpan; + newClip->m_spans = q_check_ptr((QSpan *)realloc(newClip->m_spans, newClip->allocated*2*sizeof(QSpan))); newClip->allocated *= 2; } } diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index 3dab491..43f7675 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -134,7 +134,7 @@ Q_GUI_EXPORT #endif QRasterPaintEngine : public QPaintEngineEx { - Q_DECLARE_PRIVATE(QRasterPaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QRasterPaintEngine) public: QRasterPaintEngine(QPaintDevice *device); @@ -331,8 +331,8 @@ public: void recalculateFastImages(); QPaintDevice *device; - QOutlineMapper *outlineMapper; - QRasterBuffer *rasterBuffer; + QScopedPointer<QOutlineMapper> outlineMapper; + QScopedPointer<QRasterBuffer> rasterBuffer; #if defined (Q_WS_WIN) HDC hdc; @@ -343,9 +343,9 @@ public: QRect deviceRect; QStroker basicStroker; - QDashStroker *dashStroker; + QScopedPointer<QDashStroker> dashStroker; - QT_FT_Raster *grayRaster; + QScopedPointer<QT_FT_Raster> grayRaster; unsigned long rasterPoolSize; unsigned char *rasterPoolBase; @@ -357,7 +357,7 @@ public: QFontEngineGlyphCache::Type glyphCacheType; - QClipData *baseClip; + QScopedPointer<QClipData> baseClip; int deviceDepth; @@ -368,7 +368,7 @@ public: uint isPlain45DegreeRotation : 1; #endif - QRasterizer *rasterizer; + QScopedPointer<QRasterizer> rasterizer; }; @@ -539,7 +539,7 @@ inline const QClipData *QRasterPaintEnginePrivate::clip() const { Q_Q(const QRasterPaintEngine); if (q->state() && q->state()->clip && q->state()->clip->enabled) return q->state()->clip; - return baseClip; + return baseClip.data(); } diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp index e3248ea..6ab39da 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/gui/painting/qpaintengine_x11.cpp @@ -271,7 +271,7 @@ void QXRenderTessellator::addTrap(const Trapezoid &trap) { if (size == allocated) { allocated = qMax(2*allocated, 64); - traps = (XTrapezoid *)realloc(traps, allocated * sizeof(XTrapezoid)); + traps = q_check_ptr((XTrapezoid *)realloc(traps, allocated * sizeof(XTrapezoid))); } traps[size].top = Q27Dot5ToXFixed(trap.top); traps[size].bottom = Q27Dot5ToXFixed(trap.bottom); diff --git a/src/gui/painting/qpaintengine_x11_p.h b/src/gui/painting/qpaintengine_x11_p.h index 738a155..2a7894d 100644 --- a/src/gui/painting/qpaintengine_x11_p.h +++ b/src/gui/painting/qpaintengine_x11_p.h @@ -76,7 +76,7 @@ struct qt_float_point class QX11PaintEngine : public QPaintEngine { - Q_DECLARE_PRIVATE(QX11PaintEngine) + Q_DECLARE_SCOPED_PRIVATE(QX11PaintEngine) public: QX11PaintEngine(); ~QX11PaintEngine(); diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index 22354bc..aea79e8 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -143,7 +143,7 @@ class QPixmapFilter; class Q_GUI_EXPORT QPaintEngineEx : public QPaintEngine { - Q_DECLARE_PRIVATE(QPaintEngineEx) + Q_DECLARE_SCOPED_PRIVATE(QPaintEngineEx) public: QPaintEngineEx(); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 76e2fcc..e4c6f57 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -80,21 +80,6 @@ QT_BEGIN_NAMESPACE bool qt_show_painter_debug_output = true; #endif -class QPainterPrivateCleaner -{ -public: - static inline void cleanup(QPainterPrivate *d) - { - delete d; - } - - static inline void reset(QPainterPrivate *&d, QPainterPrivate *other) - { - delete d; - d = other; - } -}; - extern QPixmap qt_pixmapForBrush(int style, bool invert); void qt_format_text(const QFont &font, @@ -276,9 +261,7 @@ bool QPainterPrivate::attachPainterPrivate(QPainter *q, QPaintDevice *pdev) // However, to support corner cases we grow the array dynamically if needed. sp->d_ptr->d_ptrs_size <<= 1; const int newSize = sp->d_ptr->d_ptrs_size * sizeof(QPainterPrivate *); - QPainterPrivate ** newPointers = (QPainterPrivate **)realloc(sp->d_ptr->d_ptrs, newSize); - Q_CHECK_PTR(newPointers); - sp->d_ptr->d_ptrs = newPointers; + sp->d_ptr->d_ptrs = q_check_ptr((QPainterPrivate **)realloc(sp->d_ptr->d_ptrs, newSize)); } sp->d_ptr->d_ptrs[++sp->d_ptr->refcount - 2] = q->d_ptr.data(); q->d_ptr.data_ptr() = sp->d_ptr.data(); diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h index c81f5d4..227c6f5 100644 --- a/src/gui/painting/qpainter.h +++ b/src/gui/painting/qpainter.h @@ -79,11 +79,11 @@ class QTextItem; class QMatrix; class QTransform; -class QPainterPrivateCleaner; +class QPainterPrivateDeleter; class Q_GUI_EXPORT QPainter { - Q_DECLARE_PRIVATE(QPainter) + Q_DECLARE_SCOPED_PRIVATE(QPainter) Q_GADGET Q_FLAGS(RenderHint RenderHints) @@ -500,7 +500,7 @@ private: Q_DISABLE_COPY(QPainter) friend class Q3Painter; - QScopedCustomPointer<QPainterPrivate, QPainterPrivateCleaner> d_ptr; + QCustomScopedPointer<QPainterPrivate> d_ptr; friend class QFontEngine; friend class QFontEngineBox; diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index f9fd61e..20d7985 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE -struct QPainterPathPrivateHandler +struct QPainterPathPrivateDeleter { static inline void cleanup(QPainterPathPrivate *d) { @@ -82,13 +82,6 @@ struct QPainterPathPrivateHandler if (d && !d->ref.deref()) delete static_cast<QPainterPathData *>(d); } - - static inline void reset(QPainterPathPrivate *&d, QPainterPathPrivate *other) - { - QPainterPathPrivate *oldD = d; - d = other; - cleanup(oldD); - } }; // This value is used to determine the length of control point vectors diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h index 5068739..ef92397 100644 --- a/src/gui/painting/qpainterpath.h +++ b/src/gui/painting/qpainterpath.h @@ -57,7 +57,7 @@ QT_MODULE(Gui) class QFont; class QPainterPathPrivate; -struct QPainterPathPrivateHandler; +struct QPainterPathPrivateDeleter; class QPainterPathData; class QPainterPathStrokerPrivate; class QPolygonF; @@ -203,7 +203,7 @@ public: QPainterPath &operator-=(const QPainterPath &other); private: - QScopedCustomPointer<QPainterPathPrivate, QPainterPathPrivateHandler> d_ptr; + QScopedPointer<QPainterPathPrivate, QPainterPathPrivateDeleter> d_ptr; inline void ensureData() { if (!d_ptr) ensureData_helper(); } void ensureData_helper(); @@ -237,7 +237,7 @@ public: friend class QPainterPathStrokerPrivate; friend class QMatrix; friend class QTransform; - friend struct QPainterPathPrivateHandler; + friend struct QPainterPathPrivateDeleter; #ifndef QT_NO_DATASTREAM friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPainterPath &); friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &); @@ -256,7 +256,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &); class Q_GUI_EXPORT QPainterPathStroker { - Q_DECLARE_PRIVATE(QPainterPathStroker) + Q_DECLARE_SCOPED_PRIVATE(QPainterPathStroker) public: QPainterPathStroker(); ~QPainterPathStroker(); diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h index 0e023d6..26f5bd7 100644 --- a/src/gui/painting/qpdf_p.h +++ b/src/gui/painting/qpdf_p.h @@ -183,7 +183,7 @@ class QPdfBaseEnginePrivate; class QPdfBaseEngine : public QAlphaPaintEngine, public QPrintEngine { - Q_DECLARE_PRIVATE(QPdfBaseEngine) + Q_DECLARE_SCOPED_PRIVATE(QPdfBaseEngine) public: QPdfBaseEngine(QPdfBaseEnginePrivate &d, PaintEngineFeatures f); ~QPdfBaseEngine() {} diff --git a/src/gui/painting/qprintengine_mac_p.h b/src/gui/painting/qprintengine_mac_p.h index 23e99cd..1fdb172 100644 --- a/src/gui/painting/qprintengine_mac_p.h +++ b/src/gui/painting/qprintengine_mac_p.h @@ -72,7 +72,7 @@ class QPrinterPrivate; class QMacPrintEnginePrivate; class QMacPrintEngine : public QPaintEngine, public QPrintEngine { - Q_DECLARE_PRIVATE(QMacPrintEngine) + Q_DECLARE_SCOPED_PRIVATE(QMacPrintEngine) public: QMacPrintEngine(QPrinter::PrinterMode mode); diff --git a/src/gui/painting/qprintengine_pdf_p.h b/src/gui/painting/qprintengine_pdf_p.h index 6f884a9..e130ada 100644 --- a/src/gui/painting/qprintengine_pdf_p.h +++ b/src/gui/painting/qprintengine_pdf_p.h @@ -84,7 +84,7 @@ class QPdfEnginePrivate; class QPdfEngine : public QPdfBaseEngine { - Q_DECLARE_PRIVATE(QPdfEngine) + Q_DECLARE_SCOPED_PRIVATE(QPdfEngine) public: QPdfEngine(QPrinter::PrinterMode m); virtual ~QPdfEngine(); diff --git a/src/gui/painting/qprintengine_ps_p.h b/src/gui/painting/qprintengine_ps_p.h index 986be38a..4b8034e 100644 --- a/src/gui/painting/qprintengine_ps_p.h +++ b/src/gui/painting/qprintengine_ps_p.h @@ -70,7 +70,7 @@ class QPSPrintEnginePrivate; class QPSPrintEngine : public QPdfBaseEngine { - Q_DECLARE_PRIVATE(QPSPrintEngine) + Q_DECLARE_SCOPED_PRIVATE(QPSPrintEngine) public: // QPrinter uses these explicit QPSPrintEngine(QPrinter::PrinterMode m); diff --git a/src/gui/painting/qprintengine_qws_p.h b/src/gui/painting/qprintengine_qws_p.h index 41cf935..5e552fe 100644 --- a/src/gui/painting/qprintengine_qws_p.h +++ b/src/gui/painting/qprintengine_qws_p.h @@ -70,7 +70,7 @@ class QImage; class QtopiaPrintEngine : public QPaintEngine, public QPrintEngine { - Q_DECLARE_PRIVATE(QtopiaPrintEngine) + Q_DECLARE_SCOPED_PRIVATE(QtopiaPrintEngine) public: QtopiaPrintEngine(QPrinter::PrinterMode mode); diff --git a/src/gui/painting/qprintengine_win_p.h b/src/gui/painting/qprintengine_win_p.h index 36a32e8..34fa538 100644 --- a/src/gui/painting/qprintengine_win_p.h +++ b/src/gui/painting/qprintengine_win_p.h @@ -69,7 +69,7 @@ class QPainterState; class QWin32PrintEngine : public QAlphaPaintEngine, public QPrintEngine { - Q_DECLARE_PRIVATE(QWin32PrintEngine) + Q_DECLARE_SCOPED_PRIVATE(QWin32PrintEngine) public: QWin32PrintEngine(QPrinter::PrinterMode mode); diff --git a/src/gui/painting/qprinter.h b/src/gui/painting/qprinter.h index 25c2f0c..842845b 100644 --- a/src/gui/painting/qprinter.h +++ b/src/gui/painting/qprinter.h @@ -65,7 +65,7 @@ class QPrinterInfo; class Q_GUI_EXPORT QPrinter : public QPaintDevice { - Q_DECLARE_PRIVATE(QPrinter) + Q_DECLARE_SCOPED_PRIVATE(QPrinter) public: enum PrinterMode { ScreenResolution, PrinterResolution, HighResolution }; diff --git a/src/gui/painting/qprinterinfo.h b/src/gui/painting/qprinterinfo.h index c34e591..5c0a25f 100644 --- a/src/gui/painting/qprinterinfo.h +++ b/src/gui/painting/qprinterinfo.h @@ -53,10 +53,10 @@ QT_MODULE(Gui) #ifndef QT_NO_PRINTER class QPrinterInfoPrivate; -class QPrinterInfoPrivateCleanup; +class QPrinterInfoPrivateDeleter; class Q_GUI_EXPORT QPrinterInfo { -Q_DECLARE_PRIVATE(QPrinterInfo) +Q_DECLARE_SCOPED_PRIVATE(QPrinterInfo) public: QPrinterInfo(); @@ -77,7 +77,7 @@ public: private: QPrinterInfo(const QString& name); - QScopedCustomPointer<QPrinterInfoPrivate, QPrinterInfoPrivateCleanup> d_ptr; + QScopedPointer<QPrinterInfoPrivate, QPrinterInfoPrivateDeleter> d_ptr; }; #endif // QT_NO_PRINTER diff --git a/src/gui/painting/qprinterinfo_mac.cpp b/src/gui/painting/qprinterinfo_mac.cpp index 6932015..66455d9 100644 --- a/src/gui/painting/qprinterinfo_mac.cpp +++ b/src/gui/painting/qprinterinfo_mac.cpp @@ -65,7 +65,7 @@ private: static QPrinterInfoPrivate nullQPrinterInfoPrivate; -class QPrinterInfoPrivateCleanup +class QPrinterInfoPrivateDeleter { public: static inline void cleanup(QPrinterInfoPrivate *d) @@ -73,12 +73,6 @@ public: if (d != &nullQPrinterInfoPrivate) delete d; } - - static inline void reset(QPrinterInfoPrivate *&d, QPrinterInfoPrivate *other) - { - cleanup(d); - d = other; - } }; extern QPrinter::PaperSize qSizeFTopaperSize(const QSizeF& size); diff --git a/src/gui/painting/qprinterinfo_unix.cpp b/src/gui/painting/qprinterinfo_unix.cpp index b9f1f3b..11f94dc 100644 --- a/src/gui/painting/qprinterinfo_unix.cpp +++ b/src/gui/painting/qprinterinfo_unix.cpp @@ -82,7 +82,7 @@ private: static QPrinterInfoPrivate nullQPrinterInfoPrivate; -class QPrinterInfoPrivateCleanup +class QPrinterInfoPrivateDeleter { public: static inline void cleanup(QPrinterInfoPrivate *d) @@ -90,12 +90,6 @@ public: if (d != &nullQPrinterInfoPrivate) delete d; } - - static inline void reset(QPrinterInfoPrivate *&d, QPrinterInfoPrivate *other) - { - cleanup(d); - d = other; - } }; ///////////////////////////////////////////////////////////////////////////// diff --git a/src/gui/painting/qprinterinfo_win.cpp b/src/gui/painting/qprinterinfo_win.cpp index 4a92d30..89449b0 100644 --- a/src/gui/painting/qprinterinfo_win.cpp +++ b/src/gui/painting/qprinterinfo_win.cpp @@ -69,7 +69,7 @@ private: static QPrinterInfoPrivate nullQPrinterInfoPrivate; -class QPrinterInfoPrivateCleanup +class QPrinterInfoPrivateDeleter { public: static inline void cleanup(QPrinterInfoPrivate *d) @@ -77,12 +77,6 @@ public: if (d != &nullQPrinterInfoPrivate) delete d; } - - static inline void reset(QPrinterInfoPrivate *&d, QPrinterInfoPrivate *other) - { - cleanup(d); - d = other; - } }; ///////////////////////////////////////////////////////////////////////////// diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index 6d15271..346b31d 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -437,10 +437,8 @@ inline void QScanConverter::allocate(int size) { if (m_alloc < size) { int newAlloc = qMax(size, 2 * m_alloc); - Intersection *newIntersections = (Intersection *)realloc(m_intersections, newAlloc * sizeof(Intersection)); - Q_CHECK_PTR(newIntersections); + m_intersections = q_check_ptr((Intersection *)realloc(m_intersections, newAlloc * sizeof(Intersection))); m_alloc = newAlloc; - m_intersections = newIntersections; } } diff --git a/src/gui/painting/qtessellator.cpp b/src/gui/painting/qtessellator.cpp index 711f997..6c16772 100644 --- a/src/gui/painting/qtessellator.cpp +++ b/src/gui/painting/qtessellator.cpp @@ -406,9 +406,9 @@ void QTessellatorPrivate::Scanline::init(int maxActiveEdges) if (!edges || maxActiveEdges > default_alloc) { max_edges = maxActiveEdges; int s = qMax(maxActiveEdges + 1, default_alloc + 1); - edges = (Edge **)realloc(edges, s*sizeof(Edge *)); - edge_table = (Edge *)realloc(edge_table, s*sizeof(Edge)); - old = (Edge **)realloc(old, s*sizeof(Edge *)); + edges = q_check_ptr((Edge **)realloc(edges, s*sizeof(Edge *))); + edge_table = q_check_ptr((Edge *)realloc(edge_table, s*sizeof(Edge))); + old = q_check_ptr((Edge **)realloc(old, s*sizeof(Edge *))); } size = 0; old_size = 0; @@ -566,8 +566,8 @@ void QTessellatorPrivate::Vertices::init(int maxVertices) { if (!storage || maxVertices > allocated) { int size = qMax((int)default_alloc, maxVertices); - storage = (Vertex *)realloc(storage, size*sizeof(Vertex)); - sorted = (Vertex **)realloc(sorted, size*sizeof(Vertex *)); + storage = q_check_ptr((Vertex *)realloc(storage, size*sizeof(Vertex))); + sorted = q_check_ptr((Vertex **)realloc(sorted, size*sizeof(Vertex *))); allocated = maxVertices; } } @@ -739,7 +739,7 @@ void QTessellatorPrivate::cancelCoincidingEdges() if (testListSize > tlSize - 2) { tlSize = qMax(tlSize*2, 16); - tl = (QCoincidingEdge *)realloc(tl, tlSize*sizeof(QCoincidingEdge)); + tl = q_check_ptr((QCoincidingEdge *)realloc(tl, tlSize*sizeof(QCoincidingEdge))); } if (n->flags & (LineBeforeStarts|LineBeforeHorizontal)) { tl[testListSize].start = n; diff --git a/src/gui/painting/qwindowsurface_raster_p.h b/src/gui/painting/qwindowsurface_raster_p.h index b3256b3..4ee2047 100644 --- a/src/gui/painting/qwindowsurface_raster_p.h +++ b/src/gui/painting/qwindowsurface_raster_p.h @@ -108,7 +108,7 @@ public: private: void prepareBuffer(QImage::Format format, QWidget *widget); - Q_DECLARE_PRIVATE(QRasterWindowSurface) + Q_DECLARE_SCOPED_PRIVATE(QRasterWindowSurface) QScopedPointer<QRasterWindowSurfacePrivate> d_ptr; }; diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index e81adcc..5de4317 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -75,8 +75,8 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget) // We create empty CFbsBitmap here -> it will be resized in setGeometry - d_ptr->bitmap = new (ELeave) CFbsBitmap; - User::LeaveIfError( d_ptr->bitmap->Create(TSize(0, 0), mode ) ); + d_ptr->bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new + qt_throwIfError( d_ptr->bitmap->Create(TSize(0, 0), mode ) ); updatePaintDeviceOnBitmap(); @@ -141,7 +141,8 @@ bool QS60WindowSurface::scroll(const QRegion &area, int dx, int dy) if (d_ptr->device.isNull()) return false; - CFbsBitmapDevice *bitmapDevice = CFbsBitmapDevice::NewL(d_ptr->bitmap); + CFbsBitmapDevice *bitmapDevice = 0; + QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(d_ptr->bitmap)); CBitmapContext *bitmapContext; TInt err = bitmapDevice->CreateBitmapContext(bitmapContext); if (err != KErrNone) { @@ -177,7 +178,7 @@ void QS60WindowSurface::setGeometry(const QRect& rect) QWindowSurface::setGeometry(rect); TRect nativeRect(qt_QRect2TRect(rect)); - User::LeaveIfError(d_ptr->bitmap->Resize(nativeRect.Size())); + qt_throwIfError(d_ptr->bitmap->Resize(nativeRect.Size())); if (!rect.isNull()) updatePaintDeviceOnBitmap(); diff --git a/src/gui/painting/qwindowsurface_s60_p.h b/src/gui/painting/qwindowsurface_s60_p.h index 40a866d..6a31ced 100644 --- a/src/gui/painting/qwindowsurface_s60_p.h +++ b/src/gui/painting/qwindowsurface_s60_p.h @@ -81,7 +81,7 @@ public: static void unlockBitmapHeap(); CFbsBitmap *symbianBitmap() const; - + private: void updatePaintDeviceOnBitmap(); diff --git a/src/gui/statemachine/qbasickeyeventtransition_p.h b/src/gui/statemachine/qbasickeyeventtransition_p.h index 1d507b3..038c7d1 100644 --- a/src/gui/statemachine/qbasickeyeventtransition_p.h +++ b/src/gui/statemachine/qbasickeyeventtransition_p.h @@ -88,7 +88,7 @@ protected: private: Q_DISABLE_COPY(QBasicKeyEventTransition) - Q_DECLARE_PRIVATE(QBasicKeyEventTransition) + Q_DECLARE_SCOPED_PRIVATE(QBasicKeyEventTransition) }; QT_END_NAMESPACE diff --git a/src/gui/statemachine/qbasicmouseeventtransition_p.h b/src/gui/statemachine/qbasicmouseeventtransition_p.h index 8ca6118..eb0dc0f 100644 --- a/src/gui/statemachine/qbasicmouseeventtransition_p.h +++ b/src/gui/statemachine/qbasicmouseeventtransition_p.h @@ -91,7 +91,7 @@ protected: private: Q_DISABLE_COPY(QBasicMouseEventTransition) - Q_DECLARE_PRIVATE(QBasicMouseEventTransition) + Q_DECLARE_SCOPED_PRIVATE(QBasicMouseEventTransition) }; QT_END_NAMESPACE diff --git a/src/gui/statemachine/qkeyeventtransition.h b/src/gui/statemachine/qkeyeventtransition.h index 45ae684..c3a440b 100644 --- a/src/gui/statemachine/qkeyeventtransition.h +++ b/src/gui/statemachine/qkeyeventtransition.h @@ -76,7 +76,7 @@ protected: private: Q_DISABLE_COPY(QKeyEventTransition) - Q_DECLARE_PRIVATE(QKeyEventTransition) + Q_DECLARE_SCOPED_PRIVATE(QKeyEventTransition) }; #endif //QT_NO_STATEMACHINE diff --git a/src/gui/statemachine/qmouseeventtransition.h b/src/gui/statemachine/qmouseeventtransition.h index a56a554..35c7d1d 100644 --- a/src/gui/statemachine/qmouseeventtransition.h +++ b/src/gui/statemachine/qmouseeventtransition.h @@ -80,7 +80,7 @@ protected: private: Q_DISABLE_COPY(QMouseEventTransition) - Q_DECLARE_PRIVATE(QMouseEventTransition) + Q_DECLARE_SCOPED_PRIVATE(QMouseEventTransition) }; #endif //QT_NO_STATEMACHINE diff --git a/src/gui/styles/qcleanlooksstyle.h b/src/gui/styles/qcleanlooksstyle.h index ebfb707..834f238 100644 --- a/src/gui/styles/qcleanlooksstyle.h +++ b/src/gui/styles/qcleanlooksstyle.h @@ -56,7 +56,7 @@ class QCleanlooksStylePrivate; class Q_GUI_EXPORT QCleanlooksStyle : public QWindowsStyle { Q_OBJECT - Q_DECLARE_PRIVATE(QCleanlooksStyle) + Q_DECLARE_SCOPED_PRIVATE(QCleanlooksStyle) public: QCleanlooksStyle(); diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index ba28e75..bfcb7c9 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -3216,8 +3216,10 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) { if (!d->isViewItemCached(*vopt)) { d->viewItemLayout(vopt, &d->checkRect, &d->decorationRect, &d->displayRect, false); - if (d->cachedOption) + if (d->cachedOption) { delete d->cachedOption; + d->cachedOption = 0; + } d->cachedOption = new QStyleOptionViewItemV4(*vopt); } if (sr == SE_ViewItemCheckIndicator) diff --git a/src/gui/styles/qcommonstyle.h b/src/gui/styles/qcommonstyle.h index ce54a96..1f64fb3 100644 --- a/src/gui/styles/qcommonstyle.h +++ b/src/gui/styles/qcommonstyle.h @@ -98,7 +98,7 @@ protected: QCommonStyle(QCommonStylePrivate &dd); private: - Q_DECLARE_PRIVATE(QCommonStyle) + Q_DECLARE_SCOPED_PRIVATE(QCommonStyle) Q_DISABLE_COPY(QCommonStyle) }; diff --git a/src/gui/styles/qgtkstyle.h b/src/gui/styles/qgtkstyle.h index e12f175..3feeafa 100644 --- a/src/gui/styles/qgtkstyle.h +++ b/src/gui/styles/qgtkstyle.h @@ -60,7 +60,7 @@ class QGtkStylePrivate; class Q_GUI_EXPORT QGtkStyle : public QCleanlooksStyle { Q_OBJECT - Q_DECLARE_PRIVATE(QGtkStyle) + Q_DECLARE_SCOPED_PRIVATE(QGtkStyle) public: QGtkStyle(); diff --git a/src/gui/styles/qmotifstyle.h b/src/gui/styles/qmotifstyle.h index e848eb4..356f420 100644 --- a/src/gui/styles/qmotifstyle.h +++ b/src/gui/styles/qmotifstyle.h @@ -113,7 +113,7 @@ protected: bool eventFilter(QObject *o, QEvent *e); private: - Q_DECLARE_PRIVATE(QMotifStyle) + Q_DECLARE_SCOPED_PRIVATE(QMotifStyle) Q_DISABLE_COPY(QMotifStyle) bool highlightCols; diff --git a/src/gui/styles/qplastiquestyle.h b/src/gui/styles/qplastiquestyle.h index ac3da41..74560fc 100644 --- a/src/gui/styles/qplastiquestyle.h +++ b/src/gui/styles/qplastiquestyle.h @@ -56,7 +56,7 @@ class QPlastiqueStylePrivate; class Q_GUI_EXPORT QPlastiqueStyle : public QWindowsStyle { Q_OBJECT - Q_DECLARE_PRIVATE(QPlastiqueStyle) + Q_DECLARE_SCOPED_PRIVATE(QPlastiqueStyle) public: QPlastiqueStyle(); ~QPlastiqueStyle(); diff --git a/src/gui/styles/qproxystyle.h b/src/gui/styles/qproxystyle.h index c9edaff..33f252a 100644 --- a/src/gui/styles/qproxystyle.h +++ b/src/gui/styles/qproxystyle.h @@ -102,7 +102,7 @@ protected Q_SLOTS: Qt::Orientation orientation, const QStyleOption *option = 0, const QWidget *widget = 0) const; private: Q_DISABLE_COPY(QProxyStyle) - Q_DECLARE_PRIVATE(QProxyStyle) + Q_DECLARE_SCOPED_PRIVATE(QProxyStyle) }; #endif // QT_NO_STYLE_PROXY diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 2c486a2..01a469c 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -88,16 +88,16 @@ static const QByteArray propertyKeyCurrentlayout = "currentlayout"; const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** -{240,320,1,14,true,QLatin1String("QVGA Landscape Mirrored")}, -{240,320,1,14,false,QLatin1String("QVGA Landscape")}, -{320,240,1,14,true,QLatin1String("QVGA Portrait Mirrored")}, -{320,240,1,14,false,QLatin1String("QVGA Portrait")}, -{360,640,1,14,true,QLatin1String("NHD Landscape Mirrored")}, -{360,640,1,14,false,QLatin1String("NHD Landscape")}, -{640,360,1,14,true,QLatin1String("NHD Portrait Mirrored")}, -{640,360,1,14,false,QLatin1String("NHD Portrait")}, -{352,800,1,12,true,QLatin1String("E90 Landscape Mirrored")}, -{352,800,1,12,false,QLatin1String("E90 Landscape")} +{240,320,1,14,true,"QVGA Landscape Mirrored"}, +{240,320,1,14,false,"QVGA Landscape"}, +{320,240,1,14,true,"QVGA Portrait Mirrored"}, +{320,240,1,14,false,"QVGA Portrait"}, +{360,640,1,14,true,"NHD Landscape Mirrored"}, +{360,640,1,14,false,"NHD Landscape"}, +{640,360,1,14,true,"NHD Portrait Mirrored"}, +{640,360,1,14,false,"NHD Portrait"}, +{352,800,1,12,true,"E90 Landscape Mirrored"}, +{352,800,1,12,false,"E90 Landscape"} // *** End of generated data *** }; const int QS60StylePrivate::m_numberOfLayouts = @@ -280,7 +280,7 @@ void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, break; case SE_Editor: drawFrame(SF_Editor, painter, rect, flags | SF_PointNorth); - break; + break; default: break; } @@ -319,7 +319,7 @@ QVariant QS60StylePrivate::styleProperty(const char *name) const static QStringList layouts; if (layouts.isEmpty()) for (int i = 0; i < m_numberOfLayouts; i++) - layouts.append(m_layoutHeaders[i].layoutName); + layouts.append(QLatin1String(m_layoutHeaders[i].layoutName)); return layouts; } return QVariant(); @@ -796,12 +796,12 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); QApplication::setPalette(widgetPalette, "QTextEdit"); widgetPalette = *palette; - + widgetPalette.setColor(QPalette::All, QPalette::HighlightedText, s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); QApplication::setPalette(widgetPalette, "QComboBox"); widgetPalette = *palette; - + widgetPalette.setColor(QPalette::WindowText, mainAreaTextColor); widgetPalette.setColor(QPalette::Button, QApplication::palette().color(QPalette::Button)); widgetPalette.setColor(QPalette::Dark, mainAreaTextColor.darker()); diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index d8e9a40..38d8e48 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -57,7 +57,7 @@ class QS60StylePrivate; class Q_GUI_EXPORT QS60Style : public QCommonStyle { Q_OBJECT - Q_DECLARE_PRIVATE(QS60Style) + Q_DECLARE_SCOPED_PRIVATE(QS60Style) public: QS60Style(); diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 7240978..4bf8143 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -75,7 +75,7 @@ typedef struct { int major_version; int minor_version; bool mirroring; // TODO: (nice to have) Use Qt::LayoutDirection - QString layoutName; + const char* layoutName; } layoutHeader; #ifdef Q_OS_SYMBIAN @@ -270,7 +270,7 @@ public: SP_QsnFrButtonSideBInactive, SP_QsnFrButtonSideLInactive, SP_QsnFrButtonSideRInactive, - SP_QsnFrButtonCenterInactive, + SP_QsnFrButtonCenterInactive, SP_QsnFrNotepadCornerTl, SP_QsnFrNotepadCornerTr, SP_QsnFrNotepadCornerBl, diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 63346da..f304d14 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -80,7 +80,7 @@ enum TSupportRelease { ES60_5_1 = 0x0008, ES60_5_2 = 0x0010, // Add all new releases here - ES60_AllReleases = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 + ES60_AllReleases = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2 }; typedef struct { @@ -106,10 +106,10 @@ public: static QPixmap generateMissingThemeGraphic(QS60StyleEnums::SkinParts &part, const QSize &size, QS60StylePrivate::SkinElementFlags flags); private: - static QPixmap createSkinnedGraphicsL(QS60StyleEnums::SkinParts part, + static QPixmap createSkinnedGraphicsLX(QS60StyleEnums::SkinParts part, const QSize &size, QS60StylePrivate::SkinElementFlags flags); - static QPixmap createSkinnedGraphicsL(QS60StylePrivate::SkinFrameElements frameElement, const QSize &size, QS60StylePrivate::SkinElementFlags flags); - static QPixmap colorSkinnedGraphicsL(const QS60StyleEnums::SkinParts &stylepart, + static QPixmap createSkinnedGraphicsLX(QS60StylePrivate::SkinFrameElements frameElement, const QSize &size, QS60StylePrivate::SkinElementFlags flags); + static QPixmap colorSkinnedGraphicsLX(const QS60StyleEnums::SkinParts &stylepart, const QSize &size, QS60StylePrivate::SkinElementFlags flags); static void frameIdAndCenterId(QS60StylePrivate::SkinFrameElements frameElement, TAknsItemID &frameId, TAknsItemID ¢erId); static TRect innerRectFromElement(QS60StylePrivate::SkinFrameElements frameElement, const TRect &outerRect); @@ -317,7 +317,7 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { /* SP_QsnFrButtonSideBInactive */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b6}, /* SP_QsnFrButtonSideLInactive */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b7}, /* SP_QsnFrButtonSideRInactive */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b8}, - /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b9}, + /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b9}, /* SP_QsnFrNotepadCornerTl */ {KAknsIIDQsnFrNotepadContCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, /* SP_QsnFrNotepadCornerTr */ {KAknsIIDQsnFrNotepadContCornerTr, ENoDraw, ES60_AllReleases, -1,-1}, @@ -336,10 +336,10 @@ QPixmap QS60StyleModeSpecifics::skinnedGraphics( QS60StylePrivate::SkinElementFlags flags) { QPixmap themedImage; - TRAPD( error, { - const QPixmap skinnedImage = createSkinnedGraphicsL(stylepart, size, flags); + TRAPD( error, QT_TRYCATCH_LEAVING({ + const QPixmap skinnedImage = createSkinnedGraphicsLX(stylepart, size, flags); themedImage = skinnedImage; - }); + })); if (error) return themedImage = QPixmap(); return themedImage; @@ -349,10 +349,10 @@ QPixmap QS60StyleModeSpecifics::skinnedGraphics( QS60StylePrivate::SkinFrameElements frame, const QSize &size, QS60StylePrivate::SkinElementFlags flags) { QPixmap themedImage; - TRAPD( error, { - const QPixmap skinnedImage = createSkinnedGraphicsL(frame, size, flags); + TRAPD( error, QT_TRYCATCH_LEAVING({ + const QPixmap skinnedImage = createSkinnedGraphicsLX(frame, size, flags); themedImage = skinnedImage; - }); + })); if (error) return themedImage = QPixmap(); return themedImage; @@ -363,7 +363,7 @@ QPixmap QS60StyleModeSpecifics::colorSkinnedGraphics( const QSize &size, QS60StylePrivate::SkinElementFlags flags) { QPixmap colorGraphics; - TRAPD(error, colorGraphics = colorSkinnedGraphicsL(stylepart, size, flags)); + TRAPD(error, QT_TRYCATCH_LEAVING(colorGraphics = colorSkinnedGraphicsLX(stylepart, size, flags))); return error ? QPixmap() : colorGraphics; } @@ -521,10 +521,11 @@ void QS60StyleModeSpecifics::fallbackInfo(const QS60StyleEnums::SkinParts &style } } -QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsL( +QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX( const QS60StyleEnums::SkinParts &stylepart, const QSize &size, QS60StylePrivate::SkinElementFlags flags) { + // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts. const int stylepartIndex = (int)stylepart; const TAknsItemID skinId = m_partMap[stylepartIndex].skinID; @@ -563,6 +564,13 @@ QColor QS60StyleModeSpecifics::colorValue(const TAknsItemID &colorGroup, int col return QColor(skinnedColor.Red(),skinnedColor.Green(),skinnedColor.Blue()); } +struct QAutoFbsBitmapHeapLock +{ + QAutoFbsBitmapHeapLock(CFbsBitmap* aBmp) : mBmp(aBmp) { mBmp->LockHeap(); } + ~QAutoFbsBitmapHeapLock() { mBmp->UnlockHeap(); } + CFbsBitmap* mBmp; +}; + QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, QImage::Format format) { Q_ASSERT(icon); @@ -589,13 +597,13 @@ QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask if (mask) { //checkAndUnCompressBitmap might set mask to NULL const TSize maskSize = icon->SizeInPixels(); const int maskBytesPerLine = CFbsBitmap::ScanLineLength(maskSize.iWidth, mask->DisplayMode()); - mask->LockHeap(); + // heap lock object required because QImage ctor might throw + QAutoFbsBitmapHeapLock maskHeapLock(mask); const uchar *const maskBytes = (uchar *)mask->DataAddress(); // Since no other bitmap should be locked, we can just "borrow" the mask data for setAlphaChannel const QImage maskImage(maskBytes, maskSize.iWidth, maskSize.iHeight, maskBytesPerLine, QImage::Format_Indexed8); if (!maskImage.isNull()) iconImage.setAlphaChannel(maskImage); - mask->UnlockHeap(); } } @@ -631,10 +639,11 @@ QPoint qt_s60_fill_background_offset(const QWidget *targetWidget) return QPoint(globalPos.iX, globalPos.iY); } -QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL( +QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX( QS60StyleEnums::SkinParts part, const QSize &size, QS60StylePrivate::SkinElementFlags flags) { + // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts. if (!size.isValid()) return QPixmap(); @@ -712,9 +721,10 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL( return result; } -QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL(QS60StylePrivate::SkinFrameElements frameElement, +QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFrameElements frameElement, const QSize &size, QS60StylePrivate::SkinElementFlags flags) { + // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts. if (!size.isValid()) return QPixmap(); @@ -892,7 +902,10 @@ void QS60StyleModeSpecifics::checkAndUnCompressBitmap(CFbsBitmap*& aOriginalBitm void QS60StyleModeSpecifics::checkAndUnCompressBitmapL(CFbsBitmap*& aOriginalBitmap) { - if (aOriginalBitmap->IsCompressedInRAM()) { + const TSize iconSize = aOriginalBitmap->SizeInPixels(); + const int iconBytesPerLine = CFbsBitmap::ScanLineLength(iconSize.iWidth, aOriginalBitmap->DisplayMode()); + const int iconBytesCount = iconBytesPerLine * iconSize.iHeight; + if (aOriginalBitmap->IsCompressedInRAM() || aOriginalBitmap->Header().iBitmapSize < iconBytesCount) { const TSize iconSize(aOriginalBitmap->SizeInPixels().iWidth, aOriginalBitmap->SizeInPixels().iHeight); CFbsBitmap* uncompressedBitmap = new (ELeave) CFbsBitmap(); @@ -941,7 +954,7 @@ QFont QS60StylePrivate::s60Font_specific( } QFont result; - TRAPD( error, { + TRAPD( error, QT_TRYCATCH_LEAVING({ const CAknLayoutFont* aknFont = AknFontAccess::CreateLayoutFontFromSpecificationL(*dev, spec); @@ -950,7 +963,7 @@ QFont QS60StylePrivate::s60Font_specific( result.setPointSize(pointSize); // Correct the font size returned by CreateLayoutFontFromSpecificationL() delete aknFont; - }); + })); if (error) result = QFont(); return result; } @@ -1178,7 +1191,9 @@ void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap User::Leave(KErrArgument); // Note! aSrcBitmap->IsCompressedInRAM() is always ETrue, since this method is called only if that applies! - ASSERT(aSrcBitmap->IsCompressedInRAM()); + // Extra note! this function is also being used when bitmaps appear to be compressed (because DataSize is too small) + // even when they pretend they are not. Assert removed. +// ASSERT(aSrcBitmap->IsCompressedInRAM()); TDisplayMode displayMode = aSrcBitmap->DisplayMode(); diff --git a/src/gui/styles/qstyle.h b/src/gui/styles/qstyle.h index f22bf55..68d4734 100644 --- a/src/gui/styles/qstyle.h +++ b/src/gui/styles/qstyle.h @@ -68,7 +68,7 @@ class QStylePrivate; class Q_GUI_EXPORT QStyle : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QStyle) + Q_DECLARE_SCOPED_PRIVATE(QStyle) protected: QStyle(QStylePrivate &dd); diff --git a/src/gui/styles/qstylesheetstyle_p.h b/src/gui/styles/qstylesheetstyle_p.h index 9b7b79d..399e449 100644 --- a/src/gui/styles/qstylesheetstyle_p.h +++ b/src/gui/styles/qstylesheetstyle_p.h @@ -182,7 +182,7 @@ public: private: Q_DISABLE_COPY(QStyleSheetStyle) - Q_DECLARE_PRIVATE(QStyleSheetStyle) + Q_DECLARE_SCOPED_PRIVATE(QStyleSheetStyle) }; diff --git a/src/gui/styles/qwindowsmobilestyle.h b/src/gui/styles/qwindowsmobilestyle.h index ab32e8e..9892dec 100644 --- a/src/gui/styles/qwindowsmobilestyle.h +++ b/src/gui/styles/qwindowsmobilestyle.h @@ -104,7 +104,7 @@ protected: QWindowsMobileStyle(QWindowsMobileStylePrivate &dd); private: - Q_DECLARE_PRIVATE(QWindowsMobileStyle) + Q_DECLARE_SCOPED_PRIVATE(QWindowsMobileStyle) }; #endif // QT_NO_STYLE_WINDOWSMOBILE diff --git a/src/gui/styles/qwindowsstyle.h b/src/gui/styles/qwindowsstyle.h index c169a84..45260e8 100644 --- a/src/gui/styles/qwindowsstyle.h +++ b/src/gui/styles/qwindowsstyle.h @@ -98,7 +98,7 @@ protected: private: Q_DISABLE_COPY(QWindowsStyle) - Q_DECLARE_PRIVATE(QWindowsStyle) + Q_DECLARE_SCOPED_PRIVATE(QWindowsStyle) void *reserved; }; diff --git a/src/gui/styles/qwindowsvistastyle.h b/src/gui/styles/qwindowsvistastyle.h index 97b1e74..60cd7a5 100644 --- a/src/gui/styles/qwindowsvistastyle.h +++ b/src/gui/styles/qwindowsvistastyle.h @@ -96,7 +96,7 @@ protected Q_SLOTS: private: Q_DISABLE_COPY(QWindowsVistaStyle) - Q_DECLARE_PRIVATE(QWindowsVistaStyle) + Q_DECLARE_SCOPED_PRIVATE(QWindowsVistaStyle) friend class QStyleFactory; }; #endif //QT_NO_STYLE_WINDOWSVISTA diff --git a/src/gui/styles/qwindowsxpstyle.h b/src/gui/styles/qwindowsxpstyle.h index ab26f56..21e24ff 100644 --- a/src/gui/styles/qwindowsxpstyle.h +++ b/src/gui/styles/qwindowsxpstyle.h @@ -93,7 +93,7 @@ protected Q_SLOTS: private: Q_DISABLE_COPY(QWindowsXPStyle) - Q_DECLARE_PRIVATE(QWindowsXPStyle) + Q_DECLARE_SCOPED_PRIVATE(QWindowsXPStyle) friend class QStyleFactory; void *reserved; }; diff --git a/src/gui/text/qabstractfontengine_qws.h b/src/gui/text/qabstractfontengine_qws.h index e6be611..8403f87 100644 --- a/src/gui/text/qabstractfontengine_qws.h +++ b/src/gui/text/qabstractfontengine_qws.h @@ -118,7 +118,7 @@ public: virtual QList<QFontEngineInfo> availableFontEngines() const = 0; private: - Q_DECLARE_PRIVATE(QFontEnginePlugin) + Q_DECLARE_SCOPED_PRIVATE(QFontEnginePlugin) Q_DISABLE_COPY(QFontEnginePlugin) }; @@ -207,7 +207,7 @@ public: */ private: - Q_DECLARE_PRIVATE(QAbstractFontEngine) + Q_DECLARE_SCOPED_PRIVATE(QAbstractFontEngine) Q_DISABLE_COPY(QAbstractFontEngine) }; diff --git a/src/gui/text/qabstracttextdocumentlayout.h b/src/gui/text/qabstracttextdocumentlayout.h index 070c301..3681eec 100644 --- a/src/gui/text/qabstracttextdocumentlayout.h +++ b/src/gui/text/qabstracttextdocumentlayout.h @@ -62,7 +62,7 @@ class QTextFrame; class Q_GUI_EXPORT QAbstractTextDocumentLayout : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QAbstractTextDocumentLayout) + Q_DECLARE_SCOPED_PRIVATE(QAbstractTextDocumentLayout) public: explicit QAbstractTextDocumentLayout(QTextDocument *doc); diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 844c3f9..d33cdf0 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -226,7 +226,9 @@ struct QtFontStyle delete [] setwidthName; #endif #if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) - while (count--) { + while (count) { + // bitfield count-- in while condition does not work correctly in mwccsym2 + count--; #ifdef Q_WS_X11 free(pixelSizes[count].encodings); #endif diff --git a/src/gui/text/qfontdatabase_qws.cpp b/src/gui/text/qfontdatabase_qws.cpp index 0407508..d731d21 100644 --- a/src/gui/text/qfontdatabase_qws.cpp +++ b/src/gui/text/qfontdatabase_qws.cpp @@ -762,21 +762,21 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, if (!privateDb()->count) initializeDb(); - QFontEngine *fe = 0; + QScopedPointer<QFontEngine> fe; if (fp) { if (fp->rawMode) { - fe = loadEngine(script, fp, request, 0, 0, 0, 0 - ); + fe.reset(loadEngine(script, fp, request, 0, 0, 0, 0)); // if we fail to load the rawmode font, use a 12pixel box engine instead - if (! fe) fe = new QFontEngineBox(12); - return fe; + if (fe.isNull()) + fe.reset(new QFontEngineBox(12)); + return fe.take(); } QFontCache::Key key(request, script); - fe = QFontCache::instance()->findEngine(key); - if (fe) - return fe; + fe.reset(QFontCache::instance()->findEngine(key)); + if (! fe.isNull()) + return fe.take(); } QString family_name, foundry_name; @@ -800,11 +800,11 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, script, request.weight, request.style, request.stretch, request.pixelSize, pitch); if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) { - fe = new QTestFontEngine(request.pixelSize); + fe.reset(new QTestFontEngine(request.pixelSize)); fe->fontDef = request; } - if (!fe) + if (fe.isNull()) { QtFontDesc desc; match(script, request, family_name, foundry_name, force_encoding_id, &desc); @@ -825,16 +825,28 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, 'p', 0 ); - fe = loadEngine(script, fp, request, desc.family, desc.foundry, desc.style, desc.size - ); + fe.reset(loadEngine(script, fp, request, desc.family, desc.foundry, desc.style, desc.size + )); } else { FM_DEBUG(" NO MATCH FOUND\n"); } - if (fe) + if (! fe.isNull()) initFontDef(desc, request, &fe->fontDef); } - if (fe) { +#ifndef QT_NO_FREETYPE + if (! fe.isNull()) { + if (scriptRequiresOpenType(script) && fe->type() == QFontEngine::Freetype) { + HB_Face hbFace = static_cast<QFontEngineFT *>(fe.data())->harfbuzzFace(); + if (!hbFace || !hbFace->supported_scripts[script]) { + FM_DEBUG(" OpenType support missing for script\n"); + fe.reset(0); + } + } + } +#endif + + if (! fe.isNull()) { if (fp) { QFontDef def = request; if (def.family.isEmpty()) { @@ -842,32 +854,21 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, def.family = def.family.left(def.family.indexOf(QLatin1Char(','))); } QFontCache::Key key(def, script); - QFontCache::instance()->insertEngine(key, fe); - } - -#ifndef QT_NO_FREETYPE - if (scriptRequiresOpenType(script) && fe->type() == QFontEngine::Freetype) { - HB_Face hbFace = static_cast<QFontEngineFT *>(fe)->harfbuzzFace(); - if (!hbFace || !hbFace->supported_scripts[script]) { - FM_DEBUG(" OpenType support missing for script\n"); - delete fe; - fe = 0; - } + QFontCache::instance()->insertEngine(key, fe.data()); } -#endif } - if (!fe) { + if (fe.isNull()) { if (!request.family.isEmpty()) return 0; FM_DEBUG("returning box engine"); - fe = new QFontEngineBox(request.pixelSize); + fe.reset(new QFontEngineBox(request.pixelSize)); if (fp) { QFontCache::Key key(request, script); - QFontCache::instance()->insertEngine(key, fe); + QFontCache::instance()->insertEngine(key, fe.data()); } } @@ -877,7 +878,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, fe->fontDef.pointSize = request.pointSize; } - return fe; + return fe.take(); } void QFontDatabase::load(const QFontPrivate *d, int script) @@ -898,7 +899,13 @@ void QFontDatabase::load(const QFontPrivate *d, int script) if (!d->engineData) { // create a new one d->engineData = new QFontEngineData; - QFontCache::instance()->insertEngineData(key, d->engineData); + QT_TRY { + QFontCache::instance()->insertEngineData(key, d->engineData); + } QT_CATCH(...) { + delete d->engineData; + d->engineData = 0; + QT_RETHROW; + } } else { d->engineData->ref.ref(); } @@ -907,8 +914,6 @@ void QFontDatabase::load(const QFontPrivate *d, int script) // the cached engineData could have already loaded the engine we want if (d->engineData->engines[script]) return; - // load the font - QFontEngine *engine = 0; // double scale = 1.0; // ### TODO: fix the scale calculations // list of families to try @@ -940,20 +945,15 @@ void QFontDatabase::load(const QFontPrivate *d, int script) // null family means find the first font matching the specified script family_list << QString(); + // load the font + QFontEngine *engine = 0; QStringList::ConstIterator it = family_list.constBegin(), end = family_list.constEnd(); - for (; ! engine && it != end; ++it) { + for (; !engine && it != end; ++it) { req.family = *it; engine = QFontDatabase::findFont(script, d, req); - if (engine) { - if (engine->type() != QFontEngine::Box) - break; - - if (! req.family.isEmpty()) - engine = 0; - - continue; - } + if (engine && (engine->type()==QFontEngine::Box) && !req.family.isEmpty()) + engine = 0; } engine->ref.ref(); diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 416c3d1..8176009 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -69,7 +69,7 @@ QFileInfoList alternativeFilePaths(const QString &path, const QStringList &nameF const QString zDriveString("Z:/"); driveStrings.removeAll(zDriveString); driveStrings.prepend(zDriveString); - + QStringList uniqueFileNameList; for (int i = driveStrings.count() - 1; i >= 0; --i) { const QDir dirOnDrive(driveStrings.at(i) + path); @@ -107,9 +107,12 @@ private: QFontDatabaseS60StoreImplementation::QFontDatabaseS60StoreImplementation() { m_heap = User::ChunkHeap(NULL, 0x1000, 0x100000); - m_store = CFontStore::NewL(m_heap); - m_rasterizer = COpenFontRasterizer::NewL(TUid::Uid(0x101F7F5E)); - m_store->InstallRasterizerL(m_rasterizer); + QT_TRAP_THROWING( + m_store = CFontStore::NewL(m_heap); + m_rasterizer = COpenFontRasterizer::NewL(TUid::Uid(0x101F7F5E)); + CleanupStack::PushL(m_rasterizer); + m_store->InstallRasterizerL(m_rasterizer); + CleanupStack::Pop(m_rasterizer);); QStringList filters; filters.append(QString::fromLatin1("*.ttf")); @@ -117,14 +120,14 @@ QFontDatabaseS60StoreImplementation::QFontDatabaseS60StoreImplementation() const QFileInfoList fontFiles = alternativeFilePaths(QString::fromLatin1("resource\\Fonts"), filters); foreach (const QFileInfo &fontFileInfo, fontFiles) { const QString fontFile = QDir::toNativeSeparators(fontFileInfo.absoluteFilePath()); - m_store->AddFileL(qt_QString2TPtrC(fontFile)); + TPtrC fontFilePtr(qt_QString2TPtrC(fontFile)); + QT_TRAP_THROWING(m_store->AddFileL(fontFilePtr)); } } QFontDatabaseS60StoreImplementation::~QFontDatabaseS60StoreImplementation() { qDeleteAll(m_extensions); - delete m_rasterizer; - delete m_store; + // TODO m_store cleanup removed because it was crashing m_heap->Close(); } @@ -218,7 +221,7 @@ static void initializeDb() QS60Data::screenDevice()->TypefaceSupport(typefaceSupport, i); CFont *font; // We have to get a font instance in order to know all the details TFontSpec fontSpec(typefaceSupport.iTypeface.iName, 11); - QS60Data::screenDevice()->GetNearestFontInPixels(font, fontSpec); + qt_throwIfError(QS60Data::screenDevice()->GetNearestFontInPixels(font, fontSpec)); if (font->TypeUid() == KCFbsFontUid) { TOpenFontFaceAttrib faceAttrib; const CFbsFont *cfbsFont = dynamic_cast<const CFbsFont *>(font); @@ -390,7 +393,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script) { QFontEngine *fe = 0; QFontDef req = d->request; - + if (!d->engineData) { const QFontCache::Key key(cleanedFontDef(req), script); getEngineData(d, key); diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 730137e..794fd79 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -236,8 +236,10 @@ HB_Font QFontEngine::harfbuzzFont() const HB_Face QFontEngine::harfbuzzFace() const { - if (!hbFace) + if (!hbFace) { hbFace = qHBNewFace(const_cast<QFontEngine *>(this), hb_getSFntTable); + Q_CHECK_PTR(hbFace); + } return hbFace; } diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 499d28c..4c4438a 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -205,7 +205,9 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id) FT_Init_FreeType(&freetypeData->library); QFreetypeFace *freetype = freetypeData->faces.value(face_id, 0); - if (!freetype) { + if (freetype) { + freetype->ref.ref(); + } else { QScopedPointer<QFreetypeFace> newFreetype(new QFreetypeFace); FT_Face face; QFile file(QString::fromUtf8(face_id.filename)); @@ -234,7 +236,8 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id) newFreetype->face = face; newFreetype->hbFace = qHBNewFace(face, hb_getSFntTable); - newFreetype->ref = 0; + Q_CHECK_PTR(newFreetype->hbFace); + newFreetype->ref = 1; newFreetype->xsize = 0; newFreetype->ysize = 0; newFreetype->matrix.xx = 0x10000; @@ -289,10 +292,15 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id) #endif FT_Set_Charmap(newFreetype->face, newFreetype->unicode_map); - freetypeData->faces.insert(face_id, newFreetype.data()); + QT_TRY { + freetypeData->faces.insert(face_id, newFreetype.data()); + } QT_CATCH(...) { + newFreetype.take()->release(face_id); + // we could return null in principle instead of throwing + QT_RETHROW; + } freetype = newFreetype.take(); } - freetype->ref.ref(); return freetype; } @@ -306,7 +314,8 @@ void QFreetypeFace::release(const QFontEngine::FaceId &face_id) if (charset) FcCharSetDestroy(charset); #endif - freetypeData->faces.take(face_id); + if(freetypeData->faces.contains(face_id)) + freetypeData->faces.take(face_id); delete this; } if (freetypeData->faces.isEmpty()) { diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index aa1cd0a..0572e92 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -119,7 +119,7 @@ struct QFreetypeFace static void addBitmapToPath(FT_GlyphSlot slot, const QFixedPoint &point, QPainterPath *path, bool = false); private: - friend class QScopedPointer<QFreetypeFace>; + friend class QScopedPointerDeleter<QFreetypeFace>; QFreetypeFace() : _lock(QMutex::Recursive) {} ~QFreetypeFace() {} QAtomicInt ref; diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index f485afb..d1e591e 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -130,11 +130,11 @@ QFontEngineS60::QFontEngineS60(const QFontDef &request, const QFontEngineS60Exte m_fontSizeInPixels = (request.pixelSize >= 0)? request.pixelSize:pointsToPixels(request.pointSize); QS60WindowSurface::unlockBitmapHeap(); - m_textRenderBitmap = new (ELeave) CFbsBitmap(); + m_textRenderBitmap = q_check_ptr(new CFbsBitmap()); // CBase derived object needs check on new const TSize bitmapSize(1, 1); // It is just a dummy bitmap that I need to keep the font alive (or maybe not) - User::LeaveIfError(m_textRenderBitmap->Create(bitmapSize, EGray256)); - m_textRenderBitmapDevice = CFbsBitmapDevice::NewL(m_textRenderBitmap); - User::LeaveIfError(m_textRenderBitmapDevice->CreateContext(m_textRenderBitmapGc)); + qt_throwIfError(m_textRenderBitmap->Create(bitmapSize, EGray256)); + QT_TRAP_THROWING(m_textRenderBitmapDevice = CFbsBitmapDevice::NewL(m_textRenderBitmap)); + qt_throwIfError(m_textRenderBitmapDevice->CreateContext(m_textRenderBitmapGc)); cache_cost = sizeof(QFontEngineS60) + bitmapSize.iHeight * bitmapSize.iWidth * 4; TFontSpec fontSpec(qt_QString2TPtrC(request.family), m_fontSizeInPixels); diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index c6717e3..c42326f 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -390,7 +390,7 @@ bool QFontEngineWin::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph unsigned int glyph = glyphs->glyphs[glyph_pos]; if(int(glyph) >= designAdvancesSize) { int newSize = (glyph + 256) >> 8 << 8; - designAdvances = (QFixed *)realloc(designAdvances, newSize*sizeof(QFixed)); + designAdvances = q_check_ptr((QFixed *)realloc(designAdvances, newSize*sizeof(QFixed))); for(int i = designAdvancesSize; i < newSize; ++i) designAdvances[i] = -1000000; designAdvancesSize = newSize; @@ -423,7 +423,8 @@ bool QFontEngineWin::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph if (glyph >= widthCacheSize) { int newSize = (glyph + 256) >> 8 << 8; - widthCache = (unsigned char *)realloc(widthCache, newSize*sizeof(QFixed)); + widthCache = q_check_ptr((unsigned char *)realloc(widthCache, + newSize*sizeof(QFixed))); memset(widthCache + widthCacheSize, 0, newSize - widthCacheSize); widthCacheSize = newSize; } @@ -463,7 +464,8 @@ void QFontEngineWin::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla unsigned int glyph = glyphs->glyphs[i]; if(int(glyph) >= designAdvancesSize) { int newSize = (glyph + 256) >> 8 << 8; - designAdvances = (QFixed *)realloc(designAdvances, newSize*sizeof(QFixed)); + designAdvances = q_check_ptr((QFixed *)realloc(designAdvances, + newSize*sizeof(QFixed))); for(int i = designAdvancesSize; i < newSize; ++i) designAdvances[i] = -1000000; designAdvancesSize = newSize; @@ -490,7 +492,8 @@ void QFontEngineWin::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla if (glyph >= widthCacheSize) { int newSize = (glyph + 256) >> 8 << 8; - widthCache = (unsigned char *)realloc(widthCache, newSize*sizeof(QFixed)); + widthCache = q_check_ptr((unsigned char *)realloc(widthCache, + newSize*sizeof(QFixed))); memset(widthCache + widthCacheSize, 0, newSize - widthCacheSize); widthCacheSize = newSize; } diff --git a/src/gui/text/qfragmentmap_p.h b/src/gui/text/qfragmentmap_p.h index c2ba2b4..9c2a673 100644 --- a/src/gui/text/qfragmentmap_p.h +++ b/src/gui/text/qfragmentmap_p.h @@ -222,13 +222,19 @@ QFragmentMapData<Fragment>::QFragmentMapData() template <class Fragment> void QFragmentMapData<Fragment>::init() { - fragments = (Fragment *)malloc(64*fragmentSize); + // the following code will realloc an existing fragment or create a new one. + // it will also ignore errors when shrinking an existing fragment. + Fragment *newFragments = (Fragment *)realloc(fragments, 64*fragmentSize); + if (newFragments) { + fragments = newFragments; + head->allocated = 64; + } Q_CHECK_PTR(fragments); + head->tag = (((quint32)'p') << 24) | (((quint32)'m') << 16) | (((quint32)'a') << 8) | 'p'; //TAG('p', 'm', 'a', 'p'); head->root = 0; head->freelist = 1; head->node_count = 0; - head->allocated = 64; // mark all items to the right as unused F(head->freelist).right = 0; } @@ -236,7 +242,7 @@ void QFragmentMapData<Fragment>::init() template <class Fragment> QFragmentMapData<Fragment>::~QFragmentMapData() { - free(head); + free(fragments); } template <class Fragment> @@ -800,7 +806,6 @@ public: inline void clear() { for (Iterator it = begin(); !it.atEnd(); ++it) it.value()->free(); - ::free(data.head); data.init(); } diff --git a/src/gui/text/qsyntaxhighlighter.h b/src/gui/text/qsyntaxhighlighter.h index ee249b8..bfbb533 100644 --- a/src/gui/text/qsyntaxhighlighter.h +++ b/src/gui/text/qsyntaxhighlighter.h @@ -66,7 +66,7 @@ class QTextEdit; class Q_GUI_EXPORT QSyntaxHighlighter : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QSyntaxHighlighter) + Q_DECLARE_SCOPED_PRIVATE(QSyntaxHighlighter) public: QSyntaxHighlighter(QObject *parent); QSyntaxHighlighter(QTextDocument *parent); diff --git a/src/gui/text/qtextcontrol_p.h b/src/gui/text/qtextcontrol_p.h index eb0d749..59693ac 100644 --- a/src/gui/text/qtextcontrol_p.h +++ b/src/gui/text/qtextcontrol_p.h @@ -86,7 +86,7 @@ class QTimerEvent; class Q_GUI_EXPORT QTextControl : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QTextControl) + Q_DECLARE_SCOPED_PRIVATE(QTextControl) #ifndef QT_NO_TEXTHTMLPARSER Q_PROPERTY(QString html READ toHtml WRITE setHtml NOTIFY textChanged USER true) #endif diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h index 40b6621..cfbb558 100644 --- a/src/gui/text/qtextdocument.h +++ b/src/gui/text/qtextdocument.h @@ -286,7 +286,7 @@ public: QTextDocumentPrivate *docHandle() const; private: Q_DISABLE_COPY(QTextDocument) - Q_DECLARE_PRIVATE(QTextDocument) + Q_DECLARE_SCOPED_PRIVATE(QTextDocument) friend class QTextObjectPrivate; }; diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index e66b07c..88afe4a 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -188,6 +188,7 @@ QTextDocumentPrivate::QTextDocumentPrivate() docChangeOldLength(0), docChangeLength(0), framesDirty(true), + rtFrame(0), initialBlockCharFormatIndex(-1) // set correctly later in init() { editBlock = 0; @@ -218,7 +219,6 @@ QTextDocumentPrivate::QTextDocumentPrivate() void QTextDocumentPrivate::init() { - rtFrame = 0; framesDirty = false; bool undoState = undoEnabled; @@ -241,42 +241,48 @@ void QTextDocumentPrivate::clear() } QList<QTextCursorPrivate *>oldCursors = cursors; - cursors.clear(); - changedCursors.clear(); - - QMap<int, QTextObject *>::Iterator objectIt = objects.begin(); - while (objectIt != objects.end()) { - if (*objectIt != rtFrame) { - delete *objectIt; - objectIt = objects.erase(objectIt); - } else { - ++objectIt; + QT_TRY{ + cursors.clear(); + changedCursors.clear(); + + QMap<int, QTextObject *>::Iterator objectIt = objects.begin(); + while (objectIt != objects.end()) { + if (*objectIt != rtFrame) { + delete *objectIt; + objectIt = objects.erase(objectIt); + } else { + ++objectIt; + } } - } - // also clear out the remaining root frame pointer - // (we're going to delete the object further down) - objects.clear(); + // also clear out the remaining root frame pointer + // (we're going to delete the object further down) + objects.clear(); - title.clear(); - undoState = 0; - truncateUndoStack(); - text = QString(); - unreachableCharacterCount = 0; - modifiedState = 0; - modified = false; - formats = QTextFormatCollection(); - int len = fragments.length(); - fragments.clear(); - blocks.clear(); - cachedResources.clear(); - delete rtFrame; - init(); - cursors = oldCursors; - inContentsChange = true; - q->contentsChange(0, len, 0); - inContentsChange = false; - if (lout) - lout->documentChanged(0, len, 0); + title.clear(); + undoState = 0; + truncateUndoStack(); + text = QString(); + unreachableCharacterCount = 0; + modifiedState = 0; + modified = false; + formats = QTextFormatCollection(); + int len = fragments.length(); + fragments.clear(); + blocks.clear(); + cachedResources.clear(); + delete rtFrame; + rtFrame = 0; + init(); + cursors = oldCursors; + inContentsChange = true; + q->contentsChange(0, len, 0); + inContentsChange = false; + if (lout) + lout->documentChanged(0, len, 0); + } QT_CATCH(...) { + cursors = oldCursors; // at least recover the cursors + QT_RETHROW; + } } QTextDocumentPrivate::~QTextDocumentPrivate() diff --git a/src/gui/text/qtextdocumentlayout_p.h b/src/gui/text/qtextdocumentlayout_p.h index 41507b0..4dc18d0 100644 --- a/src/gui/text/qtextdocumentlayout_p.h +++ b/src/gui/text/qtextdocumentlayout_p.h @@ -65,7 +65,7 @@ class QTextDocumentLayoutPrivate; class Q_AUTOTEST_EXPORT QTextDocumentLayout : public QAbstractTextDocumentLayout { - Q_DECLARE_PRIVATE(QTextDocumentLayout) + Q_DECLARE_SCOPED_PRIVATE(QTextDocumentLayout) Q_OBJECT Q_PROPERTY(int cursorWidth READ cursorWidth WRITE setCursorWidth) Q_PROPERTY(qreal idealWidth READ idealWidth) diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index a3dd83e..7f82365 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -3041,12 +3041,18 @@ int QTextFormatCollection::indexForFormat(const QTextFormat &format) int idx = formats.size(); formats.append(format); - QTextFormat &f = formats.last(); - if (!f.d) - f.d = new QTextFormatPrivate; - f.d->resolveFont(defaultFnt); + QT_TRY{ + QTextFormat &f = formats.last(); + if (!f.d) + f.d = new QTextFormatPrivate; + f.d->resolveFont(defaultFnt); - hashes.insert(hash); + hashes.insert(hash); + + } QT_CATCH(...) { + formats.pop_back(); + QT_RETHROW; + } return idx; } diff --git a/src/gui/text/qtextlist.h b/src/gui/text/qtextlist.h index 04f1838..3d07be8 100644 --- a/src/gui/text/qtextlist.h +++ b/src/gui/text/qtextlist.h @@ -81,7 +81,7 @@ public: private: Q_DISABLE_COPY(QTextList) - Q_DECLARE_PRIVATE(QTextList) + Q_DECLARE_SCOPED_PRIVATE(QTextList) }; inline void QTextList::setFormat(const QTextListFormat &aformat) diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h index 4f239b2..f22f77c 100644 --- a/src/gui/text/qtextobject.h +++ b/src/gui/text/qtextobject.h @@ -84,7 +84,7 @@ protected: QTextObject(QTextObjectPrivate &p, QTextDocument *doc); private: - Q_DECLARE_PRIVATE(QTextObject) + Q_DECLARE_SCOPED_PRIVATE(QTextObject) Q_DISABLE_COPY(QTextObject) friend class QTextDocumentPrivate; }; @@ -107,7 +107,7 @@ protected: protected: QTextBlockGroup(QTextBlockGroupPrivate &p, QTextDocument *doc); private: - Q_DECLARE_PRIVATE(QTextBlockGroup) + Q_DECLARE_SCOPED_PRIVATE(QTextBlockGroup) Q_DISABLE_COPY(QTextBlockGroup) friend class QTextDocumentPrivate; }; @@ -182,7 +182,7 @@ protected: QTextFrame(QTextFramePrivate &p, QTextDocument *doc); private: friend class QTextDocumentPrivate; - Q_DECLARE_PRIVATE(QTextFrame) + Q_DECLARE_SCOPED_PRIVATE(QTextFrame) Q_DISABLE_COPY(QTextFrame) }; Q_DECLARE_TYPEINFO(QTextFrame::iterator, Q_MOVABLE_TYPE); diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp index 11ea2a7..160eb35 100644 --- a/src/gui/text/qtexttable.cpp +++ b/src/gui/text/qtexttable.cpp @@ -446,9 +446,7 @@ void QTextTablePrivate::update() const nRows = (cells.size() + nCols-1)/nCols; // qDebug(">>>> QTextTablePrivate::update, nRows=%d, nCols=%d", nRows, nCols); - int* newGrid = (int *)realloc(grid, nRows*nCols*sizeof(int)); - Q_CHECK_PTR(newGrid); - grid = newGrid; + grid = q_check_ptr((int *)realloc(grid, nRows*nCols*sizeof(int))); memset(grid, 0, nRows*nCols*sizeof(int)); QTextDocumentPrivate *p = pieceTable; @@ -472,9 +470,7 @@ void QTextTablePrivate::update() const cellIndices[i] = cell; if (r + rowspan > nRows) { - newGrid = (int *)realloc(grid, sizeof(int)*(r + rowspan)*nCols); - Q_CHECK_PTR(newGrid); - grid = newGrid; + grid = q_check_ptr((int *)realloc(grid, sizeof(int)*(r + rowspan)*nCols)); memset(grid + (nRows*nCols), 0, sizeof(int)*(r+rowspan-nRows)*nCols); nRows = r + rowspan; } diff --git a/src/gui/text/qtexttable.h b/src/gui/text/qtexttable.h index 612c71c..2deb3fa 100644 --- a/src/gui/text/qtexttable.h +++ b/src/gui/text/qtexttable.h @@ -134,7 +134,7 @@ public: private: Q_DISABLE_COPY(QTextTable) - Q_DECLARE_PRIVATE(QTextTable) + Q_DECLARE_SCOPED_PRIVATE(QTextTable) friend class QTextTableCell; }; diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index b823100..80678aa 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -158,7 +158,7 @@ QT_BEGIN_NAMESPACE QCompletionModel::QCompletionModel(QCompleterPrivate *c, QObject *parent) : QAbstractProxyModel(*new QCompletionModelPrivate, parent), - c(c), engine(0), showAll(false) + c(c), showAll(false) { createEngine(); } @@ -208,11 +208,10 @@ void QCompletionModel::createEngine() break; } - delete engine; if (sortedEngine) - engine = new QSortedModelEngine(c); + engine.reset(new QSortedModelEngine(c)); else - engine = new QUnsortedModelEngine(c); + engine.reset(new QUnsortedModelEngine(c)); } QModelIndex QCompletionModel::mapToSource(const QModelIndex& index) const diff --git a/src/gui/util/qcompleter.h b/src/gui/util/qcompleter.h index a419154..ac8c0c6 100644 --- a/src/gui/util/qcompleter.h +++ b/src/gui/util/qcompleter.h @@ -154,7 +154,7 @@ Q_SIGNALS: private: Q_DISABLE_COPY(QCompleter) - Q_DECLARE_PRIVATE(QCompleter) + Q_DECLARE_SCOPED_PRIVATE(QCompleter) Q_PRIVATE_SLOT(d_func(), void _q_complete(QModelIndex)) Q_PRIVATE_SLOT(d_func(), void _q_completionSelected(const QItemSelection&)) diff --git a/src/gui/util/qcompleter_p.h b/src/gui/util/qcompleter_p.h index 288f531..745afff 100644 --- a/src/gui/util/qcompleter_p.h +++ b/src/gui/util/qcompleter_p.h @@ -214,7 +214,6 @@ class QCompletionModel : public QAbstractProxyModel public: QCompletionModel(QCompleterPrivate *c, QObject *parent); - ~QCompletionModel() { delete engine; } void createEngine(); void setFiltered(bool); @@ -237,10 +236,10 @@ public: QModelIndex mapFromSource(const QModelIndex& sourceIndex) const; QCompleterPrivate *c; - QCompletionEngine *engine; + QScopedPointer<QCompletionEngine> engine; bool showAll; - Q_DECLARE_PRIVATE(QCompletionModel) + Q_DECLARE_SCOPED_PRIVATE(QCompletionModel) signals: void rowsAdded(); diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index eb2d92e..18a0a73 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -287,10 +287,10 @@ void QDesktopServices::unsetUrlHandler(const QString &scheme) \note The storage location returned can be a directory that does not exist; i.e., it may need to be created by the system or the user. - + \note On Symbian OS, DataLocation and ApplicationsLocation always point to appropriate folder on same drive with executable. FontsLocation always points to folder on ROM drive. - Rest of the standard locations point to folder on same drive with executable, except + Rest of the standard locations point to folder on same drive with executable, except that if executable is in ROM the folder from C drive is returned. \note On Mac OS X, DataLocation does not include QCoreApplication::organizationName. diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index 77cf254..565dd6e 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -74,8 +74,31 @@ _LIT(KBrowserPrefix, "4 " ); _LIT(KFontsDir, "z:\\resource\\Fonts\\"); const TUid KUidBrowser = { 0x10008D39 }; -static void handleMailtoSchemeL(const QUrl &url) +template<class R> +class QAutoClose { +public: + QAutoClose(R& aObj) : mPtr(&aObj) {} + ~QAutoClose() + { + if (mPtr) + mPtr->Close(); + } + void Forget() + { + mPtr = 0; + } +private: + QAutoClose(const QAutoClose&); + QAutoClose& operator=(const QAutoClose&); +private: + R* mPtr; +}; + +static void handleMailtoSchemeLX(const QUrl &url) +{ + // this function has many intermingled leaves and throws. Qt and Symbian objects do not have + // destructor dependencies, and cleanup object is used to prevent cleanup stack dependency on stack. QString recipient = url.path(); QString subject = url.queryItemValue("subject"); QString body = url.queryItemValue("body"); @@ -84,15 +107,15 @@ static void handleMailtoSchemeL(const QUrl &url) QString bcc = url.queryItemValue("bcc"); // these fields might have comma separated addresses - QStringList recipients = recipient.split(","); - QStringList tos = to.split(","); - QStringList ccs = cc.split(","); - QStringList bccs = bcc.split(","); + QStringList recipients = recipient.split(",", QString::SkipEmptyParts); + QStringList tos = to.split(",", QString::SkipEmptyParts); + QStringList ccs = cc.split(",", QString::SkipEmptyParts); + QStringList bccs = bcc.split(",", QString::SkipEmptyParts); - RSendAs sendAs; - User::LeaveIfError(sendAs.Connect()); - CleanupClosePushL(sendAs); + RSendAs sendAs; + User::LeaveIfError(sendAs.Connect()); + QAutoClose<RSendAs> sendAsCleanup(sendAs); CSendAsAccounts* accounts = CSendAsAccounts::NewL(); @@ -101,60 +124,57 @@ static void handleMailtoSchemeL(const QUrl &url) TInt count = accounts->Count(); CleanupStack::PopAndDestroy(accounts); - if(!count) { + if(!count) { // TODO: we should try to create account if count == 0 // CSendUi would provide account creation service for us, but it requires ridicilous // capabilities: LocalServices NetworkServices ReadDeviceData ReadUserData WriteDeviceData WriteUserData - User::Leave(KErrNotSupported); - } else { - RSendAsMessage sendAsMessage; + User::Leave(KErrNotSupported); + } else { + RSendAsMessage sendAsMessage; sendAsMessage.CreateL(sendAs, KUidMsgTypeSMTP); - CleanupClosePushL(sendAsMessage); - - + QAutoClose<RSendAsMessage> sendAsMessageCleanup(sendAsMessage); + + // Subject sendAsMessage.SetSubjectL(qt_QString2TPtrC(subject)); - + // Body sendAsMessage.SetBodyTextL(qt_QString2TPtrC(body)); - + // To foreach(QString item, recipients) sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientTo ); - + foreach(QString item, tos) sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientTo ); - + // Cc foreach(QString item, ccs) sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientCc ); - + // Bcc foreach(QString item, bccs) sendAsMessage.AddRecipientL(qt_QString2TPtrC(item), RSendAsMessage::ESendAsRecipientBcc ); - + // send the message sendAsMessage.LaunchEditorAndCloseL(); - - // sendAsMessage (already closed) - CleanupStack::Pop(); - } - // sendAs - CleanupStack::PopAndDestroy(); + // sendAsMessage is already closed + sendAsMessageCleanup.Forget(); + } } static bool handleMailtoScheme(const QUrl &url) { - TRAPD(err, handleMailtoSchemeL(url)); + TRAPD(err, QT_TRYCATCH_LEAVING(handleMailtoSchemeLX(url))); return err ? false : true; } static void handleOtherSchemesL(const TDesC& aUrl) { // Other schemes are at the moment passed to WEB browser - HBufC* buf16 = HBufC::NewLC( aUrl.Length() + KBrowserPrefix.iTypeLength ); - buf16->Des().Copy( KBrowserPrefix ); // Prefix used to launch correct browser view - buf16->Des().Append( aUrl ); + HBufC* buf16 = HBufC::NewLC( aUrl.Length() + KBrowserPrefix.iTypeLength ); + buf16->Des().Copy( KBrowserPrefix ); // Prefix used to launch correct browser view + buf16->Des().Append( aUrl ); TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); TApaTask task = taskList.FindApp( KUidBrowser ); @@ -169,12 +189,12 @@ static void handleOtherSchemesL(const TDesC& aUrl) else { // Start a new browser instance - RApaLsSession appArcSession; - User::LeaveIfError( appArcSession.Connect() ); - CleanupClosePushL<RApaLsSession>( appArcSession ); - TThreadId id; + RApaLsSession appArcSession; + User::LeaveIfError( appArcSession.Connect() ); + CleanupClosePushL<RApaLsSession>( appArcSession ); + TThreadId id; appArcSession.StartDocument( *buf16, KUidBrowser , id ); - CleanupStack::PopAndDestroy(); // appArcSession + CleanupStack::PopAndDestroy(); // appArcSession } CleanupStack::PopAndDestroy( buf16 ); @@ -182,7 +202,9 @@ static void handleOtherSchemesL(const TDesC& aUrl) static bool handleOtherSchemes(const QUrl &url) { - TRAPD( err, handleOtherSchemesL(qt_QString2TPtrC(url.toEncoded()))); + QString encUrl(url.toEncoded()); + TPtrC urlPtr(qt_QString2TPtrC(encUrl)); + TRAPD( err, handleOtherSchemesL(urlPtr)); return err ? false : true; } @@ -233,8 +255,8 @@ static void openDocumentL(const TDesC& aUrl) { #ifndef USE_DOCUMENTHANDLER // Start app associated to file MIME type by using RApaLsSession - // Apparc base method cannot be used to open app in embedded mode, - // but seems to be most stable way at the moment + // Apparc base method cannot be used to open app in embedded mode, + // but seems to be most stable way at the moment RApaLsSession appArcSession; User::LeaveIfError( appArcSession.Connect() ); CleanupClosePushL<RApaLsSession>( appArcSession ); @@ -242,25 +264,25 @@ static void openDocumentL(const TDesC& aUrl) // ESwitchFiles means do not start another instance // Leaves if file does not exist, leave is trapped in openDocument and false returned to user. User::LeaveIfError( appArcSession.StartDocument( aUrl, id, - RApaLsSession::ESwitchFiles ) ); // ELaunchNewApp + RApaLsSession::ESwitchFiles ) ); // ELaunchNewApp CleanupStack::PopAndDestroy(); // appArcSession #else // This is an alternative way to launch app associated to MIME type - // CDocumentHandler would support opening apps in embedded mode, - // but our Qt application window group seems to always get switched on top of embedded one - // -> Cannot use menus etc of embedded app -> used - - CDocumentHandler* docHandler = CDocumentHandler::NewLC(); - TDataType temp; - //Standalone file opening fails for some file-types at least in S60 3.1 emulator - //For example .txt file fails with KErrAlreadyInUse and music files with KERN-EXEC 0 - //Workaround is to use OpenFileEmbeddedL - //docHandler->OpenFileL(aUrl, temp); - - // Opening file with CDocumentHandler will leave if file does not exist - // Leave is trapped in openDocument and false returned to user. - docHandler->OpenFileEmbeddedL(aUrl, temp); - CleanupStack::PopAndDestroy(docHandler); + // CDocumentHandler would support opening apps in embedded mode, + // but our Qt application window group seems to always get switched on top of embedded one + // -> Cannot use menus etc of embedded app -> used + + CDocumentHandler* docHandler = CDocumentHandler::NewLC(); + TDataType temp; + //Standalone file opening fails for some file-types at least in S60 3.1 emulator + //For example .txt file fails with KErrAlreadyInUse and music files with KERN-EXEC 0 + //Workaround is to use OpenFileEmbeddedL + //docHandler->OpenFileL(aUrl, temp); + + // Opening file with CDocumentHandler will leave if file does not exist + // Leave is trapped in openDocument and false returned to user. + docHandler->OpenFileEmbeddedL(aUrl, temp); + CleanupStack::PopAndDestroy(docHandler); #endif } @@ -273,10 +295,12 @@ static void openDocumentL(const TDesC& aUrl) // wide range of schemes and is extensible by plugins static bool handleUrl(const QUrl &url) { - if (!url.isValid()) - return false; + if (!url.isValid()) + return false; - TRAPD( err, handleUrlL(qt_QString2TPtrC(url.toString()))); + QString urlString(url.toString()); + TPtrC urlPtr(qt_QString2TPtrC(urlString)); + TRAPD( err, handleUrlL(urlPtr)); return err ? false : true; } @@ -289,12 +313,12 @@ static void handleUrlL(const TDesC& aUrl) } static bool launchWebBrowser(const QUrl &url) { - return handleUrl(url); + return handleUrl(url); } static bool openDocument(const QUrl &file) { - return handleUrl(url); + return handleUrl(url); } #endif @@ -316,7 +340,8 @@ static bool openDocument(const QUrl &file) QString filePath = file.toLocalFile(); filePath = QDir::toNativeSeparators(filePath); - TRAPD(err, openDocumentL(qt_QString2TPtrC(filePath))); + TPtrC filePathPtr(qt_QString2TPtrC(filePath)); + TRAPD(err, openDocumentL(filePathPtr)); return err ? false : true; } @@ -366,7 +391,7 @@ QString QDesktopServices::storageLocation(StandardLocation type) //return QDir::homePath(); break; break; case DataLocation: - CEikonEnv::Static()->FsSession().PrivatePath( path ); + CEikonEnv::Static()->FsSession().PrivatePath( path ); // TODO: Should we actually return phone mem if data is on ROM? path.Insert( 0, exeDrive().Name() ); break; diff --git a/src/gui/util/qsystemtrayicon.h b/src/gui/util/qsystemtrayicon.h index 0f1e2d2..ac90487 100644 --- a/src/gui/util/qsystemtrayicon.h +++ b/src/gui/util/qsystemtrayicon.h @@ -117,7 +117,7 @@ protected: private: Q_DISABLE_COPY(QSystemTrayIcon) - Q_DECLARE_PRIVATE(QSystemTrayIcon) + Q_DECLARE_SCOPED_PRIVATE(QSystemTrayIcon) friend class QSystemTrayIconSys; friend class QBalloonTip; diff --git a/src/gui/util/qundogroup.h b/src/gui/util/qundogroup.h index ddab6e0..24d4e12 100644 --- a/src/gui/util/qundogroup.h +++ b/src/gui/util/qundogroup.h @@ -60,7 +60,7 @@ QT_MODULE(Gui) class Q_GUI_EXPORT QUndoGroup : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QUndoGroup) + Q_DECLARE_SCOPED_PRIVATE(QUndoGroup) public: explicit QUndoGroup(QObject *parent = 0); diff --git a/src/gui/util/qundostack.h b/src/gui/util/qundostack.h index 8efad0e..8ad4b198 100644 --- a/src/gui/util/qundostack.h +++ b/src/gui/util/qundostack.h @@ -90,7 +90,7 @@ private: class Q_GUI_EXPORT QUndoStack : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QUndoStack) + Q_DECLARE_SCOPED_PRIVATE(QUndoStack) Q_PROPERTY(bool active READ isActive WRITE setActive) Q_PROPERTY(int undoLimit READ undoLimit WRITE setUndoLimit) diff --git a/src/gui/util/qundoview.h b/src/gui/util/qundoview.h index fa0c163..293c0c2 100644 --- a/src/gui/util/qundoview.h +++ b/src/gui/util/qundoview.h @@ -61,7 +61,7 @@ QT_MODULE(Gui) class Q_GUI_EXPORT QUndoView : public QListView { Q_OBJECT - Q_DECLARE_PRIVATE(QUndoView) + Q_DECLARE_SCOPED_PRIVATE(QUndoView) Q_PROPERTY(QString emptyLabel READ emptyLabel WRITE setEmptyLabel) Q_PROPERTY(QIcon cleanIcon READ cleanIcon WRITE setCleanIcon) diff --git a/src/gui/widgets/qabstractbutton.h b/src/gui/widgets/qabstractbutton.h index 29e9bf9..9e33479 100644 --- a/src/gui/widgets/qabstractbutton.h +++ b/src/gui/widgets/qabstractbutton.h @@ -168,7 +168,7 @@ protected: QAbstractButton(QAbstractButtonPrivate &dd, QWidget* parent = 0); private: - Q_DECLARE_PRIVATE(QAbstractButton) + Q_DECLARE_SCOPED_PRIVATE(QAbstractButton) Q_DISABLE_COPY(QAbstractButton) friend class QButtonGroup; }; diff --git a/src/gui/widgets/qabstractscrollarea.h b/src/gui/widgets/qabstractscrollarea.h index 3ec41d1..9a7e844 100644 --- a/src/gui/widgets/qabstractscrollarea.h +++ b/src/gui/widgets/qabstractscrollarea.h @@ -123,7 +123,7 @@ protected: virtual void scrollContentsBy(int dx, int dy); private: - Q_DECLARE_PRIVATE(QAbstractScrollArea) + Q_DECLARE_SCOPED_PRIVATE(QAbstractScrollArea) Q_DISABLE_COPY(QAbstractScrollArea) Q_PRIVATE_SLOT(d_func(), void _q_hslide(int)) Q_PRIVATE_SLOT(d_func(), void _q_vslide(int)) diff --git a/src/gui/widgets/qabstractslider.h b/src/gui/widgets/qabstractslider.h index 7e03b6e..6517944 100644 --- a/src/gui/widgets/qabstractslider.h +++ b/src/gui/widgets/qabstractslider.h @@ -174,7 +174,7 @@ protected: private: Q_DISABLE_COPY(QAbstractSlider) - Q_DECLARE_PRIVATE(QAbstractSlider) + Q_DECLARE_SCOPED_PRIVATE(QAbstractSlider) }; QT_END_NAMESPACE diff --git a/src/gui/widgets/qabstractspinbox.h b/src/gui/widgets/qabstractspinbox.h index e65f27b..2e8f7f9 100644 --- a/src/gui/widgets/qabstractspinbox.h +++ b/src/gui/widgets/qabstractspinbox.h @@ -165,7 +165,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_editorTextChanged(const QString &)) Q_PRIVATE_SLOT(d_func(), void _q_editorCursorPositionChanged(int, int)) - Q_DECLARE_PRIVATE(QAbstractSpinBox) + Q_DECLARE_SCOPED_PRIVATE(QAbstractSpinBox) Q_DISABLE_COPY(QAbstractSpinBox) }; Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractSpinBox::StepEnabled) diff --git a/src/gui/widgets/qbuttongroup.h b/src/gui/widgets/qbuttongroup.h index 708c91c..fca1524 100644 --- a/src/gui/widgets/qbuttongroup.h +++ b/src/gui/widgets/qbuttongroup.h @@ -98,7 +98,7 @@ public: private: Q_DISABLE_COPY(QButtonGroup) - Q_DECLARE_PRIVATE(QButtonGroup) + Q_DECLARE_SCOPED_PRIVATE(QButtonGroup) friend class QAbstractButton; friend class QAbstractButtonPrivate; }; diff --git a/src/gui/widgets/qcalendarwidget.h b/src/gui/widgets/qcalendarwidget.h index f567180..edd1511 100644 --- a/src/gui/widgets/qcalendarwidget.h +++ b/src/gui/widgets/qcalendarwidget.h @@ -179,7 +179,7 @@ Q_SIGNALS: void currentPageChanged(int year, int month); private: - Q_DECLARE_PRIVATE(QCalendarWidget) + Q_DECLARE_SCOPED_PRIVATE(QCalendarWidget) Q_DISABLE_COPY(QCalendarWidget) Q_PRIVATE_SLOT(d_func(), void _q_slotShowDate(const QDate &date)) diff --git a/src/gui/widgets/qcheckbox.h b/src/gui/widgets/qcheckbox.h index 1d61783..cd41626 100644 --- a/src/gui/widgets/qcheckbox.h +++ b/src/gui/widgets/qcheckbox.h @@ -102,7 +102,7 @@ public: #endif private: - Q_DECLARE_PRIVATE(QCheckBox) + Q_DECLARE_SCOPED_PRIVATE(QCheckBox) Q_DISABLE_COPY(QCheckBox) }; diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index b6fae10..c4f81d4 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -1251,8 +1251,12 @@ QComboBox::~QComboBox() // ### check delegateparent and delete delegate if us? Q_D(QComboBox); - disconnect(d->model, SIGNAL(destroyed()), - this, SLOT(_q_modelDestroyed())); + QT_TRY { + disconnect(d->model, SIGNAL(destroyed()), + this, SLOT(_q_modelDestroyed())); + } QT_CATCH(...) { + ; // objects can't throw in destructor + } } /*! diff --git a/src/gui/widgets/qcombobox.h b/src/gui/widgets/qcombobox.h index 22f6928..2807a4f 100644 --- a/src/gui/widgets/qcombobox.h +++ b/src/gui/widgets/qcombobox.h @@ -300,7 +300,7 @@ protected: QComboBox(QComboBoxPrivate &, QWidget *); private: - Q_DECLARE_PRIVATE(QComboBox) + Q_DECLARE_SCOPED_PRIVATE(QComboBox) Q_DISABLE_COPY(QComboBox) Q_PRIVATE_SLOT(d_func(), void _q_itemSelected(const QModelIndex &item)) Q_PRIVATE_SLOT(d_func(), void _q_emitHighlighted(const QModelIndex &)) diff --git a/src/gui/widgets/qcommandlinkbutton.h b/src/gui/widgets/qcommandlinkbutton.h index bf30242..5191252 100644 --- a/src/gui/widgets/qcommandlinkbutton.h +++ b/src/gui/widgets/qcommandlinkbutton.h @@ -75,7 +75,7 @@ protected: private: Q_DISABLE_COPY(QCommandLinkButton) - Q_DECLARE_PRIVATE(QCommandLinkButton) + Q_DECLARE_SCOPED_PRIVATE(QCommandLinkButton) }; QT_END_NAMESPACE diff --git a/src/gui/widgets/qdatetimeedit.h b/src/gui/widgets/qdatetimeedit.h index e43a3fa..1e4c621 100644 --- a/src/gui/widgets/qdatetimeedit.h +++ b/src/gui/widgets/qdatetimeedit.h @@ -197,7 +197,7 @@ protected: QDateTimeEdit(const QVariant &val, QVariant::Type parserType, QWidget *parent = 0); private: - Q_DECLARE_PRIVATE(QDateTimeEdit) + Q_DECLARE_SCOPED_PRIVATE(QDateTimeEdit) Q_DISABLE_COPY(QDateTimeEdit) Q_PRIVATE_SLOT(d_func(), void _q_resetButton()) diff --git a/src/gui/widgets/qdial.h b/src/gui/widgets/qdial.h index 91b8c5e..f07999b 100644 --- a/src/gui/widgets/qdial.h +++ b/src/gui/widgets/qdial.h @@ -109,7 +109,7 @@ Q_SIGNALS: #endif private: - Q_DECLARE_PRIVATE(QDial) + Q_DECLARE_SCOPED_PRIVATE(QDial) Q_DISABLE_COPY(QDial) }; diff --git a/src/gui/widgets/qdialogbuttonbox.h b/src/gui/widgets/qdialogbuttonbox.h index df40a66..97a6a59 100644 --- a/src/gui/widgets/qdialogbuttonbox.h +++ b/src/gui/widgets/qdialogbuttonbox.h @@ -154,7 +154,7 @@ protected: private: Q_DISABLE_COPY(QDialogButtonBox) - Q_DECLARE_PRIVATE(QDialogButtonBox) + Q_DECLARE_SCOPED_PRIVATE(QDialogButtonBox) Q_PRIVATE_SLOT(d_func(), void _q_handleButtonClicked()) Q_PRIVATE_SLOT(d_func(), void _q_handleButtonDestroyed()) }; diff --git a/src/gui/widgets/qdockwidget.h b/src/gui/widgets/qdockwidget.h index f0c0b46..b1abbdd 100644 --- a/src/gui/widgets/qdockwidget.h +++ b/src/gui/widgets/qdockwidget.h @@ -124,7 +124,7 @@ protected: void initStyleOption(QStyleOptionDockWidget *option) const; private: - Q_DECLARE_PRIVATE(QDockWidget) + Q_DECLARE_SCOPED_PRIVATE(QDockWidget) Q_DISABLE_COPY(QDockWidget) Q_PRIVATE_SLOT(d_func(), void _q_toggleView(bool)) Q_PRIVATE_SLOT(d_func(), void _q_toggleTopLevel()) diff --git a/src/gui/widgets/qfocusframe.h b/src/gui/widgets/qfocusframe.h index 139374c..e496343 100644 --- a/src/gui/widgets/qfocusframe.h +++ b/src/gui/widgets/qfocusframe.h @@ -71,7 +71,7 @@ protected: void initStyleOption(QStyleOption *option) const; private: - Q_DECLARE_PRIVATE(QFocusFrame) + Q_DECLARE_SCOPED_PRIVATE(QFocusFrame) Q_DISABLE_COPY(QFocusFrame) }; diff --git a/src/gui/widgets/qfontcombobox.h b/src/gui/widgets/qfontcombobox.h index 6034881..41f9d72 100644 --- a/src/gui/widgets/qfontcombobox.h +++ b/src/gui/widgets/qfontcombobox.h @@ -97,7 +97,7 @@ protected: private: Q_DISABLE_COPY(QFontComboBox) - Q_DECLARE_PRIVATE(QFontComboBox) + Q_DECLARE_SCOPED_PRIVATE(QFontComboBox) Q_PRIVATE_SLOT(d_func(), void _q_currentChanged(const QString &)) Q_PRIVATE_SLOT(d_func(), void _q_updateModel()) }; diff --git a/src/gui/widgets/qframe.h b/src/gui/widgets/qframe.h index 7b6073b..f8776c6 100644 --- a/src/gui/widgets/qframe.h +++ b/src/gui/widgets/qframe.h @@ -138,7 +138,7 @@ protected: private: Q_DISABLE_COPY(QFrame) - Q_DECLARE_PRIVATE(QFrame) + Q_DECLARE_SCOPED_PRIVATE(QFrame) }; QT_END_NAMESPACE diff --git a/src/gui/widgets/qgroupbox.h b/src/gui/widgets/qgroupbox.h index d3f76e1..c4bef6e 100644 --- a/src/gui/widgets/qgroupbox.h +++ b/src/gui/widgets/qgroupbox.h @@ -109,7 +109,7 @@ public: private: Q_DISABLE_COPY(QGroupBox) - Q_DECLARE_PRIVATE(QGroupBox) + Q_DECLARE_SCOPED_PRIVATE(QGroupBox) Q_PRIVATE_SLOT(d_func(), void _q_setChildrenEnabled(bool b)) }; diff --git a/src/gui/widgets/qlabel.h b/src/gui/widgets/qlabel.h index b7a7c11..520d661 100644 --- a/src/gui/widgets/qlabel.h +++ b/src/gui/widgets/qlabel.h @@ -156,7 +156,7 @@ public: private: Q_DISABLE_COPY(QLabel) - Q_DECLARE_PRIVATE(QLabel) + Q_DECLARE_SCOPED_PRIVATE(QLabel) #ifndef QT_NO_MOVIE Q_PRIVATE_SLOT(d_func(), void _q_movieUpdated(const QRect&)) Q_PRIVATE_SLOT(d_func(), void _q_movieResized(const QSize&)) diff --git a/src/gui/widgets/qlcdnumber.h b/src/gui/widgets/qlcdnumber.h index 1437427..3d7cf43 100644 --- a/src/gui/widgets/qlcdnumber.h +++ b/src/gui/widgets/qlcdnumber.h @@ -128,7 +128,7 @@ public: private: Q_DISABLE_COPY(QLCDNumber) - Q_DECLARE_PRIVATE(QLCDNumber) + Q_DECLARE_SCOPED_PRIVATE(QLCDNumber) }; #endif // QT_NO_LCDNUMBER diff --git a/src/gui/widgets/qlineedit.h b/src/gui/widgets/qlineedit.h index daac6a7..9eed110 100644 --- a/src/gui/widgets/qlineedit.h +++ b/src/gui/widgets/qlineedit.h @@ -265,7 +265,7 @@ private: friend class QDateTimeEdit; #endif Q_DISABLE_COPY(QLineEdit) - Q_DECLARE_PRIVATE(QLineEdit) + Q_DECLARE_SCOPED_PRIVATE(QLineEdit) Q_PRIVATE_SLOT(d_func(), void _q_handleWindowActivate()) Q_PRIVATE_SLOT(d_func(), void _q_deleteSelected()) Q_PRIVATE_SLOT(d_func(), void _q_textEdited(const QString &)) diff --git a/src/gui/widgets/qmaccocoaviewcontainer_mac.h b/src/gui/widgets/qmaccocoaviewcontainer_mac.h index 8ca1073..0fdaac5 100644 --- a/src/gui/widgets/qmaccocoaviewcontainer_mac.h +++ b/src/gui/widgets/qmaccocoaviewcontainer_mac.h @@ -63,7 +63,7 @@ public: void *cocoaView() const; private: - Q_DECLARE_PRIVATE(QMacCocoaViewContainer) + Q_DECLARE_SCOPED_PRIVATE(QMacCocoaViewContainer) }; QT_END_NAMESPACE diff --git a/src/gui/widgets/qmacnativewidget_mac.h b/src/gui/widgets/qmacnativewidget_mac.h index 5c654b5..904108e 100644 --- a/src/gui/widgets/qmacnativewidget_mac.h +++ b/src/gui/widgets/qmacnativewidget_mac.h @@ -64,7 +64,7 @@ protected: bool event(QEvent *ev); private: - Q_DECLARE_PRIVATE(QMacNativeWidget) + Q_DECLARE_SCOPED_PRIVATE(QMacNativeWidget) }; QT_END_NAMESPACE diff --git a/src/gui/widgets/qmainwindow.h b/src/gui/widgets/qmainwindow.h index 9c2fb88..a221131 100644 --- a/src/gui/widgets/qmainwindow.h +++ b/src/gui/widgets/qmainwindow.h @@ -202,7 +202,7 @@ protected: bool event(QEvent *event); private: - Q_DECLARE_PRIVATE(QMainWindow) + Q_DECLARE_SCOPED_PRIVATE(QMainWindow) Q_DISABLE_COPY(QMainWindow) }; diff --git a/src/gui/widgets/qmdiarea.h b/src/gui/widgets/qmdiarea.h index 9f1014e..f64397b 100644 --- a/src/gui/widgets/qmdiarea.h +++ b/src/gui/widgets/qmdiarea.h @@ -153,7 +153,7 @@ protected: private: Q_DISABLE_COPY(QMdiArea) - Q_DECLARE_PRIVATE(QMdiArea) + Q_DECLARE_SCOPED_PRIVATE(QMdiArea) Q_PRIVATE_SLOT(d_func(), void _q_deactivateAllWindows()) Q_PRIVATE_SLOT(d_func(), void _q_processWindowStateChanged(Qt::WindowStates, Qt::WindowStates)) Q_PRIVATE_SLOT(d_func(), void _q_currentTabChanged(int index)) diff --git a/src/gui/widgets/qmdisubwindow.h b/src/gui/widgets/qmdisubwindow.h index 924cc9a..bfb523d 100644 --- a/src/gui/widgets/qmdisubwindow.h +++ b/src/gui/widgets/qmdisubwindow.h @@ -137,7 +137,7 @@ protected: private: Q_DISABLE_COPY(QMdiSubWindow) - Q_DECLARE_PRIVATE(QMdiSubWindow) + Q_DECLARE_SCOPED_PRIVATE(QMdiSubWindow) Q_PRIVATE_SLOT(d_func(), void _q_updateStaysOnTopHint()) Q_PRIVATE_SLOT(d_func(), void _q_enterInteractiveMode()) Q_PRIVATE_SLOT(d_func(), void _q_processFocusChanged(QWidget *, QWidget *)) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index d0620af..f130a29 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -144,7 +144,7 @@ public slots: void onTrigger(QAction *action) { d_func()->activateAction(action, QAction::Trigger, false); } void onHovered(QAction *action) { d_func()->activateAction(action, QAction::Hover, false); } private: - Q_DECLARE_PRIVATE(QTornOffMenu) + Q_DECLARE_SCOPED_PRIVATE(QTornOffMenu) friend class QMenuPrivate; }; diff --git a/src/gui/widgets/qmenu.h b/src/gui/widgets/qmenu.h index 41890c4..9f9cdf5 100644 --- a/src/gui/widgets/qmenu.h +++ b/src/gui/widgets/qmenu.h @@ -77,7 +77,7 @@ class Q_GUI_EXPORT QMenu : public QWidget { private: Q_OBJECT - Q_DECLARE_PRIVATE(QMenu) + Q_DECLARE_SCOPED_PRIVATE(QMenu) Q_PROPERTY(bool tearOffEnabled READ isTearOffEnabled WRITE setTearOffEnabled) Q_PROPERTY(QString title READ title WRITE setTitle) diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index 76057e7..1b21b71 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -87,7 +87,7 @@ bool menuExists() { QWidget *w = qApp->activeWindow(); QMenuBarPrivate *mb = menubars()->value(w); - if ((!mb) && !menubars()->count()) + if ((!mb) && !menubars()->count()) return false; return true; } @@ -196,7 +196,7 @@ static void qt_symbian_insert_action(QSymbianMenuAction* action, QList<SymbianMe if (!action->action->isEnabled()){ menuItem->menuItemData.iFlags += EEikMenuItemDimmed; } - + if (action->action->isCheckable()) { if (action->action->isChecked()) menuItem->menuItemData.iFlags += EEikMenuItemCheckBox | EEikMenuItemSymbolOn; @@ -244,7 +244,7 @@ Q_GUI_EXPORT void qt_symbian_show_toplevel( CEikMenuPane* menuPane) return; rebuildMenu(); for (int i = 0; i < symbianMenus.count(); ++i) - menuPane->AddMenuItemL(symbianMenus.at(i)->menuItemData); + QT_TRAP_THROWING(menuPane->AddMenuItemL(symbianMenus.at(i)->menuItemData)); } Q_GUI_EXPORT void qt_symbian_show_submenu( CEikMenuPane* menuPane, int id) @@ -252,7 +252,7 @@ Q_GUI_EXPORT void qt_symbian_show_submenu( CEikMenuPane* menuPane, int id) SymbianMenuItem* menu = qt_symbian_find_menu(id, symbianMenus); if (menu) { for (int i = 0; i < menu->children.count(); ++i) - menuPane->AddMenuItemL(menu->children.at(i)->menuItemData); + QT_TRAP_THROWING(menuPane->AddMenuItemL(menu->children.at(i)->menuItemData)); } } @@ -262,7 +262,7 @@ void QMenuBarPrivate::symbianCommands(int command) QContextMenuEvent* event = new QContextMenuEvent(QContextMenuEvent::Keyboard, QPoint(0,0)); QCoreApplication::postEvent(widgetWithContextMenu, event); } - + int size = nativeMenuBars.size(); for (int i = 0; i < nativeMenuBars.size(); ++i) { SymbianMenuItem* menu = qt_symbian_find_menu_item(command, symbianMenus); diff --git a/src/gui/widgets/qmenubar.h b/src/gui/widgets/qmenubar.h index 1fda1c1..ddd2d67 100644 --- a/src/gui/widgets/qmenubar.h +++ b/src/gui/widgets/qmenubar.h @@ -336,7 +336,7 @@ private: #endif private: - Q_DECLARE_PRIVATE(QMenuBar) + Q_DECLARE_SCOPED_PRIVATE(QMenuBar) Q_DISABLE_COPY(QMenuBar) Q_PRIVATE_SLOT(d_func(), void _q_actionTriggered()) Q_PRIVATE_SLOT(d_func(), void _q_actionHovered()) diff --git a/src/gui/widgets/qplaintextedit.h b/src/gui/widgets/qplaintextedit.h index 35bbc37..767bb69 100644 --- a/src/gui/widgets/qplaintextedit.h +++ b/src/gui/widgets/qplaintextedit.h @@ -69,7 +69,7 @@ class QMimeData; class Q_GUI_EXPORT QPlainTextEdit : public QAbstractScrollArea { Q_OBJECT - Q_DECLARE_PRIVATE(QPlainTextEdit) + Q_DECLARE_SCOPED_PRIVATE(QPlainTextEdit) Q_ENUMS(LineWrapMode) Q_PROPERTY(bool tabChangesFocus READ tabChangesFocus WRITE setTabChangesFocus) Q_PROPERTY(QString documentTitle READ documentTitle WRITE setDocumentTitle) @@ -278,7 +278,7 @@ class QPlainTextDocumentLayoutPrivate; class Q_GUI_EXPORT QPlainTextDocumentLayout : public QAbstractTextDocumentLayout { Q_OBJECT - Q_DECLARE_PRIVATE(QPlainTextDocumentLayout) + Q_DECLARE_SCOPED_PRIVATE(QPlainTextDocumentLayout) Q_PROPERTY(int cursorWidth READ cursorWidth WRITE setCursorWidth) public: diff --git a/src/gui/widgets/qprintpreviewwidget.h b/src/gui/widgets/qprintpreviewwidget.h index d74bf93..240306f 100644 --- a/src/gui/widgets/qprintpreviewwidget.h +++ b/src/gui/widgets/qprintpreviewwidget.h @@ -58,7 +58,7 @@ class QPrintPreviewWidgetPrivate; class Q_GUI_EXPORT QPrintPreviewWidget : public QWidget { Q_OBJECT - Q_DECLARE_PRIVATE(QPrintPreviewWidget) + Q_DECLARE_SCOPED_PRIVATE(QPrintPreviewWidget) public: enum ViewMode { diff --git a/src/gui/widgets/qprogressbar.h b/src/gui/widgets/qprogressbar.h index 5ac6b85..de995b6 100644 --- a/src/gui/widgets/qprogressbar.h +++ b/src/gui/widgets/qprogressbar.h @@ -117,7 +117,7 @@ protected: void initStyleOption(QStyleOptionProgressBar *option) const; private: - Q_DECLARE_PRIVATE(QProgressBar) + Q_DECLARE_SCOPED_PRIVATE(QProgressBar) Q_DISABLE_COPY(QProgressBar) }; diff --git a/src/gui/widgets/qpushbutton.h b/src/gui/widgets/qpushbutton.h index 2264cc3..1b4cb95 100644 --- a/src/gui/widgets/qpushbutton.h +++ b/src/gui/widgets/qpushbutton.h @@ -111,7 +111,7 @@ public: private: Q_DISABLE_COPY(QPushButton) - Q_DECLARE_PRIVATE(QPushButton) + Q_DECLARE_SCOPED_PRIVATE(QPushButton) #ifndef QT_NO_MENU Q_PRIVATE_SLOT(d_func(), void _q_popupPressed()) #endif diff --git a/src/gui/widgets/qradiobutton.h b/src/gui/widgets/qradiobutton.h index e631bab..d2eaa4d 100644 --- a/src/gui/widgets/qradiobutton.h +++ b/src/gui/widgets/qradiobutton.h @@ -77,7 +77,7 @@ public: #endif private: - Q_DECLARE_PRIVATE(QRadioButton) + Q_DECLARE_SCOPED_PRIVATE(QRadioButton) Q_DISABLE_COPY(QRadioButton) }; diff --git a/src/gui/widgets/qrubberband.h b/src/gui/widgets/qrubberband.h index 1e638fd..629bc29 100644 --- a/src/gui/widgets/qrubberband.h +++ b/src/gui/widgets/qrubberband.h @@ -87,7 +87,7 @@ protected: void initStyleOption(QStyleOptionRubberBand *option) const; private: - Q_DECLARE_PRIVATE(QRubberBand) + Q_DECLARE_SCOPED_PRIVATE(QRubberBand) }; inline void QRubberBand::setGeometry(int ax, int ay, int aw, int ah) diff --git a/src/gui/widgets/qscrollarea.h b/src/gui/widgets/qscrollarea.h index d713e15..d2179b8 100644 --- a/src/gui/widgets/qscrollarea.h +++ b/src/gui/widgets/qscrollarea.h @@ -88,7 +88,7 @@ protected: void scrollContentsBy(int dx, int dy); private: - Q_DECLARE_PRIVATE(QScrollArea) + Q_DECLARE_SCOPED_PRIVATE(QScrollArea) Q_DISABLE_COPY(QScrollArea) }; diff --git a/src/gui/widgets/qscrollbar.h b/src/gui/widgets/qscrollbar.h index 9d25359..b9302b3 100644 --- a/src/gui/widgets/qscrollbar.h +++ b/src/gui/widgets/qscrollbar.h @@ -92,7 +92,7 @@ private: friend Q_GUI_EXPORT QStyleOptionSlider qt_qscrollbarStyleOption(QScrollBar *scrollBar); Q_DISABLE_COPY(QScrollBar) - Q_DECLARE_PRIVATE(QScrollBar) + Q_DECLARE_SCOPED_PRIVATE(QScrollBar) }; #endif // QT_NO_SCROLLBAR diff --git a/src/gui/widgets/qsizegrip.h b/src/gui/widgets/qsizegrip.h index 5a0fb3b..7e9e6ac 100644 --- a/src/gui/widgets/qsizegrip.h +++ b/src/gui/widgets/qsizegrip.h @@ -82,7 +82,7 @@ public: #endif private: - Q_DECLARE_PRIVATE(QSizeGrip) + Q_DECLARE_SCOPED_PRIVATE(QSizeGrip) Q_DISABLE_COPY(QSizeGrip) Q_PRIVATE_SLOT(d_func(), void _q_showIfNotHidden()) }; diff --git a/src/gui/widgets/qslider.h b/src/gui/widgets/qslider.h index 18c2603..3ff3889 100644 --- a/src/gui/widgets/qslider.h +++ b/src/gui/widgets/qslider.h @@ -122,7 +122,7 @@ private: friend Q_GUI_EXPORT QStyleOptionSlider qt_qsliderStyleOption(QSlider *slider); Q_DISABLE_COPY(QSlider) - Q_DECLARE_PRIVATE(QSlider) + Q_DECLARE_SCOPED_PRIVATE(QSlider) }; #endif // QT_NO_SLIDER diff --git a/src/gui/widgets/qspinbox.h b/src/gui/widgets/qspinbox.h index a168528..96d7b96 100644 --- a/src/gui/widgets/qspinbox.h +++ b/src/gui/widgets/qspinbox.h @@ -119,7 +119,7 @@ Q_SIGNALS: private: Q_DISABLE_COPY(QSpinBox) - Q_DECLARE_PRIVATE(QSpinBox) + Q_DECLARE_SCOPED_PRIVATE(QSpinBox) }; class QDoubleSpinBoxPrivate; @@ -176,7 +176,7 @@ Q_SIGNALS: private: Q_DISABLE_COPY(QDoubleSpinBox) - Q_DECLARE_PRIVATE(QDoubleSpinBox) + Q_DECLARE_SCOPED_PRIVATE(QDoubleSpinBox) }; #endif // QT_NO_SPINBOX diff --git a/src/gui/widgets/qsplashscreen.h b/src/gui/widgets/qsplashscreen.h index d7c521c..23d4d34 100644 --- a/src/gui/widgets/qsplashscreen.h +++ b/src/gui/widgets/qsplashscreen.h @@ -87,7 +87,7 @@ protected: private: Q_DISABLE_COPY(QSplashScreen) - Q_DECLARE_PRIVATE(QSplashScreen) + Q_DECLARE_SCOPED_PRIVATE(QSplashScreen) }; #endif // QT_NO_SPLASHSCREEN diff --git a/src/gui/widgets/qsplitter.h b/src/gui/widgets/qsplitter.h index ad5620e..5f16db2 100644 --- a/src/gui/widgets/qsplitter.h +++ b/src/gui/widgets/qsplitter.h @@ -142,7 +142,7 @@ public: private: Q_DISABLE_COPY(QSplitter) - Q_DECLARE_PRIVATE(QSplitter) + Q_DECLARE_SCOPED_PRIVATE(QSplitter) private: friend class QSplitterHandle; }; @@ -179,7 +179,7 @@ protected: private: Q_DISABLE_COPY(QSplitterHandle) - Q_DECLARE_PRIVATE(QSplitterHandle) + Q_DECLARE_SCOPED_PRIVATE(QSplitterHandle) }; #endif // QT_NO_SPLITTER diff --git a/src/gui/widgets/qstackedwidget.h b/src/gui/widgets/qstackedwidget.h index 95d6d9f..6dd21bb 100644 --- a/src/gui/widgets/qstackedwidget.h +++ b/src/gui/widgets/qstackedwidget.h @@ -88,7 +88,7 @@ protected: private: Q_DISABLE_COPY(QStackedWidget) - Q_DECLARE_PRIVATE(QStackedWidget) + Q_DECLARE_SCOPED_PRIVATE(QStackedWidget) }; #endif // QT_NO_STACKEDWIDGET diff --git a/src/gui/widgets/qstatusbar.h b/src/gui/widgets/qstatusbar.h index 86d1cda..28cb2a9 100644 --- a/src/gui/widgets/qstatusbar.h +++ b/src/gui/widgets/qstatusbar.h @@ -104,7 +104,7 @@ protected: private: Q_DISABLE_COPY(QStatusBar) - Q_DECLARE_PRIVATE(QStatusBar) + Q_DECLARE_SCOPED_PRIVATE(QStatusBar) }; #endif // QT_NO_STATUSBAR diff --git a/src/gui/widgets/qtabbar.h b/src/gui/widgets/qtabbar.h index 402f54b..2e6eaac 100644 --- a/src/gui/widgets/qtabbar.h +++ b/src/gui/widgets/qtabbar.h @@ -212,7 +212,7 @@ Q_SIGNALS: friend class QAccessibleTabBar; private: Q_DISABLE_COPY(QTabBar) - Q_DECLARE_PRIVATE(QTabBar) + Q_DECLARE_SCOPED_PRIVATE(QTabBar) Q_PRIVATE_SLOT(d_func(), void _q_scrollTabs()) Q_PRIVATE_SLOT(d_func(), void _q_closeTab()) }; diff --git a/src/gui/widgets/qtabwidget.h b/src/gui/widgets/qtabwidget.h index 10150af..138a612 100644 --- a/src/gui/widgets/qtabwidget.h +++ b/src/gui/widgets/qtabwidget.h @@ -234,7 +234,7 @@ Q_SIGNALS: #endif // QT3_SUPPORT private: - Q_DECLARE_PRIVATE(QTabWidget) + Q_DECLARE_SCOPED_PRIVATE(QTabWidget) Q_DISABLE_COPY(QTabWidget) Q_PRIVATE_SLOT(d_func(), void _q_showTab(int)) Q_PRIVATE_SLOT(d_func(), void _q_removeTab(int)) diff --git a/src/gui/widgets/qtextbrowser.h b/src/gui/widgets/qtextbrowser.h index d5bd956..b9a501f 100644 --- a/src/gui/widgets/qtextbrowser.h +++ b/src/gui/widgets/qtextbrowser.h @@ -125,7 +125,7 @@ public: private: Q_DISABLE_COPY(QTextBrowser) - Q_DECLARE_PRIVATE(QTextBrowser) + Q_DECLARE_SCOPED_PRIVATE(QTextBrowser) Q_PRIVATE_SLOT(d_func(), void _q_documentModified()) Q_PRIVATE_SLOT(d_func(), void _q_activateAnchor(const QString &)) Q_PRIVATE_SLOT(d_func(), void _q_highlightLink(const QString &)) diff --git a/src/gui/widgets/qtextedit.h b/src/gui/widgets/qtextedit.h index 9e10e07..ab807e8 100644 --- a/src/gui/widgets/qtextedit.h +++ b/src/gui/widgets/qtextedit.h @@ -70,7 +70,7 @@ class QMimeData; class Q_GUI_EXPORT QTextEdit : public QAbstractScrollArea { Q_OBJECT - Q_DECLARE_PRIVATE(QTextEdit) + Q_DECLARE_SCOPED_PRIVATE(QTextEdit) Q_FLAGS(AutoFormatting) Q_ENUMS(LineWrapMode) Q_PROPERTY(AutoFormatting autoFormatting READ autoFormatting WRITE setAutoFormatting) diff --git a/src/gui/widgets/qtoolbar.h b/src/gui/widgets/qtoolbar.h index 07502b3..6e58555 100644 --- a/src/gui/widgets/qtoolbar.h +++ b/src/gui/widgets/qtoolbar.h @@ -162,7 +162,7 @@ public: #endif private: - Q_DECLARE_PRIVATE(QToolBar) + Q_DECLARE_SCOPED_PRIVATE(QToolBar) Q_DISABLE_COPY(QToolBar) Q_PRIVATE_SLOT(d_func(), void _q_toggleView(bool)) Q_PRIVATE_SLOT(d_func(), void _q_updateIconSize(const QSize &)) diff --git a/src/gui/widgets/qtoolbox.h b/src/gui/widgets/qtoolbox.h index 2c38967..242efa6 100644 --- a/src/gui/widgets/qtoolbox.h +++ b/src/gui/widgets/qtoolbox.h @@ -124,7 +124,7 @@ public: #endif private: - Q_DECLARE_PRIVATE(QToolBox) + Q_DECLARE_SCOPED_PRIVATE(QToolBox) Q_DISABLE_COPY(QToolBox) Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked()) Q_PRIVATE_SLOT(d_func(), void _q_widgetDestroyed(QObject*)) diff --git a/src/gui/widgets/qtoolbutton.h b/src/gui/widgets/qtoolbutton.h index 1e7d678..7286096 100644 --- a/src/gui/widgets/qtoolbutton.h +++ b/src/gui/widgets/qtoolbutton.h @@ -127,7 +127,7 @@ protected: private: Q_DISABLE_COPY(QToolButton) - Q_DECLARE_PRIVATE(QToolButton) + Q_DECLARE_SCOPED_PRIVATE(QToolButton) #ifndef QT_NO_MENU Q_PRIVATE_SLOT(d_func(), void _q_buttonPressed()) Q_PRIVATE_SLOT(d_func(), void _q_updateButtonDown()) diff --git a/src/gui/widgets/qvalidator.h b/src/gui/widgets/qvalidator.h index 5c27d1d..5c15116 100644 --- a/src/gui/widgets/qvalidator.h +++ b/src/gui/widgets/qvalidator.h @@ -90,7 +90,7 @@ protected: private: Q_DISABLE_COPY(QValidator) - Q_DECLARE_PRIVATE(QValidator) + Q_DECLARE_SCOPED_PRIVATE(QValidator) }; class Q_GUI_EXPORT QIntValidator : public QValidator @@ -168,7 +168,7 @@ public: QObject * parent, const char *name); #endif private: - Q_DECLARE_PRIVATE(QDoubleValidator) + Q_DECLARE_SCOPED_PRIVATE(QDoubleValidator) Q_DISABLE_COPY(QDoubleValidator) double b; diff --git a/src/gui/widgets/qworkspace.cpp b/src/gui/widgets/qworkspace.cpp index 3184140..da06e9d 100644 --- a/src/gui/widgets/qworkspace.cpp +++ b/src/gui/widgets/qworkspace.cpp @@ -228,7 +228,7 @@ void QMDIControl::paintEvent(QPaintEvent *) class QWorkspaceTitleBar : public QWidget { Q_OBJECT - Q_DECLARE_PRIVATE(QWorkspaceTitleBar) + Q_DECLARE_SCOPED_PRIVATE(QWorkspaceTitleBar) Q_PROPERTY(bool autoRaise READ autoRaise WRITE setAutoRaise) Q_PROPERTY(bool movable READ isMovable WRITE setMovable) diff --git a/src/gui/widgets/qworkspace.h b/src/gui/widgets/qworkspace.h index 8a64315..1a20d6c 100644 --- a/src/gui/widgets/qworkspace.h +++ b/src/gui/widgets/qworkspace.h @@ -115,7 +115,7 @@ protected: #endif private: - Q_DECLARE_PRIVATE(QWorkspace) + Q_DECLARE_SCOPED_PRIVATE(QWorkspace) Q_DISABLE_COPY(QWorkspace) Q_PRIVATE_SLOT(d_func(), void _q_normalizeActiveWindow()) Q_PRIVATE_SLOT(d_func(), void _q_minimizeActiveWindow()) |