diff options
94 files changed, 1955 insertions, 1094 deletions
diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index f457e63..12803b8 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -8,12 +8,16 @@ The Qt version 4.6 series is binary compatible with the 4.5.x series. Applications compiled for 4.5 will continue to run with 4.6. Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Task Tracker: +corresponding to tasks in the Qt Bug Tracker, the (now obsolete) Task +Tracker, or the Merge Request queue of the public source repository. - http://qt.nokia.com/developer/task-tracker +Each of these identifiers can be entered in the tracker to obtain more +information about a particular change. Issue numbers for the various +trackers have the following formats: -Each of these identifiers can be entered in the task tracker to obtain more -information about a particular change. +QTBUG-1234 - Qt Bug Tracker: http://bugreports.qt.nokia.com +MR#1234 - Merge Request: http://qt.gitorious.org +123456 - Task Tracker: http://qt.nokia.com/developer/task-tracker **************************************************************************** * General * @@ -34,11 +38,14 @@ information about a particular change. - QGLShaderProgram, QGLShader * New classes for using shader programs written in the GL Shading Language. + - QGraphicsEffect + * New classes for applying graphics effects to graphics items and widgets. + - Boxes demo ported to use new 3D math and shader program classes. - OpenVG graphics system added. - - Add 800x480 screen mode to qvfb configuration dialog. + - Added 800x480 screen mode to qvfb configuration dialog. - Improved support for input methods in graphics view. @@ -48,10 +55,20 @@ information about a particular change. - QAbstractVideoSurface, QVideoFrame * New abstract video output classes. + - New state machine framework added to QtCore. + + - QContiguousCache + * New class for efficiently caching items within a scrolling view. + Third party components ---------------------- - - Updated FreeType to version 2.3.9 + - Updated FreeType to version 2.3.9. + + - Updated harfbuzz to the latest version from fd.org. + + - Updated sqlite to version 3.6.19. + **************************************************************************** * Library * @@ -60,335 +77,380 @@ Third party components QtCore - QByteArray - * New overloads for QByteArray::insert() and QByteArray::prepend() - - - QObject - * [259514] fixed a possible dead-lock in the destructor + * New overloads for QByteArray::insert() and QByteArray::prepend(). - - QVariant - * Many optimisations - * Added QVariant::toFloat() and QVariant::toReal() - * Added QVariant(float) constructor - * qvariant_cast<QVariant> and qVariantFromValue<QVariant> are now - identify functions - * Added support for math3d types. + - QEventDispatcherGlib (internal class) + * Fix a regression introduced in 4.5.3 that would cause timers to not + be delivered. - - Qt::escape - * now escape the double quote (") + - QEventDispatcherUNIX (internal class) + * Improve detection of monotonic clock support to include + non-POSIX.1-2001 compliant systems. + * [250681] Fix time change detection on UNIX systems without monotonic + timers. - - QScopedPointer - * New pointer class for cleaning up objects when leaving the - current scope + - QEventDispatcherWin32 (internal class) + * Changed the threshold for using multimedia timers to 20ms (was 10ms). + * Changed the way Qt's posted events are sent by the event + dispatcher. They are now driven on top of a Windows message + instead of an explicit call in processEvents(). This means that + posted events are sent even when a Windows modal message loop is + running (for example, when the user is moving a window or when a + native modal dialog is visible). + * Fixed a bug that would allow the same timer id to be used by multiple + QTimer instances. - QFile - * Make QFile::resize() more robust when operating on buffered files + * Make QFile::resize() more robust when operating on buffered files. - QObject - * Added the possibility to pass the flag Qt::UniqueConnection to QObject::connect - * Fixed race conditions that occured when moving object to threads while connecting + * [259514] fixed a possible dead-lock in the destructor. + * Added the possibility to pass the flag Qt::UniqueConnection to + QObject::connect. + * Fixed race conditions that occured when moving object to threads + while connecting. - QPluginLoader - * Improved performance of plugin loading by reusing the plugin cache instead of loading - it every time. + * Improved performance of plugin loading by reusing the plugin cache + instead of loading it every time. + + - QProcessEnvironment + * New class; support for easy access to key/value pairs in the process + environment. - QRegExp - * New pattern syntax "QRegExp::WildcardUnix" with wildcard characters escaping + * New pattern syntax "QRegExp::WildcardUnix" with wildcard character + escaping. + + - QScopedPointer + * New pointer class for cleaning up objects when leaving the current + scope. - QSharedPointer - * Added support for creating the object along the internal private + * Added support for creating the object along with the internal private data in one single memory allocation. (QSharedPointer::create) - * Fixed a bug where, in a race condition, QSharedPointer could - track a pointer that was being deleted. + * Fixed a bug where, in a race condition, QSharedPointer could track a + pointer that was being deleted. + + - QTextCodec + * Instantiate the CP949 codec when building with -no-iconv. - QTextStream * [221316] Fixed crash on large input. * Improved reading utf8/utf16/utf32 data by correctly skipping the ByteOrderMark when reading data by one character at a time. + - QThread + * [249997] Document that QThread priority has no effect on Linux. + - QUrl * Made QUrl hostname parser a lot stricter, requiring compliance to STD3 to validate, thus preventing invalid hostnames from being accepted. See below in "Important Behavior Changes". - - QXmlStreamWriter - * [256468] fix comment indentation + - QUuid + * [QTBUG-3543] Fixed a bug in createUuid() which caused multiple + threads to generate the identical UUID sequences. + + - QVariant + * Many optimisations. + * Added QVariant::toFloat() and QVariant::toReal(). + * Added QVariant(float) constructor. + * qvariant_cast<QVariant> and qVariantFromValue<QVariant> are now + identity functions. + * Added support for math3d types. - QWeakPointer * Added support for tracking QObject-derived classes that aren't attached to a QSharedPointer. * Added QWeakPointer::data which allows you to obtain the pointer being tracked (without protection). + * Added operator-> like the above data(), but requires a #define. - - QUuid - * [QTBUG-3543] Fixed a bug in createUuid() which caused multiple - threads to generate the identical UUID sequences - - - QEventDispatcherGlib (internal class) - * Fix a regression introduced in 4.5.3 that would cause timers to not - be delivered. + - QXmlStreamWriter + * [256468] Fixed comment indentation. - - QEventDispatcherUNIX (internal class) - * Improve detection of monotonic clock support to include - non-POSIX.1-2001 compliant systems. - * [250681] Fix time change detection on UNIX systems without - monotonic timers. +QtGui - - QEventDispatcherWin32 (internal class) - * Changed the threshold for using multimedia timers to 20ms (was 10ms). - * Changed the way Qt's posted events are sent by the event - dispatcher. The are now driven on top of a Windows message - instead of an explicit call in processEvents(). This means that - posted events are sent even when a Windows modal message loop is - running (for example, when the user is moving a window or when a - native modal dialog is visible). - * Fixed a bug that would allow the same timer id to be used by - multiple QTimer instances. + - Qt::escape + * Now escape the double quote ("). - - QTextCodec - * Instantiate the CP949 codec when building with -no-iconv. + - QAbstractItemView + * [256502] Fixes selectionModel::hasSelection return value after + model::reset. - - QThread - * [249997] Document that QThread priority has no effect on Linux. + - QApplication + * [QTBUG-739] Removed internal widgets from QApplication::topLevelWidgets(). -QtGui + - QCalendarWidget + * [252943] QCalendarWidget::setDateTextFormat() reset the format if the + date is invalid. - - QGraphicsAnchorLayout - * Support for expanding size policy has been removed. (The Qt 4.6 - Beta had support for it). + - QColumnView + * [246999] Fixed view not updating when the model changed dynamically. - - QCalendarWidget - * [252943] QCalendarWidget::setDateTextFormat() reset the format if the date is invalid. + - QComboBox + * [220195] Fixed keyboard search when current index is -1. - QCompleter - * [246056] Fixed a possible assertion when setting the completer prefix + * [246056] Fixed a possible assertion when setting the completer prefix. - QEvent * Introduced RequestSoftwareInputPanel and CloseSoftwareInputPanel events. - QFontDialog - * [256466] fixed the dialog not always returning the selected style. + * [256466] Fixed the dialog not always returning the selected style. + + - QFontEngine + * [QTBUG-2354] Support certain 'Microsoft' platform symbol fonts which + also contain a regular unicode table for exactly the symbol range of + code points. + + - QFontEngineQPF + * Make alphaMapForGlyph() generate the correct color table for + Indexed8 and Mono glyph images. Fixed the "all glyphs are white + boxes" problem in OpenGL1 paint engine. + + - QFontMetrics + * [176401] Account for right bearing in bounding rect. + + - QGraphicsAnchorLayout + * Support for expanding size policy has been removed. (The Qt 4.6 Beta + had support for it). - QGraphicsBlurEffect - * Since the 4.6 beta Qt::RenderHint has been moved to + * Since the 4.6 Beta, Qt::RenderHint has been moved to QGraphicsBlurEffect::BlurHint. - * Input contexts are not activated for disabled widgets anymore. - * [250555] Data copied from Mozilla Firefox can now be pasted correctly to a Qt application. - QGraphicsItem - * Fixed bug and improved accuracy of QGraphicsItem::childrenBoundingRect(). * Many optimizations. - * Introduced QGraphicsItem::ItemHasNoContents - * Introduced QGraphicsItem::ItemSendsGeometryChanges (see Behavioral Changes) - * Introduced QGraphicsItem::focusProxy(), focus proxy support - * Introduced QGraphicsItem::ItemNegativeZStacksBehindParent - * Introduced QGraphicsItem::ItemIsPanel, light-weight window support + * Fixed bug and improved accuracy of QGraphicsItem::childrenBoundingRect(). + * Introduced QGraphicsItem::ItemHasNoContents. + * Introduced QGraphicsItem::ItemSendsGeometryChanges (see Behavioral + Changes). + * Introduced QGraphicsItem::focusProxy(), focus proxy support. + * Introduced QGraphicsItem::ItemNegativeZStacksBehindParent. + * Introduced QGraphicsItem::ItemIsPanel, light-weight window support. * Introduced modality support for QGraphicsItem panels. * Introduced activation support. - * Introduced QGraphicsItem::stackBefore() + * Introduced QGraphicsItem::stackBefore(). * Cached items are now always invalidated when update() is called. * Added input hints. + * Added a new set of properties to set a transformation on an item. -- QGraphicsLayout - * Introduced QGraphicsLayout::addChildLayoutItem() + - QGraphicsLayout + * Introduced QGraphicsLayout::addChildLayoutItem(). - QGraphicsObject - * New class; inherits QGraphicsItem and adds notification signals and property declarations. + * New class; inherits QGraphicsItem and adds notification signals and + property declarations. - QGraphicsProxyWidget - * [251407] Fixed window flag handling. Now QGraphicsProxyWidget's flags win. - * Fix Qt::ClickFocus policy + * [251407] Fixed window flag handling. Now QGraphicsProxyWidget's flags + win. + * Fix Qt::ClickFocus policy. - QGraphicsScene + * Many optimizations. * [245317] Fixes to mouse grabbing behavior. * Fixed delivery of double-click events after explicit grab and then ungrab. - * Rewrote the internal rendering to use a recursive instead of an iterative approach. - * Many optimizations. + * Rewrote the internal rendering to use a recursive instead of an iterative + approach. * Ensure hover enter events are delivered when an item is pressed. * Introduced activation support. * Fixed bugs in initial focus support. - QGraphicsTextItem - * Now inherits from QGraphicsObject instead + * Now inherits from QGraphicsObject instead. - QGraphicsTransform * New class; eases animation of transformations for QGraphicsItem. - QGraphicsView - * Fix mapToScene(QRect) to avoid extra unnecessary adjustments. * Many optimizations. - * Introduced QGraphicsView::isTransformed() - * [QTBUG-4151] Items with parent that sets ItemClipsChildrenToShape were sometimes invisible. + * Fix mapToScene(QRect) to avoid extra unnecessary adjustments. + * Introduced QGraphicsView::isTransformed(). + * [QTBUG-4151] Items with parent that sets ItemClipsChildrenToShape were + sometimes invisible. - QGraphicsWidget - * Now inherits from QGraphicsObject instead - * Interactive resizing of top level windows now respects height-for-width constraints. + * Now inherits from QGraphicsObject instead. + * Interactive resizing of top level windows now respects height-for-width + constraints. * Reduced memory footprint. - QHeaderView - * [208320] Make sure the sort indicator s taken into account for the size hint - * [255574] Make sure the sizehint for the section depend on visible sections + * [208320] Make sure the sort indicator is taken into account for the size + hint. + * [255574] Make sure the size hint for the section depends on visible + sections. - - QMainWindow - * [226060] Adding actions to a toolbar would always make the next toolbar move - - - QMenuBar - * [260873] Fix mouse interaction while undocking a widget from the main window - * dock areas don't get a splitter if their dock widgets are not resizable - - - QColumnView - * [246999] Fixed view not updating when the model is changed dynamically + - QImageReader + * [255627] Fix floating point exception in + QImageReader::setScaledSize(QSize(0, 0)). - QLineEdit * [248948] Clear selection when redoing a delete operation. - * [QTBUG-5261] Fixed: Erasing characters from textedits does not update the text + * [QTBUG-5261] Fixed bug where erasing characters from a textedit did not + update the text. - QListView - * [243335] Fixed the visualRect to return correct values when the widget is not yet show + * [243335] Fixed the visualRect to return correct values when the widget is + not yet shown. - - QTreeView - * [234930] Be able to use :has-children and :has-sibillings in a stylesheet - * [252616] Set QStyleOptionViewItemV4::OnlyOne flag when painting spanning columns - * [245654] Fixed expandAll when deleting and recreating a mode for the tree - * [239271] Fixed missing update when adding a row when the first column is hidden - * [258225] Fixed scrollTo with center and bottom + - QMainWindow + * [226060] Adding actions to a toolbar would always make the next toolbar + move. - - QTreeWidget - * [253109] Shows the widget when calling setItemWidget + - QMenu + * [252610] Fixed position of the shortcut text while setting a stylesheet + on menu items - - QTableView - * [191545] Selections work more similarly to well-known spreadsheets - * [234926] Fixed sorting after changing QTableView header - * [244651] [245327] [250193] [QTBUG-5062] Spans get plenty of love with - speed-up, support for rows/columns insertion/removal, and better keyboard - navigation + - QMenuBar + * [260873] Fix mouse interaction while undocking a widget from the main + window + * Dock areas didn't get a splitter if their dock widgets were not + resizable. - - QTableWidget - * [234641] Fixed takeItem to cause the view to be updated. + - QPaintDevice + * New qt_paint_device_metric() function to replace the friend declarations + for window surface classes that need to access metric(). - - QTabBar - * [196326] Fixed having a stylesheet on a QTabBar resulted in some tab names - to be slightly clipped. - * [241383] Added ability to style the close tab button with style sheet + - QPainter + * [QTBUG-1666] Made QPainter::drawText() respect Qt::TextDontClip flag + also in vertical direction. + * [254658] Improved clipping performance in OpenGL paint engine. - - QComboBox - * [220195] Fixed keyboard search when current index is -1 + - QPainterPath + * [QTBUG-1537] Fixed bug where the points of a rounded rectangle were added + in counter-clockwise order instead of clockwise order like other shapes. + + - QPen + * [QTBUG-2738] Made QPen::setDashOffset() work with non-custom dashed lines. - QPixmap * Optimized width(), height(), isNull() and depth(). - * [QTBUG-2832] Fixed bug where calling fill on pixmap with active painter could crash. + * [QTBUG-2832] Fixed bug where calling fill on pixmap with active painter + could crash. - - QRegion - * Minor optimizations. + - QPlainTextEdit + * Fixed crash when clicking on a text edit which was smaller than the + height of the font used. - - QSpinBox - * [259226] Fixed setting a stylesheet on a QSpinBox to change the arrow possition - * [255051] Fixed sizeHint update bug. + - QPlastiqueStyle + * [QTBUG-3555] Fixed a bug in the Plastique style that would cause an + ASSERT failure in QFont when the application font has a pixel size set. - - QStandardItemModel - * [255652] Fixed crash while using takeRow with a QSortFilterProxyModel + - QPrinter + * [QTBUG-4497] Removed redundant SetPen command in the postscript code when + reusing a QPrinter object. - - QToolTip - * Fixed a bug where tooltips were not shown in popups. (Windows only). + - QPrintPreviewDialog now uses a QMainWindow with a proper QToolBar, instead + of a plain layout. - - QGraphicsItem - * Added a new set of properties to set a transformation on a item + - QPushButton + * [255581] Fixed sizeHint recalculation bug. - - QMenu - * [252610] Fixed position of the shortcut text while setting a stylesheet on menu items + - QRasterPaintEngine + * [QTBUG-4210] Fixed bug where bitmaps were painted black instead of in pen + colour. + + - QRegion + * Minor optimizations. - QSortFilterProxyModel * [251296] Fixed bugs in which filtered items could not be filtered. - QSplitter - * [206494] Added ability to style pressed slided with stylesheet + * [206494] Added ability to style pressed slider with stylesheet. + + - QSpinBox + * [259226] Fixed setting a stylesheet on a QSpinBox to change the arrow + position. + * [255051] Fixed sizeHint update bug. + + - QStandardItemModel + * [255652] Fixed crash while using takeRow with a QSortFilterProxyModel. - QStroker * [QTBUG-5212] Fixed bug where thick strokes around small shapes could cause holes in the stroke. - - QWidget - * Added inputMethodHints property. - * [201649] Added QWidget::previousInFocusChain - * [254563] Fixed a crash when setting a focus in a widget tree that - contains invisible widgets + - QTabBar + * [196326] Fixed having a stylesheet on a QTabBar resulted in some tab + names being slightly clipped. + * [241383] Added ability to style the close tab button with style sheet - - QFontEngineQPF - * Make alphaMapForGlyph() generate the correct color table for - Indexed8 and Mono glyph images. Fixed the "all glyphs are white - boxes" problem in OpenGL1 paint engine. + - QTableView + * [191545] Selections work more similarly to well-known spreadsheets. + * [234926] Fixed sorting after changing QTableView header. + * [244651] [245327] [250193] [QTBUG-5062] Spans get plenty of love with + performance improvements, support for row/column insertioa and removal, + and better keyboard navigation. - - QPaintDevice - * New qt_paint_device_metric() function to replace the friend - declarations for window surface classes that need to access metric(). + - QTableWidget + * [234641] Fixed takeItem to cause the view to be updated. - - QPainterPath - * [QTBUG-1537] Fixed bug where the points of a rounded rectangle were added - in counter-clockwise order instead of clockwise order like other shapes. + - QTextDocument + * [207189] Support setting font size using short hand syntax in the + CSS "font" property. + * [201228] Remove implicit margin on bullet lists when exporting to HTML. + * [240086] Fixed bug which caused floating objects which span several + pages to float into the second page of the document even when it's + the only existing object, causing the document to contain a blank + first page. + * [240325] Even with wrap mode set to Qt::TextWordWrap, the layout + would sometimes break outside word boundaries when floating objects + affected the width available to the text. - - QPen - * [QTBUG-2738] Made QPen::setDashOffset() work with non-custom dashed lines. + - QTextLayout + * [QTBUG-4468] Count tabs as multiple characters when applying a fixed + column width. + * [176401] Take into account the negative right bearing of the last + character in an item of text if the glyph extends beyond its ascent. - - QPushButton - * [255581] Fixed sizeHint recalculation bug. + - QToolTip + * Fixed a bug where tooltips were not shown in popups (Windows only). - - QRasterPaintEngine - * [QTBUG-4210] Fixed bug where bitmaps were painted black instead of in pen colour. + - QTreeView + * [234930] Be able to use :has-children and :has-sibillings in a stylesheet. + * [252616] Set QStyleOptionViewItemV4::OnlyOne flag when painting spanning + columns. + * [245654] Fixed expandAll when deleting and recreating a mode for the tree. + * [239271] Fixed missing update when adding a row when the first column is + hidden. + * [258225] Fixed scrollTo with center and bottom. - - QApplication - * [QTBUG-739] Removed internal widgets from QApplication::topLevelWidgets(). + - QTreeWidget + * [253109] Shows the widget when calling setItemWidget. + + - QWidget + * Added inputMethodHints property. + * [201649] Added QWidget::previousInFocusChain. + * [254563] Fixed a crash when setting focus in a widget tree that + contains invisible widgets. + * [QTBUG-5012] Fixed uninitialized background when using QWidget::render + with Qt::WA_NoSystemBackground and window opacity set. QtDBus - QDBusConnection - * Made sending of invalid/incomplete messages consistently fail - with error (no more assertions). - - - QPlainTextEdit - * Fixed crash when clicking on a text edit which was smaller than the - height of the font used. - - - QPrinter - * [QTBUG-4497] Removed redundant SetPen command in the postscript code - when reusing a QPrinter object. - - - QTextLayout - * [QTBUG-4468] Count tabs as multiple characters when applying a fixed - column width. - * [176401] Take into account the negative right bearing of the last - character in an item of text if the glyph extends beyond its ascent. - - - QTextDocument - * [207189] Support setting font size using short hand syntax in the - CSS "font" property. - * [201228] Remove implicit margin on bullet lists when exporting to - HTML. - * [240086] Fixed bug which caused floating objects which span several - pages to float into the second page of the document even when it's - the only existing object, causing the document to contain a blank - first page. - * [240325] Even when wrap mode is set to Qt::TextWordWrap, the layout - would sometimes break outside word boundaries when floating objects - affected the width available to the text. This has been fixed. - - - QFontEngine - * [QTBUG-2354] Support certain 'Microsoft' platform symbol fonts which - also contain a regular unicode table for exactly the symbol range of - code points. - - - QFontMetrics - * [176401] Account for right bearing in bounding rect. + * Made sending of invalid/incomplete messages consistently fail with error + (no more assertions). + * [249528/QTBUG-3833] Added an overload of connect() that allows one to + specify strings for matching arguments. - - QPlastiqueStyle - * [QTBUG-3555] Fixed a bug in the Plastique style that would cause an - ASSERT failure in QFont when the application font has a pixel size set. + - QDBusServiceWatcher + * New class; supports efficiently watching for a service to be created, + deleted or to change owners. QtNetwork - QAbstractSocket - * only disconnect from host when all bytes have been written + * Only disconnect from host when all bytes have been written. * New setSocketOption method. - QHttp @@ -396,42 +458,47 @@ QtNetwork * QHttp is now obsolete and replaced by QNetworkAccessManager. - QLocalServer - * fix timeout when waiting for a connection on Unix + * Fix timeout when waiting for a connection on Unix. - QNativeSocketEngine * Do not set the OS socket send and receive buffer size. The OS should auto tune these values for us. - QNetworkAcessManager - * [242916] add possibility to send HTTP DELETE requests + * [242916] Add possibility to send HTTP DELETE requests. * Connection count per HTTP server increased to 6 on Desktop, 3 on Symbian. * Optional HTTP pipelining support. * General HTTP performance improvements. - QNetworkReply - * [257322] add possibility to ignore specific SSL errors + * [257322] Add possibility to ignore specific SSL errors. * New isFinished() method. - QSslCertificate - * [251830] fix version() and serialNumber() methods + * [251830] Fix version() and serialNumber() methods. - QSslSocket - * [257322] add possibility to ignore specific SSL errors - * Fix build with openssl 1.0.0 betas + * [257322] Add possibility to ignore specific SSL errors. + * Fix build with openssl 1.0.0 betas. * Trigger a SSL transmission when reading from the socket. In certain cases the connection stalled when a buffer limit was used. QtOpenGL + - QGLColormap + * setEntry() was inserting entries instead of replacing them. + * Clarified documentation for isEmpty(). + + - QGLContext + * Fix RGB565 mode in bindTexture(). + * Map mipmaps work on OpenGL/ES 2.0 systems in bindTexture(). + * Improve performance of QGLContext::currentContext(). + - QGLFormat * Increase unit test coverage and fix some long-standing issues. * Improve performance of code that tests QGLFormat options. * operator==() now tests for equality on all fields. - - QGLColormap - * setEntry() was inserting entries instead of replacing them. - * Clarified documentation for isEmpty(). - - QGLFramebufferObject * Add support for the ARB_framebuffer_object, OES_framebuffer_object, and OES_packed_depth_stencil extensions. @@ -443,11 +510,6 @@ QtOpenGL - Improvements to context sharing and object cleanup logic. - - QGLContext - * Fix RGB565 mode in bindTexture(). - * Map mipmaps work on OpenGL/ES 2.0 systems in bindTexture(). - * Improve performance of QGLContext::currentContext(). - - QGLGradientCache * [249919] Clean up the gradient cache in the right context. @@ -457,42 +519,57 @@ QtOpenGL instered into the fragment "pipeline". * Fixed conical gradients. + - Added a static function, QGL::setPreferredPaintEngine(), to allow users + to set the preferred GL paint engine. + - Cleaned up usage of OpenGL extensions. QtOpenGL now uses the OpenGL 2.0 names of methods rather than using the EXT postfix. However, when resolving extensions, QtOpenGL will also try postfixing EXT if the OpenGL 2.0 name is not found. - - Fix QGLWidget::showFullscreen() on EGL platforms + - Fix QGLWidget::showFullscreen() on EGL platforms. - Added lots of OpenGL autotests. +QtScript + + - Many optimizations. + - Improved ECMA script compliance. + - New method, QScriptString::toArrayIndex(), for converting QScriptString + to a QtScript array index. + QtSql - * [QTBUG-3162] Views for Sql table models should not reset state on failed queries. - * [QTBUG-5251] Fix retrieval of SQL 'TIME' information for PostgreSQL. - * Better error checking for in case of failed query. - * [QTBUG-5179] Fixed Floating point number truncation in qsqlpsql plugin. - * [QTBUG-551] Fixed Oracle batchExec using strings as out params. - * Updated sqlite to 3.6.19 + readded our patches. - * [QTBUG-3736] ODBC: Retrieved in ascii, should be stored in ascii. - * Fixed issue with multiple lookups to same table/field in QSqlRelationalTableModel - * Updated documentation of setForwardOnly - * [QT-754] TDS: Fixed improper formatting of date values - * TDS: Fixed missing field/table name escaping. - * ODBC: Fixed setForwardOnly not being reset on when the query is reset. - * [QTBUG-4510] Add reconnection option to the mysql driver. - * [222678] Fixed QSqlTableModel: trying to delete the wrong row. - * Interbase: Fixed crash when calling numRows on unknown query type. - * DB2: Don't return an error when the table is just empty. - * [17327] Added OCI support for synonyms to tables created by another user. - * [176267] Fixed mysql driver not knowing the difference between tables and views. - * Fixed determination of end of ODBC string on deficient drivers. - * Added ability to open sqlite databases readonly. - * Fixed race condition on reopening an ODBC connection. - * Fixed invalid use of statics in the defaultCasing code. - * Fixed proper quoting under odbc. - * [252450 & 246125] Fixed failed queries due to MySql driver auto-preparing. - * QSqlDatabase now has a database level precisionPolicy. Queries now default to this. - * Add proper iODBC linking support. + + - [QTBUG-3162] Views for Sql table models should not reset state on failed + queries. + - [QTBUG-5251] Fix retrieval of SQL 'TIME' information for PostgreSQL. + - Better error checking in case of failed query. + - [QTBUG-5179] Fixed floating point number truncation in qsqlpsql plugin. + - [QTBUG-551] Fixed Oracle batchExec using strings as out params. + - Updated sqlite to 3.6.19 + readded our patches. + - [QTBUG-3736] ODBC: Retrieved in ascii, should be stored in ascii. + - Fixed issue with multiple lookups to same table/field in + QSqlRelationalTableModel. + - Updated documentation of setForwardOnly. + - [QT-754] TDS: Fixed improper formatting of date values. + - TDS: Fixed missing field/table name escaping. + - ODBC: Fixed setForwardOnly not being reset on when the query is reset. + - [QTBUG-4510] Add reconnection option to the mysql driver. + - [222678] Fixed QSqlTableModel: trying to delete the wrong row. + - Interbase: Fixed crash when calling numRows on unknown query type. + - DB2: Don't return an error when the table is just empty. + - [17327] Added OCI support for synonyms to tables created by another user. + - [176267] Fixed mysql driver not knowing the difference between tables and + views. + - Fixed determination of end of ODBC string on deficient drivers. + - Added ability to open sqlite databases readonly. + - Fixed race condition on reopening an ODBC connection. + - Fixed invalid use of statics in the defaultCasing code. + - Fixed proper quoting under odbc. + - [252450 & 246125] Fixed failed queries due to MySql driver auto-preparing. + - QSqlDatabase now has a database level precisionPolicy. Queries now default + to this. + - Add proper iODBC linking support. QtSvg @@ -501,26 +578,60 @@ QtSvg * [202426] Made attribute inheritance work with 'use' tags. * [250618] Fixed gradient on strokes. * [254040] Added support for 'vector-effect'. - + - QSvgPaintEngine * [257052] Changed drawImage() to ignore aspect ratio. +QtWebKit + + - Many bug fixes. + + - QWebElement + * New class; introduced to implement DOM like operations on a web page. + + - QWebFrame + * New properties for an URL and a focus management. + * New signals delivering current loading status. + + - QWebInspector + * New class for embedding the WebInspector as a QWidget + + - QWebHistory + * Streaming operators for saving and restoring QWebHistory's state. + + - QWebPage + * New property; preferredContentsSize for setting layout of the page in the + viewport. + * New slot; shouldInterruptJavaScript, called when JavaScript program is + running too long. + + - QWebSecurityOrigin: + * New functions for defining local URL schemes. + + - QWebSettings + * New options for text encoding, printing shrink factor and off-line web + application cache (HTML5). + + - QWebView + * Support for render hints. + QtXml - QDomDocument - * set the codec to UTF-8 if codec not present or unknown + * Set the codec to UTF-8 if codec not present or unknown. QtXmlPatterns - QXmlQuery - * [245219] Added QXmlQuery::setFocus(const QString &focus); + * [245219] Added QXmlQuery::setFocus(const QString &focus). Qt Plugins - Tiff plugin - * [258526] Rotate the image if the tiff file contains an orientation tag + * [258526] Rotate the image if the tiff file contains an orientation tag. * [254317] Add support for mono and indexed format + **************************************************************************** * Platform Specific Changes * **************************************************************************** @@ -549,31 +660,36 @@ Qt for Linux/X11 palette, usage of KColorDialog and KFileDialog) using the GuiPlatformPlugin - Fixed pasting the clipboard content to non-Qt application on X11 when the - requested format is image/ppm. Patch by Ritt.K + requested format is image/ppm. - - On X11 Qt now supports the _NET_WM_SYNC protocol. + - On X11, Qt now supports the _NET_WM_SYNC protocol. - - On X11 Qt now supports the SAVE_TARGET protocol that allows to keep + - On X11, Qt now supports the SAVE_TARGET protocol that allows to keep clipboard contents if the application that owns the clipboards exits - - [QTBUG-4652] On X11 clipboard content can be properly retrieved even when an - application asks the unsupported target. This fixes copying and pasting data - when using Synergy. + - [QTBUG-4652] On X11, clipboard content can be properly retrieved even when + an application asks for the unsupported target. This fixes copying and + pasting data when using Synergy. + - [MR#797] Fixed a crash when using QX11EmbedContainer/Widget on x86_64. + - [MR#1111] Emit workAreaResized when _NET_WORKAREA is changed on X11. - - - [QTBUG-3620] Fixed bug on X11 that caused bitmap fonts to become so small - it was unreadable when printed or presented in a print preview widget. + + - [QTBUG-3620] Fixed bug on X11 that caused bitmap fonts to become so small + it was unreadable when printed or presented in a print preview widget. - Improved EGL integration on X11 (including better visual selection). - - Support Qt::WA_TranslucentBackground on top-level QGLWidgets on X11, both + - Made Qt::WA_TranslucentBackground work in combination with native + child widgets. + + - Support Qt::WA_TranslucentBackground on top-level QGLWidgets on X11, both (EGL & glX). This allows OpenGL (& ES) rendering to semi-transparent widgets if a compositing window manager is running. - Support OpenGL texture_from_pixmap extension on X11 (EGL & glX) when calling QPainter::drawPixmap() with the OpenGL paint engine, or calling - QGLContext::bindTexture() on an X11 QPixmap. If the + QGLContext::bindTexture() on an X11 QPixmap. If the GLX_EXT_texture_from_pixmap or EGL_NOKIA_texture_from_pixmap extensions are present, Qt will attempt to use glXBindTexImageEXT or eglBindTexImage to bind the pixmap to a texture, rather than copying the pixel data. @@ -589,8 +705,8 @@ Qt for Linux/X11 event though the program is using the QEventLoop::ExcludeUserInputEvents flag. - - [255559] Fixed generation of XdndLeave events to include the - correct source id. + - [255559] Fixed generation of XdndLeave events to include the correct + source id. - [258319] Avoid division by zero on some Xlib/Xserver implementations. @@ -624,8 +740,8 @@ Qt for Windows - [251554] Fixed openUrl("mailto:") with Thunderbird on Windows. - [254501] QDestopServices now supports cyrillic file names. - Fixed an issue which prevents moving fixed size windows using titlebar. - - [258087] Fixed an issue on Vista which returns incorrect file paths when using - QFileDialog::getOpenFileNames() + - [258087] Fixed an issue on Vista which returns incorrect file paths when + using QFileDialog::getOpenFileNames() - [253763] Fixed a focus issue when using out-of-process ActiveQt controls. - [255912] Mouse move events will not be delivered to a blocked widget. - [225588] Enabled IME reconversion support. @@ -634,67 +750,75 @@ Qt for Windows * Now much more reliable when reading a file through a QIODevice. * If Video Mixing Renderer 9 is not available, falls back to software rendering. - * Fixed a flicker issue when switching source with a transition time of 0 + * Fixed a flicker issue when switching source with a transition time of 0. - - [QTBUG-4445] Fixed bug on Windows that caused problems when printing - text where several characters were represented by a single glyph, e.g. + - [QTBUG-4445] Fixed bug on Windows that caused problems when printing + text where several characters were represented by a single glyph, e.g. a double 't' with the Calibri font. - - - Added QSysInfo::WV_WINDOWS7 and QSysInfo::WV_6_1 + + - Added QSysInfo::WV_WINDOWS7 and QSysInfo::WV_6_1. + + - Changed QPrintDialog under Windows to use PrintDlgEx, instead of the old + deprecated PrintDlg call. Qt for Mac OS X --------------- - - Add support for GetURL events on Mac OS X - - [123740] Fixed an issue with dead keys on Mac (cocoa) on French keyboard layout. - - [252088] Drag Leave events will be delivered correctly on Cocoa. - - [257661] Cocoa now uses the correct line ending for clipboard plain text. - - [258438] Enabled Emacs style keyboard shortcuts. - - [258173] Fixed an issue which caused "whatsthis" pointer to flicked on Cocoa. - - [QTBUG-4418] Fixed maximizing and restoring a window on Mac. - -General changes on Mac OS X: - - Mac OS X version support: Support for 10.3(Panther) has been dropped, support for - 10.6(Snow Leopard) has been added. - - The Cocoa port now supports static linking. - - The Cocoa port now supports the Qt3Support library (with the exception of Q3FileDialog) - to ease the transition from Carbon to Cocoa. - - The Cocoa binary packages are now Intel only (universal i386 and x86_64). - - Snow Leopard notes: - - Gcc 4.2 is used by default. Configure with -platform macx-g++40 to select 4.0. - - Using the 10.4u SDK requires gcc 4.0. - - Configuring for the Cocoa port (-cocoa) produces 64-bit binaries by default. - Use the -arch flags to override. - - Building for ppc64 is no longer supported by the gcc tool chain. - - Building for ppc is still supported. - -Cocoa: -- Fixed stacking order of modal dialogs so that they never rearrange level, or - hide in the background. -- Fixed problem with plugins written with Qt that closes down the native application - when hiding a modal dialog. -- Fixed problem that native applications cannot quit when using plugins written with - Qt from a native application. -- Fixed problem that the menubar is not restored correctly when using plugins written - with Qt from a native application. -- The event dispatcher now integrates better with native applications that spins the - event loop them selves. -- Using Qt::AA_MacPluginApplication will now disable the use of native menubars on mac. -- Sliders and scroll views in Qt now uses pixel scrolling for mouse devices - that supports this. -- Wheel events can now contain a delta with a value as low as 1 for mouse devices that - uses pixel scrolling. + - General changes on Mac OS X: + * Mac OS X version support: Support for 10.3(Panther) has been dropped and + support for 10.6(Snow Leopard) has been added. + * The Cocoa port now supports static linking. + * The Cocoa port now supports the Qt3Support library (with the exception of + Q3FileDialog) to ease the transition from Carbon to Cocoa. + * The Cocoa binary packages are now Intel only (universal i386 and x86_64). + * Snow Leopard notes: + - Gcc 4.2 is used by default. Configure with -platform macx-g++40 to + select 4.0. + - Using the 10.4u SDK requires gcc 4.0. + - Configuring for the Cocoa port (-cocoa) produces 64-bit binaries by + default. Use the -arch flags to override. + - Building for ppc64 is no longer supported by the gcc tool chain. + - Building for ppc is still supported. + * Added support for GetURL events on Mac OS X. + + - General bug fixes: + * [123740] Fixed an issue with dead keys on Mac (cocoa) on French keyboard + layout. + * [258438] Enabled Emacs style keyboard shortcuts. + * [QTBUG-4418] Fixed maximizing and restoring a window. + + - Cocoa bug fixes: + * [252088] Drag Leave events will be delivered correctly on Cocoa. + * [257661] Cocoa now uses the correct line ending for clipboard plain text. + * [258173] Fixed an issue which caused "whatsthis" pointer to flicker. + * Fixed some warnings that might get printed when reparenting QGLWidget. + * Fixed stacking order of modal dialogs so that they never rearrange level, + or hide in the background. + * Fixed problem with plugins written with Qt that closes down the native + application when hiding a modal dialog. + * Fixed problem that native applications cannot quit when using plugins + written with Qt from a native application. + * Fixed problem that the menubar is not restored correctly when using + plugins written with Qt from a native application. + * The event dispatcher now integrates better with native applications that + spin the event loop themselves. + * Using Qt::AA_MacPluginApplication will now disable the use of native + menubars on Mac. + * Sliders and scroll views in Qt now use pixel scrolling for mouse devices + that support this. + * Wheel events can now contain a delta with a value as low as 1 for mouse + devices that use pixel scrolling. Qt for Embedded Linux --------------------- -- Added QMAKE_LIBS_OPENGL_ES1, QMAKE_LIBS_OPENGL_ES1CL and - QMAKE_LIBS_OPENGL_ES2 qmake variables for specifying OpenGL ES - specific libraries. + - Added QMAKE_LIBS_OPENGL_ES1, QMAKE_LIBS_OPENGL_ES1CL and + QMAKE_LIBS_OPENGL_ES2 qmake variables for specifying OpenGL ES + specific libraries. -- Compilation fixes for OpenGL/ES 1.0 and OpenGL/ES 1.1 Common Lite. + - Compilation fixes for OpenGL/ES 1.0 and OpenGL/ES 1.1 Common Lite. -- EGL and OpenGL/ES + - EGL and OpenGL/ES * Protect the use of version-specific EGL symbols with #ifdef's. * Make sure an EGL context is current when resolving GL extensions. * Introduce "lazyDoneCurrent" for optimizing context switching in @@ -706,27 +830,38 @@ Qt for Embedded Linux * Fix detection of pbuffers on OpenGL/ES systems. * EGL_SAMPLES was being set to the wrong value for multisampled surfaces. -- PowerVR + - PowerVR * Make the code better at detecting MBX vs SGX header files. * Fix 32-bit screen support - some code was still assuming 16-bit. * Stop GL window surfaces double-flushing their contents. * Remove surface holder, which never worked all that well. * Implement screen rotations. -- Remove obsolete OpenGL/ES screen drivers: hybrid, ahigl. + - Mouse and keyboard drivers + * Removed obsolete drivers (vr41xx, yopy, sl5000, bus mouse). + * Added a new LinuxInput driver for both mouse and keyboard. + * Added keymap support for QWS via standard Linux .kmap files. + (complete with dead-keys, compose-key and LED handling). + + - Remove obsolete OpenGL/ES screen drivers: hybrid, ahigl. -- Send enter/leave events also to child widgets + - Send enter/leave events also to child widgets. -- Fix crash when instantiating multiple QApplications + - Fix crash when instantiating multiple QApplications. -- Optimize software cursor by using native image format instead of 8-bit + - Optimize software cursor by using native image format instead of 8-bit. -- [255828] Avoid window decoration flicker on show + - [255828] Avoid window decoration flicker on show. -- [255495] Fix blend function crash on AVR32 + - [255495] Fix blend function crash on AVR32. + + - Fix qconfig configurations. + + - Add powerpc mkspec and remove "empty" ppc mkspec . Qt for Windows CE ----------------- + - On Windows CE the link time code generation has been disabled by default to be consistent with win32-msvc200x. - The default button size has been reduced in the Windows mobile style. @@ -738,32 +873,59 @@ Qt for Windows CE - [257352] When configuring Qt for Windows CE, configure points the user to setcepaths, when its done. - [259850] Added a makespec template for Windows CE 6. - + - Fixed the hardcoded GL library names for Windows CE. + **************************************************************************** * Tools * **************************************************************************** -- Designer + - Designer + * [233683] Promoted Widgets are now stored correctly in scratchpad. + * [249823] Added search functionality to the resource browser. + * [254282] Enabled the use of promoted widgets in form templates. + * [254824] Made it possible to override the createAction()/createWidget() + functions of QUiLoader. + * [256332] Enabled deleting all pages of a QTabWidget or QStackedWidget. + * [259238] Fixed menubar/menu editing in right-to-left mode. + * [259918] Fixed setting of object names for container pages not to use + localized strings. + * [260658] Fixed saving of alpha values set in the palette editor. + * It is now possible to further specify the kind of custom widget string + properties using XML tags. + + - uic + * [260784] Generated code for retranslateUi doesn't cause compiler warnings + anymore. + + - uic3 + * [128859] Fixed code generation of QLabel's wordWrap property. + + - qdoc3 + * Changed qdoc3 binary to be in bin/ instead of a platform specific location. + + - Linguist + * Linguist GUI: Experimental support for editing multi-length strings. + * lupdate is now again the only tool which can parse program code. + * lupdate + - Actually guess the target language from the file name. + - Make -{source,target}-language actually override values from files. + - C++ parser + * Properly support "using namespace", etc. + * Remove the obsolete TRANSLATOR hack relating to "using namespace". + * Support attaching meta data to translatable message. + * Actually use the argument of Q_DECLARE_TR_FUNCTION. + * Optimization. + * Bug fixes and robustness improvements. + * lrelease + - Add -markuntranslated <prefix> option. + * Both lupdate & lrelease + - Accuracy improvements of the qmake .pro file parser. + - Support for ID-based translations. Somewhat experimental. + * lconvert + - Add --sort-contexts option. + - Add --locations option (complementing lupdate). + - Add --no-ui-lines option (complementing lupdate). - - [233683] Promoted Widgets are now stored correctly in scratchpad. - - [249823] Added search functionality to the resource browser. - - [254282] Enabled the use of promoted widgets in form templates. - - [254824] Made it possible to override the createAction()/createWidget() - functions of QUiLoader. - - [256332] Enabled deleting all pages of a QTabWidget or QStackedWidget. - - [259238] Fixed menubar/menu editing in right-to-left mode. - - [259918] Fixed setting of object names for container pages not to use - localized strings. - - [260658] Fixed saving of alpha values set in the palette editor. - - It is now possible to further specify the kind of custom widget - string properties using XML tags. - -- uic3 - - - [128859] Fixed code generation of QLabel's wordWrap property. - - - lupdate - - Fixed a bug in the java source code parser. **************************************************************************** * DirectFB * @@ -805,9 +967,7 @@ Qt for Windows CE most boards and loading these images will generally require an image conversion anyway. - - Fix a bug regarding QGraphicsProxyWidgets - - - Fix a crash when resizing windows + - Fix a crash when resizing windows. - Compile with versions < 1.0. We still recommend using newer versions. @@ -870,7 +1030,7 @@ Qt for Windows CE - QDesktopWidget on X11 no longer emits the resized(int) signal when screens are added or removed. This was not done on other platforms. Use the - screenCountChanged signal instead + screenCountChanged signal instead. - QUrl's parser is more strict when for hostnames in URLs. QUrl now enforces STD 3 rules: @@ -886,7 +1046,7 @@ Qt for Windows CE before, but weren't interpreted as such. - The Unix configure-time check for STL is stricter now in Qt - 4.6.0. This means some legacy STL implementations may fail to pass + 4.6. This means some legacy STL implementations may fail to pass the test and, therefore, Qt will automatically disable STL support. This is a binary-compatible change: existing code will continue to @@ -915,16 +1075,31 @@ Qt for Windows CE if those are set. This matches the behavior on the other platforms. - The Animation Framework - * currentTime() now returns the complete current time including previous loops - * currentLoopTime() returns the time inside the current loop - * stateChanged signal sends the new state as first parameter and old state as - the second - * QAnimationGroup::clearAnimations() has been renames to clear() - * QAnimationGroup::insertAnimationAt() has been renames to insertAnimation() - * QAnimationGroup::takeAnimationAt() has been renames to takeAnimation() - * QSequentialAnimationGroup::insertPauseAt() has been renames to insertPause() + * currentTime() now returns the complete current time including previous + loops. + * currentLoopTime() returns the time inside the current loop. + * stateChanged signal sends the new state as first parameter and old state + as the second. + * QAnimationGroup::clearAnimations() has been renamed to clear(). + * QAnimationGroup::insertAnimationAt() has been renamed to + insertAnimation(). + * QAnimationGroup::takeAnimationAt() has been renamed to takeAnimation(). + * QSequentialAnimationGroup::insertPauseAt() has been renamed to + insertPause(). + * [QT-941] Avoids timer ticks when there are only pause animations running. - Refactoring in OpenGL examples to improve portability and utilize the Animation framework for animation. The hellogl and overpainting examples now compile on OpenGL/ES 1.1. Also common code is factored. +- Changed QWebFrame::setHtml() and setContent() to not affect the back/forward + and the session history. + +- qmake no longer adds Qt internal dependencies to the linker when Qt + is built in shared mode (not static). This means that applications + that made use of platform-specific API may need to adjust the LIBS + variable in their .pro files to match: + + X11: LIBS += -lX11 + Mac: LIBS += -framework AppKit -framework Carbon + diff --git a/doc/src/images/graphicseffect-bloom.png b/doc/src/images/graphicseffect-bloom.png Binary files differdeleted file mode 100644 index dace7eb..0000000 --- a/doc/src/images/graphicseffect-bloom.png +++ /dev/null diff --git a/doc/src/images/graphicseffect-effects.png b/doc/src/images/graphicseffect-effects.png Binary files differdeleted file mode 100644 index 609bef9..0000000 --- a/doc/src/images/graphicseffect-effects.png +++ /dev/null diff --git a/doc/src/images/graphicseffect-grayscale.png b/doc/src/images/graphicseffect-grayscale.png Binary files differdeleted file mode 100644 index 8b6e5c6..0000000 --- a/doc/src/images/graphicseffect-grayscale.png +++ /dev/null diff --git a/doc/src/images/graphicseffect-pixelize.png b/doc/src/images/graphicseffect-pixelize.png Binary files differdeleted file mode 100644 index 57a0057..0000000 --- a/doc/src/images/graphicseffect-pixelize.png +++ /dev/null diff --git a/doc/src/images/hoverevents.png b/doc/src/images/hoverevents.png Binary files differnew file mode 100644 index 0000000..ccc079b --- /dev/null +++ b/doc/src/images/hoverevents.png diff --git a/doc/src/platforms/supported-platforms.qdoc b/doc/src/platforms/supported-platforms.qdoc index 302ecb4..560ddfe 100644 --- a/doc/src/platforms/supported-platforms.qdoc +++ b/doc/src/platforms/supported-platforms.qdoc @@ -86,7 +86,7 @@ \row \o Apple Mac OS X 10.5 "Leopard" x86_64 (Carbon, Cocoa 32 and 64bit) \o As provided by Apple \row \o Embedded Linux QWS (ARM) - \o gcc (\l{http:\\www.codesourcery.com}{Codesourcery version)} + \o gcc (\l{http://www.codesourcery.com/}{Codesourcery version)} \row \o Windows CE 5.0 (ARMv4i, x86, MIPS) \o MSVC 2005 WinCE 5.0 Standard (x86, pocket, smart, mipsii) \row \o Symbian (S60 3.1, 3.2 and 5.0) @@ -125,7 +125,7 @@ \row \o Linux \o Intel Compiler \row \o Embedded Linux QWS (Mips, PowerPC) - \o gcc (\l{http:\\www.codesourcery.com}{Codesourcery version)} + \o gcc (\l{http://www.codesourcery.com/}{Codesourcery version)} \row \o Embedded Linux X11 (ARM) \o gcc (\l{http://www.scratchbox.org/}{Scratchbox)} \row \o Windows CE 6.0 (ARMv4i, x86, MIPS) diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index 4911426..2f74451 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -608,19 +608,19 @@ \section1 Graphics Effects Effects can be used to alter the appearance of UI elements such as - \l{QGraphicsItem}s and \l{QWidget}s. A range of standard effects such - as blurring, colorizing or blooming is provided, and it is possible to - implement custom effects. + \l{QGraphicsItem}s and \l{QWidget}s. A couple of standard effects such + as blurring, colorizing and drop shadow are provided, and it is + possible to implement custom effects. \table \row - \o - \o \img graphicseffect-plain.png - \o + \o{2,1} \img graphicseffect-plain.png \row \o \img graphicseffect-blur.png \o \img graphicseffect-colorize.png - \o \img graphicseffect-bloom.png + \row + \o \img graphicseffect-opacity.png + \o \img graphicseffect-drop-shadow.png \endtable See the QGraphicsEffect class documentation for more information. diff --git a/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp b/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp index 35689f4..5ef6609 100644 --- a/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp +++ b/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp @@ -40,11 +40,11 @@ ****************************************************************************/ //! [0] -MyGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *source) +MyGraphicsOpacityEffect::draw(QPainter *painter) { // Fully opaque; draw directly without going through a pixmap. if (qFuzzyCompare(m_opacity, 1)) { - source->draw(painter); + drawSource(painter); return; } ... @@ -52,18 +52,18 @@ MyGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *source) //! [0] //! [1] -MyGraphicsEffect::draw(QPainter *painter, QGraphicsEffectSource *source) +MyGraphicsEffect::draw(QPainter *painter) { ... QPoint offset; - if (source->isPixmap()) { + if (sourceIsPixmap()) { // No point in drawing in device coordinates (pixmap will be scaled anyways). - const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset); + const QPixmap pixmap = sourcePixmap(Qt::LogicalCoordinates, &offset); ... painter->drawPixmap(offset, pixmap); } else { // Draw pixmap in device coordinates to avoid pixmap scaling; - const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); + const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset); painter->setWorldTransform(QTransform()); ... painter->drawPixmap(offset, pixmap); diff --git a/examples/effects/blurpicker/blureffect.cpp b/examples/effects/blurpicker/blureffect.cpp index 9046cbd..956637d 100644 --- a/examples/effects/blurpicker/blureffect.cpp +++ b/examples/effects/blurpicker/blureffect.cpp @@ -62,8 +62,8 @@ QRectF BlurEffect::boundingRect() const return QGraphicsBlurEffect::boundingRect(); } -void BlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source) +void BlurEffect::draw(QPainter *painter) { adjustForItem(); - QGraphicsBlurEffect::draw(painter, source); + QGraphicsBlurEffect::draw(painter); } diff --git a/examples/effects/blurpicker/blureffect.h b/examples/effects/blurpicker/blureffect.h index 6cfa55a..3d1d433 100644 --- a/examples/effects/blurpicker/blureffect.h +++ b/examples/effects/blurpicker/blureffect.h @@ -54,7 +54,7 @@ public: QRectF boundingRect() const; - void draw(QPainter *painter, QGraphicsEffectSource *source); + void draw(QPainter *painter); private: void adjustForItem(); diff --git a/examples/effects/customshader/blureffect.cpp b/examples/effects/customshader/blureffect.cpp index 9046cbd..956637d 100644 --- a/examples/effects/customshader/blureffect.cpp +++ b/examples/effects/customshader/blureffect.cpp @@ -62,8 +62,8 @@ QRectF BlurEffect::boundingRect() const return QGraphicsBlurEffect::boundingRect(); } -void BlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source) +void BlurEffect::draw(QPainter *painter) { adjustForItem(); - QGraphicsBlurEffect::draw(painter, source); + QGraphicsBlurEffect::draw(painter); } diff --git a/examples/effects/customshader/blureffect.h b/examples/effects/customshader/blureffect.h index 6cfa55a..3d1d433 100644 --- a/examples/effects/customshader/blureffect.h +++ b/examples/effects/customshader/blureffect.h @@ -54,7 +54,7 @@ public: QRectF boundingRect() const; - void draw(QPainter *painter, QGraphicsEffectSource *source); + void draw(QPainter *painter); private: void adjustForItem(); diff --git a/src/3rdparty/ce-compat/ce_time.cpp b/src/3rdparty/ce-compat/ce_time.c index 92efae0..92efae0 100644 --- a/src/3rdparty/ce-compat/ce_time.cpp +++ b/src/3rdparty/ce-compat/ce_time.c diff --git a/src/3rdparty/ce-compat/ce_time.h b/src/3rdparty/ce-compat/ce_time.h index 9d946e8..07ca094 100644 --- a/src/3rdparty/ce-compat/ce_time.h +++ b/src/3rdparty/ce-compat/ce_time.h @@ -2,15 +2,24 @@ #define __CE_TIME_H__ #if defined(_WIN32_WCE) && _WIN32_WCE >= 0x600 -// we need to prototype the time functions for Windows CE >= 6.0 +/* we need to prototype the time functions for Windows CE >= 6.0 */ #include <crtdefs.h> +#ifdef __cplusplus +extern "C" { +#endif + struct tm; time_t time(time_t* timer); time_t mktime(struct tm *t); size_t strftime(char * const s, const size_t maxsize, const char * const format, const struct tm * const t); struct tm *localtime(const time_t *timer); -#endif +#ifdef __cplusplus +} /* closing brace for extern "C" */ #endif + +#endif /* defined(_WIN32_WCE) && _WIN32_WCE >= 0x600 */ + +#endif /* !defined(__CE_TIME_H__) */ diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri index 2330de1..ea6e5ab 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri @@ -59,7 +59,8 @@ win32-* { } wince* { - SOURCES += $$QT_SOURCE_TREE/src/3rdparty/ce-compat/ce_time.cpp + INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/ce-compat + SOURCES += $$QT_SOURCE_TREE/src/3rdparty/ce-compat/ce_time.c DEFINES += WINCEBASIC } diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h index 73212db..2a407d4 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h @@ -367,6 +367,10 @@ # endif #endif +#if PLATFORM(WINCE) && PLATFORM(QT) +# include <ce_time.h> +#endif + /* Compiler */ /* COMPILER(MSVC) */ @@ -561,7 +565,7 @@ #define HAVE_SYS_TIME_H 1 #define HAVE_SYS_TIMEB_H 1 -#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !PLATFORM(IPHONE) +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !PLATFORM(IPHONE) && !PLATFORM(QT) #define HAVE_MADV_FREE_REUSE 1 #define HAVE_MADV_FREE 1 #define HAVE_PTHREAD_SETNAME_NP 1 diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri index eb26664..8bd4225 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri @@ -61,7 +61,8 @@ win32-* { } wince* { - SOURCES += $$QT_SOURCE_TREE/src/3rdparty/ce-compat/ce_time.cpp + INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/ce-compat + SOURCES += $$QT_SOURCE_TREE/src/3rdparty/ce-compat/ce_time.c DEFINES += WINCEBASIC } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h index 7632435..7bfde5b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h @@ -372,6 +372,10 @@ # endif #endif +#if PLATFORM(WINCE) && PLATFORM(QT) +# include <ce_time.h> +#endif + /* Compiler */ /* COMPILER(MSVC) */ @@ -556,7 +560,7 @@ #define HAVE_SYS_TIME_H 1 #define HAVE_SYS_TIMEB_H 1 -#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !PLATFORM(IPHONE) +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !PLATFORM(IPHONE) && !PLATFORM(QT) #define HAVE_MADV_FREE_REUSE 1 #define HAVE_MADV_FREE 1 #define HAVE_PTHREAD_SETNAME_NP 1 diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h index bcd8744..5ad72e4 100644 --- a/src/corelib/io/qsettings_p.h +++ b/src/corelib/io/qsettings_p.h @@ -62,6 +62,7 @@ #ifndef QT_NO_QOBJECT #include "private/qobject_p.h" #endif +#include "private/qscopedpointer_p.h" #ifdef Q_OS_WIN #include "QtCore/qt_windows.h" diff --git a/src/corelib/kernel/qfunctions_wince.h b/src/corelib/kernel/qfunctions_wince.h index f7ca195..ad9d3a1 100644 --- a/src/corelib/kernel/qfunctions_wince.h +++ b/src/corelib/kernel/qfunctions_wince.h @@ -192,7 +192,11 @@ int qt_wince__rmdir(const char *dirname); int qt_wince__access( const char *path, int pmode ); int qt_wince__rename( const char *oldname, const char *newname ); int qt_wince__remove( const char *name ); +#ifdef __cplusplus +int qt_wince_open( const char *filename, int oflag, int pmode = 0 ); +#else int qt_wince_open( const char *filename, int oflag, int pmode ); +#endif int qt_wince_stat( const char *path, struct stat *buffer ); int qt_wince__fstat( int handle, struct stat *buffer); diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index b433723..c40b3cf 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -209,70 +209,6 @@ private: Q_DISABLE_COPY(QScopedArrayPointer) }; -/* Internal helper class - exposes the data through data_ptr (legacy from QShared). - Required for some internal Qt classes, do not use otherwise. */ -template <typename T, typename Cleanup = QScopedPointerDeleter<T> > -class QCustomScopedPointer : public QScopedPointer<T, Cleanup> -{ -public: - explicit inline QCustomScopedPointer(T *p = 0) - : QScopedPointer<T, Cleanup>(p) - { - } - - inline T *&data_ptr() - { - return this->d; - } - -private: - Q_DISABLE_COPY(QCustomScopedPointer) -}; - -/* Internal helper class - a handler for QShared* classes, to be used in QCustomScopedPointer */ -template <typename T> -class QScopedPointerSharedDeleter -{ -public: - static inline void cleanup(T *d) - { - if (d && !d->ref.deref()) - delete d; - } -}; - -/* Internal. - This class is basically a scoped pointer pointing to a ref-counted object - */ -template <typename T> -class QScopedSharedPointer : public QCustomScopedPointer<T, QScopedPointerSharedDeleter<T> > -{ -public: - explicit inline QScopedSharedPointer(T *p = 0) - : QCustomScopedPointer<T, QScopedPointerSharedDeleter<T> >(p) - { - } - - inline void detach() - { - qAtomicDetach(this->d); - } - - inline void assign(T *other) - { - if (this->d == other) - return; - if (other) - other->ref.ref(); - T *oldD = this->d; - this->d = other; - QScopedPointerSharedDeleter<T>::cleanup(oldD); - } - -private: - Q_DISABLE_COPY(QScopedSharedPointer) -}; - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/tools/qscopedpointer_p.h b/src/corelib/tools/qscopedpointer_p.h new file mode 100644 index 0000000..b1636d5 --- /dev/null +++ b/src/corelib/tools/qscopedpointer_p.h @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of internal files. This header file may change from version to version +// without notice, or even be removed. +// +// We mean it. +// + +#ifndef QSCOPEDPOINTER_P_H +#define QSCOPEDPOINTER_P_H + +#include "QtCore/qscopedpointer.h" + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE +QT_MODULE(Core) + + +/* Internal helper class - exposes the data through data_ptr (legacy from QShared). + Required for some internal Qt classes, do not use otherwise. */ +template <typename T, typename Cleanup = QScopedPointerDeleter<T> > +class QCustomScopedPointer : public QScopedPointer<T, Cleanup> +{ +public: + explicit inline QCustomScopedPointer(T *p = 0) + : QScopedPointer<T, Cleanup>(p) + { + } + + inline T *&data_ptr() + { + return this->d; + } + +private: + Q_DISABLE_COPY(QCustomScopedPointer) +}; + +/* Internal helper class - a handler for QShared* classes, to be used in QCustomScopedPointer */ +template <typename T> +class QScopedPointerSharedDeleter +{ +public: + static inline void cleanup(T *d) + { + if (d && !d->ref.deref()) + delete d; + } +}; + +/* Internal. + This class is basically a scoped pointer pointing to a ref-counted object + */ +template <typename T> +class QScopedSharedPointer : public QCustomScopedPointer<T, QScopedPointerSharedDeleter<T> > +{ +public: + explicit inline QScopedSharedPointer(T *p = 0) + : QCustomScopedPointer<T, QScopedPointerSharedDeleter<T> >(p) + { + } + + inline void detach() + { + qAtomicDetach(this->d); + } + + inline void assign(T *other) + { + if (this->d == other) + return; + if (other) + other->ref.ref(); + T *oldD = this->d; + this->d = other; + QScopedPointerSharedDeleter<T>::cleanup(oldD); + } + +private: + Q_DISABLE_COPY(QScopedSharedPointer) +}; + + +QT_END_NAMESPACE +QT_END_HEADER + +#endif diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 007b763..3406e41 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -44,7 +44,8 @@ HEADERS += \ tools/qunicodetables_p.h \ tools/qvarlengtharray.h \ tools/qvector.h \ - tools/qscopedpointer.h + tools/qscopedpointer.h \ + tools/qscopedpointer_p.h SOURCES += \ diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 568ff73..3fca319 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -67,7 +67,17 @@ \o QGraphicsOpacityEffect - renders the item with an opacity \endlist - \img graphicseffect-effects.png + \table + \row + \o{2,1} \img graphicseffect-plain.png + \row + \o \img graphicseffect-blur.png + \o \img graphicseffect-colorize.png + \row + \o \img graphicseffect-opacity.png + \o \img graphicseffect-drop-shadow.png + \endtable + \img graphicseffect-widget.png For more information on how to use each effect, refer to the specific @@ -76,24 +86,21 @@ To create your own custom effect, create a subclass of QGraphicsEffect (or any other existing effects) and reimplement the virtual function draw(). This function is called whenever the effect needs to redraw. The draw() - function accepts two arguments: the painter and a pointer to the source - (QGraphicsEffectSource). The source provides extra context information, - such as a pointer to the item that is rendering the effect, any cached - pixmap data, or the device rectangle bounds. For more information, refer to - the documenation for draw(). To obtain a pointer to the current source, - simply call source(). + function takes the painter with which to draw as an argument. For more + information, refer to the documenation for draw(). In the draw() function + you can call sourcePixmap() to get a pixmap of the graphics effect source + which you can then process. If your effect changes, use update() to request for a redraw. If your custom effect changes the bounding rectangle of the source, e.g., a radial glow effect may need to apply an extra margin, you can reimplement the - virtual boundingRectFor() function, and call updateBoundingRect() to notify - the framework whenever this rectangle changes. The virtual - sourceBoundingRectChanged() function is called to notify the effects that - the source's bounding rectangle has changed - e.g., if the source is a + virtual boundingRectFor() function, and call updateBoundingRect() + to notify the framework whenever this rectangle changes. The virtual + sourceChanged() function is called to notify the effects that + the source has changed in some way - e.g., if the source is a QGraphicsRectItem and its rectangle parameters have changed. - \sa QGraphicsItem::setGraphicsEffect(), QWidget::setGraphicsEffect(), - QGraphicsEffectSource + \sa QGraphicsItem::setGraphicsEffect(), QWidget::setGraphicsEffect() */ #include "qgraphicseffect_p.h" @@ -112,10 +119,10 @@ QT_BEGIN_NAMESPACE /*! + \internal \class QGraphicsEffectSource \brief The QGraphicsEffectSource class represents the source on which a QGraphicsEffect is installed on. - \since 4.6 When a QGraphicsEffect is installed on a QGraphicsItem, for example, this class will act as a wrapper around QGraphicsItem. Then, calling update() is @@ -154,20 +161,13 @@ QGraphicsEffectSource::~QGraphicsEffectSource() {} /*! - Returns the bounds of the current painter's device. - - This function is useful when you want to draw something in device - coordinates and ensure the size of the pixmap is not bigger than the size - of the device. - - Calling QGraphicsEffectSource::pixmap(Qt::DeviceCoordinates) always returns - a pixmap which is bound to the device's size. + Returns the bounding rectangle of the source mapped to the given \a system. - \sa pixmap() + \sa draw() */ -QRect QGraphicsEffectSource::deviceRect() const +QRectF QGraphicsEffectSource::boundingRect(Qt::CoordinateSystem system) const { - return d_func()->deviceRect(); + return d_func()->boundingRect(system); } /*! @@ -175,9 +175,12 @@ QRect QGraphicsEffectSource::deviceRect() const \sa draw() */ -QRectF QGraphicsEffectSource::boundingRect(Qt::CoordinateSystem system) const +QRectF QGraphicsEffect::sourceBoundingRect(Qt::CoordinateSystem system) const { - return d_func()->boundingRect(system); + Q_D(const QGraphicsEffect); + if (d->source) + return d->source->boundingRect(system); + return QRectF(); } /*! @@ -218,10 +221,6 @@ const QStyleOption *QGraphicsEffectSource::styleOption() const This function should only be called from QGraphicsEffect::draw(). - For example: - - \snippet doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp 0 - \sa QGraphicsEffect::draw() */ void QGraphicsEffectSource::draw(QPainter *painter) @@ -246,6 +245,24 @@ void QGraphicsEffectSource::draw(QPainter *painter) } /*! + Draws the source directly using the given \a painter. + + This function should only be called from QGraphicsEffect::draw(). + + For example: + + \snippet doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp 0 + + \sa QGraphicsEffect::draw() +*/ +void QGraphicsEffect::drawSource(QPainter *painter) +{ + Q_D(const QGraphicsEffect); + if (d->source) + d->source->draw(painter); +} + +/*! Schedules a redraw of the source. Call this function whenever the source needs to be redrawn. @@ -271,6 +288,19 @@ bool QGraphicsEffectSource::isPixmap() const } /*! + Returns true if the source effectively is a pixmap, e.g., a + QGraphicsPixmapItem. + + This function is useful for optimization purposes. For instance, there's no + point in drawing the source in device coordinates to avoid pixmap scaling + if this function returns true - the source pixmap will be scaled anyways. +*/ +bool QGraphicsEffect::sourceIsPixmap() const +{ + return source() ? source()->isPixmap() : false; +} + +/*! Returns a pixmap with the source painted into it. The \a system specifies which coordinate system to be used for the source. @@ -283,15 +313,15 @@ bool QGraphicsEffectSource::isPixmap() const The returned pixmap is bound to the current painter's device rectangle when \a system is Qt::DeviceCoordinates. - \sa QGraphicsEffect::draw(), boundingRect(), deviceRect() + \sa QGraphicsEffect::draw(), boundingRect() */ -QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offset, PixmapPadMode mode) const +QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offset, QGraphicsEffect::PixmapPadMode mode) const { Q_D(const QGraphicsEffectSource); // Shortcut, no cache for childless pixmap items... const QGraphicsItem *item = graphicsItem(); - if (system == Qt::LogicalCoordinates && mode == NoExpandPadMode && item && isPixmap()) { + if (system == Qt::LogicalCoordinates && mode == QGraphicsEffect::NoPad && item && isPixmap()) { return ((QGraphicsPixmapItem *) item)->pixmap(); } @@ -320,6 +350,27 @@ QPixmap QGraphicsEffectSource::pixmap(Qt::CoordinateSystem system, QPoint *offse return pm; } +/*! + Returns a pixmap with the source painted into it. + + The \a system specifies which coordinate system to be used for the source. + The optional \a offset parameter returns the offset where the pixmap should + be painted at using the current painter. For control on how the pixmap is + padded use the \a mode parameter. + + The returned pixmap is clipped to the current painter's device rectangle when + \a system is Qt::DeviceCoordinates. + + \sa draw(), boundingRect() +*/ +QPixmap QGraphicsEffect::sourcePixmap(Qt::CoordinateSystem system, QPoint *offset, QGraphicsEffect::PixmapPadMode mode) const +{ + Q_D(const QGraphicsEffect); + if (d->source) + return d->source->pixmap(system, offset, mode); + return QPixmap(); +} + QGraphicsEffectSourcePrivate::~QGraphicsEffectSourcePrivate() { invalidateCache(); @@ -327,7 +378,7 @@ QGraphicsEffectSourcePrivate::~QGraphicsEffectSourcePrivate() void QGraphicsEffectSourcePrivate::invalidateCache(bool effectRectChanged) const { - if (effectRectChanged && m_cachedMode != QGraphicsEffectSource::ExpandToEffectRectPadMode) + if (effectRectChanged && m_cachedMode != QGraphicsEffect::PadToEffectiveBoundingRect) return; QPixmapCache::remove(m_cacheKey); } @@ -359,9 +410,9 @@ QGraphicsEffect::~QGraphicsEffect() } /*! - Returns the bounding rectangle for this effect, i.e., the bounding - rectangle of the source, adjusted by any margins applied by the effect - itself. + Returns the effective bounding rectangle for this effect, i.e., the + bounding rectangle of the source, adjusted by any margins applied by + the effect itself. \sa boundingRectFor(), updateBoundingRect() */ @@ -374,12 +425,13 @@ QRectF QGraphicsEffect::boundingRect() const } /*! - Returns the bounding rectangle for this effect, given the provided source - \a rect. When writing you own custom effect, you must call - updateBoundingRect() whenever any parameters are changed that may cause - this this function to return a different value. + Returns the effective bounding rectangle for this effect, given the + provided \a rect in the source's coordinate space. When writing + you own custom effect, you must call updateBoundingRect() whenever any + parameters are changed that may cause this this function to return a + different value. - \sa boundingRect() + \sa sourceBoundingRect() */ QRectF QGraphicsEffect::boundingRectFor(const QRectF &rect) const { @@ -445,6 +497,8 @@ void QGraphicsEffect::update() } /*! + \internal + Returns a pointer to the source, which provides extra context information that can be useful for the effect. @@ -464,7 +518,7 @@ QGraphicsEffectSource *QGraphicsEffect::source() const This function will call update() if this is necessary. - \sa boundingRectFor(), boundingRect() + \sa boundingRectFor(), boundingRect(), sourceBoundingRect() */ void QGraphicsEffect::updateBoundingRect() { @@ -476,15 +530,13 @@ void QGraphicsEffect::updateBoundingRect() } /*! - \fn virtual void QGraphicsEffect::draw(QPainter *painter, - QGraphicsEffectSource *source) = 0 + \fn virtual void QGraphicsEffect::draw(QPainter *painter) = 0 This pure virtual function draws the effect and is called whenever the - source() needs to be drawn. + source needs to be drawn. Reimplement this function in a QGraphicsEffect subclass to provide the - effect's drawing implementation, using \a painter. The \a source parameter - is provided for convenience; its value is the same as source(). + effect's drawing implementation, using \a painter. For example: @@ -492,8 +544,6 @@ void QGraphicsEffect::updateBoundingRect() This function should not be called explicitly by the user, since it is meant for reimplementation purposes only. - - \sa QGraphicsEffectSource */ /*! @@ -509,6 +559,20 @@ void QGraphicsEffect::updateBoundingRect() */ /*! + \enum QGraphicsEffect::PixmapPadMode + + This enum describes how the pixmap returned from sourcePixmap should be + padded. + + \value NoPad The pixmap should not receive any additional + padding. + \value PadToTransparentBorder The pixmap should be padded + to ensure it has a completely transparent border. + \value PadToEffectiveBoundingRect The pixmap should be padded to + match the effective bounding rectangle of the effect. +*/ + +/*! This virtual function is called by QGraphicsEffect to notify the effect that the source has changed. If the effect applies any cache, then this cache must be purged in order to reflect the new appearance of the source. @@ -615,26 +679,25 @@ void QGraphicsColorizeEffect::setStrength(qreal strength) /*! \reimp */ -void QGraphicsColorizeEffect::draw(QPainter *painter, QGraphicsEffectSource *source) +void QGraphicsColorizeEffect::draw(QPainter *painter) { Q_D(QGraphicsColorizeEffect); if (!d->opaque) { - source->draw(painter); + drawSource(painter); return; } QPoint offset; - if (source->isPixmap()) { + if (sourceIsPixmap()) { // No point in drawing in device coordinates (pixmap will be scaled anyways). - const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset, - QGraphicsEffectSource::NoExpandPadMode); + const QPixmap pixmap = sourcePixmap(Qt::LogicalCoordinates, &offset, NoPad); d->filter->draw(painter, offset, pixmap); return; } // Draw pixmap in deviceCoordinates to avoid pixmap scaling. - const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); + const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset); QTransform restoreTransform = painter->worldTransform(); painter->setWorldTransform(QTransform()); d->filter->draw(painter, offset, pixmap); @@ -649,7 +712,7 @@ void QGraphicsColorizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou A blur effect blurs the source. This effect is useful for reducing details, such as when the source loses focus and you want to draw attention to other elements. The level of detail can be modified using the setBlurRadius() - function. Use setBlurHint() to choose the quality or performance blur hints. + function. Use setBlurHints() to choose the blur hints. By default, the blur radius is 5 pixels. @@ -666,15 +729,17 @@ void QGraphicsColorizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou blur effects are applied. The hints might not have an effect in all the paint engines. - \value QualityHint Indicates that rendering quality is the most important factor, - at the potential cost of lower performance. - \value PerformanceHint Indicates that rendering performance is the most important factor, at the potential cost of lower quality. + \value QualityHint Indicates that rendering quality is the most important factor, + at the potential cost of lower performance. + \value AnimationHint Indicates that the blur radius is going to be animated, hinting - that the implementation can keep a cache of blurred verisons of the source pixmap. - Do not use this hint if the source item is going to be dynamically changing. + that the implementation can keep a cache of blurred verisons of the source. + Do not use this hint if the source is going to be dynamically changing. + + \sa blurHints(), setBlurHints() */ @@ -686,7 +751,7 @@ QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsBlurEffectPrivate, parent) { Q_D(QGraphicsBlurEffect); - d->filter->setBlurHint(QGraphicsBlurEffect::PerformanceHint); + d->filter->setBlurHints(QGraphicsBlurEffect::PerformanceHint); } /*! @@ -730,7 +795,7 @@ void QGraphicsBlurEffect::setBlurRadius(qreal radius) */ /*! - \property QGraphicsBlurEffect::blurHint + \property QGraphicsBlurEffect::blurHints \brief the blur hint of the effect. Use the PerformanceHint hint to say that you want a faster blur, @@ -739,27 +804,27 @@ void QGraphicsBlurEffect::setBlurRadius(qreal radius) By default, the blur hint is PerformanceHint. */ -QGraphicsBlurEffect::BlurHint QGraphicsBlurEffect::blurHint() const +QGraphicsBlurEffect::BlurHints QGraphicsBlurEffect::blurHints() const { Q_D(const QGraphicsBlurEffect); - return d->filter->blurHint(); + return d->filter->blurHints(); } -void QGraphicsBlurEffect::setBlurHint(QGraphicsBlurEffect::BlurHint hint) +void QGraphicsBlurEffect::setBlurHints(QGraphicsBlurEffect::BlurHints hints) { Q_D(QGraphicsBlurEffect); - if (d->filter->blurHint() == hint) + if (d->filter->blurHints() == hints) return; - d->filter->setBlurHint(hint); - emit blurHintChanged(hint); + d->filter->setBlurHints(hints); + emit blurHintsChanged(hints); } /*! - \fn void QGraphicsBlurEffect::blurHintChanged(QGraphicsBlurEffect::BlurHint hint) + \fn void QGraphicsBlurEffect::blurHintsChanged(QGraphicsBlurEffect::BlurHints hints) - This signal is emitted whenever the effect's blur hint changes. - The \a hint parameter holds the effect's new blur hint. + This signal is emitted whenever the effect's blur hints changes. + The \a hints parameter holds the effect's new blur hints. */ /*! @@ -774,21 +839,21 @@ QRectF QGraphicsBlurEffect::boundingRectFor(const QRectF &rect) const /*! \reimp */ -void QGraphicsBlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source) +void QGraphicsBlurEffect::draw(QPainter *painter) { Q_D(QGraphicsBlurEffect); if (d->filter->radius() <= 0) { - source->draw(painter); + drawSource(painter); return; } - QGraphicsEffectSource::PixmapPadMode mode = QGraphicsEffectSource::ExpandToEffectRectPadMode; + PixmapPadMode mode = PadToEffectiveBoundingRect; if (painter->paintEngine()->type() == QPaintEngine::OpenGL2) - mode = QGraphicsEffectSource::ExpandToTransparentBorderPadMode; + mode = PadToTransparentBorder; // Draw pixmap in device coordinates to avoid pixmap scaling. QPoint offset; - const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset, mode); + const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset, mode); QTransform restoreTransform = painter->worldTransform(); painter->setWorldTransform(QTransform()); d->filter->draw(painter, offset, pixmap); @@ -963,21 +1028,21 @@ QRectF QGraphicsDropShadowEffect::boundingRectFor(const QRectF &rect) const /*! \reimp */ -void QGraphicsDropShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *source) +void QGraphicsDropShadowEffect::draw(QPainter *painter) { Q_D(QGraphicsDropShadowEffect); if (d->filter->blurRadius() <= 0 && d->filter->offset().isNull()) { - source->draw(painter); + drawSource(painter); return; } - QGraphicsEffectSource::PixmapPadMode mode = QGraphicsEffectSource::ExpandToEffectRectPadMode; + PixmapPadMode mode = PadToEffectiveBoundingRect; if (painter->paintEngine()->type() == QPaintEngine::OpenGL2) - mode = QGraphicsEffectSource::ExpandToTransparentBorderPadMode; + mode = PadToTransparentBorder; // Draw pixmap in device coordinates to avoid pixmap scaling. QPoint offset; - const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset, mode); + const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset, mode); QTransform restoreTransform = painter->worldTransform(); painter->setWorldTransform(QTransform()); d->filter->draw(painter, offset, pixmap); @@ -1100,7 +1165,7 @@ void QGraphicsOpacityEffect::setOpacityMask(const QBrush &mask) /*! \reimp */ -void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *source) +void QGraphicsOpacityEffect::draw(QPainter *painter) { Q_D(QGraphicsOpacityEffect); @@ -1110,18 +1175,16 @@ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *sour // Opaque; draw directly without going through a pixmap. if (d->isFullyOpaque && !d->hasOpacityMask) { - source->draw(painter); + drawSource(painter); return; } - QPoint offset; - Qt::CoordinateSystem system = source->isPixmap() ? Qt::LogicalCoordinates : Qt::DeviceCoordinates; - QPixmap pixmap = source->pixmap(system, &offset, QGraphicsEffectSource::NoExpandPadMode); + Qt::CoordinateSystem system = sourceIsPixmap() ? Qt::LogicalCoordinates : Qt::DeviceCoordinates; + QPixmap pixmap = sourcePixmap(system, &offset, QGraphicsEffect::NoPad); if (pixmap.isNull()) return; - painter->save(); painter->setOpacity(d->opacity); @@ -1133,7 +1196,7 @@ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *sour QTransform worldTransform = painter->worldTransform(); worldTransform *= QTransform::fromTranslate(-offset.x(), -offset.y()); pixmapPainter.setWorldTransform(worldTransform); - pixmapPainter.fillRect(source->boundingRect(), d->opacityMask); + pixmapPainter.fillRect(sourceBoundingRect(), d->opacityMask); } else { pixmapPainter.translate(-offset); pixmapPainter.fillRect(pixmap.rect(), d->opacityMask); diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h index 5c73f4b..2257f01 100644 --- a/src/gui/effects/qgraphicseffect.h +++ b/src/gui/effects/qgraphicseffect.h @@ -60,46 +60,7 @@ class QStyleOption; class QPainter; class QPixmap; -class QGraphicsEffectSourcePrivate; -class Q_GUI_EXPORT QGraphicsEffectSource : public QObject -{ - Q_OBJECT -public: - enum PixmapPadMode { - NoExpandPadMode, - ExpandToTransparentBorderPadMode, - ExpandToEffectRectPadMode - }; - - ~QGraphicsEffectSource(); - const QGraphicsItem *graphicsItem() const; - const QWidget *widget() const; - const QStyleOption *styleOption() const; - - bool isPixmap() const; - void draw(QPainter *painter); - void update(); - - QRectF boundingRect(Qt::CoordinateSystem coordinateSystem = Qt::LogicalCoordinates) const; - QRect deviceRect() const; - QPixmap pixmap(Qt::CoordinateSystem system = Qt::LogicalCoordinates, - QPoint *offset = 0, - PixmapPadMode mode = ExpandToEffectRectPadMode) const; - -protected: - QGraphicsEffectSource(QGraphicsEffectSourcePrivate &dd, QObject *parent = 0); - -private: - Q_DECLARE_PRIVATE(QGraphicsEffectSource) - Q_DISABLE_COPY(QGraphicsEffectSource) - friend class QGraphicsEffect; - friend class QGraphicsEffectPrivate; - friend class QGraphicsScenePrivate; - friend class QGraphicsItem; - friend class QGraphicsItemPrivate; - friend class QWidget; - friend class QWidgetPrivate; -}; +class QGraphicsEffectSource; class QGraphicsEffectPrivate; class Q_GUI_EXPORT QGraphicsEffect : public QObject @@ -116,14 +77,18 @@ public: }; Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag) + enum PixmapPadMode { + NoPad, + PadToTransparentBorder, + PadToEffectiveBoundingRect + }; + QGraphicsEffect(QObject *parent = 0); virtual ~QGraphicsEffect(); - virtual QRectF boundingRectFor(const QRectF &rect) const; + virtual QRectF boundingRectFor(const QRectF &sourceRect) const; QRectF boundingRect() const; - QGraphicsEffectSource *source() const; - bool isEnabled() const; public Q_SLOTS: @@ -135,10 +100,17 @@ Q_SIGNALS: protected: QGraphicsEffect(QGraphicsEffectPrivate &d, QObject *parent = 0); - virtual void draw(QPainter *painter, QGraphicsEffectSource *source) = 0; + virtual void draw(QPainter *painter) = 0; virtual void sourceChanged(ChangeFlags flags); void updateBoundingRect(); + bool sourceIsPixmap() const; + QRectF sourceBoundingRect(Qt::CoordinateSystem system = Qt::LogicalCoordinates) const; + void drawSource(QPainter *painter); + QPixmap sourcePixmap(Qt::CoordinateSystem system = Qt::LogicalCoordinates, + QPoint *offset = 0, + PixmapPadMode mode = PadToEffectiveBoundingRect) const; + private: Q_DECLARE_PRIVATE(QGraphicsEffect) Q_DISABLE_COPY(QGraphicsEffect) @@ -147,6 +119,10 @@ private: friend class QGraphicsScenePrivate; friend class QWidget; friend class QWidgetPrivate; + +public: + QGraphicsEffectSource *source() const; // internal + }; Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsEffect::ChangeFlags) @@ -172,7 +148,7 @@ Q_SIGNALS: void strengthChanged(qreal strength); protected: - void draw(QPainter *painter, QGraphicsEffectSource *source); + void draw(QPainter *painter); private: Q_DECLARE_PRIVATE(QGraphicsColorizeEffect) @@ -183,38 +159,42 @@ class QGraphicsBlurEffectPrivate; class Q_GUI_EXPORT QGraphicsBlurEffect: public QGraphicsEffect { Q_OBJECT + Q_FLAGS(BlurHint BlurHints) Q_PROPERTY(qreal blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged) - Q_PROPERTY(BlurHint blurHint READ blurHint WRITE setBlurHint NOTIFY blurHintChanged) + Q_PROPERTY(BlurHints blurHints READ blurHints WRITE setBlurHints NOTIFY blurHintsChanged) public: enum BlurHint { - QualityHint, - PerformanceHint, - AnimationHint + PerformanceHint = 0x00, + QualityHint = 0x01, + AnimationHint = 0x02 }; + Q_DECLARE_FLAGS(BlurHints, BlurHint) QGraphicsBlurEffect(QObject *parent = 0); ~QGraphicsBlurEffect(); QRectF boundingRectFor(const QRectF &rect) const; qreal blurRadius() const; - BlurHint blurHint() const; + BlurHints blurHints() const; public Q_SLOTS: void setBlurRadius(qreal blurRadius); - void setBlurHint(BlurHint hint); + void setBlurHints(BlurHints hints); Q_SIGNALS: void blurRadiusChanged(qreal blurRadius); - void blurHintChanged(BlurHint hint); + void blurHintsChanged(BlurHints hints); protected: - void draw(QPainter *painter, QGraphicsEffectSource *source); + void draw(QPainter *painter); private: Q_DECLARE_PRIVATE(QGraphicsBlurEffect) Q_DISABLE_COPY(QGraphicsBlurEffect) }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsBlurEffect::BlurHints) + class QGraphicsDropShadowEffectPrivate; class Q_GUI_EXPORT QGraphicsDropShadowEffect: public QGraphicsEffect { @@ -264,7 +244,7 @@ Q_SIGNALS: void colorChanged(const QColor &color); protected: - void draw(QPainter *painter, QGraphicsEffectSource *source); + void draw(QPainter *painter); private: Q_DECLARE_PRIVATE(QGraphicsDropShadowEffect) @@ -293,7 +273,7 @@ Q_SIGNALS: void opacityMaskChanged(const QBrush &mask); protected: - void draw(QPainter *painter, QGraphicsEffectSource *source); + void draw(QPainter *painter); private: Q_DECLARE_PRIVATE(QGraphicsOpacityEffect) diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h index d94d08d..0011eef 100644 --- a/src/gui/effects/qgraphicseffect_p.h +++ b/src/gui/effects/qgraphicseffect_p.h @@ -63,6 +63,41 @@ #ifndef QT_NO_GRAPHICSEFFECT QT_BEGIN_NAMESPACE +class QGraphicsEffectSourcePrivate; +class Q_GUI_EXPORT QGraphicsEffectSource : public QObject +{ + Q_OBJECT +public: + ~QGraphicsEffectSource(); + const QGraphicsItem *graphicsItem() const; + const QWidget *widget() const; + const QStyleOption *styleOption() const; + + bool isPixmap() const; + void draw(QPainter *painter); + void update(); + + QRectF boundingRect(Qt::CoordinateSystem coordinateSystem = Qt::LogicalCoordinates) const; + QRect deviceRect() const; + QPixmap pixmap(Qt::CoordinateSystem system = Qt::LogicalCoordinates, + QPoint *offset = 0, + QGraphicsEffect::PixmapPadMode mode = QGraphicsEffect::PadToEffectiveBoundingRect) const; + +protected: + QGraphicsEffectSource(QGraphicsEffectSourcePrivate &dd, QObject *parent = 0); + +private: + Q_DECLARE_PRIVATE(QGraphicsEffectSource) + Q_DISABLE_COPY(QGraphicsEffectSource) + friend class QGraphicsEffect; + friend class QGraphicsEffectPrivate; + friend class QGraphicsScenePrivate; + friend class QGraphicsItem; + friend class QGraphicsItemPrivate; + friend class QWidget; + friend class QWidgetPrivate; +}; + class QGraphicsEffectSourcePrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QGraphicsEffectSource) @@ -70,7 +105,7 @@ public: QGraphicsEffectSourcePrivate() : QObjectPrivate() , m_cachedSystem(Qt::DeviceCoordinates) - , m_cachedMode(QGraphicsEffectSource::ExpandToTransparentBorderPadMode) + , m_cachedMode(QGraphicsEffect::PadToTransparentBorder) {} virtual ~QGraphicsEffectSourcePrivate(); @@ -84,7 +119,7 @@ public: virtual void update() = 0; virtual bool isPixmap() const = 0; virtual QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset = 0, - QGraphicsEffectSource::PixmapPadMode mode = QGraphicsEffectSource::ExpandToTransparentBorderPadMode) const = 0; + QGraphicsEffect::PixmapPadMode mode = QGraphicsEffect::PadToTransparentBorder) const = 0; virtual void effectBoundingRectChanged() = 0; void invalidateCache(bool effectRectChanged = false) const; @@ -94,7 +129,7 @@ public: private: mutable Qt::CoordinateSystem m_cachedSystem; - mutable QGraphicsEffectSource::PixmapPadMode m_cachedMode; + mutable QGraphicsEffect::PixmapPadMode m_cachedMode; mutable QPoint m_cachedOffset; mutable QPixmapCache::Key m_cacheKey; }; diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 723e496..9d495e9 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -10812,7 +10812,7 @@ void QGraphicsItemEffectSourcePrivate::draw(QPainter *painter) } QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *offset, - QGraphicsEffectSource::PixmapPadMode mode) const + QGraphicsEffect::PixmapPadMode mode) const { const bool deviceCoordinates = (system == Qt::DeviceCoordinates); if (!info && deviceCoordinates) { @@ -10828,9 +10828,9 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP const QRectF sourceRect = boundingRect(system); QRect effectRect; - if (mode == QGraphicsEffectSource::ExpandToEffectRectPadMode) { + if (mode == QGraphicsEffect::PadToEffectiveBoundingRect) { effectRect = item->graphicsEffect()->boundingRectFor(sourceRect).toAlignedRect(); - } else if (mode == QGraphicsEffectSource::ExpandToTransparentBorderPadMode) { + } else if (mode == QGraphicsEffect::PadToTransparentBorder) { // adjust by 1.5 to account for cosmetic pens effectRect = sourceRect.adjusted(-1.5, -1.5, 1.5, 1.5).toAlignedRect(); } else { diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index afc2198..75c8246 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -633,7 +633,7 @@ public: void draw(QPainter *); QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset, - QGraphicsEffectSource::PixmapPadMode mode) const; + QGraphicsEffect::PixmapPadMode mode) const; QGraphicsItem *item; QGraphicsItemPaintInfo *info; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 2748ab6..13f31b8 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4656,7 +4656,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter * sourced->lastEffectTransform = painter->worldTransform(); sourced->invalidateCache(); } - item->d_ptr->graphicsEffect->draw(painter, source); + item->d_ptr->graphicsEffect->draw(painter); painter->setWorldTransform(restoreTransform); sourced->info = 0; } else diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index d83ef2c..c0b840a 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -490,7 +490,7 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q which is applied when \l{QPixmapFilter::}{draw()} is called. The filter lets you specialize the radius of the blur as well - as hint as to whether to prefer performance or quality. + as hints as to whether to prefer performance or quality. By default, the blur effect is produced by applying an exponential filter generated from the specified blurRadius(). Paint engines @@ -505,10 +505,10 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q class QPixmapBlurFilterPrivate : public QPixmapFilterPrivate { public: - QPixmapBlurFilterPrivate() : radius(5), hint(QGraphicsBlurEffect::PerformanceHint) {} + QPixmapBlurFilterPrivate() : radius(5), hints(QGraphicsBlurEffect::PerformanceHint) {} qreal radius; - QGraphicsBlurEffect::BlurHint hint; + QGraphicsBlurEffect::BlurHints hints; }; @@ -554,9 +554,9 @@ qreal QPixmapBlurFilter::radius() const } /*! - Setting the blur hint to PerformanceHint causes the implementation + Setting the blur hints to PerformanceHint causes the implementation to trade off visual quality to blur the image faster. Setting the - blur hint to QualityHint causes the implementation to improve + blur hints to QualityHint causes the implementation to improve visual quality at the expense of speed. AnimationHint causes the implementation to optimize for animating @@ -568,21 +568,21 @@ qreal QPixmapBlurFilter::radius() const \internal */ -void QPixmapBlurFilter::setBlurHint(QGraphicsBlurEffect::BlurHint hint) +void QPixmapBlurFilter::setBlurHints(QGraphicsBlurEffect::BlurHints hints) { Q_D(QPixmapBlurFilter); - d->hint = hint; + d->hints = hints; } /*! - Gets the blur hint of the blur filter. + Gets the blur hints of the blur filter. \internal */ -QGraphicsBlurEffect::BlurHint QPixmapBlurFilter::blurHint() const +QGraphicsBlurEffect::BlurHints QPixmapBlurFilter::blurHints() const { Q_D(const QPixmapBlurFilter); - return d->hint; + return d->hints; } /*! @@ -685,7 +685,7 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap QPixmapBlurFilter *blurFilter = static_cast<QPixmapBlurFilter*>(filter); if (blurFilter) { blurFilter->setRadius(d->radius); - blurFilter->setBlurHint(d->hint); + blurFilter->setBlurHints(d->hints); blurFilter->draw(painter, p, src, srcRect); return; } diff --git a/src/gui/image/qpixmapfilter_p.h b/src/gui/image/qpixmapfilter_p.h index 2573fc7..46e744e 100644 --- a/src/gui/image/qpixmapfilter_p.h +++ b/src/gui/image/qpixmapfilter_p.h @@ -132,10 +132,10 @@ public: ~QPixmapBlurFilter(); void setRadius(qreal radius); - void setBlurHint(QGraphicsBlurEffect::BlurHint hint); + void setBlurHints(QGraphicsBlurEffect::BlurHints hints); qreal radius() const; - QGraphicsBlurEffect::BlurHint blurHint() const; + QGraphicsBlurEffect::BlurHints blurHints() const; QRectF boundingRectFor(const QRectF &rect) const; void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const; diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index ff97405..c4a25e1 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -399,6 +399,40 @@ QMouseEventEx::~QMouseEventEx() The function pos() gives the current cursor position, while oldPos() gives the old mouse position. + + There are a few similarities between the events QEvent::HoverEnter + and QEvent::HoverLeave, and the events QEvent::Enter and QEvent::Leave. + However, they are slightly different because we do an update() in the event + handler of HoverEnter and HoverLeave. + + QEvent::HoverMove is also slightly different from QEvent::MouseMove. Let us + consider a top-level window A containing a child B which in turn contains a + child C (all with mouse tracking enabled): + + \image hoverEvents.png + + Now, if you move the cursor from the top to the bottom in the middle of A, + you will get the following QEvent::MouseMove events: + + \list 1 + \o A::MouseMove + \o B::MouseMove + \o C::MouseMove + \endlist + + You will get the same events for QEvent::HoverMove, except that the event + always propagates to the top-level regardless whether the event is accepted + or not. It will only stop propagating with the Qt::WA_NoMousePropagation + attribute. + + In this case the events will occur in the following way: + + \list 1 + \o A::HoverMove + \o A::HoverMove, B::HoverMove + \o A::HoverMove, B::HoverMove, C::HoverMove + \endlist + */ /*! diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index f856b13..c776c36 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -5238,7 +5238,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP QPainter p(pdev); p.translate(offset); context.painter = &p; - graphicsEffect->draw(&p, source); + graphicsEffect->draw(&p); paintEngine->d_func()->systemClip = QRegion(); } else { context.painter = sharedPainter; @@ -5248,7 +5248,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP } sharedPainter->save(); sharedPainter->translate(offset); - graphicsEffect->draw(sharedPainter, source); + graphicsEffect->draw(sharedPainter); sharedPainter->restore(); } sourced->context = 0; @@ -5470,7 +5470,7 @@ void QWidgetEffectSourcePrivate::draw(QPainter *painter) } QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *offset, - QGraphicsEffectSource::PixmapPadMode mode) const + QGraphicsEffect::PixmapPadMode mode) const { const bool deviceCoordinates = (system == Qt::DeviceCoordinates); if (!context && deviceCoordinates) { @@ -5491,10 +5491,10 @@ QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint * QRect effectRect; - if (mode == QGraphicsEffectSource::ExpandToEffectRectPadMode) { + if (mode == QGraphicsEffect::PadToEffectiveBoundingRect) { effectRect = m_widget->graphicsEffect()->boundingRectFor(sourceRect).toAlignedRect(); - } else if (mode == QGraphicsEffectSource::ExpandToTransparentBorderPadMode) { + } else if (mode == QGraphicsEffect::PadToTransparentBorder) { effectRect = sourceRect.adjusted(-1, -1, 1, 1).toAlignedRect(); } else { @@ -11781,10 +11781,6 @@ void QWidget::ungrabGesture(Qt::GestureType gesture) } -QT_END_NAMESPACE - -#include "moc_qwidget.cpp" - /*! \typedef WId \relates QWidget @@ -12101,3 +12097,8 @@ void QWidgetPrivate::_q_delayedDestroy(WId winId) delete winId; } #endif + +QT_END_NAMESPACE + +#include "moc_qwidget.cpp" + diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 151b90a..df28bac 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -824,7 +824,7 @@ public: QRectF boundingRect(Qt::CoordinateSystem system) const; void draw(QPainter *p); QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset, - QGraphicsEffectSource::PixmapPadMode mode) const; + QGraphicsEffect::PixmapPadMode mode) const; QWidget *m_widget; QWidgetPaintContext *context; diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index b5e92c7..02ffb29 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -301,32 +301,6 @@ short QS60StylePrivate::pixelMetric(int metric) return returnValue; } -void QS60StylePrivate::setStyleProperty(const char *name, const QVariant &value) -{ - if (name == propertyKeyCurrentlayout) { - static const QStringList layouts = styleProperty(propertyKeyLayouts).toStringList(); - const QString layout = value.toString(); - Q_ASSERT(layouts.contains(layout)); - const int layoutIndex = layouts.indexOf(layout); - setCurrentLayout(layoutIndex); - QApplication::setLayoutDirection(m_layoutHeaders[layoutIndex].mirroring ? Qt::RightToLeft : Qt::LeftToRight); - clearCaches(); - refreshUI(); - } -} - -QVariant QS60StylePrivate::styleProperty(const char *name) const -{ - if (name == propertyKeyLayouts) { - static QStringList layouts; - if (layouts.isEmpty()) - for (int i = 0; i < m_numberOfLayouts; i++) - layouts.append(QLatin1String(m_layoutHeaders[i].layoutName)); - return layouts; - } - return QVariant(); -} - QColor QS60StylePrivate::stateColor(const QColor &color, const QStyleOption *option) { QColor retColor (color); @@ -2873,24 +2847,6 @@ void QS60Style::unpolish(QApplication *application) } /*! - Sets the style property \a name to the \a value. - */ -void QS60Style::setStyleProperty(const char *name, const QVariant &value) -{ - Q_D(QS60Style); - d->setStyleProperty_specific(name, value); -} - -/*! - Returns the value of style property \a name. - */ -QVariant QS60Style::styleProperty(const char *name) const -{ - Q_D(const QS60Style); - return d->styleProperty_specific(name); -} - -/*! \reimp */ bool QS60Style::event(QEvent *e) diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h index ab10792..885ea40 100644 --- a/src/gui/styles/qs60style.h +++ b/src/gui/styles/qs60style.h @@ -79,10 +79,6 @@ public: #ifndef Q_NO_USING_KEYWORD using QCommonStyle::polish; #endif - - void setStyleProperty(const char *name, const QVariant &value); - QVariant styleProperty(const char *name) const; - bool event(QEvent *e); #ifndef Q_WS_S60 diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 46547bf..b9789b9 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -388,14 +388,6 @@ public: // draws a specific skin part static void drawSkinPart(QS60StyleEnums::SkinParts part, QPainter *painter, const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags); - // sets style property - void setStyleProperty(const char *name, const QVariant &value); - // sets specific style property - void setStyleProperty_specific(const char *name, const QVariant &value); - // gets style property - QVariant styleProperty(const char *name) const; - // gets specific style property - QVariant styleProperty_specific(const char *name) const; // gets pixel metrics value static short pixelMetric(int metric); // gets color. 'index' is NOT 0-based. diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index c2a207c..b5f2d1c 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -1014,23 +1014,6 @@ QS60StylePrivate::QS60StylePrivate() setActiveLayout(); } -void QS60StylePrivate::setStyleProperty_specific(const char *name, const QVariant &value) -{ - if (QLatin1String(name) == QLatin1String("foo")) { - // BaR - } else { - setStyleProperty(name, value); - } -} - -QVariant QS60StylePrivate::styleProperty_specific(const char *name) const -{ - if (QLatin1String(name) == QLatin1String("foo")) - return QLatin1String("Bar"); - else - return styleProperty(name); -} - QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list, int index, const QStyleOption *option) { diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index 706b4e9..4317483 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -308,16 +308,6 @@ QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size, return result; } -void QS60StylePrivate::setStyleProperty_specific(const char *name, const QVariant &value) -{ - setStyleProperty(name, value); -} - -QVariant QS60StylePrivate::styleProperty_specific(const char *name) const -{ - return styleProperty(name); -} - QPixmap QS60StylePrivate::backgroundTexture() { if (!m_background) { diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 1a6bb11..ca5be0e 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -136,6 +136,23 @@ QFontDatabaseS60StoreImplementation::~QFontDatabaseS60StoreImplementation() m_heap->Close(); } +#ifndef FNTSTORE_H_INLINES_SUPPORT_FMM +/* + Workaround: fntstore.h has an inlined function 'COpenFont* CBitmapFont::OpenFont()' + that returns a private data member. The header will change between SDKs. But Qt has + to build on any SDK version and run on other versions of Symbian OS. + This function performs the needed pointer arithmetic to get the right COpenFont* +*/ +COpenFont* OpenFontFromBitmapFont(const CBitmapFont* aBitmapFont) +{ + const TInt offsetIOpenFont = 92; // '_FOFF(CBitmapFont, iOpenFont)' ..if iOpenFont weren't private + const TUint valueIOpenFont = *(TUint*)PtrAdd(aBitmapFont, offsetIOpenFont); + return (valueIOpenFont & 1) ? + (COpenFont*)PtrAdd(aBitmapFont, valueIOpenFont & ~1) : // New behavior: iOpenFont is offset + (COpenFont*)valueIOpenFont; // Old behavior: iOpenFont is pointer +} +#endif // FNTSTORE_H_INLINES_SUPPORT_FMM + const QFontEngineS60Extensions *QFontDatabaseS60StoreImplementation::extension(const QString &typeface) const { if (!m_extensions.contains(typeface)) { @@ -144,8 +161,14 @@ const QFontEngineS60Extensions *QFontDatabaseS60StoreImplementation::extension(c spec.iHeight = 1; const TInt err = m_store->GetNearestFontToDesignHeightInPixels(font, spec); Q_ASSERT(err == KErrNone && font); - CBitmapFont *bitmapFont = static_cast<CBitmapFont*>(font); - m_extensions.insert(typeface, new QFontEngineS60Extensions(font, bitmapFont->OpenFont())); + const CBitmapFont *bitmapFont = static_cast<CBitmapFont*>(font); + COpenFont *openFont = +#ifdef FNTSTORE_H_INLINES_SUPPORT_FMM + bitmapFont->openFont(); +#else + OpenFontFromBitmapFont(bitmapFont); +#endif // FNTSTORE_H_INLINES_SUPPORT_FMM + m_extensions.insert(typeface, new QFontEngineS60Extensions(font, openFont)); } return m_extensions.value(typeface); } diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 0eaab28..fcb0ea2 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -102,7 +102,7 @@ private: class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapBlurFilter> { public: - QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHint hint); + QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHints hints); void setUniforms(QGLShaderProgram *program); @@ -123,13 +123,13 @@ private: mutable bool m_haveCached; mutable int m_cachedRadius; - mutable QGraphicsBlurEffect::BlurHint m_hint; + mutable QGraphicsBlurEffect::BlurHints m_hints; }; class QGLPixmapDropShadowFilter : public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapDropShadowFilter> { public: - QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHint hint); + QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHints hints); void setUniforms(QGLShaderProgram *program); @@ -143,7 +143,7 @@ private: mutable bool m_haveCached; mutable int m_cachedRadius; - mutable QGraphicsBlurEffect::BlurHint m_hint; + mutable QGraphicsBlurEffect::BlurHints m_hints; }; extern QGLWidget *qt_gl_share_widget(); @@ -159,19 +159,19 @@ QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *pr case QPixmapFilter::BlurFilter: { const QPixmapBlurFilter *proto = static_cast<const QPixmapBlurFilter *>(prototype); - if (proto->blurHint() == QGraphicsBlurEffect::AnimationHint) { + if (proto->blurHints() & QGraphicsBlurEffect::AnimationHint) { if (!d->animationBlurFilter) - d->animationBlurFilter.reset(new QGLPixmapBlurFilter(proto->blurHint())); + d->animationBlurFilter.reset(new QGLPixmapBlurFilter(proto->blurHints())); return d->animationBlurFilter.data(); } - if (proto->blurHint() == QGraphicsBlurEffect::PerformanceHint || proto->radius() <= 5) { - if (!d->fastBlurFilter) - d->fastBlurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::PerformanceHint)); - return d->fastBlurFilter.data(); + if ((proto->blurHints() & QGraphicsBlurEffect::QualityHint) && proto->radius() > 5) { + if (!d->blurFilter) + d->blurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::QualityHint)); + return d->blurFilter.data(); } - if (!d->blurFilter) - d->blurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::QualityHint)); - return d->blurFilter.data(); + if (!d->fastBlurFilter) + d->fastBlurFilter.reset(new QGLPixmapBlurFilter(QGraphicsBlurEffect::PerformanceHint)); + return d->fastBlurFilter.data(); } case QPixmapFilter::DropShadowFilter: { @@ -316,11 +316,11 @@ static const char *qt_gl_texture_sampling_helper = " return texture2D(src, srcCoords).a;\n" "}\n"; -QGLPixmapBlurFilter::QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHint hint) +QGLPixmapBlurFilter::QGLPixmapBlurFilter(QGraphicsBlurEffect::BlurHints hints) : m_animatedBlur(false) , m_haveCached(false) , m_cachedRadius(0) - , m_hint(hint) + , m_hints(hints) { } @@ -503,7 +503,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext()); QGLBlurTextureCache *blurTextureCache = QGLBlurTextureCache::cacheForContext(ctx); - if (m_hint == QGraphicsBlurEffect::AnimationHint && blurTextureCache->fitsInCache(src)) { + if ((m_hints & QGraphicsBlurEffect::AnimationHint) && blurTextureCache->fitsInCache(src)) { QRect targetRect = src.rect().adjusted(-qMaxCachedBlurLevel, -qMaxCachedBlurLevel, qMaxCachedBlurLevel, qMaxCachedBlurLevel); // ensure even dimensions (going to divide by two) targetRect.setWidth((targetRect.width() + 1) & ~1); @@ -514,7 +514,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const info = blurTextureCache->takeBlurTextureInfo(src); } else { m_animatedBlur = false; - m_hint = QGraphicsBlurEffect::QualityHint; + m_hints = QGraphicsBlurEffect::QualityHint; m_singlePass = false; QGLFramebufferObjectFormat format; @@ -594,7 +594,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const if (!m_haveCached || !m_animatedBlur) { m_haveCached = true; m_animatedBlur = true; - m_hint = QGraphicsBlurEffect::AnimationHint; + m_hints = QGraphicsBlurEffect::AnimationHint; filter->setSource(qt_gl_interpolate_filter); } @@ -653,7 +653,7 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const int actualRadius = qRound(radius()); int filterRadius = actualRadius; int fastRadii[] = { 1, 2, 3, 5, 8, 15, 25 }; - if (m_hint != QGraphicsBlurEffect::QualityHint) { + if (!(m_hints & QGraphicsBlurEffect::QualityHint)) { uint i = 0; for (; i < (sizeof(fastRadii)/sizeof(*fastRadii))-1; ++i) { if (fastRadii[i+1] > filterRadius) @@ -762,7 +762,7 @@ void QGLPixmapBlurFilter::setUniforms(QGLShaderProgram *program) return; } - if (m_hint == QGraphicsBlurEffect::QualityHint) { + if (m_hints & QGraphicsBlurEffect::QualityHint) { if (m_singlePass) program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height()); else if (m_horizontalBlur) @@ -912,10 +912,10 @@ QByteArray QGLPixmapBlurFilter::generateGaussianShader(int radius, bool singlePa return source; } -QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHint hint) +QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter(QGraphicsBlurEffect::BlurHints hints) : m_haveCached(false) , m_cachedRadius(0) - , m_hint(hint) + , m_hints(hints) { } @@ -1018,7 +1018,7 @@ void QGLPixmapDropShadowFilter::setUniforms(QGLShaderProgram *program) alpha); } - if (m_hint == QGraphicsBlurEffect::QualityHint) { + if (m_hints & QGraphicsBlurEffect::QualityHint) { if (m_singlePass) program->setUniformValue("delta", 1.0 / m_textureSize.width(), 1.0 / m_textureSize.height()); else if (m_horizontalBlur) diff --git a/src/opengl/qgraphicsshadereffect.cpp b/src/opengl/qgraphicsshadereffect.cpp index 1c02fd0..4d7a69c 100644 --- a/src/opengl/qgraphicsshadereffect.cpp +++ b/src/opengl/qgraphicsshadereffect.cpp @@ -241,7 +241,7 @@ void QGraphicsShaderEffect::setPixelShaderFragment(const QByteArray& code) /*# \reimp */ -void QGraphicsShaderEffect::draw(QPainter *painter, QGraphicsEffectSource *source) +void QGraphicsShaderEffect::draw(QPainter *painter) { Q_D(QGraphicsShaderEffect); @@ -256,13 +256,13 @@ void QGraphicsShaderEffect::draw(QPainter *painter, QGraphicsEffectSource *sourc bool usingShader = d->customShaderStage->setOnPainter(painter); QPoint offset; - if (source->isPixmap()) { + if (sourceIsPixmap()) { // No point in drawing in device coordinates (pixmap will be scaled anyways). - const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset); + const QPixmap pixmap = sourcePixmap(Qt::LogicalCoordinates, &offset); painter->drawPixmap(offset, pixmap); } else { // Draw pixmap in device coordinates to avoid pixmap scaling. - const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); + const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset); QTransform restoreTransform = painter->worldTransform(); painter->setWorldTransform(QTransform()); painter->drawPixmap(offset, pixmap); @@ -273,7 +273,7 @@ void QGraphicsShaderEffect::draw(QPainter *painter, QGraphicsEffectSource *sourc if (usingShader) d->customShaderStage->removeFromPainter(painter); #else - source->draw(painter); + drawSource(painter); #endif } diff --git a/src/opengl/qgraphicsshadereffect_p.h b/src/opengl/qgraphicsshadereffect_p.h index de7f00c..de65ebb 100644 --- a/src/opengl/qgraphicsshadereffect_p.h +++ b/src/opengl/qgraphicsshadereffect_p.h @@ -76,7 +76,7 @@ public: void setPixelShaderFragment(const QByteArray& code); protected: - void draw(QPainter *painter, QGraphicsEffectSource *source); + void draw(QPainter *painter); void setUniformsDirty(); virtual void setUniforms(QGLShaderProgram *program); diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 5d66fb7..3a46700 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -7006,7 +7006,7 @@ EXPORTS _ZN9QPolygonFC2ERK8QPolygon @ 7005 NONAME _ZN9QS60Style11qt_metacallEN11QMetaObject4CallEiPPv @ 7006 NONAME _ZN9QS60Style11qt_metacastEPKc @ 7007 NONAME - _ZN9QS60Style16setStylePropertyEPKcRK8QVariant @ 7008 NONAME + _ZN9QS60Style16setStylePropertyEPKcRK8QVariant @ 7008 NONAME ABSENT _ZN9QS60Style16staticMetaObjectE @ 7009 NONAME DATA 16 _ZN9QS60Style19getStaticMetaObjectEv @ 7010 NONAME _ZN9QS60Style5eventEP6QEvent @ 7011 NONAME @@ -10445,7 +10445,7 @@ EXPORTS _ZNK9QS60Style11drawControlEN6QStyle14ControlElementEPK12QStyleOptionP8QPainterPK7QWidget @ 10444 NONAME _ZNK9QS60Style11pixelMetricEN6QStyle11PixelMetricEPK12QStyleOptionPK7QWidget @ 10445 NONAME _ZNK9QS60Style13drawPrimitiveEN6QStyle16PrimitiveElementEPK12QStyleOptionP8QPainterPK7QWidget @ 10446 NONAME - _ZNK9QS60Style13stylePropertyEPKc @ 10447 NONAME + _ZNK9QS60Style13stylePropertyEPKc @ 10447 NONAME ABSENT _ZNK9QS60Style14subControlRectEN6QStyle14ComplexControlEPK19QStyleOptionComplexNS0_10SubControlEPK7QWidget @ 10448 NONAME _ZNK9QS60Style14subElementRectEN6QStyle10SubElementEPK12QStyleOptionPK7QWidget @ 10449 NONAME _ZNK9QS60Style16sizeFromContentsEN6QStyle12ContentsTypeEPK12QStyleOptionRK5QSizePK7QWidget @ 10450 NONAME diff --git a/src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata_p.h b/src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata_p.h index 4a9447a..2513a8c 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata_p.h +++ b/src/scripttools/debugging/qscriptdebuggerconsolecommandgroupdata_p.h @@ -54,7 +54,7 @@ // #include <QtCore/qobjectdefs.h> -#include <QtCore/qscopedpointer.h> +#include <QtCore/private/qscopedpointer_p.h> #include <QtCore/qmap.h> QT_BEGIN_NAMESPACE diff --git a/src/scripttools/debugging/qscriptdebuggervalue_p.h b/src/scripttools/debugging/qscriptdebuggervalue_p.h index 2f1da1e..452f7ea 100644 --- a/src/scripttools/debugging/qscriptdebuggervalue_p.h +++ b/src/scripttools/debugging/qscriptdebuggervalue_p.h @@ -54,7 +54,7 @@ // #include <QtCore/qobjectdefs.h> -#include <QtCore/qscopedpointer.h> +#include <QtCore/private/qscopedpointer_p.h> #include <QtCore/qlist.h> QT_BEGIN_NAMESPACE diff --git a/src/scripttools/debugging/qscriptdebuggervalueproperty_p.h b/src/scripttools/debugging/qscriptdebuggervalueproperty_p.h index 2ec6124..b130307 100644 --- a/src/scripttools/debugging/qscriptdebuggervalueproperty_p.h +++ b/src/scripttools/debugging/qscriptdebuggervalueproperty_p.h @@ -55,7 +55,7 @@ #include <QtCore/qobjectdefs.h> #include <QtCore/qlist.h> -#include <QtCore/qscopedpointer.h> +#include <QtCore/private/qscopedpointer_p.h> #include <QtScript/qscriptvalue.h> QT_BEGIN_NAMESPACE diff --git a/src/scripttools/debugging/qscriptscriptdata_p.h b/src/scripttools/debugging/qscriptscriptdata_p.h index 5006c19..f42ffa5 100644 --- a/src/scripttools/debugging/qscriptscriptdata_p.h +++ b/src/scripttools/debugging/qscriptscriptdata_p.h @@ -54,7 +54,7 @@ // #include <QtCore/qobjectdefs.h> -#include <QtCore/qscopedpointer.h> +#include <QtCore/private/qscopedpointer_p.h> #include <QtCore/qdatetime.h> #include <QtCore/qmap.h> diff --git a/src/scripttools/debugging/qscriptvalueproperty_p.h b/src/scripttools/debugging/qscriptvalueproperty_p.h index 61b239d..ca290a1 100644 --- a/src/scripttools/debugging/qscriptvalueproperty_p.h +++ b/src/scripttools/debugging/qscriptvalueproperty_p.h @@ -55,7 +55,7 @@ #include <QtCore/qobjectdefs.h> #include <QtCore/qlist.h> -#include <QtCore/qscopedpointer.h> +#include <QtCore/private/qscopedpointer_p.h> #include <QtScript/qscriptvalue.h> QT_BEGIN_NAMESPACE diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 1ec4c16..46f26f8 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -135,6 +135,7 @@ SUBDIRS += \ qfocusevent \ qfocusframe \ qfont \ + qfontcombobox \ qfontdatabase \ qfontdialog \ qfontmetrics \ diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp index 53eba32..5bd7a0a 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp @@ -63,5 +63,20 @@ void FindDialog::reset() { tr("%n item(s)", "merge from singular to plural form", 4); tr("%n item(s)", "merge from a finished singular form to an unfinished plural form", 4); -} + + + //% "Hello" + qtTrId("xx_hello"); + + //% "New world" + qtTrId("xx_world"); + + + //= new_id + tr("this is just some text"); + + + //: A message without source string + qtTrId("qtn_virtual"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before index d06252c..379cce4 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.before @@ -1,6 +1,23 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS><TS version="1.1" language="zh_CN"> <context> + <name></name> + <message id="xx_hello"> + <location filename="finddialog.cpp" line="70"/> + <source>Hello</source> + <translation>Hallo</translation> + </message> + <message id="xx_world"> + <location filename="finddialog.cpp" line="73"/> + <source>World</source> + <translation>Welt</translation> + </message> + <message id="qtn_virtual"> + <location filename="finddialog.cpp" line="79"/> + <extracomment>A message without source string</extracomment> + </message> +</context> +<context> <name>FindDialog</name> <message> <source></source> @@ -44,5 +61,10 @@ <numerusform></numerusform> </translation> </message> + <message> + <location filename="finddialog.cpp" line="59"/> + <source>this is just some text</source> + <translation type="unfinished">Unfertige Uebersetzung</translation> + </message> </context> </TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result index be4e02e..de43266 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp/project.ts.result @@ -2,6 +2,26 @@ <!DOCTYPE TS> <TS version="2.0" language="zh_CN"> <context> + <name></name> + <message id="xx_hello"> + <location filename="finddialog.cpp" line="70"/> + <source>Hello</source> + <translation>Hallo</translation> + </message> + <message id="xx_world"> + <location filename="finddialog.cpp" line="73"/> + <source>New world</source> + <oldsource>World</oldsource> + <translation type="unfinished">Welt</translation> + </message> + <message id="qtn_virtual"> + <location filename="finddialog.cpp" line="81"/> + <source></source> + <extracomment>A message without source string</extracomment> + <translation></translation> + </message> +</context> +<context> <name>FindDialog</name> <message> <source></source> @@ -45,5 +65,10 @@ <numerusform></numerusform> </translation> </message> + <message id="new_id"> + <location filename="finddialog.cpp" line="77"/> + <source>this is just some text</source> + <translation type="unfinished">Unfertige Uebersetzung</translation> + </message> </context> </TS> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp index e1464a2..9abb367 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp @@ -148,4 +148,7 @@ void FindDialog::doFind(bool forward) bool FindDialog::hasFindExpression() const { // statusMessage(tr( "Should be obsolete" )); + + //% "This is some random text" + qtTrId("keep_id") } diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before index 834f512..feab169 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.before @@ -1,6 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS><TS version="1.1"> <context> + <name></name> + <message id="keep_id"> + <location filename="finddialog.cpp" line="153"/> + <source>This is some random text</source> + <translation type="unfinished"></translation> + </message> + <message id="obsolete_id"> + <location filename="finddialog.cpp" line="155"/> + <source>Should be obsolete, too</source> + <translation type="unfinished">SHOULD BE OBSOLETE AS WELL</translation> + </message> +</context> +<context> <name>FindDialog</name> <message> <location filename="finddialog.cpp" line="85"/> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result index b328e90..ee3d0f6 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result @@ -2,6 +2,14 @@ <!DOCTYPE TS> <TS version="2.0"> <context> + <name></name> + <message id="keep_id"> + <location filename="finddialog.cpp" line="153"/> + <source>This is some random text</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>FindDialog</name> <message> <location filename="finddialog.cpp" line="85"/> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp index 7b28c75..cc3af48 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp @@ -150,6 +150,9 @@ void FindDialog::doFind(bool forward) bool FindDialog::hasFindExpression() const { + //% "This is some random text" + qtTrId("keep_id") + return !findExpr.isEmpty(); } diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before index 1fa0fd3..2bc6049 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.before @@ -1,6 +1,19 @@ <?xml version="1.0"?> <!DOCTYPE TS><TS version="1.1"> <context> + <name></name> + <message id="keep_id"> + <location filename="finddialog.cpp" line="154"/> + <source>This is some random text</source> + <translation type="unfinished"></translation> + </message> + <message id="obsolete_id"> + <location filename="finddialog.cpp" line="155"/> + <source>Should be obsolete, too</source> + <translation type="unfinished">SHOULD BE OBSOLETE AS WELL</translation> + </message> +</context> +<context> <name>FindDialog</name> <message> <location filename="finddialog.cpp" line="85"/> diff --git a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result index cfd11b1..f442cbc 100644 --- a/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result @@ -2,6 +2,18 @@ <!DOCTYPE TS> <TS version="2.0"> <context> + <name></name> + <message id="keep_id"> + <location filename="finddialog.cpp" line="154"/> + <source>This is some random text</source> + <translation type="unfinished"></translation> + </message> + <message id="obsolete_id"> + <source>Should be obsolete, too</source> + <translation type="obsolete">SHOULD BE OBSOLETE AS WELL</translation> + </message> +</context> +<context> <name>FindDialog</name> <message> <source>Enter the text you are looking for.</source> diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp index e243e66..386d9b7 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp @@ -247,3 +247,8 @@ class YetAnotherTest : QObject { tr("nothing"); } }; + + + +//: This is a message without a source string +QString test = qtTrId("yet_another_id"); diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result index 26e5a65..6d50c21 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -18,6 +18,12 @@ backslashed \ stuff.</source> </translation> <extra-some>thing</extra-some> </message> + <message id="yet_another_id"> + <location filename="main.cpp" line="254"/> + <source></source> + <extracomment>This is a message without a source string</extracomment> + <translation type="unfinished"></translation> + </message> </context> <context> <name>Dialog2</name> diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index 18ebddc..cc59b62 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -2517,8 +2517,8 @@ void tst_QComboBox::task_QTBUG_1071_changingFocusEmitsActivated() cb.addItem("1"); cb.addItem("2"); QLineEdit edit; - layout.add(&cb); - layout.add(&edit); + layout.addWidget(&cb); + layout.addWidget(&edit); w.show(); QTest::qWaitForWindowShown(&w); diff --git a/tests/auto/qdatastream/qdatastream.pro b/tests/auto/qdatastream/qdatastream.pro index 5b90357..c132073 100644 --- a/tests/auto/qdatastream/qdatastream.pro +++ b/tests/auto/qdatastream/qdatastream.pro @@ -12,7 +12,7 @@ QT += svg wince*: { - addFiles.sources = datastream.q42 gearflowers.svg + addFiles.sources = datastream.q42 tests2.svg addFiles.path = . DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\"\\\" diff --git a/tests/auto/qdatastream/tst_qdatastream.cpp b/tests/auto/qdatastream/tst_qdatastream.cpp index 7535645..24447ea 100644 --- a/tests/auto/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/qdatastream/tst_qdatastream.cpp @@ -320,8 +320,7 @@ void tst_QDataStream::getSetCheck() tst_QDataStream::tst_QDataStream() { - svgFile = QLatin1String(SRCDIR) + QLatin1String("/") + - QLatin1String(SVGFILE); + svgFile = QLatin1String(SRCDIR SVGFILE); } tst_QDataStream::~tst_QDataStream() diff --git a/tests/auto/qfile/largefile/largefile.pro b/tests/auto/qfile/largefile/largefile.pro index 0f96865..d67cb46 100644 --- a/tests/auto/qfile/largefile/largefile.pro +++ b/tests/auto/qfile/largefile/largefile.pro @@ -2,3 +2,5 @@ load(qttest_p4) QT = core SOURCES += tst_largefile.cpp + +wince*: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp diff --git a/tests/auto/qfile/largefile/tst_largefile.cpp b/tests/auto/qfile/largefile/tst_largefile.cpp index 9105063..980f4ba 100644 --- a/tests/auto/qfile/largefile/tst_largefile.cpp +++ b/tests/auto/qfile/largefile/tst_largefile.cpp @@ -54,7 +54,10 @@ #ifdef Q_OS_WIN #include <windows.h> + +#ifndef Q_OS_WINCE #include <io.h> +#endif #ifndef FSCTL_SET_SPARSE // MinGW doesn't define this. @@ -295,7 +298,7 @@ void tst_LargeFile::sparseFileData() void tst_LargeFile::createSparseFile() { -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN32) // On Windows platforms, we must explicitly set the file to be sparse, // so disk space is not allocated for the full file when writing to it. HANDLE handle = ::CreateFileA("qt_largefile.tmp", @@ -313,7 +316,7 @@ void tst_LargeFile::createSparseFile() int fd = ::_open_osfhandle((intptr_t)handle, 0); QVERIFY( -1 != fd ); QVERIFY( largeFile.open(fd, QIODevice::WriteOnly | QIODevice::Unbuffered) ); -#else // !Q_OS_WIN +#else // !Q_OS_WIN32 largeFile.setFileName("qt_largefile.tmp"); QVERIFY( largeFile.open(QIODevice::WriteOnly | QIODevice::Unbuffered) ); #endif @@ -321,13 +324,13 @@ void tst_LargeFile::createSparseFile() void tst_LargeFile::closeSparseFile() { -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN32) int fd = largeFile.handle(); #endif largeFile.close(); -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN32) if (-1 != fd) ::_close(fd); #endif diff --git a/tests/auto/qfile/test/test.pro b/tests/auto/qfile/test/test.pro index 46f63b3..faaa927 100644 --- a/tests/auto/qfile/test/test.pro +++ b/tests/auto/qfile/test/test.pro @@ -14,6 +14,7 @@ wince*|symbian { } wince* { + SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp # needed for QT_OPEN DEFINES += SRCDIR=\\\"\\\" } else:symbian { # do not define SRCDIR at all diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index b40cf43..d216924 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -49,6 +49,7 @@ #include <QtGui/qstyleoption.h> #include "../../shared/util.h" +#include <private/qgraphicseffect_p.h> //TESTED_CLASS= //TESTED_FILES= @@ -131,16 +132,16 @@ public: int margin() const { return m_margin; } - void draw(QPainter *painter, QGraphicsEffectSource *source) + void draw(QPainter *painter) { ++numRepaints; if (doNothingInDraw) return; - m_source = source; + m_source = source(); m_painter = painter; - m_styleOption = source->styleOption(); + m_styleOption = source()->styleOption(); m_opacity = painter->opacity(); - source->draw(painter); + drawSource(painter); } void sourceChanged(QGraphicsEffect::ChangeFlags flags) diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp index 55294d5..9991ab4 100644 --- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp +++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp @@ -46,6 +46,8 @@ #include <QtGui/qgraphicsitem.h> #include <QtGui/qstyleoption.h> +#include <private/qgraphicseffect_p.h> + //TESTED_CLASS= //TESTED_FILES= @@ -54,13 +56,12 @@ class CustomItem : public QGraphicsRectItem public: CustomItem(qreal x, qreal y, qreal width, qreal height) : QGraphicsRectItem(x, y, width, height), numRepaints(0), - m_painter(0), m_styleOption(0) + m_painter(0) {} void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { m_painter = painter; - m_styleOption = option; ++numRepaints; QGraphicsRectItem::paint(painter, option, widget); } @@ -69,12 +70,10 @@ public: { numRepaints = 0; m_painter = 0; - m_styleOption = 0; } int numRepaints; QPainter *m_painter; - const QStyleOption *m_styleOption; }; class CustomEffect : public QGraphicsEffect @@ -84,7 +83,7 @@ public: : QGraphicsEffect(), numRepaints(0), m_margin(10), m_sourceChanged(false), m_sourceBoundingRectChanged(false), doNothingInDraw(false), storeDeviceDependentStuff(false), - m_painter(0), m_styleOption(0), m_source(0) + m_painter(0), m_source(0) {} QRectF boundingRectFor(const QRectF &rect) const @@ -96,7 +95,6 @@ public: m_sourceChanged = false; m_sourceBoundingRectChanged = false; m_painter = 0; - m_styleOption = 0; m_source = 0; deviceCoordinatesPixmap = QPixmap(); deviceRect = QRect(); @@ -112,20 +110,19 @@ public: int margin() const { return m_margin; } - void draw(QPainter *painter, QGraphicsEffectSource *source) + void draw(QPainter *painter) { ++numRepaints; if (storeDeviceDependentStuff) { - deviceCoordinatesPixmap = source->pixmap(Qt::DeviceCoordinates); - deviceRect = source->deviceRect(); - sourceDeviceBoundingRect = source->boundingRect(Qt::DeviceCoordinates); + deviceCoordinatesPixmap = source()->pixmap(Qt::DeviceCoordinates); + deviceRect = QRect(0, 0, painter->device()->width(), painter->device()->height()); + sourceDeviceBoundingRect = source()->boundingRect(Qt::DeviceCoordinates); } if (doNothingInDraw) return; - m_source = source; + m_source = source(); m_painter = painter; - m_styleOption = source->styleOption(); - source->draw(painter); + source()->draw(painter); } void sourceChanged() @@ -141,7 +138,6 @@ public: bool doNothingInDraw; bool storeDeviceDependentStuff; QPainter *m_painter; - const QStyleOption *m_styleOption; QGraphicsEffectSource *m_source; QPixmap deviceCoordinatesPixmap; QRect deviceRect; @@ -227,8 +223,6 @@ void tst_QGraphicsEffectSource::styleOption() QTest::qWait(50); QCOMPARE(item->numRepaints, 1); QCOMPARE(effect->numRepaints, 1); - QVERIFY(effect->m_styleOption); - QCOMPARE(effect->m_styleOption, item->m_styleOption); } void tst_QGraphicsEffectSource::isPixmap() @@ -291,10 +285,6 @@ void tst_QGraphicsEffectSource::boundingRect() void tst_QGraphicsEffectSource::deviceRect() { - QTest::ignoreMessage(QtWarningMsg, "QGraphicsEffectSource::deviceRect: Not yet implemented, lacking device context"); - QCOMPARE(effect->source()->deviceRect(), QRect()); - - // We can at least check that the rect was correct in QGraphicsEffect::draw. effect->storeDeviceDependentStuff = true; effect->source()->update(); QTest::qWait(50); @@ -332,13 +322,13 @@ public: return src.adjusted(-10, -10, 10, 10); } - void draw(QPainter *, QGraphicsEffectSource *source) { - pix = source->pixmap(coordinateMode, &offset, padMode); + void draw(QPainter *) { + pix = source()->pixmap(coordinateMode, &offset, padMode); } QPixmap pix; QPoint offset; - QGraphicsEffectSource::PixmapPadMode padMode; + QGraphicsEffect::PixmapPadMode padMode; Qt::CoordinateSystem coordinateMode; }; @@ -351,32 +341,32 @@ void tst_QGraphicsEffectSource::pixmapPadding_data() QTest::addColumn<uint>("ulPixel"); QTest::newRow("log,nopad") << int(Qt::LogicalCoordinates) - << int(QGraphicsEffectSource::NoExpandPadMode) + << int(QGraphicsEffect::NoPad) << QSize(10, 10) << QPoint(0, 0) << 0xffff0000u; QTest::newRow("log,transparent") << int(Qt::LogicalCoordinates) - << int(QGraphicsEffectSource::ExpandToTransparentBorderPadMode) + << int(QGraphicsEffect::PadToTransparentBorder) << QSize(14, 14) << QPoint(-2, -2) << 0x00000000u; QTest::newRow("log,effectrect") << int(Qt::LogicalCoordinates) - << int(QGraphicsEffectSource::ExpandToEffectRectPadMode) + << int(QGraphicsEffect::PadToEffectiveBoundingRect) << QSize(30, 30) << QPoint(-10, -10) << 0x00000000u; QTest::newRow("dev,nopad") << int(Qt::DeviceCoordinates) - << int(QGraphicsEffectSource::NoExpandPadMode) + << int(QGraphicsEffect::NoPad) << QSize(20, 20) << QPoint(40, 40) << 0xffff0000u; QTest::newRow("dev,transparent") << int(Qt::DeviceCoordinates) - << int(QGraphicsEffectSource::ExpandToTransparentBorderPadMode) + << int(QGraphicsEffect::PadToTransparentBorder) << QSize(24, 24) << QPoint(38, 38) << 0x00000000u; QTest::newRow("dev,effectrect") << int(Qt::DeviceCoordinates) - << int(QGraphicsEffectSource::ExpandToEffectRectPadMode) + << int(QGraphicsEffect::PadToEffectiveBoundingRect) << QSize(40, 40) << QPoint(30, 30) << 0x00000000u; @@ -404,7 +394,7 @@ void tst_QGraphicsEffectSource::pixmapPadding() QFETCH(QSize, size); QFETCH(uint, ulPixel); - effect->padMode = (QGraphicsEffectSource::PixmapPadMode) padMode; + effect->padMode = (QGraphicsEffect::PixmapPadMode) padMode; effect->coordinateMode = (Qt::CoordinateSystem) coordinateMode; scene->render(&dummyPainter, scene->itemsBoundingRect(), scene->itemsBoundingRect()); diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp index 5c6ed54..cb8f1e9 100644 --- a/tests/auto/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp @@ -879,7 +879,7 @@ void tst_QListWidget::moveItemsPriv() for (int r = 0; r < rowCount; ++r) new QListWidgetItem(QString::number(r), testWidget); - QListModel *model = dynamic_cast<QListModel *>(testWidget->model()); + QListModel *model = qobject_cast<QListModel *>(testWidget->model()); QVERIFY(model); QSignalSpy beginMoveSpy(model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); QSignalSpy movedSpy(model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int))); diff --git a/tests/auto/qscopedpointer/tst_qscopedpointer.cpp b/tests/auto/qscopedpointer/tst_qscopedpointer.cpp index f319891..ddd5579 100644 --- a/tests/auto/qscopedpointer/tst_qscopedpointer.cpp +++ b/tests/auto/qscopedpointer/tst_qscopedpointer.cpp @@ -413,27 +413,6 @@ void tst_QScopedPointer::comparison() QCOMPARE( int(RefCounted::instanceCount), 0 ); { - // QCustomScopedPointer is an internal helper class -- it is unsupported! - - RefCounted *a = new RefCounted; - RefCounted *b = new RefCounted; - - QCOMPARE( int(RefCounted::instanceCount), 2 ); - - QCustomScopedPointer<RefCounted> pa1(a); - QCustomScopedPointer<RefCounted> pa2(a); - QCustomScopedPointer<RefCounted> pb(b); - - scopedPointerComparisonTest(pa1, pa2, pb); - - pa2.take(); - - QCOMPARE( int(RefCounted::instanceCount), 2 ); - } - - QCOMPARE( int(RefCounted::instanceCount), 0 ); - - { // QScopedSharedPointer is an internal helper class -- it is unsupported! RefCounted *a = new RefCounted; @@ -441,13 +420,9 @@ void tst_QScopedPointer::comparison() QCOMPARE( int(RefCounted::instanceCount), 2 ); - a->ref.ref(); - QScopedSharedPointer<RefCounted> pa1(a); - a->ref.ref(); - QScopedSharedPointer<RefCounted> pa2(a); - b->ref.ref(); - QScopedSharedPointer<RefCounted> pb(b); - + QSharedDataPointer<RefCounted> pa1(a); + QSharedDataPointer<RefCounted> pa2(a); + QSharedDataPointer<RefCounted> pb(b); QCOMPARE( int(a->ref), 2 ); QCOMPARE( int(b->ref), 1 ); diff --git a/tools/assistant/tools/assistant/bookmarkmanager.cpp b/tools/assistant/tools/assistant/bookmarkmanager.cpp index 9cccd82..511a56e 100644 --- a/tools/assistant/tools/assistant/bookmarkmanager.cpp +++ b/tools/assistant/tools/assistant/bookmarkmanager.cpp @@ -621,6 +621,7 @@ Qt::ItemFlags BookmarkModel::flags(const QModelIndex &index) const BookmarkManager::BookmarkManager(QHelpEngineCore *_helpEngine) : treeModel(new BookmarkModel(0, 1, this)) , listModel(new BookmarkModel(0, 1, this)) + , renameItem(0) , helpEngine(_helpEngine) { folderIcon = QApplication::style()->standardIcon(QStyle::SP_DirClosedIcon); diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index 62b4736..67d803d 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -666,34 +666,16 @@ void CentralWidget::setSourceInNewTab(const QUrl &url, qreal zoom) tabWidget->setCurrentIndex(tabWidget->addTab(viewer, quoteTabTitle(viewer->documentTitle()))); - QFont font = qApp->font(); - bool userFont = helpEngine->customValue(QLatin1String("useBrowserFont")).toBool(); - if (userFont) { - font = qVariantValue<QFont>(helpEngine->customValue( - QLatin1String("browserFont"))); - } - -#if !defined(QT_NO_WEBKIT) - QWebSettings *settings = QWebSettings::globalSettings(); - if (!userFont) { - int fontSize = settings->fontSize(QWebSettings::DefaultFontSize); - QString fontFamily = settings->fontFamily(QWebSettings::StandardFont); - font = QFont(fontFamily, fontSize); - } + QFont font; + getBrowserFontFor(viewer, &font); - QWebView *view = qobject_cast<QWebView*> (viewer); - if (view) { - settings = view->settings(); - settings->setFontFamily(QWebSettings::StandardFont, font.family()); - settings->setFontSize(QWebSettings::DefaultFontSize, font.pointSize()); - } else if (viewer) { - viewer->setFont(font); - } - viewer->setTextSizeMultiplier(zoom == 0.0 ? 1.0 : zoom); -#else +#if defined(QT_NO_WEBKIT) font.setPointSize((int)(font.pointSize() + zoom)); - viewer->setFont(font); + setBrowserFontFor(viewer, font); viewer->setZoom((int)zoom); +#else + setBrowserFontFor(viewer, font); + viewer->setTextSizeMultiplier(zoom == 0.0 ? 1.0 : zoom); #endif connectSignals(); @@ -1011,41 +993,17 @@ bool CentralWidget::findInTextBrowser(QTextBrowser* browser, const QString &ttf, void CentralWidget::updateBrowserFont() { - QFont font = qApp->font(); - bool userFont = helpEngine->customValue(QLatin1String("useBrowserFont")).toBool(); - if (userFont) { - font = qVariantValue<QFont>(helpEngine->customValue( - QLatin1String("browserFont"))); - } - -#if !defined(QT_NO_WEBKIT) - QWebSettings *settings = QWebSettings::globalSettings(); - if (!userFont) { - int fontSize = settings->fontSize(QWebSettings::DefaultFontSize); - QString fontFamily = settings->fontFamily(QWebSettings::StandardFont); - font = QFont(fontFamily, fontSize); + QFont font; + bool searchAttached = searchWidgetAttached(); + if (searchAttached) { + getBrowserFontFor(m_searchWidget, &font); + setBrowserFontFor(m_searchWidget, font); } -#endif - QWidget *widget = 0; - for (int i = 0; i < tabWidget->count(); ++i) { - widget = tabWidget->widget(i); -#if !defined(QT_NO_WEBKIT) - QWebView *view = qobject_cast<QWebView*> (widget); - if (view) { - settings = view->settings(); - settings->setFontFamily(QWebSettings::StandardFont, font.family()); - settings->setFontSize(QWebSettings::DefaultFontSize, font.pointSize()); - } else if (widget) { - if (!userFont) - font = qApp->font(); - widget->setFont(font); - } -#else - if (widget && widget->font() != font) - widget->setFont(font); -#endif - } + int i = searchAttached ? 1 : 0; + getBrowserFontFor(tabWidget->widget(i), &font); + for (i; i < tabWidget->count(); ++i) + setBrowserFontFor(tabWidget->widget(i), font); } void CentralWidget::createSearchWidget(QHelpSearchEngine *searchEngine) @@ -1058,6 +1016,10 @@ void CentralWidget::createSearchWidget(QHelpSearchEngine *searchEngine) SLOT(setSourceFromSearch(QUrl))); connect(m_searchWidget, SIGNAL(requestShowLinkInNewTab(QUrl)), this, SLOT(setSourceFromSearchInNewTab(QUrl))); + + QFont font; + getBrowserFontFor(m_searchWidget, &font); + setBrowserFontFor(m_searchWidget, font); } void CentralWidget::activateSearchWidget(bool updateLastTabPage) @@ -1079,7 +1041,7 @@ void CentralWidget::activateSearchWidget(bool updateLastTabPage) void CentralWidget::removeSearchWidget() { - if (m_searchWidget && m_searchWidget->isAttached()) { + if (searchWidgetAttached()) { tabWidget->removeTab(0); m_searchWidget->setAttached(false); } @@ -1088,7 +1050,7 @@ void CentralWidget::removeSearchWidget() int CentralWidget::availableHelpViewer() const { int count = tabWidget->count(); - if (m_searchWidget && m_searchWidget->isAttached()) + if (searchWidgetAttached()) count--; return count; } @@ -1096,7 +1058,7 @@ int CentralWidget::availableHelpViewer() const bool CentralWidget::enableTabCloseAction() const { int minTabCount = 1; - if (m_searchWidget && m_searchWidget->isAttached()) + if (searchWidgetAttached()) minTabCount = 2; return (tabWidget->count() > minTabCount); @@ -1199,4 +1161,40 @@ QMap<int, QString> CentralWidget::currentSourceFileList() const return sourceList; } +void CentralWidget::getBrowserFontFor(QWidget *viewer, QFont *font) +{ + const QLatin1String key("useBrowserFont"); + if (!helpEngine->customValue(key, false).toBool()) { + *font = qApp->font(); // case for QTextBrowser and SearchWidget +#if !defined(QT_NO_WEBKIT) + QWebView *view = qobject_cast<QWebView*> (viewer); + if (view) { + QWebSettings *settings = QWebSettings::globalSettings(); + *font = QFont(settings->fontFamily(QWebSettings::StandardFont), + settings->fontSize(QWebSettings::DefaultFontSize)); + } +#endif + } else { + *font = qVariantValue<QFont>(helpEngine->customValue( + QLatin1String("browserFont"))); + } +} + +void CentralWidget::setBrowserFontFor(QWidget *widget, const QFont &font) +{ +#if !defined(QT_NO_WEBKIT) + QWebView *view = qobject_cast<QWebView*> (widget); + if (view) { + QWebSettings *settings = view->settings(); + settings->setFontFamily(QWebSettings::StandardFont, font.family()); + settings->setFontSize(QWebSettings::DefaultFontSize, font.pointSize()); + } else if (widget && widget->font() != font) { + widget->setFont(font); + } +#else + if (widget && widget->font() != font) + widget->setFont(font); +#endif +} + QT_END_NAMESPACE diff --git a/tools/assistant/tools/assistant/centralwidget.h b/tools/assistant/tools/assistant/centralwidget.h index 7ae8ee5..8c186f0 100644 --- a/tools/assistant/tools/assistant/centralwidget.h +++ b/tools/assistant/tools/assistant/centralwidget.h @@ -48,6 +48,8 @@ #include <QtGui/QWidget> +#include "searchwidget.h" + QT_BEGIN_NAMESPACE class QEvent; @@ -65,7 +67,6 @@ class CentralWidget; class PrintHelper; class MainWindow; -class SearchWidget; class QHelpSearchEngine; class FindWidget : public QWidget @@ -123,6 +124,9 @@ public: HelpViewer *currentHelpViewer() const; void activateTab(bool onlyHelpViewer = false); + bool searchWidgetAttached() const { + return m_searchWidget && m_searchWidget->isAttached(); + } void createSearchWidget(QHelpSearchEngine *searchEngine); void activateSearchWidget(bool updateLastTabPage = false); void removeSearchWidget(); @@ -190,6 +194,9 @@ private: void highlightSearchTerms(); void setLastShownPages(); + void getBrowserFontFor(QWidget* viewer, QFont *font); + void setBrowserFontFor(QWidget *widget, const QFont &font); + private: int lastTabPage; QString collectionFile; diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp index c888a5f..3547652 100644 --- a/tools/assistant/tools/assistant/helpviewer.cpp +++ b/tools/assistant/tools/assistant/helpviewer.cpp @@ -133,10 +133,9 @@ HelpNetworkAccessManager::HelpNetworkAccessManager(QHelpEngine *engine, { } -QNetworkReply *HelpNetworkAccessManager::createRequest(Operation op, - const QNetworkRequest &request, QIODevice *outgoingData) +QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/, + const QNetworkRequest &request, QIODevice* /*outgoingData*/) { - const QString& scheme = request.url().scheme(); const QUrl& url = request.url(); QString mimeType = url.toString(); if (mimeType.endsWith(QLatin1String(".svg")) diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index de3f695..c56e7e4 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -227,16 +227,8 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) if (!m_cmdLine->currentFilter().isEmpty()) { const QString &curFilter = m_cmdLine->currentFilter(); - m_helpEngine->setCurrentFilter(curFilter); - if (m_filterCombo) { - int idx = m_filterCombo->findText(curFilter); - if (idx >= 0) { - bool blocked = m_filterCombo->signalsBlocked(); - m_filterCombo->blockSignals(true); - m_filterCombo->setCurrentIndex(idx); - m_filterCombo->blockSignals(blocked); - } - } + if (m_helpEngine->customFilters().contains(curFilter)) + m_helpEngine->setCurrentFilter(curFilter); } if (usesDefaultCollection()) @@ -664,6 +656,8 @@ void MainWindow::setupFilterToolbar() SLOT(setupFilterCombo())); connect(m_filterCombo, SIGNAL(activated(QString)), this, SLOT(filterDocumentation(QString))); + connect(m_helpEngine, SIGNAL(currentFilterChanged(QString)), this, + SLOT(currentFilterChanged(QString))); setupFilterCombo(); } @@ -1041,4 +1035,11 @@ QString MainWindow::defaultHelpCollectionFileName() arg(QLatin1String(QT_VERSION_STR)); } +void MainWindow::currentFilterChanged(const QString &filter) +{ + const int index = m_filterCombo->findText(filter); + Q_ASSERT(index != -1); + m_filterCombo->setCurrentIndex(index); +} + QT_END_NAMESPACE diff --git a/tools/assistant/tools/assistant/mainwindow.h b/tools/assistant/tools/assistant/mainwindow.h index 6b858e9..7559fe4 100644 --- a/tools/assistant/tools/assistant/mainwindow.h +++ b/tools/assistant/tools/assistant/mainwindow.h @@ -95,6 +95,7 @@ public slots: void showSearchWidget(); void syncContents(); void activateCurrentCentralWidgetTab(); + void currentFilterChanged(const QString &filter); private slots: void insertLastPages(); diff --git a/tools/assistant/tools/assistant/remotecontrol.cpp b/tools/assistant/tools/assistant/remotecontrol.cpp index be1c197..474a681 100644 --- a/tools/assistant/tools/assistant/remotecontrol.cpp +++ b/tools/assistant/tools/assistant/remotecontrol.cpp @@ -237,6 +237,8 @@ void RemoteControl::handleCommandString(const QString &cmdString) else m_mainWindow->expandTOC(depth); } else if (cmd == QLatin1String("setcurrentfilter")) { + if (!m_helpEngine->customFilters().contains(arg)) + return; if (m_caching) { clearCache(); m_currentFilter = arg; diff --git a/tools/assistant/translations/qt_help.pro b/tools/assistant/translations/qt_help.pro index 0133ea4..db54ae6 100644 --- a/tools/assistant/translations/qt_help.pro +++ b/tools/assistant/translations/qt_help.pro @@ -47,4 +47,5 @@ TRANSLATIONS = \ $$TR_DIR/qt_help_pl.ts \ $$TR_DIR/qt_help_ru.ts \ $$TR_DIR/qt_help_zh_CN.ts \ - $$TR_DIR/qt_help_zh_TW.ts + $$TR_DIR/qt_help_zh_TW.ts \ + $$TR_DIR/qt_help_fr.ts diff --git a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp index 7ab7cb4..e36e828 100644 --- a/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp +++ b/tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp @@ -73,6 +73,7 @@ #include <QtGui/QVBoxLayout> #include <QtGui/QToolButton> #include <QtGui/QButtonGroup> +#include <QtGui/QToolBar> QT_BEGIN_NAMESPACE @@ -724,20 +725,20 @@ SignalSlotEditorWindow::SignalSlotEditorWindow(QDesignerFormEditorInterface *cor QVBoxLayout *layout = new QVBoxLayout(this); layout->setMargin(0); - layout->addWidget(m_view); + layout->setSpacing(0); - QHBoxLayout *layout2 = new QHBoxLayout; - layout2->setMargin(3); - layout->addLayout(layout2); - layout2->addStretch(); + QToolBar *toolBar = new QToolBar; + toolBar->setIconSize(QSize(22, 22)); + m_add_button->setIcon(createIconSet(QLatin1String("plus.png"))); + connect(m_add_button, SIGNAL(clicked()), this, SLOT(addConnection())); + toolBar->addWidget(m_add_button); m_remove_button->setIcon(createIconSet(QLatin1String("minus.png"))); connect(m_remove_button, SIGNAL(clicked()), this, SLOT(removeConnection())); - layout2->addWidget(m_remove_button); + toolBar->addWidget(m_remove_button); - m_add_button->setIcon(createIconSet(QLatin1String("plus.png"))); - connect(m_add_button, SIGNAL(clicked()), this, SLOT(addConnection())); - layout2->addWidget(m_add_button); + layout->addWidget(toolBar); + layout->addWidget(m_view); connect(core->formWindowManager(), SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)), diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp index 6f5f86a..7807761 100644 --- a/tools/linguist/lconvert/main.cpp +++ b/tools/linguist/lconvert/main.cpp @@ -239,7 +239,7 @@ int main(int argc, char *argv[]) qWarning() << qPrintable(cd.error()); return 2; } - Translator::reportDuplicates(tr.resolveDuplicates(), inFiles[0].name, verbose); + tr.reportDuplicates(tr.resolveDuplicates(), inFiles[0].name, verbose); for (int i = 1; i < inFiles.size(); ++i) { Translator tr2; @@ -247,7 +247,7 @@ int main(int argc, char *argv[]) qWarning() << qPrintable(cd.error()); return 2; } - Translator::reportDuplicates(tr2.resolveDuplicates(), inFiles[i].name, verbose); + tr2.reportDuplicates(tr2.resolveDuplicates(), inFiles[i].name, verbose); for (int j = 0; j < tr2.messageCount(); ++j) tr.replaceSorted(tr2.message(j)); } diff --git a/tools/linguist/linguist/messagemodel.cpp b/tools/linguist/linguist/messagemodel.cpp index e6bb9af..024fd91 100644 --- a/tools/linguist/linguist/messagemodel.cpp +++ b/tools/linguist/linguist/messagemodel.cpp @@ -209,20 +209,29 @@ bool DataModel::load(const QString &fileName, bool *langGuessed, QWidget *parent return false; } - QSet<TranslatorMessagePtr> dupes = tor.resolveDuplicates(); - if (!dupes.isEmpty()) { + Translator::Duplicates dupes = tor.resolveDuplicates(); + if (!dupes.byId.isEmpty() || !dupes.byContents.isEmpty()) { QString err = tr("<qt>Duplicate messages found in '%1':").arg(Qt::escape(fileName)); int numdups = 0; - foreach (const TranslatorMessagePtr &msg, dupes) { + foreach (int i, dupes.byId) { + if (++numdups >= 5) { + err += tr("<p>[more duplicates omitted]"); + goto doWarn; + } + err += tr("<p>* ID: %1").arg(Qt::escape(tor.message(i).id())); + } + foreach (int j, dupes.byContents) { + const TranslatorMessage &msg = tor.message(j); if (++numdups >= 5) { err += tr("<p>[more duplicates omitted]"); break; } err += tr("<p>* Context: %1<br>* Source: %2") - .arg(Qt::escape(msg->context()), Qt::escape(msg->sourceText())); - if (!msg->comment().isEmpty()) - err += tr("<br>* Comment: %3").arg(Qt::escape(msg->comment())); + .arg(Qt::escape(msg.context()), Qt::escape(msg.sourceText())); + if (!msg.comment().isEmpty()) + err += tr("<br>* Comment: %3").arg(Qt::escape(msg.comment())); } + doWarn: QMessageBox::warning(parent, QObject::tr("Qt Linguist"), err); } diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index ecaed27..742c2e6 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -105,7 +105,7 @@ static bool loadTsFile(Translator &tor, const QString &tsFileName, bool /* verbo static bool releaseTranslator(Translator &tor, const QString &qmFileName, ConversionData &cd, bool removeIdentical) { - Translator::reportDuplicates(tor.resolveDuplicates(), qmFileName, cd.isVerbose()); + tor.reportDuplicates(tor.resolveDuplicates(), qmFileName, cd.isVerbose()); if (cd.isVerbose()) printOut(QCoreApplication::tr( "Updating '%1'...\n").arg(qmFileName)); diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index fb95a95..443abd0 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1883,22 +1883,18 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) case Tok_trid: if (!tor) goto case_default; - if (sourcetext.isEmpty()) { - yyTok = getToken(); - } else { - if (!msgid.isEmpty()) - qWarning("%s:%d: //= cannot be used with qtTrId() / QT_TRID_NOOP(). Ignoring\n", - qPrintable(yyFileName), yyLineNo); - //utf8 = false; // Maybe use //%% or something like that - line = yyLineNo; - yyTok = getToken(); - if (match(Tok_LeftParen) && matchString(&msgid) && !msgid.isEmpty()) { - bool plural = match(Tok_Comma); - recordMessage(line, QString(), sourcetext, QString(), extracomment, - msgid, extra, false, plural); - } - sourcetext.clear(); + if (!msgid.isEmpty()) + qWarning("%s:%d: //= cannot be used with qtTrId() / QT_TRID_NOOP(). Ignoring\n", + qPrintable(yyFileName), yyLineNo); + //utf8 = false; // Maybe use //%% or something like that + line = yyLineNo; + yyTok = getToken(); + if (match(Tok_LeftParen) && matchString(&msgid) && !msgid.isEmpty()) { + bool plural = match(Tok_Comma); + recordMessage(line, QString(), sourcetext, QString(), extracomment, + msgid, extra, false, plural); } + sourcetext.clear(); extracomment.clear(); msgid.clear(); extra.clear(); diff --git a/tools/linguist/lupdate/merge.cpp b/tools/linguist/lupdate/merge.cpp index b5f77cd..fa0dd3d 100644 --- a/tools/linguist/lupdate/merge.cpp +++ b/tools/linguist/lupdate/merge.cpp @@ -247,10 +247,8 @@ int applyNumberHeuristic(Translator &tor) t = translated.find(zeroKey((*u).sourceText())); if (t != translated.end() && !t.key().isEmpty() && t->sourceText() != u->sourceText()) { - TranslatorMessage m = *u; - m.setTranslation(translationAttempt(t->translation(), t->sourceText(), - u->sourceText())); - tor.replace(m); + u->setTranslation(translationAttempt(t->translation(), t->sourceText(), + u->sourceText())); inserted++; } } @@ -305,9 +303,7 @@ int applySameTextHeuristic(Translator &tor) QString key = u->sourceText(); t = translated.find(key); if (t != translated.end()) { - TranslatorMessage m = *u; - m.setTranslations(t->translations()); - tor.replace(m); + u->setTranslations(t->translations()); ++inserted; } } @@ -345,15 +341,17 @@ Translator merge(const Translator &tor, const Translator &virginTor, foreach (TranslatorMessage m, tor.messages()) { TranslatorMessage::Type newType = TranslatorMessage::Finished; - if (m.sourceText().isEmpty()) { + if (m.sourceText().isEmpty() && m.id().isEmpty()) { // context/file comment TranslatorMessage mv = virginTor.find(m.context()); if (!mv.isNull()) m.setComment(mv.comment()); } else { - TranslatorMessage mv = virginTor.find(m.context(), m.sourceText(), m.comment()); - if (mv.isNull()) { + TranslatorMessage mv; + int mvi = virginTor.find(m); + if (mvi < 0) { if (!(options & HeuristicSimilarText)) { + makeObsolete: newType = TranslatorMessage::Obsolete; if (m.type() != TranslatorMessage::Obsolete) obsoleted++; @@ -362,10 +360,7 @@ Translator merge(const Translator &tor, const Translator &virginTor, mv = virginTor.find(m.context(), m.comment(), m.allReferences()); if (mv.isNull()) { // did not find it in the virgin, mark it as obsolete - newType = TranslatorMessage::Obsolete; - if (m.type() != TranslatorMessage::Obsolete) - obsoleted++; - m.clearReferences(); + goto makeObsolete; } else { // Do not just accept it if its on the same line number, // but different source text. @@ -380,6 +375,7 @@ Translator merge(const Translator &tor, const Translator &virginTor, ++similarTextHeuristicCount; neww++; + outdateSource: m.setOldSourceText(m.sourceText()); m.setSourceText(mv.sourceText()); const QString &oldpluralsource = m.extra(QLatin1String("po-msgid_plural")); @@ -387,38 +383,45 @@ Translator merge(const Translator &tor, const Translator &virginTor, m.setExtra(QLatin1String("po-old_msgid_plural"), oldpluralsource); m.unsetExtra(QLatin1String("po-msgid_plural")); } - m.setReferences(mv.allReferences()); // Update secondary references - m.setPlural(mv.isPlural()); - m.setUtf8(mv.isUtf8()); - m.setExtraComment(mv.extraComment()); + goto copyAttribs; // Update secondary references } else { // The virgin and vernacular sourceTexts are so // different that we could not find it. - newType = TranslatorMessage::Obsolete; - if (m.type() != TranslatorMessage::Obsolete) - obsoleted++; - m.clearReferences(); + goto makeObsolete; } } } } else { - switch (m.type()) { - case TranslatorMessage::Finished: - default: - if (m.isPlural() == mv.isPlural()) { - newType = TranslatorMessage::Finished; - } else { - newType = TranslatorMessage::Unfinished; - } + mv = virginTor.message(mvi); + if (!mv.id().isEmpty() + && (mv.context() != m.context() + || mv.sourceText() != m.sourceText() + || mv.comment() != m.comment())) { known++; - break; - case TranslatorMessage::Unfinished: newType = TranslatorMessage::Unfinished; - known++; - break; - case TranslatorMessage::Obsolete: - newType = TranslatorMessage::Unfinished; - neww++; + m.setContext(mv.context()); + m.setComment(mv.comment()); + if (mv.sourceText() != m.sourceText()) + goto outdateSource; + } else { + switch (m.type()) { + case TranslatorMessage::Finished: + default: + if (m.isPlural() == mv.isPlural()) { + newType = TranslatorMessage::Finished; + } else { + newType = TranslatorMessage::Unfinished; + } + known++; + break; + case TranslatorMessage::Unfinished: + newType = TranslatorMessage::Unfinished; + known++; + break; + case TranslatorMessage::Obsolete: + newType = TranslatorMessage::Unfinished; + neww++; + } } // Always get the filename and linenumber info from the @@ -426,10 +429,12 @@ Translator merge(const Translator &tor, const Translator &virginTor, // This should also enable us to read a file that does not // have the <location> element. // why not use operator=()? Because it overwrites e.g. userData. + copyAttribs: m.setReferences(mv.allReferences()); m.setPlural(mv.isPlural()); m.setUtf8(mv.isUtf8()); m.setExtraComment(mv.extraComment()); + m.setId(mv.id()); } } @@ -442,11 +447,11 @@ Translator merge(const Translator &tor, const Translator &virginTor, vernacular translator. */ foreach (const TranslatorMessage &mv, virginTor.messages()) { - if (mv.sourceText().isEmpty()) { + if (mv.sourceText().isEmpty() && mv.id().isEmpty()) { if (tor.contains(mv.context())) continue; } else { - if (tor.contains(mv.context(), mv.sourceText(), mv.comment())) + if (tor.find(mv) >= 0) continue; if (options & HeuristicSimilarText) { TranslatorMessage m = tor.find(mv.context(), mv.comment(), mv.allReferences()); @@ -460,7 +465,7 @@ Translator merge(const Translator &tor, const Translator &virginTor, outTor.append(mv); else outTor.appendSorted(mv); - if (!mv.sourceText().isEmpty()) + if (!mv.sourceText().isEmpty() || !mv.id().isEmpty()) ++neww; } diff --git a/tools/linguist/lupdate/qscript.cpp b/tools/linguist/lupdate/qscript.cpp index 4600656..6c94588 100644 --- a/tools/linguist/lupdate/qscript.cpp +++ b/tools/linguist/lupdate/qscript.cpp @@ -776,7 +776,7 @@ static void recordMessage( fileName, lineNo, QStringList(), TranslatorMessage::Unfinished, plural); msg.setExtraComment(extracomment.simplified()); - tor->replace(msg); + tor->extend(msg); } diff --git a/tools/linguist/phrasebooks/french.qph b/tools/linguist/phrasebooks/french.qph index 9440345..a34effe 100644 --- a/tools/linguist/phrasebooks/french.qph +++ b/tools/linguist/phrasebooks/french.qph @@ -1346,4 +1346,24 @@ <source>Select All</source> <target>Sélectionner tout</target> </phrase> +<phrase> + <source>Cannot create directory: %1</source> + <target>Impossible de créer le répertoire : %1</target> +</phrase> +<phrase> + <source>&Case sensitive</source> + <target>&Sensible à la casse</target> +</phrase> +<phrase> + <source>Whole &words</source> + <target>M&ots complets</target> +</phrase> +<phrase> + <source>Title:</source> + <target>Titre :</target> +</phrase> +<phrase> + <source>Fonts</source> + <target>Polices</target> +</phrase> </QPH> diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index 5965aac..99aedef 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -685,6 +685,16 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) +static bool containsStripped(const Translator &translator, const TranslatorMessage &msg) +{ + foreach (const TranslatorMessage &tmsg, translator.messages()) + if (tmsg.sourceText() == msg.sourceText() + && tmsg.context() == msg.context() + && tmsg.comment().isEmpty()) + return true; + return false; +} + static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData &cd) { Releaser releaser; @@ -741,7 +751,7 @@ static bool saveQM(const Translator &translator, QIODevice &dev, ConversionData bool forceComment = msg.comment().isEmpty() || msg.context().isEmpty() - || translator.contains(msg.context(), msg.sourceText(), QString()); + || containsStripped(translator, msg); releaser.insert(msg, tlns, forceComment); } } diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index cd670cc..bc27daf 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -80,18 +80,9 @@ QList<Translator::FileFormat> &Translator::registeredFileFormats() return theFormats; } -void Translator::replace(const TranslatorMessage &msg) -{ - int index = m_messages.indexOf(msg); - if (index == -1) - m_messages.append(msg); - else - m_messages[index] = msg; -} - void Translator::replaceSorted(const TranslatorMessage &msg) { - int index = m_messages.indexOf(msg); + int index = find(msg); if (index == -1) appendSorted(msg); else @@ -100,7 +91,7 @@ void Translator::replaceSorted(const TranslatorMessage &msg) void Translator::extend(const TranslatorMessage &msg) { - int index = m_messages.indexOf(msg); + int index = find(msg); if (index == -1) { m_messages.append(msg); } else { @@ -145,7 +136,7 @@ void Translator::appendSorted(const TranslatorMessage &msg) int prevLine = 0; int curIdx = 0; foreach (const TranslatorMessage &mit, m_messages) { - bool sameFile = mit.fileName() == msg.fileName(); + bool sameFile = mit.fileName() == msg.fileName() && mit.context() == msg.context(); int curLine; if (sameFile && (curLine = mit.lineNumber()) >= prevLine) { if (msgLine >= prevLine && msgLine < curLine) { @@ -311,19 +302,21 @@ bool Translator::release(QFile *iod, ConversionData &cd) const return false; } -bool Translator::contains(const QString &context, - const QString &sourceText, const QString &comment) const -{ - return m_messages.contains(TranslatorMessage(context, sourceText, comment, - QString(), QString(), 0)); -} - -TranslatorMessage Translator::find(const QString &context, - const QString &sourceText, const QString &comment) const +int Translator::find(const TranslatorMessage &msg) const { - TranslatorMessage needle(context, sourceText, comment, QString(), QString(), 0); - int index = m_messages.indexOf(needle); - return index == -1 ? TranslatorMessage() : m_messages.at(index); + for (int i = 0; i < m_messages.count(); ++i) { + const TranslatorMessage &tmsg = m_messages.at(i); + if (msg.id().isEmpty() || tmsg.id().isEmpty()) { + if (msg.context() == tmsg.context() + && msg.sourceText() == tmsg.sourceText() + && msg.comment() == tmsg.comment()) + return i; + } else { + if (msg.id() == tmsg.id()) + return i; + } + } + return -1; } TranslatorMessage Translator::find(const QString &context, @@ -344,7 +337,7 @@ TranslatorMessage Translator::find(const QString &context, bool Translator::contains(const QString &context) const { foreach (const TranslatorMessage &msg, m_messages) - if (msg.context() == context && msg.sourceText().isEmpty()) + if (msg.context() == context && msg.sourceText().isEmpty() && msg.id().isEmpty()) return true; return false; } @@ -352,7 +345,7 @@ bool Translator::contains(const QString &context) const TranslatorMessage Translator::find(const QString &context) const { foreach (const TranslatorMessage &msg, m_messages) - if (msg.context() == context && msg.sourceText().isEmpty()) + if (msg.context() == context && msg.sourceText().isEmpty() && msg.id().isEmpty()) return msg; return TranslatorMessage(); } @@ -435,49 +428,143 @@ void Translator::dropUiLines() } } -QSet<TranslatorMessagePtr> Translator::resolveDuplicates() +struct TranslatorMessageIdPtr { + explicit TranslatorMessageIdPtr(const TranslatorMessage &tm) + { + ptr = &tm; + } + + inline const TranslatorMessage *operator->() const + { + return ptr; + } + + const TranslatorMessage *ptr; +}; + +Q_DECLARE_TYPEINFO(TranslatorMessageIdPtr, Q_MOVABLE_TYPE); + +inline int qHash(TranslatorMessageIdPtr tmp) +{ + return qHash(tmp->id()); +} + +inline bool operator==(TranslatorMessageIdPtr tmp1, TranslatorMessageIdPtr tmp2) +{ + return tmp1->id() == tmp2->id(); +} + +struct TranslatorMessageContentPtr { + explicit TranslatorMessageContentPtr(const TranslatorMessage &tm) + { + ptr = &tm; + } + + inline const TranslatorMessage *operator->() const + { + return ptr; + } + + const TranslatorMessage *ptr; +}; + +Q_DECLARE_TYPEINFO(TranslatorMessageContentPtr, Q_MOVABLE_TYPE); + +inline int qHash(TranslatorMessageContentPtr tmp) +{ + int hash = qHash(tmp->context()) ^ qHash(tmp->sourceText()); + if (!tmp->sourceText().isEmpty()) + // Special treatment for context comments (empty source). + hash ^= qHash(tmp->comment()); + return hash; +} + +inline bool operator==(TranslatorMessageContentPtr tmp1, TranslatorMessageContentPtr tmp2) +{ + if (tmp1->context() != tmp2->context() || tmp1->sourceText() != tmp2->sourceText()) + return false; + // Special treatment for context comments (empty source). + if (tmp1->sourceText().isEmpty()) + return true; + return tmp1->comment() == tmp2->comment(); +} + +Translator::Duplicates Translator::resolveDuplicates() { - QSet<TranslatorMessagePtr> dups; - QHash<TranslatorMessagePtr, int> refs; + Duplicates dups; + QHash<TranslatorMessageIdPtr, int> idRefs; + QHash<TranslatorMessageContentPtr, int> contentRefs; for (int i = 0; i < m_messages.count();) { const TranslatorMessage &msg = m_messages.at(i); - QHash<TranslatorMessagePtr, int>::ConstIterator it = refs.constFind(msg); - if (it != refs.constEnd()) { - TranslatorMessage &omsg = m_messages[*it]; - if (omsg.isUtf8() != msg.isUtf8() && !omsg.isNonUtf8()) { - // Dual-encoded message - omsg.setUtf8(true); - omsg.setNonUtf8(true); - } else { - // Duplicate - dups.insert(omsg); + TranslatorMessage *omsg; + int oi; + QSet<int> *pDup; + if (!msg.id().isEmpty()) { + QHash<TranslatorMessageIdPtr, int>::ConstIterator it = + idRefs.constFind(TranslatorMessageIdPtr(msg)); + if (it != idRefs.constEnd()) { + oi = *it; + omsg = &m_messages[oi]; + pDup = &dups.byId; + goto gotDupe; } - if (!omsg.isTranslated() && msg.isTranslated()) - omsg.setTranslations(msg.translations()); - m_messages.removeAt(i); + } + { + QHash<TranslatorMessageContentPtr, int>::ConstIterator it = + contentRefs.constFind(TranslatorMessageContentPtr(msg)); + if (it != contentRefs.constEnd()) { + oi = *it; + omsg = &m_messages[oi]; + if (msg.id().isEmpty() || omsg->id().isEmpty()) { + if (!msg.id().isEmpty() && omsg->id().isEmpty()) { + omsg->setId(msg.id()); + idRefs[TranslatorMessageIdPtr(*omsg)] = oi; + } + pDup = &dups.byContents; + goto gotDupe; + } + // This is really a content dupe, but with two distinct IDs. + } + } + if (!msg.id().isEmpty()) + idRefs[TranslatorMessageIdPtr(msg)] = i; + contentRefs[TranslatorMessageContentPtr(msg)] = i; + ++i; + continue; + gotDupe: + if (omsg->isUtf8() != msg.isUtf8() && !omsg->isNonUtf8()) { + // Dual-encoded message + omsg->setUtf8(true); + omsg->setNonUtf8(true); } else { - refs[msg] = i; - ++i; + // Duplicate + pDup->insert(oi); } + if (!omsg->isTranslated() && msg.isTranslated()) + omsg->setTranslations(msg.translations()); + m_messages.removeAt(i); } return dups; } -void Translator::reportDuplicates(const QSet<TranslatorMessagePtr> &dupes, +void Translator::reportDuplicates(const Duplicates &dupes, const QString &fileName, bool verbose) { - if (!dupes.isEmpty()) { + if (!dupes.byId.isEmpty() || !dupes.byContents.isEmpty()) { if (!verbose) { qWarning("Warning: dropping duplicate messages in '%s'\n(try -verbose for more info).", qPrintable(fileName)); } else { qWarning("Warning: dropping duplicate messages in '%s':", qPrintable(fileName)); - foreach (const TranslatorMessagePtr &msg, dupes) { + foreach (int i, dupes.byId) + qWarning("\n* ID: %s", qPrintable(message(i).id())); + foreach (int j, dupes.byContents) { + const TranslatorMessage &msg = message(j); qWarning("\n* Context: %s\n* Source: %s", - qPrintable(msg->context()), - qPrintable(msg->sourceText())); - if (!msg->comment().isEmpty()) - qWarning("* Comment: %s", qPrintable(msg->comment())); + qPrintable(msg.context()), + qPrintable(msg.sourceText())); + if (!msg.comment().isEmpty()) + qWarning("* Comment: %s", qPrintable(msg.comment())); } qWarning(); } diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index ef81d2a..eec704a 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -113,18 +113,13 @@ public: bool save(const QString &filename, ConversionData &err, const QString &format /*= "auto"*/) const; bool release(QFile *iod, ConversionData &cd) const; - bool contains(const QString &context, const QString &sourceText, - const QString &comment) const; - TranslatorMessage find(const QString &context, - const QString &sourceText, const QString &comment) const; - + int find(const TranslatorMessage &msg) const; TranslatorMessage find(const QString &context, const QString &comment, const TranslatorMessage::References &refs) const; bool contains(const QString &context) const; TranslatorMessage find(const QString &context) const; - void replace(const TranslatorMessage &msg); void replaceSorted(const TranslatorMessage &msg); void extend(const TranslatorMessage &msg); // Only for single-location messages void append(const TranslatorMessage &msg); @@ -138,9 +133,10 @@ public: void dropTranslations(); void dropUiLines(); void makeFileNamesAbsolute(const QDir &originalPath); - QSet<TranslatorMessagePtr> resolveDuplicates(); - static void reportDuplicates(const QSet<TranslatorMessagePtr> &dupes, - const QString &fileName, bool verbose); + + struct Duplicates { QSet<int> byId, byContents; }; + Duplicates resolveDuplicates(); + void reportDuplicates(const Duplicates &dupes, const QString &fileName, bool verbose); void setCodecName(const QByteArray &name); QByteArray codecName() const { return m_codecName; } diff --git a/tools/linguist/shared/translatormessage.cpp b/tools/linguist/shared/translatormessage.cpp index db6f333..5151ebd 100644 --- a/tools/linguist/shared/translatormessage.cpp +++ b/tools/linguist/shared/translatormessage.cpp @@ -143,40 +143,6 @@ bool TranslatorMessage::needs8Bit() const } -bool TranslatorMessage::operator==(const TranslatorMessage& m) const -{ - static QString msgIdPlural = QLatin1String("po-msgid_plural"); - - // Special treatment for context comments (empty source). - return (m_context == m.m_context) - && m_sourcetext == m.m_sourcetext - && m_extra[msgIdPlural] == m.m_extra[msgIdPlural] - && m_id == m.m_id - && (m_sourcetext.isEmpty() || m_comment == m.m_comment); -} - - -bool TranslatorMessage::operator<(const TranslatorMessage& m) const -{ - if (m_context != m.m_context) - return m_context < m.m_context; - if (m_sourcetext != m.m_sourcetext) - return m_sourcetext < m.m_sourcetext; - if (m_comment != m.m_comment) - return m_comment < m.m_comment; - return m_id < m.m_id; -} - -int qHash(const TranslatorMessage &msg) -{ - return - qHash(msg.context()) ^ - qHash(msg.sourceText()) ^ - qHash(msg.extra(QLatin1String("po-msgid_plural"))) ^ - qHash(msg.comment()) ^ - qHash(msg.id()); -} - bool TranslatorMessage::hasExtra(const QString &key) const { return m_extra.contains(key); diff --git a/tools/linguist/shared/translatormessage.h b/tools/linguist/shared/translatormessage.h index 675bba7..60b60c5 100644 --- a/tools/linguist/shared/translatormessage.h +++ b/tools/linguist/shared/translatormessage.h @@ -109,9 +109,6 @@ public: return false; } - bool operator==(const TranslatorMessage& m) const; - bool operator<(const TranslatorMessage& m) const; - QString fileName() const { return m_fileName; } void setFileName(const QString &fileName) { m_fileName = fileName; } int lineNumber() const { return m_lineNumber; } @@ -177,34 +174,6 @@ private: Q_DECLARE_TYPEINFO(TranslatorMessage, Q_MOVABLE_TYPE); -int qHash(const TranslatorMessage &msg); - -struct TranslatorMessagePtr { - TranslatorMessagePtr(const TranslatorMessage &tm) - { - ptr = &tm; - } - - inline const TranslatorMessage *operator->() const - { - return ptr; - } - - const TranslatorMessage *ptr; -}; - -Q_DECLARE_TYPEINFO(TranslatorMessagePtr, Q_MOVABLE_TYPE); - -inline int qHash(TranslatorMessagePtr tmp) -{ - return qHash(*tmp.ptr); -} - -inline bool operator==(TranslatorMessagePtr tmp1, TranslatorMessagePtr tmp2) -{ - return *tmp1.ptr == *tmp2.ptr; -} - QT_END_NAMESPACE #endif // QT_NO_TRANSLATION diff --git a/translations/qt_help_fr.ts b/translations/qt_help_fr.ts new file mode 100644 index 0000000..632561a --- /dev/null +++ b/translations/qt_help_fr.ts @@ -0,0 +1,375 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="fr_FR"> +<context> + <name>QCLuceneResultWidget</name> + <message> + <location filename="../tools/assistant/lib/qhelpsearchresultwidget.cpp" line="+110"/> + <source>Search Results</source> + <translation type="unfinished">Résultats de la recherche</translation> + </message> + <message> + <location line="+7"/> + <source>Note:</source> + <translation type="unfinished">Note :</translation> + </message> + <message> + <location line="+1"/> + <source>The search results may not be complete since the documentation is still being indexed!</source> + <translation type="unfinished">Les résultats de la recherche risquent d'être incomplets car l'indexation de la documentation est en cours !</translation> + </message> + <message> + <location line="+11"/> + <source>Your search did not match any documents.</source> + <translation type="unfinished">Votre recherche ne correspond à aucun document.</translation> + </message> + <message> + <location line="+4"/> + <source>(The reason for this might be that the documentation is still being indexed.)</source> + <translation type="unfinished">(Il est possible que cela soit dû au fait que la documentation est en cours d'indexation.)</translation> + </message> +</context> +<context> + <name>QHelpCollectionHandler</name> + <message> + <location filename="../tools/assistant/lib/qhelpcollectionhandler.cpp" line="+79"/> + <source>The collection file '%1' is not set up yet!</source> + <translation type="unfinished">Le fichier de collection '%1' n'est pas encore paramétré !</translation> + </message> + <message> + <location line="+23"/> + <source>Cannot load sqlite database driver!</source> + <translatorcomment>driver ?</translatorcomment> + <translation type="unfinished">Chargement du pilote de base de donnée sqlite impossible !</translation> + </message> + <message> + <location line="+11"/> + <location line="+49"/> + <source>Cannot open collection file: %1</source> + <translatorcomment>collection ?</translatorcomment> + <translation type="unfinished">Impossible d'ouvrir le fichier collection : %1</translation> + </message> + <message> + <location line="-40"/> + <source>Cannot create tables in file %1!</source> + <translation type="unfinished">Impossible de créer les tables dans le fichier : %1!</translation> + </message> + <message> + <location line="+16"/> + <source>The collection file '%1' already exists!</source> + <translation type="unfinished">Le fichier collection '%1' existe déjà !</translation> + </message> + <message> + <location line="+6"/> + <source>Cannot create directory: %1</source> + <translation type="unfinished">Impossible de créer le répertoire : %1</translation> + </message> + <message> + <location line="+23"/> + <source>Cannot copy collection file: %1</source> + <translation type="unfinished">Impossible de copier le fichier collection : %1</translation> + </message> + <message> + <location line="+119"/> + <source>Unknown filter '%1'!</source> + <translation type="unfinished">Filtre '%1' inconnu !</translation> + </message> + <message> + <location line="+55"/> + <source>Cannot register filter %1!</source> + <translation type="unfinished">Impossible d'enregistrer le filtre %1 !</translation> + </message> + <message> + <location line="+44"/> + <source>Cannot open documentation file %1!</source> + <translation type="unfinished">Impossible d'ouvrir le fichier de documentation %1 !</translation> + </message> + <message> + <location line="+6"/> + <source>Invalid documentation file '%1'!</source> + <translation type="unfinished">fichier de documentation invalide : '%1' !</translation> + </message> + <message> + <location line="+34"/> + <source>The namespace %1 was not registered!</source> + <translation type="unfinished">L'espace de noms '%1' n'est pas référencé !</translation> + </message> + <message> + <location line="+120"/> + <source>Namespace %1 already exists!</source> + <translation type="unfinished">L'espace de noms %1 existe déjà !</translation> + </message> + <message> + <location line="+13"/> + <source>Cannot register namespace '%1'!</source> + <translation type="unfinished">Impossible d'enregistrer l'espace de noms '%1' !</translation> + </message> + <message> + <location line="+24"/> + <source>Cannot open database '%1' to optimize!</source> + <translation type="unfinished">Impossible d'ouvrir la base de données à optimiser '%1' !</translation> + </message> +</context> +<context> + <name>QHelpDBReader</name> + <message> + <location filename="../tools/assistant/lib/qhelpdbreader.cpp" line="+98"/> + <source>Cannot open database '%1' '%2': %3</source> + <extracomment>The placeholders are: %1 - The name of the database which cannot be opened %2 - The unique id for the connection %3 - The actual error string</extracomment> + <translation type="unfinished">Impossible d'ouvrir la base de données '%1' '%2' : %3</translation> + </message> +</context> +<context> + <name>QHelpEngineCore</name> + <message> + <location filename="../tools/assistant/lib/qhelpenginecore.cpp" line="+524"/> + <source>The specified namespace does not exist!</source> + <translation type="unfinished">L'espace de noms spécifié n'existe pas !</translation> + </message> +</context> +<context> + <name>QHelpEngineCorePrivate</name> + <message> + <location line="-402"/> + <source>Cannot open documentation file %1: %2!</source> + <translation type="unfinished">Impossible d'ouvrir le fichier de documentation %1 : %2 !</translation> + </message> +</context> +<context> + <name>QHelpGenerator</name> + <message> + <location filename="../tools/assistant/lib/qhelpgenerator.cpp" line="+157"/> + <source>Invalid help data!</source> + <translation type="unfinished">Données d'aide invalides !</translation> + </message> + <message> + <location line="+6"/> + <source>No output file name specified!</source> + <translation type="unfinished">Aucun nom de fichier de sortie spécifié !</translation> + </message> + <message> + <location line="+7"/> + <source>The file %1 cannot be overwritten!</source> + <translation type="unfinished">Le fichier %1 ne peut être écrasé !</translation> + </message> + <message> + <location line="+7"/> + <source>Building up file structure...</source> + <translation type="unfinished">Construction de la structure de fichiers en cours…</translation> + </message> + <message> + <location line="+11"/> + <source>Cannot open data base file %1!</source> + <translation type="unfinished">Impossible d'ouvrir le fichier de base de données %1 !</translation> + </message> + <message> + <location line="+11"/> + <source>Cannot register namespace %1!</source> + <translation type="unfinished">Impossible d'enregistrer l'espace de noms %1 !</translation> + </message> + <message> + <location line="+6"/> + <source>Insert custom filters...</source> + <translation type="unfinished">Insérer des filtres personnalisés…</translation> + </message> + <message> + <location line="+12"/> + <source>Insert help data for filter section (%1 of %2)...</source> + <translatorcomment>???</translatorcomment> + <translation type="unfinished">Insertion des données d'aide pour la section filtre (%1 de %2)…</translation> + </message> + <message> + <location line="+18"/> + <source>Documentation successfully generated.</source> + <translation type="unfinished">Documentation générée.</translation> + </message> + <message> + <location line="+76"/> + <source>Some tables already exist!</source> + <translation type="unfinished">Certaines tables existent déjà !</translation> + </message> + <message> + <location line="+61"/> + <source>Cannot create tables!</source> + <translation type="unfinished">Impossible de créer les tables !</translation> + </message> + <message> + <location line="+86"/> + <source>Cannot register virtual folder!</source> + <translation type="unfinished">Impossible d'enregistrer le dossier virtuel !</translation> + </message> + <message> + <location line="+10"/> + <source>Insert files...</source> + <translation type="unfinished">Insertion des fichiers...</translation> + </message> + <message> + <location line="+42"/> + <source>The referenced file %1 must be inside or within a subdirectory of (%2). Skipping it.</source> + <translation type="unfinished">Le fichier référencé %1 doit être dans le dossier (%2) ou un de ses sous-dossiers. Fichier non pris en compte.</translation> + </message> + <message> + <location line="+7"/> + <source>The file %1 does not exist! Skipping it.</source> + <translation type="unfinished">Le fichier %1 n'existe pas ! Fichier non pris en compte.</translation> + </message> + <message> + <location line="+6"/> + <source>Cannot open file %1! Skipping it.</source> + <translation type="unfinished">Impossible d'ouvrir le fichier %1 ! Fichier non pris en compte.</translation> + </message> + <message> + <location line="+131"/> + <source>The filter %1 is already registered!</source> + <translation type="unfinished">Le filtre %1 est déjà enregistré !</translation> + </message> + <message> + <location line="+5"/> + <source>Cannot register filter %1!</source> + <translation type="unfinished">Impossible d'enregistrer le filtre %1 !</translation> + </message> + <message> + <location line="+24"/> + <source>Insert indices...</source> + <translation type="unfinished">Insertion des index…</translation> + </message> + <message> + <location line="+80"/> + <source>Insert contents...</source> + <translation type="unfinished">insertion des contenus…</translation> + </message> + <message> + <location line="+8"/> + <source>Cannot insert contents!</source> + <translation type="unfinished">Impossible d'insérer les contenus !</translation> + </message> + <message> + <location line="+12"/> + <source>Cannot register contents!</source> + <translation type="unfinished">Impossible de référencer les contenus !</translation> + </message> +</context> +<context> + <name>QHelpSearchQueryWidget</name> + <message> + <location filename="../tools/assistant/lib/qhelpsearchquerywidget.cpp" line="+411"/> + <source>Search for:</source> + <translation type="unfinished">Rechercher :</translation> + </message> + <message> + <location line="+5"/> + <source>Previous search</source> + <translation type="unfinished">Recherche précédente</translation> + </message> + <message> + <location line="+4"/> + <source>Next search</source> + <translation type="unfinished">Recherche suivante</translation> + </message> + <message> + <location line="+2"/> + <source>Search</source> + <translation type="unfinished">Recherche</translation> + </message> + <message> + <location line="+20"/> + <source>Advanced search</source> + <translation type="unfinished">Recherche avancée</translation> + </message> + <message> + <location line="+18"/> + <source>words <B>similar</B> to:</source> + <translation type="unfinished">mots <B>semblables</B> à :</translation> + </message> + <message> + <location line="+6"/> + <source><B>without</B> the words:</source> + <translation type="unfinished"><B>Sans</B> les mots :</translation> + </message> + <message> + <location line="+6"/> + <source>with <B>exact phrase</B>:</source> + <translation type="unfinished">avec la <B>phrase exacte</B> :</translation> + </message> + <message> + <location line="+6"/> + <source>with <B>all</B> of the words:</source> + <translation type="unfinished">Avec <B>tous</B> les mots :</translation> + </message> + <message> + <location line="+6"/> + <source>with <B>at least one</B> of the words:</source> + <translation type="unfinished">avec <B>au moins un</B> des mots :</translation> + </message> +</context> +<context> + <name>QHelpSearchResultWidget</name> + <message> + <location filename="../tools/assistant/lib/qhelpsearchresultwidget.cpp" line="+235"/> + <source>0 - 0 of 0 Hits</source> + <translation type="unfinished">0 - 0 de 0 résultats</translation> + </message> +</context> +<context> + <name>QHelpSearchResultWidgetPrivate</name> + <message> + <location line="-61"/> + <source>%1 - %2 of %3 Hits</source> + <translation type="unfinished">%1 - %2 de %3 résultats</translation> + </message> +</context> +<context> + <name>QObject</name> + <message> + <location filename="../tools/assistant/lib/qhelp_global.h" line="+83"/> + <source>Untitled</source> + <translation type="unfinished">Sans titre</translation> + </message> + <message> + <location filename="../tools/assistant/lib/qhelpprojectdata.cpp" line="+85"/> + <source>Unknown token.</source> + <translatorcomment>contexte peu clair...</translatorcomment> + <translation type="unfinished">Identificateur inconnu.</translation> + </message> + <message> + <location line="+13"/> + <source>Unknown token. Expected "QtHelpProject"!</source> + <translation type="unfinished">Identificateur inconnu. "QtHelpProject" attendu !</translation> + </message> + <message> + <location line="+5"/> + <source>Error in line %1: %2</source> + <translation type="unfinished">Erreur à la ligne %1 : %2</translation> + </message> + <message> + <location line="+13"/> + <source>A virtual folder must not contain a '/' character!</source> + <translation type="unfinished">Un dossier virtuel ne doit pas contenir le caractère '/' !</translation> + </message> + <message> + <location line="+4"/> + <source>A namespace must not contain a '/' character!</source> + <translation type="unfinished">Un espace de noms ne doit pas contenir le caractère '/' !</translation> + </message> + <message> + <location line="+16"/> + <source>Missing namespace in QtHelpProject.</source> + <translation type="unfinished">Espace de noms manquant dans QtHelpProject.</translation> + </message> + <message> + <location line="+2"/> + <source>Missing virtual folder in QtHelpProject</source> + <translation type="unfinished">Dossier virtuel manquant dans QtHelpProject</translation> + </message> + <message> + <location line="+88"/> + <source>Missing attribute in keyword at line %1.</source> + <translation type="unfinished">Attribut manquant pour le mot clé à la ligne %1.</translation> + </message> + <message> + <location line="+123"/> + <source>The input file %1 could not be opened!</source> + <translation type="unfinished">Le fichier source %1 n'a pas pu être ouvert !</translation> + </message> +</context> +</TS> |