diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2009-04-17 12:01:04 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2009-04-17 12:01:04 (GMT) |
commit | 198efeb27e5c2a87d0a2bb6859446cb1faf45ed8 (patch) | |
tree | e4c99e89cbecd2084a87a8c7a5d4877385fcec1c /src/corelib | |
parent | bb2e4df9bee3148e819c98410aa36e22dad95d7a (diff) | |
parent | e85867003ca1741f378b1f58f4dd9d48577a5d9b (diff) | |
download | Qt-198efeb27e5c2a87d0a2bb6859446cb1faf45ed8.zip Qt-198efeb27e5c2a87d0a2bb6859446cb1faf45ed8.tar.gz Qt-198efeb27e5c2a87d0a2bb6859446cb1faf45ed8.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-animations
Conflicts:
src/gui/graphicsview/qgraphicsitem.cpp
Diffstat (limited to 'src/corelib')
36 files changed, 617 insertions, 214 deletions
diff --git a/src/corelib/concurrent/qtconcurrentreducekernel.h b/src/corelib/concurrent/qtconcurrentreducekernel.h index e863b63..2dad519 100644 --- a/src/corelib/concurrent/qtconcurrentreducekernel.h +++ b/src/corelib/concurrent/qtconcurrentreducekernel.h @@ -51,6 +51,7 @@ #include <QtCore/qmap.h> #include <QtCore/qmutex.h> #include <QtCore/qthread.h> +#include <QtCore/qthreadpool.h> #include <QtCore/qvector.h> QT_BEGIN_HEADER @@ -107,7 +108,7 @@ class ReduceKernel const ReduceOptions reduceOptions; QMutex mutex; - int progress, resultsMapSize; + int progress, resultsMapSize, threadCount; ResultsMap resultsMap; bool canReduce(int begin) const @@ -140,7 +141,8 @@ class ReduceKernel public: ReduceKernel(ReduceOptions _reduceOptions) - : reduceOptions(_reduceOptions), progress(0), resultsMapSize(0) + : reduceOptions(_reduceOptions), progress(0), resultsMapSize(0), + threadCount(QThreadPool::globalInstance()->maxThreadCount()) { } void runReduce(ReduceFunctor &reduce, @@ -210,12 +212,12 @@ public: inline bool shouldThrottle() { - return (resultsMapSize > (ReduceQueueThrottleLimit * QThread::idealThreadCount())); + return (resultsMapSize > (ReduceQueueThrottleLimit * threadCount)); } inline bool shouldStartThread() { - return (resultsMapSize <= (ReduceQueueStartLimit * QThread::idealThreadCount())); + return (resultsMapSize <= (ReduceQueueStartLimit * threadCount)); } }; diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index c26c274..40ccb15 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -3,28 +3,28 @@ Feature: PROPERTIES Description: Supports scripting Qt-based applications. Section: Kernel -Requires: +Requires: Name: Properties SeeAlso: ??? Feature: TEXTHTMLPARSER Description: Parser for HTML Section: Kernel -Requires: +Requires: Name: HtmlParser SeeAlso: ??? Feature: TEXTODFWRITER Description: Provides an ODF writer Section: Kernel -Requires: XMLSTREAMWRITER +Requires: XMLSTREAMWRITER Name: OdfWriter SeeAlso: ??? Feature: CSSPARSER Description: Parser for Style Sheets Section: Kernel -Requires: +Requires: Name: CssParser SeeAlso: ??? @@ -52,21 +52,21 @@ SeeAlso: ??? Feature: SESSIONMANAGER Description: Supports session management. Section: Kernel -Requires: +Requires: Name: Session Manager SeeAlso: ??? Feature: SHORTCUT Description: Supports keyboard accelerators and shortcuts. Section: Kernel -Requires: +Requires: Name: QShortcut SeeAlso: ??? Feature: ACTION Description: Supports widget actions. Section: Kernel -Requires: +Requires: Name: QAction SeeAlso: ??? @@ -129,8 +129,8 @@ SeeAlso: ??? Feature: XMLSTREAM Description: Provides a simple streaming API for XML. Section: Kernel -Requires: -Name: +Requires: +Name: SeeAlso: ??? Feature: XMLSTREAMREADER @@ -159,14 +159,14 @@ SeeAlso: ??? Feature: QUUID_STRING Description: Supports convertion between UUID and strings. Section: Data structures -Requires: +Requires: Name: Universally Unique Identifier Convertion SeeAlso: ??? Feature: TEXTDATE Description: Supports month and day names in dates. Section: Data structures -Requires: +Requires: Name: Text Date SeeAlso: ??? @@ -210,7 +210,7 @@ SeeAlso: ??? Feature: SETTINGS Description: Supports persistent application settings. Section: File I/O -Requires: TEXTSTREAM +Requires: TEXTSTREAM Name: QSettings SeeAlso: ??? @@ -229,7 +229,7 @@ Name: QFileSystemModel SeeAlso: ??? Feature: FILESYSTEMWATCHER -Description: Provides an interface for monitoring files and directories +Description: Provides an interface for monitoring files and directories for modications. Section: File I/O Requires: THREAD @@ -239,7 +239,7 @@ SeeAlso: ??? # Widgets Feature: TREEWIDGET -Description: Supports views using tree models. +Description: Supports views using tree models. Section: Widgets Requires: TREEVIEW Name: QTreeWidget @@ -283,7 +283,7 @@ SeeAlso: ??? Feature: SPLASHSCREEN Description: Supports splash screens that can be shown during application startup. Section: Widgets -Requires: +Requires: Name: Splash screen widget SeeAlso: ??? @@ -295,7 +295,7 @@ Name: QSplitter SeeAlso: ??? Feature: LCDNUMBER -Description: Supports LCD-like digits. +Description: Supports LCD-like digits. Section: Widgets Requires: Name: QLCDNumber @@ -381,7 +381,7 @@ SeeAlso: ??? Feature: BUTTONGROUP Description: Supports organizing groups of button widgets. Section: Widgets -Requires: GROUPBOX +Requires: GROUPBOX Name: QButtonGroup SeeAlso: ??? @@ -393,7 +393,7 @@ Name: QMainWindow SeeAlso: ??? Feature: DOCKWIDGET -Description: Supports docking widgets inside a QMainWindow or floated as +Description: Supports docking widgets inside a QMainWindow or floated as a top-level window on the desktop. Section: Widgets Requires: RUBBERBAND MAINWINDOW @@ -401,7 +401,7 @@ Name: QDockwidget SeeAlso: ??? Feature: WORKSPACE -Description: Supports workspace windows, e.g. used in an MDI application. +Description: Supports workspace windows, e.g. used in an MDI application. Section: Widgets Requires: SCROLLBAR RESIZEHANDLER MENU TOOLBUTTON MAINWINDOW TOOLBAR MENUBAR Name: QWorkSpace @@ -457,8 +457,8 @@ Name: QSlider SeeAlso: ??? Feature: SCROLLBAR -Description: Supports scrollbars allowing the user access parts of a -document that is larger than the widget used to display it. +Description: Supports scrollbars allowing the user access parts of a +document that is larger than the widget used to display it. Section: Widgets Requires: SLIDER Name: QScrollBar @@ -500,7 +500,7 @@ Name: QTextEdit SeeAlso: ??? Feature: SYNTAXHIGHLIGHTER -Description: Supports custom syntax highlighting. +Description: Supports custom syntax highlighting. Section: Widgets Requires: TEXTEDIT Name: QSyntaxHighlighter @@ -556,7 +556,7 @@ Name: QSizeGrip SeeAlso: ??? Feature: CALENDARWIDGET -Description: Provides a monthly based calendar widget allowing the user to select +Description: Provides a monthly based calendar widget allowing the user to select a date. Section: Widgets Requires: TABLEVIEW MENU TEXTDATE SPINBOX TOOLBUTTON @@ -567,14 +567,14 @@ Feature: PRINTPREVIEWWIDGET Description: Provides a widget for previewing page layouts for printer output. a date. Section: Widgets -Requires: GRAPHICSVIEW PRINTER PICTURE +Requires: GRAPHICSVIEW PRINTER Name: QPrintPreviewWidget SeeAlso: ??? # Dialogs Feature: MESSAGEBOX -Description: Supports message boxes displaying +Description: Supports message boxes displaying informative messages and simple questions. Section: Dialogs Requires: @@ -589,7 +589,7 @@ Name: QColorDialog SeeAlso: ??? Feature: FILEDIALOG -Description: Supports a dialog widget for selecting files or directories. +Description: Supports a dialog widget for selecting files or directories. Section: Dialogs Requires: DIRMODEL TREEVIEW COMBOBOX TOOLBUTTON BUTTONGROUP TOOLTIP SPLITTER STACKEDWIDGET FILESYSTEMMODEL Name: QFileDialog @@ -654,7 +654,7 @@ SeeAlso: ??? # ItemViews Feature: ITEMVIEWS -Description: Supports the model/view architecture managing the relationship +Description: Supports the model/view architecture managing the relationship between data and the way it is presented to the user. Section: ItemViews Requires: RUBBERBAND SCROLLAREA @@ -683,8 +683,8 @@ Name: QAbstractProxyModel SeeAlso: ??? Feature: SORTFILTERPROXYMODEL -Description: Supports sorting and filtering of data passed between -another model and a view. +Description: Supports sorting and filtering of data passed between +another model and a view. Section: ItemViews Requires: PROXYMODEL Name: QSortFilterProxyModel @@ -705,9 +705,9 @@ Name: QListView SeeAlso: ??? Feature: TABLEVIEW -Description: Supports a default model/view implementation of a table view. +Description: Supports a default model/view implementation of a table view. Section: ItemViews -Requires: ITEMVIEWS +Requires: ITEMVIEWS Name: QTableView SeeAlso: ??? @@ -735,21 +735,21 @@ SeeAlso: ??? # Styles Feature: STYLE_WINDOWS -Description: Supports a Microsoft Windows-like look and feel. +Description: Supports a Microsoft Windows-like look and feel. Section: Styles Requires: Name: QWindowsStyle SeeAlso: ??? Feature: STYLE_MOTIF -Description: Supports a Motif look and feel. +Description: Supports a Motif look and feel. Section: Styles Requires: Name: QMotifStyle SeeAlso: ??? Feature: STYLE_CDE -Description: Supports a CDE look and feel. +Description: Supports a CDE look and feel. Section: Styles Requires: STYLE_MOTIF Name: QCDEStyle @@ -798,7 +798,7 @@ Name: QWindowsMobileStyle SeeAlso: ??? Feature: STYLE_STYLESHEET -Description: +Description: Section: Styles Requires: STYLE_WINDOWS PROPERTIES CSSPARSER Name: QStyleSheetStyle @@ -809,14 +809,14 @@ SeeAlso: ??? Feature: IMAGEFORMATPLUGIN Description: Supports writing an image format plugin. Section: Images -Requires: +Requires: Name: QImageIOPlugin SeeAlso: ??? Feature: ICON Description: Supports scalable icons in different modes and states. Section: Images -Requires: +Requires: Name: QIcon SeeAlso: ??? @@ -837,14 +837,14 @@ SeeAlso: ??? Feature: IMAGEFORMAT_PPM Description: Supports the Portable Pixmap image file format. Section: Images -Requires: +Requires: Name: PPM Image Format SeeAlso: ??? Feature: IMAGEFORMAT_XBM Description: Supports the X11 Bitmap image file format. Section: Images -Requires: +Requires: Name: XBM Image Format SeeAlso: ??? @@ -858,14 +858,14 @@ SeeAlso: ??? Feature: IMAGEFORMAT_PNG Description: Supports the Portable Network Graphics image file format. Section: Images -Requires: +Requires: Name: PNG Image Format SeeAlso: ??? Feature: IMAGEFORMAT_JPEG Description: Supports the Joint Photographic Experts Group image file format. Section: Images -Requires: +Requires: Name: JPEG Image Format SeeAlso: ??? @@ -895,7 +895,7 @@ SeeAlso: ??? Feature: PICTURE Description: Supports recording and replaying QPainter commands. Section: Painting -Requires: +Requires: Name: QPicture SeeAlso: ??? @@ -908,9 +908,9 @@ Name: Color Names SeeAlso: ??? Feature: PRINTER -Description: Supports printing +Description: Supports printing Section: Painting -Requires: TEXTSTREAM +Requires: TEXTSTREAM PICTURE Name: QPrinter SeeAlso: ??? @@ -952,7 +952,7 @@ Name: Freetype Font Engine SeeAlso: ??? Feature: QWS_QPF -Description: Supports Qt's pre-rendered fonts, a light-weight non-scalable font format +Description: Supports Qt's pre-rendered fonts, a light-weight non-scalable font format specific to Qt for Embedded Linux. Section: Fonts Requires: @@ -960,7 +960,7 @@ Name: Qt Prerendered Font Format SeeAlso: ??? Feature: QWS_QPF2 -Description: Supports Qt's second generation of pre-rendered fonts, a light-weight +Description: Supports Qt's second generation of pre-rendered fonts, a light-weight non-scalable font format specific to Qt for Embedded Linux. Section: Fonts Requires: @@ -987,7 +987,7 @@ Feature: TRANSLATION_UTF8 Description: Supports translations using QObject::trUtf8(). Section: Internationalization Requires: TRANSLATION TEXTCODEC -Name: Translation (UTF-8 representation) +Name: Translation (UTF-8 representation) SeeAlso: ??? Feature: TEXTCODEC @@ -1007,14 +1007,14 @@ SeeAlso: ??? Feature: BIG_CODECS Description: Supports big codecs, e.g. CJK. Section: Internationalization -Requires: +Requires: Name: Big Codecs SeeAlso: ??? Feature: QWS_INPUTMETHODS Description: Supports international input methods. Section: Internationalization -Requires: +Requires: Name: QWSInputMethod SeeAlso: ??? @@ -1023,14 +1023,14 @@ SeeAlso: ??? Feature: URLINFO Description: Supports storage of URL information. Section: Networking -Requires: +Requires: Name: QUrlInfo SeeAlso: ??? Feature: HOSTINFO Description: Supports host name lookups. Section: Networking -Requires: TEXTSTREAM +Requires: TEXTSTREAM Name: QHostInfo SeeAlso: ??? @@ -1051,14 +1051,14 @@ SeeAlso: ??? Feature: UDPSOCKET Description: Supports User Datagram Protocol sockets. Section: Networking -Requires: +Requires: Name: QUdpSocket SeeAlso: ??? Feature: NETWORKPROXY Description: Supports configuring network layer proxy support to the Qt network classes. Section: Networking -Requires: +Requires: Name: QNetworkProxy SeeAlso: ??? @@ -1123,7 +1123,7 @@ Name: QUndoStack SeeAlso: ??? Feature: UNDOGROUP -Description: +Description: Section: Utilities Requires: UNDOCOMMAND UNDOSTACK Name: QUndoGroup @@ -1181,7 +1181,7 @@ Name: QSvgRenderer SeeAlso: ??? Feature: SVGWIDGET -Description: Provides a widget that is used to display the contents of SVG files. +Description: Provides a widget that is used to display the contents of SVG files. Section: SVG Requires: SVGRENDERER Name: QSvgWidget @@ -1233,21 +1233,21 @@ Name: Manager SeeAlso: ??? Feature: QWS_DECORATION_DEFAULT -Description: Supports default decoration of the top level windows. +Description: Supports default decoration of the top level windows. Section: Qt for Embedded Linux -Requires: +Requires: Name: Decoration SeeAlso: ??? Feature: QWS_DECORATION_WINDOWS -Description: Supports a "Windows" style decoration of the top level windows. +Description: Supports a "Windows" style decoration of the top level windows. Section: Qt for Embedded Linux Requires: QWS_DECORATION_DEFAULT Name: Decoration (Windows Style) SeeAlso: ??? Feature: QWS_DECORATION_STYLED -Description: Supports styled decoration of the top level windows. +Description: Supports styled decoration of the top level windows. Section: Qt for Embedded Linux Requires: QWS_DECORATION_DEFAULT Name: Decoration (Styled) @@ -1395,13 +1395,13 @@ SeeAlso: ??? Feature: PHONON_MEDIACONTROLLER Description: Support for the MediaController class Section: Phonon -Requires: +Requires: Name: Phonon::MediaController SeeAlso: ??? Feature: PHONON_ABSTRACTMEDIASTREAM Description: Support for streaming of raw data (QIODevice...) Section: Phonon -Requires: +Requires: Name: Phonon::AbstractMediaStream SeeAlso: ??? diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index b9c2bee..8324d05 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1054,6 +1054,7 @@ bool qSharedBuild() \value WV_XP Windows XP (operating system version 5.1) \value WV_2003 Windows Server 2003, Windows Server 2003 R2, Windows Home Server, Windows XP Professional x64 Edition (operating system version 5.2) \value WV_VISTA Windows Vista, Windows Server 2008 (operating system version 6.0) + \value WV_WINDOWS7 Windows 7 (operating system version 6.1) Alternatively, you may use the following macros which correspond directly to the Windows operating system version number: @@ -1062,6 +1063,7 @@ bool qSharedBuild() \value WV_5_1 Operating system version 5.1, corresponds to Windows XP \value WV_5_2 Operating system version 5.2, corresponds to Windows Server 2003, Windows Server 2003 R2, Windows Home Server, and Windows XP Professional x64 Edition \value WV_6_0 Operating system version 6.0, corresponds to Windows Vista and Windows Server 2008 + \value WV_6_1 Operating system version 6.1, corresponds to Windows 7 CE-based versions: @@ -1095,6 +1097,7 @@ bool qSharedBuild() \value MV_10_3 Mac OS X 10.3 \value MV_10_4 Mac OS X 10.4 \value MV_10_5 Mac OS X 10.5 + \value MV_10_6 Mac OS X 10.6 \value MV_Unknown An unknown and currently unsupported platform \value MV_CHEETAH Apple codename for MV_10_0 @@ -1103,6 +1106,7 @@ bool qSharedBuild() \value MV_PANTHER Apple codename for MV_10_3 \value MV_TIGER Apple codename for MV_10_4 \value MV_LEOPARD Apple codename for MV_10_5 + \value MV_SNOWLEOPARD Apple codename for MV_10_6 \sa WinVersion */ @@ -1631,16 +1635,19 @@ QSysInfo::WinVersion QSysInfo::windowsVersion() default: // VER_PLATFORM_WIN32_NT if (osver.dwMajorVersion < 5) { winver = QSysInfo::WV_NT; - } else if (osver.dwMajorVersion == 6) { - winver = QSysInfo::WV_VISTA; - } else if (osver.dwMinorVersion == 0) { + } else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 0) { winver = QSysInfo::WV_2000; - } else if (osver.dwMinorVersion == 1) { + } else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 1) { winver = QSysInfo::WV_XP; - } else if (osver.dwMinorVersion == 2) { + } else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 2) { winver = QSysInfo::WV_2003; + } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 0) { + winver = QSysInfo::WV_VISTA; + } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 1) { + winver = QSysInfo::WV_WINDOWS7; } else { - qWarning("Qt: Untested Windows version detected!"); + qWarning("Qt: Untested Windows version %d.%d detected!", + osver.dwMajorVersion, osver.dwMinorVersion); winver = QSysInfo::WV_NT_based; } } @@ -1667,6 +1674,8 @@ QSysInfo::WinVersion QSysInfo::windowsVersion() winver = QSysInfo::WV_XP; else if (override == "VISTA") winver = QSysInfo::WV_VISTA; + else if (override == "WINDOWS7") + winver = QSysInfo::WV_WINDOWS7; } #endif @@ -1925,9 +1934,11 @@ QString qt_error_string(int errorCode) The message handler is a function that prints out debug messages, warnings, critical and fatal error messages. The Qt library (debug - version) contains hundreds of warning messages that are printed + mode) contains hundreds of warning messages that are printed when internal errors (usually invalid function arguments) - occur. If you implement your own message handler, you get total + occur. Qt built in release mode also contains such warnings unless + QT_NO_WARNING_OUTPUT and/or QT_NO_DEBUG_OUTPUT have been set during + compilation. If you implement your own message handler, you get total control of these messages. The default message handler prints the message to the standard @@ -2022,7 +2033,8 @@ void qt_message_output(QtMsgType msgType, const char *buf) during compilation. If you pass the function a format string and a list of arguments, - it works in similar way to the C printf() function. + it works in similar way to the C printf() function. The format + should be a Latin-1 string. Example: @@ -2033,11 +2045,12 @@ void qt_message_output(QtMsgType msgType, const char *buf) \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 25 - This syntax automatically puts a single space between each item, - and outputs a newline at the end. It supports many C++ and Qt - types. + With this syntax, the function returns a QDebug object that is + configured to use the QtDebugMsg message type. It automatically + puts a single space between each item, and outputs a newline at + the end. It supports many C++ and Qt types. - To supress the output at runtime, install your own message handler + To suppress the output at run-time, install your own message handler with qInstallMsgHandler(). \sa qWarning(), qCritical(), qFatal(), qInstallMsgHandler(), @@ -2067,7 +2080,8 @@ void qDebug(const char *msg, ...) QT_FATAL_WARNINGS is defined. This function takes a format string and a list of arguments, - similar to the C printf() function. + similar to the C printf() function. The format should be a Latin-1 + string. Example: \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 26 @@ -2105,8 +2119,9 @@ void qWarning(const char *msg, ...) message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the debugger. - This function takes a format string and a list of arguments, similar - to the C printf() function. + This function takes a format string and a list of arguments, + similar to the C printf() function. The format should be a Latin-1 + string. Example: \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 28 @@ -2930,6 +2945,11 @@ bool QInternal::callFunction(InternalFunction func, void **args) Compares the floating point value \a p1 and \a p2 and returns \c true if they are considered equal, otherwise \c false. + Note that comparing values where either \a p1 or \a p2 is 0.0 will not work. + The solution to this is to compare against values greater than or equal to 1.0. + + \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 46 + The two numbers are compared in a relative way, where the exactness is stronger the smaller the numbers are. */ @@ -2961,4 +2981,24 @@ bool QInternal::callFunction(InternalFunction func, void **args) \snippet doc/src/snippets/code/src_gui_dialogs_qmessagebox.cpp 4 */ +/*! + \macro Q_DECL_EXPORT + \relates <QtGlobal> + + This macro marks a symbol for shared library export (see + \l{sharedlibrary.html}{Creating Shared Libraries}). + + \sa Q_DECL_IMPORT +*/ + +/*! + \macro Q_DECL_IMPORT + \relates <QtGlobal> + + This macro declares a symbol to be an import from a shared library (see + \l{sharedlibrary.html}{Creating Shared Libraries}). + + \sa Q_DECL_EXPORT +*/ + QT_END_NAMESPACE diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 5f7f262..025442a 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -289,6 +289,9 @@ namespace QtExperimental {} #ifdef AUTODETECT_COCOA # ifdef Q_OS_MAC64 # define QT_MAC_USE_COCOA 1 +# define QT_BUILD_KEY QT_BUILD_KEY_COCOA +# else +# define QT_BUILD_KEY QT_BUILD_KEY_CARBON # endif #endif @@ -1322,6 +1325,7 @@ public: WV_XP = 0x0030, WV_2003 = 0x0040, WV_VISTA = 0x0080, + WV_WINDOWS7 = 0x0090, WV_NT_based = 0x00f0, /* version numbers */ @@ -1330,6 +1334,7 @@ public: WV_5_1 = WV_XP, WV_5_2 = WV_2003, WV_6_0 = WV_VISTA, + WV_6_1 = WV_WINDOWS7, WV_CE = 0x0100, WV_CENET = 0x0200, @@ -1353,6 +1358,7 @@ public: MV_10_3 = 0x0005, MV_10_4 = 0x0006, MV_10_5 = 0x0007, + MV_10_6 = 0x0008, /* codenames */ MV_CHEETAH = MV_10_0, @@ -1360,7 +1366,8 @@ public: MV_JAGUAR = MV_10_2, MV_PANTHER = MV_10_3, MV_TIGER = MV_10_4, - MV_LEOPARD = MV_10_5 + MV_LEOPARD = MV_10_5, + MV_SNOWLEOPARD = MV_10_6 }; static const MacVersion MacintoshVersion; #endif diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index fb7fa0c..a519f4a 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -280,9 +280,7 @@ public: WindowStaysOnTopHint = 0x00040000, // reserved for Qt3Support: // WMouseNoMask = 0x00080000, - WindowOkButtonHint = 0x00080000, // WDestructiveClose = 0x00100000, - WindowCancelButtonHint = 0x00100000, // WStaticContents = 0x00200000, // WGroupLeader = 0x00400000, // WShowModal = 0x00800000, @@ -291,7 +289,9 @@ public: WindowStaysOnBottomHint = 0x04000000, WindowCloseButtonHint = 0x08000000, MacWindowToolBarButtonHint = 0x10000000, - BypassGraphicsProxyWidget = 0x20000000 + BypassGraphicsProxyWidget = 0x20000000, + WindowOkButtonHint = 0x00080000, + WindowCancelButtonHint = 0x00100000 #ifdef QT3_SUPPORT , diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp index 0fa31f8..611b19a 100644 --- a/src/corelib/io/qdebug.cpp +++ b/src/corelib/io/qdebug.cpp @@ -49,3 +49,260 @@ #include "qdebug.h" // This file is needed to force compilation of QDebug into the kernel library. + +/*! + \class QDebug + \ingroup io + \mainclass + \brief The QDebug class provides an output stream for debugging information. + + QDebug is used whenever the developer needs to write out debugging or tracing + information to a device, file, string or console. + + \section1 Basic Use + + In the common case, it is useful to call the qDebug() function to obtain a + default QDebug object to use for writing debugging information. + + \snippet doc/src/snippets/qdebug/qdebugsnippet.cpp 1 + + This constructs a QDebug object using the constructor that accepts a QtMsgType + value of QtDebugMsg. Similarly, the qWarning(), qCritical() and qFatal() + functions also return QDebug objects for the corresponding message types. + + The class also provides several constructors for other situations, including + a constructor that accepts a QFile or any other QIODevice subclass that is + used to write debugging information to files and other devices. The constructor + that accepts a QString is used to write to a string for display or serialization. + + \section1 Writing Custom Types to a Stream + + Many standard types can be written to QDebug objects, and Qt provides support for + most Qt value types. To add support for custom types, you need to implement a + streaming operator, as in the following example: + + \snippet doc/src/snippets/qdebug/qdebugsnippet.cpp 0 + + This is described in the \l{Debugging Techniques} and + \l{Creating Custom Qt Types#Making the Type Printable}{Creating Custom Qt Types} + documents. +*/ + +/*! + \fn QDebug::QDebug(QIODevice *device) + + Constructs a debug stream that writes to the given \a device. +*/ + +/*! + \fn QDebug::QDebug(QString *string) + + Constructs a debug stream that writes to the given \a string. +*/ + +/*! + \fn QDebug::QDebug(QtMsgType type) + + Constructs a debug stream that writes to the handler for the message type specified by \a type. +*/ + +/*! + \fn QDebug::QDebug(const QDebug &other) + + Constructs a copy of the \a other debug stream. +*/ + +/*! + \fn QDebug &QDebug::operator=(const QDebug &other) + + Assigns the \a other debug stream to this stream and returns a reference to + this stream. +*/ + +/*! + \fn QDebug::~QDebug() + + Flushes any pending data to be written and destroys the debug stream. +*/ + +/*! + \fn QDebug &QDebug::space() + + Writes a space character to the debug stream and returns a reference to + the stream. + + The stream will record that the last character sent to the stream was a + space. + + \sa nospace(), maybeSpace() +*/ + +/*! + \fn QDebug &QDebug::nospace() + + Clears the stream's internal flag that records whether the last character + was a space and returns a reference to the stream. + + \sa space(), maybeSpace() +*/ + +/*! + \fn QDebug &QDebug::maybeSpace() + + Writes a space character to the debug stream, depending on the last + character sent to the stream, and returns a reference to the stream. + + If the last character was a space character, this function writes a space + character to the stream; otherwise, no characters are written to the stream. + + \sa space(), nospace() +*/ + +/*! + \fn QDebug &QDebug::operator<<(QChar t) + + Writes the character, \a t, to the stream and returns a reference to the + stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(QBool t) + \internal + + Writes the boolean value, \a t, to the stream and returns a reference to the + stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(bool t) + + Writes the boolean value, \a t, to the stream and returns a reference to the + stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(char t) + + Writes the character, \a t, to the stream and returns a reference to the + stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(signed short i) + + Writes the signed short integer, \a i, to the stream and returns a reference + to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(unsigned short i) + + Writes then unsigned short integer, \a i, to the stream and returns a + reference to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(signed int i) + + Writes the signed integer, \a i, to the stream and returns a reference + to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(unsigned int i) + + Writes then unsigned integer, \a i, to the stream and returns a reference to + the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(signed long l) + + Writes the signed long integer, \a l, to the stream and returns a reference + to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(unsigned long l) + + Writes then unsigned long integer, \a l, to the stream and returns a reference + to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(qint64 i) + + Writes the signed 64-bit integer, \a i, to the stream and returns a reference + to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(quint64 i) + + Writes then unsigned 64-bit integer, \a i, to the stream and returns a + reference to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(float f) + + Writes the 32-bit floating point number, \a f, to the stream and returns a + reference to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(double f) + + Writes the 64-bit floating point number, \a f, to the stream and returns a + reference to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(const char *s) + + Writes the '\0'-terminated string, \a s, to the stream and returns a + reference to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(const QString &s) + + Writes the string, \a s, to the stream and returns a reference to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(const QStringRef &s) + + Writes the string reference, \a s, to the stream and returns a reference to + the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(const QLatin1String &s) + + Writes the Latin1-encoded string, \a s, to the stream and returns a reference + to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(const QByteArray &b) + + Writes the byte array, \a b, to the stream and returns a reference to the + stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(const void *p) + + Writes a pointer, \a p, to the stream and returns a reference to the stream. +*/ + +/*! + \fn QDebug &QDebug::operator<<(QTextStreamFunction f) + \internal +*/ + +/*! + \fn QDebug &QDebug::operator<<(QTextStreamManipulator m) + \internal +*/ diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index 46c7dd8..b14f436 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -116,7 +116,9 @@ public: QAbstractFileEngine *engine; QStack<QAbstractFileEngineIterator *> fileEngineIterators; QString path; - QFileInfo fileInfo; + QFileInfo nextFileInfo; + //This fileinfo is the current that we will return from the public API + QFileInfo currentFileInfo; QString currentFilePath; QDirIterator::IteratorFlags iteratorFlags; QDir::Filters filters; @@ -140,8 +142,8 @@ QDirIteratorPrivate::QDirIteratorPrivate(const QString &path, const QStringList this->filters = filters; this->nameFilters = nameFilters; - fileInfo.setFile(path); - pushSubDirectory(fileInfo.isSymLink() ? fileInfo.canonicalFilePath() : path, + nextFileInfo.setFile(path); + pushSubDirectory(nextFileInfo.isSymLink() ? nextFileInfo.canonicalFilePath() : path, nameFilters, filters); } @@ -160,12 +162,12 @@ void QDirIteratorPrivate::pushSubDirectory(const QString &path, const QStringLis QDir::Filters filters) { if (iteratorFlags & QDirIterator::FollowSymlinks) { - if (fileInfo.filePath() != path) - fileInfo.setFile(path); - if (fileInfo.isSymLink()) { - visitedLinks << fileInfo.canonicalFilePath(); + if (nextFileInfo.filePath() != path) + nextFileInfo.setFile(path); + if (nextFileInfo.isSymLink()) { + visitedLinks << nextFileInfo.canonicalFilePath(); } else { - visitedLinks << fileInfo.absoluteFilePath(); + visitedLinks << nextFileInfo.absoluteFilePath(); } } @@ -199,8 +201,8 @@ void QDirIteratorPrivate::advance() QString subDir = it->currentFilePath(); #ifdef Q_OS_WIN - if (fileInfo.isSymLink()) - subDir = fileInfo.canonicalFilePath(); + if (currentFileInfo.isSymLink()) + subDir = currentFileInfo.canonicalFilePath(); #endif pushSubDirectory(subDir, it->nameFilters(), it->filters()); } @@ -213,15 +215,16 @@ void QDirIteratorPrivate::advance() while (it->hasNext()) { it->next(); if (matchesFilters(it)) { - fileInfo = it->currentFileInfo(); + currentFileInfo = nextFileInfo; + nextFileInfo = it->currentFileInfo(); // Signal that we want to follow this entry. - followNextDir = shouldFollowDirectory(fileInfo); - + followNextDir = shouldFollowDirectory(nextFileInfo); //We found a matching entry. return; } else if (iteratorFlags & QDirIterator::Subdirectories) { QFileInfo fileInfo = it->currentFileInfo(); + if (!shouldFollowDirectory(fileInfo)) continue; QString subDir = it->currentFilePath(); @@ -238,6 +241,7 @@ void QDirIteratorPrivate::advance() if (!foundDirectory) delete fileEngineIterators.pop(); } + currentFileInfo = nextFileInfo; done = true; } @@ -518,9 +522,7 @@ bool QDirIterator::hasNext() const */ QString QDirIterator::fileName() const { - if (d->fileInfo.path() != d->currentFilePath) - d->fileInfo.setFile(d->currentFilePath); - return d->fileInfo.fileName(); + return d->currentFileInfo.fileName(); } /*! @@ -543,9 +545,7 @@ QString QDirIterator::filePath() const */ QFileInfo QDirIterator::fileInfo() const { - if (d->fileInfo.filePath() != d->currentFilePath) - d->fileInfo.setFile(d->currentFilePath); - return d->fileInfo; + return d->currentFileInfo; } /*! diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index d8f08c9..d7da800 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -712,6 +712,9 @@ QFile::rename(const QString &newName) if(error() == QFile::NoError) { if (fileEngine()->rename(newName)) { unsetError(); + // engine was able to handle the new name so we just reset it + fileEngine()->setFileName(newName); + d->fileName = newName; return true; } @@ -731,10 +734,18 @@ QFile::rename(const QString &newName) } if (read == -1) { d->setError(QFile::RenameError, in.errorString()); - return true; + error = true; + } + if(!error) { + if (!in.remove()) { + d->setError(QFile::RenameError, tr("Cannot remove source file")); + error = true; + } } - if(!error) - in.remove(); + if (error) + out.remove(); + else + setFileName(newName); return !error; } } @@ -889,7 +900,10 @@ QFile::copy(const QString &newName) error = true; d->setError(QFile::CopyError, tr("Cannot create %1 for output").arg(newName)); } -#ifndef QT_NO_TEMPORARYFILE +#ifdef QT_NO_TEMPORARYFILE + if (error) + out.remove(); +#else if (!error) out.setAutoRemove(false); #endif diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index a062317..96e0f82 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -145,7 +145,7 @@ void QFileInfoPrivate::initFileEngine(const QString &file) bool QFileInfoPrivate::hasAccess(Access access) const { - if (!(data->fileEngine->fileFlags() & QAbstractFileEngine::LocalDiskFlag)) { + if (!(getFileFlags(QAbstractFileEngine::FileInfoAll) & QAbstractFileEngine::LocalDiskFlag)) { switch (access) { case ReadAccess: return getFileFlags(QAbstractFileEngine::ReadUserPerm); diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp index 4445e3c..fa44531 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp @@ -316,7 +316,7 @@ void QInotifyFileSystemWatcherEngine::readFromInotify() // qDebug() << "QInotifyFileSystemWatcherEngine::readFromInotify"; int buffSize = 0; - ioctl(inotifyFd, FIONREAD, &buffSize); + ioctl(inotifyFd, FIONREAD, (char *) &buffSize); QVarLengthArray<char, 4096> buffer(buffSize); buffSize = read(inotifyFd, buffer.data(), buffSize); const char *at = buffer.data(); diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 612f916..522be20 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -485,7 +485,7 @@ QString QFSFileEnginePrivate::longFileName(const QString &path) QString absPath = nativeAbsoluteFilePath(path); #if !defined(Q_OS_WINCE) QString prefix = QLatin1String("\\\\?\\"); - if (isUncPath(path)) { + if (isUncPath(absPath)) { prefix = QLatin1String("\\\\?\\UNC\\"); absPath.remove(0, 2); } diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index a9d8ee2..a128482 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1476,11 +1476,15 @@ QByteArray QProcess::readAllStandardError() } /*! - Starts the program \a program in a new process, passing the - command line arguments in \a arguments. The OpenMode is set to \a - mode. QProcess will immediately enter the Starting state. If the - process starts successfully, QProcess will emit started(); - otherwise, error() will be emitted. + Starts the program \a program in a new process, if one is not already + running, passing the command line arguments in \a arguments. The OpenMode + is set to \a mode. + + The QProcess object will immediately enter the Starting state. If the + process starts successfully, QProcess will emit started(); otherwise, + error() will be emitted. If the QProcess object is already running a + process, a warning may be printed at the console, and the existing + process will continue running. Note that arguments that contain spaces are not passed to the process as separate arguments. @@ -1577,10 +1581,10 @@ static QStringList parseCombinedArgString(const QString &program) /*! \overload - Starts the program \a program in a new process. \a program is a - single string of text containing both the program name and its - arguments. The arguments are separated by one or more - spaces. For example: + Starts the program \a program in a new process, if one is not already + running. \a program is a single string of text containing both the + program name and its arguments. The arguments are separated by one or + more spaces. For example: \snippet doc/src/snippets/code/src_corelib_io_qprocess.cpp 5 @@ -1589,6 +1593,9 @@ static QStringList parseCombinedArgString(const QString &program) \snippet doc/src/snippets/code/src_corelib_io_qprocess.cpp 6 + If the QProcess object is already running a process, a warning may be + printed at the console, and the existing process will continue running. + Note that, on Windows, quotes need to be both escaped and quoted. For example, the above code would be specified in the following way to ensure that \c{"My Documents"} is used as the argument to @@ -1601,6 +1608,13 @@ static QStringList parseCombinedArgString(const QString &program) void QProcess::start(const QString &program, OpenMode mode) { QStringList args = parseCombinedArgString(program); + if (args.isEmpty()) { + Q_D(QProcess); + d->processError = QProcess::FailedToStart; + setErrorString(tr("No program defined")); + emit error(d->processError); + return; + } QString prog = args.first(); args.removeFirst(); @@ -1769,6 +1783,8 @@ bool QProcess::startDetached(const QString &program, bool QProcess::startDetached(const QString &program) { QStringList args = parseCombinedArgString(program); + if (args.isEmpty()) + return false; QString prog = args.first(); args.removeFirst(); diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 37173c8..33d4a47 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -850,10 +850,10 @@ bool QProcessPrivate::processStarted() qint64 QProcessPrivate::bytesAvailableFromStdout() const { - size_t nbytes = 0; + int nbytes = 0; qint64 available = 0; if (::ioctl(stdoutChannel.pipe[0], FIONREAD, (char *) &nbytes) >= 0) - available = (qint64) *((int *) &nbytes); + available = (qint64) nbytes; #if defined (QPROCESS_DEBUG) qDebug("QProcessPrivate::bytesAvailableFromStdout() == %lld", available); #endif @@ -862,10 +862,10 @@ qint64 QProcessPrivate::bytesAvailableFromStdout() const qint64 QProcessPrivate::bytesAvailableFromStderr() const { - size_t nbytes = 0; + int nbytes = 0; qint64 available = 0; if (::ioctl(stderrChannel.pipe[0], FIONREAD, (char *) &nbytes) >= 0) - available = (qint64) *((int *) &nbytes); + available = (qint64) nbytes; #if defined (QPROCESS_DEBUG) qDebug("QProcessPrivate::bytesAvailableFromStderr() == %lld", available); #endif diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 62b4ed5..484e79a 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -2330,6 +2330,10 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, \o \c{HKEY_LOCAL_MACHINE\Software\MySoft} \endlist + \note On Windows, for 32-bit programs running in WOW64 mode, settings are + stored in the following registry path: + \c{HKEY_LOCAL_MACHINE\Software\WOW6432node}. + If the file format is IniFormat, the following files are used on Unix and Mac OS X: diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp index 67d2eeb..a08c969 100644 --- a/src/corelib/io/qsettings_win.cpp +++ b/src/corelib/io/qsettings_win.cpp @@ -548,12 +548,13 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa case REG_EXPAND_SZ: case REG_SZ: { QString s; - QT_WA( { - s = QString::fromUtf16(((const ushort*)data.constData())); - }, { - s = QString::fromLocal8Bit(data.constData()); - } ); - + if (dataSize) { + QT_WA( { + s = QString::fromUtf16(((const ushort*)data.constData())); + }, { + s = QString::fromLocal8Bit(data.constData()); + } ); + } if (value != 0) *value = stringToVariant(s); break; @@ -561,19 +562,21 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa case REG_MULTI_SZ: { QStringList l; - int i = 0; - for (;;) { - QString s; - QT_WA( { - s = QString::fromUtf16((const ushort*)data.constData() + i); - }, { - s = QString::fromLocal8Bit(data.constData() + i); - } ); - i += s.length() + 1; + if (dataSize) { + int i = 0; + for (;;) { + QString s; + QT_WA( { + s = QString::fromUtf16((const ushort*)data.constData() + i); + }, { + s = QString::fromLocal8Bit(data.constData() + i); + } ); + i += s.length() + 1; - if (s.isEmpty()) - break; - l.append(s); + if (s.isEmpty()) + break; + l.append(s); + } } if (value != 0) *value = stringListToVariantList(l); @@ -583,11 +586,13 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa case REG_NONE: case REG_BINARY: { QString s; - QT_WA( { - s = QString::fromUtf16((const ushort*)data.constData(), data.size()/2); - }, { - s = QString::fromLocal8Bit(data.constData(), data.size()); - } ); + if (dataSize) { + QT_WA( { + s = QString::fromUtf16((const ushort*)data.constData(), data.size()/2); + }, { + s = QString::fromLocal8Bit(data.constData(), data.size()); + } ); + } if (value != 0) *value = stringToVariant(s); break; diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 3cfce83..6a7b067 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -268,11 +268,13 @@ static int _gettemp(char *path, int *doopen, int domkdir, int slen) /*NOTREACHED*/ } +#ifndef Q_WS_WIN static int qt_mkstemps(char *path, int slen) { int fd = 0; return (_gettemp(path, &fd, 0, slen) ? fd : -1); } +#endif //************* QTemporaryFileEngine class QTemporaryFileEngine : public QFSFileEngine diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index 5227d4f..ed9d0aa 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -1370,7 +1370,7 @@ QTextStream::FieldAlignment QTextStream::fieldAlignment() const \snippet doc/src/snippets/code/src_corelib_io_qtextstream.cpp 5 - Output: + The string \c s contains: \snippet doc/src/snippets/code/src_corelib_io_qtextstream.cpp 6 diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index b3f9f1a..a23b2dd 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -377,6 +377,14 @@ QString qAppName() QLibrary) can be retrieved with libraryPaths() and manipulated by setLibraryPaths(), addLibraryPath(), and removeLibraryPath(). + On Unix/Linux Qt is configured to use the system local settings by + default. This can cause a conflict when using POSIX functions, for + instance, when converting between data types such as floats and + strings, since the notation may differ between locales. To get + around this problem call the POSIX function setlocale(LC_NUMERIC,"C") + right after initializing QApplication or QCoreApplication to reset + the locale that is used for number formatting to "C"-locale. + \sa QApplication, QAbstractEventDispatcher, QEventLoop, {Semaphores Example}, {Wait Conditions Example} */ diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index 1bddbe5..5e76976 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -267,6 +267,7 @@ public: GrabKeyboard = 188, UngrabKeyboard = 189, CocoaRequestModal = 190, // Internal for requesting an application modal Cocoa Window + MacGLClearDrawable = 191, // Internal Cocoa, the window has changed, so we must clear Signal = 191, StateFinished = 192, diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp index 20548de..3fd768a 100644 --- a/src/corelib/kernel/qeventdispatcher_glib.cpp +++ b/src/corelib/kernel/qeventdispatcher_glib.cpp @@ -242,6 +242,7 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context) postEventSource = reinterpret_cast<GPostEventSource *>(g_source_new(&postEventSourceFuncs, sizeof(GPostEventSource))); + postEventSource->serialNumber = 1; g_source_set_can_recurse(&postEventSource->source, true); g_source_attach(&postEventSource->source, mainContext); diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 880e95c..c4061f4 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -1059,11 +1059,20 @@ bool QEventDispatcherWin32::event(QEvent *e) QZeroTimerEvent *zte = static_cast<QZeroTimerEvent*>(e); WinTimerInfo *t = d->timerDict.value(zte->timerId()); if (t) { + t->inTimerEvent = true; + QTimerEvent te(zte->timerId()); QCoreApplication::sendEvent(t->obj, &te); - WinTimerInfo *tn = d->timerDict.value(zte->timerId()); - if (tn && t == tn) - QCoreApplication::postEvent(this, new QZeroTimerEvent(zte->timerId())); + + t = d->timerDict.value(zte->timerId()); + if (t) { + if (t->interval == 0 && t->inTimerEvent) { + // post the next zero timer event as long as the timer was not restarted + QCoreApplication::postEvent(this, new QZeroTimerEvent(zte->timerId())); + } + + t->inTimerEvent = false; + } } return true; } else if (e->type() == QEvent::Timer) { diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 719398c..b65f956 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1007,6 +1007,11 @@ enum { MaximumParamCount = 11 }; // up to 10 arguments + 1 return value a QEvent will be sent and the member is invoked as soon as the application enters the main event loop. + \o If \a type is Qt::BlockingQueuedConnection, the method will be invoked in + the same way as for Qt::QueuedConnection, except that the current thread + will block until the event is delivered. Using this connection type to + communicate between objects in the same thread will lead to deadlocks. + \o If \a type is Qt::AutoConnection, the member is invoked synchronously if \a obj lives in the same thread as the caller; otherwise it will invoke the member asynchronously. @@ -1897,6 +1902,12 @@ static QByteArray qualifiedName(const QMetaEnum &e) \ingroup objectmodel + Property meta-data is obtained from an object's meta-object. See + QMetaObject::property() and QMetaObject::propertyCount() for + details. + + \section1 Property Meta-Data + A property has a name() and a type(), as well as various attributes that specify its behavior: isReadable(), isWritable(), isDesignable(), isScriptable(), and isStored(). @@ -1912,9 +1923,10 @@ static QByteArray qualifiedName(const QMetaEnum &e) functions. See QObject::setProperty() and QObject::property() for details. - You get property meta-data through an object's meta-object. See - QMetaObject::property() and QMetaObject::propertyCount() for - details. + \section1 Copying and Assignment + + QMetaProperty objects can be copied by value. However, each copy will + refer to the same underlying property meta-data. \sa QMetaObject, QMetaEnum, QMetaMethod, {Qt's Property System} */ diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index be60055..ce10bae 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -75,9 +75,9 @@ QT_BEGIN_NAMESPACE \relates QMetaType This macro makes the type \a Type known to QMetaType as long as it - provides a public default constructor, a public copy constructor, - and a public destructor. It is needed to use the type \a Type as a - custom type in QVariant. + provides a public default constructor, a public copy constructor and + a public destructor. + It is needed to use the type \a Type as a custom type in QVariant. Ideally, this macro should be placed below the declaration of the class or struct. If that is not possible, it can be put in @@ -1255,9 +1255,9 @@ void QMetaType::destroy(int type, void *data) \relates QMetaType \threadsafe - Registers the type name \a typeName to the type \c{T}. Returns + Registers the type name \a typeName for the type \c{T}. Returns the internal ID used by QMetaType. Any class or struct that has a - public constructor, a public copy constructor, and a public + public default constructor, a public copy constructor and a public destructor can be registered. After a type has been registered, you can create and destroy diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 55cf464..05015c0 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1121,13 +1121,13 @@ bool QObject::event(QEvent *e) QThreadData *threadData = d->threadData; QAbstractEventDispatcher *eventDispatcher = threadData->eventDispatcher; if (eventDispatcher) { - // set inThreadChangeEvent to true to tell the dispatcher not to release out timer ids - // back to the pool (since the timer ids are moving to a new thread). - d->inThreadChangeEvent = true; QList<QPair<int, int> > timers = eventDispatcher->registeredTimers(this); - d->inThreadChangeEvent = false; if (!timers.isEmpty()) { + // set inThreadChangeEvent to true to tell the dispatcher not to release out timer ids + // back to the pool (since the timer ids are moving to a new thread). + d->inThreadChangeEvent = true; eventDispatcher->unregisterTimers(this); + d->inThreadChangeEvent = false; QMetaObject::invokeMethod(this, "_q_reregisterTimers", Qt::QueuedConnection, Q_ARG(void*, (new QList<QPair<int, int> >(timers)))); } diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index cdddf36..77d6599 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -95,8 +95,7 @@ static bool match(const uchar* found, const char* target, uint len) // (normalize it to be without the zero-terminating symbol) if (len > 0 && found[len-1] == '\0') --len; - // 0 means anything, "" means empty - return !found || (qstrncmp((const char *)found, target, len) == 0 && target[len] == '\0'); + return (memcmp(found, target, len) == 0 && target[len] == '\0'); } static uint elfHash(const char *name) @@ -765,8 +764,6 @@ void QTranslatorPrivate::clear() } /*! - \since 4.5 - Returns the translation for the key (\a context, \a sourceText, \a disambiguation). If none is found, also tries (\a context, \a sourceText, ""). If that still fails, returns an empty string. diff --git a/src/corelib/thread/qatomic.cpp b/src/corelib/thread/qatomic.cpp index 44c4482..f426feb 100644 --- a/src/corelib/thread/qatomic.cpp +++ b/src/corelib/thread/qatomic.cpp @@ -56,7 +56,8 @@ \section1 Non-atomic convenience operators For convenience, QAtomicInt provides integer comparison, cast, and - assignment operators. Note that these operators are \e not atomic. + assignment operators. Note that a combination of these operators + is \e not an atomic operation. \section1 The Atomic API diff --git a/src/corelib/thread/qmutexpool.cpp b/src/corelib/thread/qmutexpool.cpp index 71ecab5..96a9940 100644 --- a/src/corelib/thread/qmutexpool.cpp +++ b/src/corelib/thread/qmutexpool.cpp @@ -96,9 +96,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(QMutexPool, globalMutexPool, (true)) QMutexPool is destructed. */ QMutexPool::QMutexPool(bool recursive, int size) - : count(size), recurs(recursive) + : mutexes(size), count(size), recurs(recursive) { - mutexes = new QMutex*[count]; for (int index = 0; index < count; ++index) { mutexes[index] = 0; } @@ -110,13 +109,10 @@ QMutexPool::QMutexPool(bool recursive, int size) */ QMutexPool::~QMutexPool() { - QMutexLocker locker(&mutex); for (int index = 0; index < count; ++index) { delete mutexes[index]; mutexes[index] = 0; } - delete [] mutexes; - mutexes = 0; } /*! @@ -138,12 +134,9 @@ QMutex *QMutexPool::get(const void *address) if (!mutexes[index]) { // mutex not created, create one - - QMutexLocker locker(&mutex); - // we need to check once again that the mutex hasn't been created, since - // 2 threads could be trying to create a mutex at the same index... - if (!mutexes[index]) - mutexes[index] = new QMutex(recurs ? QMutex::Recursive : QMutex::NonRecursive); + QMutex *newMutex = new QMutex(recurs ? QMutex::Recursive : QMutex::NonRecursive); + if (!mutexes[index].testAndSetOrdered(0, newMutex)) + delete newMutex; } return mutexes[index]; diff --git a/src/corelib/thread/qmutexpool_p.h b/src/corelib/thread/qmutexpool_p.h index 65a3b54..1009ebb 100644 --- a/src/corelib/thread/qmutexpool_p.h +++ b/src/corelib/thread/qmutexpool_p.h @@ -53,7 +53,9 @@ // We mean it. // +#include "QtCore/qatomic.h" #include "QtCore/qmutex.h" +#include "QtCore/qvarlengtharray.h" #ifndef QT_NO_THREAD @@ -70,8 +72,7 @@ public: static QMutex *globalInstanceGet(const void *address); private: - QMutex mutex; - QMutex **mutexes; + QVarLengthArray<QAtomicPointer<QMutex>, 128> mutexes; int count; bool recurs; }; diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 7f87897..2fb6335 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -297,6 +297,12 @@ void QAdoptedThread::run() priority parameter. If the thread is already running, this function does nothing. + The effect of the \a priority parameter is dependent on the + operating system's scheduling policy. In particular, the \a priority + will be ignored on systems that do not support thread priorities + (such as on Linux, see http://linux.die.net/man/2/sched_setscheduler + for more details). + \sa run(), terminate() */ @@ -590,6 +596,12 @@ void QThread::cleanup() The \a priority argument can be any value in the \c QThread::Priority enum except for \c InheritPriorty. + The effect of the \a priority parameter is dependent on the + operating system's scheduling policy. In particular, the \a priority + will be ignored on systems that do not support thread priorities + (such as on Linux, see http://linux.die.net/man/2/sched_setscheduler + for more details). + \sa Priority priority() start() */ diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp index a3cbecc..c454224 100644 --- a/src/corelib/tools/qlinkedlist.cpp +++ b/src/corelib/tools/qlinkedlist.cpp @@ -652,7 +652,7 @@ QLinkedListData QLinkedListData::shared_null = { Constructs an uninitialized iterator. Functions like operator*() and operator++() should not be called - on an uninitialized iterartor. Use operator=() to assign a value + on an uninitialized iterator. Use operator=() to assign a value to it before using it. \sa QLinkedList::begin() QLinkedList::end() @@ -858,7 +858,7 @@ QLinkedListData QLinkedListData::shared_null = { Constructs an uninitialized iterator. Functions like operator*() and operator++() should not be called - on an uninitialized iterartor. Use operator=() to assign a value + on an uninitialized iterator. Use operator=() to assign a value to it before using it. \sa QLinkedList::constBegin() QLinkedList::constEnd() diff --git a/src/corelib/tools/qlistdata.cpp b/src/corelib/tools/qlistdata.cpp index 2b1c086..d7c39a7 100644 --- a/src/corelib/tools/qlistdata.cpp +++ b/src/corelib/tools/qlistdata.cpp @@ -1193,7 +1193,7 @@ void **QListData::erase(void **xi) Constructs an uninitialized iterator. Functions like operator*() and operator++() should not be called - on an uninitialized iterartor. Use operator=() to assign a value + on an uninitialized iterator. Use operator=() to assign a value to it before using it. \sa QList::begin() QList::end() @@ -1416,7 +1416,7 @@ void **QListData::erase(void **xi) Constructs an uninitialized iterator. Functions like operator*() and operator++() should not be called - on an uninitialized iterartor. Use operator=() to assign a value + on an uninitialized iterator. Use operator=() to assign a value to it before using it. \sa QList::constBegin() QList::constEnd() diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index db2fc26..559ba81 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -4399,7 +4399,8 @@ double QLocalePrivate::stringToDouble(const QString &number, bool *ok, GroupSeparatorMode group_sep_mode) const { CharBuff buff; - if (!numberToCLocale(number, group_sep_mode, &buff)) { + if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, + group_sep_mode, &buff)) { if (ok != 0) *ok = false; return 0.0; @@ -4411,7 +4412,8 @@ qlonglong QLocalePrivate::stringToLongLong(const QString &number, int base, bool *ok, GroupSeparatorMode group_sep_mode) const { CharBuff buff; - if (!numberToCLocale(number, group_sep_mode, &buff)) { + if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, + group_sep_mode, &buff)) { if (ok != 0) *ok = false; return 0; @@ -4424,7 +4426,8 @@ qulonglong QLocalePrivate::stringToUnsLongLong(const QString &number, int base, bool *ok, GroupSeparatorMode group_sep_mode) const { CharBuff buff; - if (!numberToCLocale(number, group_sep_mode, &buff)) { + if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, + group_sep_mode, &buff)) { if (ok != 0) *ok = false; return 0; diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index d8a9923..c3a989e 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -842,15 +842,19 @@ QT_BEGIN_NAMESPACE */ void QtSharedPointer::internalSafetyCheckAdd(const volatile void *ptr) { - QMutexLocker lock(&knownPointers()->mutex); + KnownPointers *const kp = knownPointers(); + if (!kp) + return; // end-game: the application is being destroyed already + + QMutexLocker lock(&kp->mutex); void *actual = const_cast<void*>(ptr); - if (knownPointers()->values.contains(actual)) { + if (kp->values.contains(actual)) { printBacktrace(knownPointers()->values.value(actual)); qFatal("QSharedPointerData: internal self-check failed: pointer %p was already tracked " "by another QSharedPointerData object", actual); } - knownPointers()->values.insert(actual, saveBacktrace()); + kp->values.insert(actual, saveBacktrace()); } /*! @@ -858,9 +862,13 @@ void QtSharedPointer::internalSafetyCheckAdd(const volatile void *ptr) */ void QtSharedPointer::internalSafetyCheckRemove(const volatile void *ptr) { - QMutexLocker lock(&knownPointers()->mutex); + KnownPointers *const kp = knownPointers(); + if (!kp) + return; // end-game: the application is being destroyed already + + QMutexLocker lock(&kp->mutex); void *actual = const_cast<void*>(ptr); - knownPointers()->values.remove(actual); + kp->values.remove(actual); } QT_END_NAMESPACE diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 1b29adc..375d672 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -579,7 +579,7 @@ const QString::Null QString::null = { }; '\\0' character for a null string (\e not a null pointer), and QString() compares equal to QString(""). We recommend that you always use the isEmpty() function and avoid isNull(). - + \section1 Argument Formats In member functions where an argument \e format can be specified @@ -1433,7 +1433,7 @@ QString &QString::append(QChar ch) truncated at the specified \a position. \snippet doc/src/snippets/qstring/main.cpp 37 - + \sa insert(), replace() */ QString &QString::remove(int pos, int len) @@ -1552,7 +1552,7 @@ QString &QString::replace(int pos, int len, const QChar *unicode, int size) return *this; if (pos + len > d->size) len = d->size - pos; - + uint index = pos; replace_helper(&index, 1, len, unicode, size); return *this; @@ -1561,15 +1561,13 @@ QString &QString::replace(int pos, int len, const QChar *unicode, int size) /*! \fn QString &QString::replace(int position, int n, QChar after) \overload replace() - + Replaces \a n characters beginning at index \a position with the character \a after and returns a reference to this string. */ QString &QString::replace(int pos, int len, QChar after) { - uint index = pos; - replace_helper(&index, 1, len, &after, 1); - return *this; + return replace(pos, len, &after, 1); } /*! @@ -1602,7 +1600,7 @@ void QString::replace_helper(uint *indices, int nIndices, int blen, const QChar { if (blen == alen) { detach(); - for (int i = 0; i < nIndices; ++i) + for (int i = 0; i < nIndices; ++i) memcpy(d->data + indices[i], after, alen * sizeof(QChar)); } else if (alen < blen) { detach(); @@ -1633,7 +1631,7 @@ void QString::replace_helper(uint *indices, int nIndices, int blen, const QChar int newLen = d->size + adjust; int moveend = d->size; resize(newLen); - + while (nIndices) { --nIndices; int movestart = indices[nIndices] + blen; @@ -1685,7 +1683,7 @@ QString &QString::replace(const QChar *before, int blen, memcpy(copy, before, blen*sizeof(QChar)); b = copy; } - + QStringMatcher matcher(b, blen, cs); int index = 0; @@ -1712,7 +1710,7 @@ QString &QString::replace(const QChar *before, int blen, // index has to be adjusted in case we get back into the loop above. index += pos*(alen-blen); } - + if (a != after) ::free((QChar *)a); if (b != before) @@ -2250,7 +2248,7 @@ int QString::indexOf(const QLatin1String &str, int from, Qt::CaseSensitivity cs) QVarLengthArray<ushort> s(len); for (int i = 0; i < len; ++i) s[i] = str.latin1()[i]; - + return qFindString(unicode(), length(), from, (const QChar *)s.data(), len, cs); } @@ -2346,7 +2344,7 @@ static int lastIndexOfHelper(const ushort *haystack, int from, const ushort *nee /* See indexOf() for explanations. */ - + const ushort *end = haystack; haystack += from; const int sl_minus_1 = sl-1; @@ -2408,7 +2406,7 @@ int QString::lastIndexOf(const QString &str, int from, Qt::CaseSensitivity cs) c const int sl = str.d->size; if (sl == 1) return lastIndexOf(QChar(str.d->data[0]), from, cs); - + const int l = d->size; if (from < 0) from += l; @@ -2446,7 +2444,7 @@ int QString::lastIndexOf(const QLatin1String &str, int from, Qt::CaseSensitivity const int sl = qstrlen(str.latin1()); if (sl == 1) return lastIndexOf(QLatin1Char(str.latin1()[0]), from, cs); - + const int l = d->size; if (from < 0) from += l; @@ -4864,7 +4862,8 @@ QString QString::toUpper() const a pointer to a zero-terminated array of unicode characters of type ushort (as returned by QString::utf16()). - \note This function expects a UTF-8 string for %s. + \note This function expects a UTF-8 string for %s and Latin-1 for + the format string. The format string supports most of the conversion specifiers provided by printf() in the standard C++ library. It doesn't @@ -5994,7 +5993,7 @@ QString QString::normalized(QString::NormalizationForm mode, QChar::UnicodeVersi } if (simple) return *this; - + QString s = *this; if (version != CURRENT_VERSION) { for (int i = 0; i < NumNormalizationCorrections; ++i) { @@ -6206,7 +6205,7 @@ static QString replaceArgEscapes(const QString &s, const ArgEscapeData &d, int f /*! Returns a copy of this string with the lowest numbered place marker replaced by string \a a, i.e., \c %1, \c %2, ..., \c %99. - + \a fieldWidth specifies the minimum amount of space that argument \a a shall occupy. If \a a requires less space than \a fieldWidth, it is padded to \a fieldWidth with character \a fillChar. A positive @@ -6818,7 +6817,7 @@ void QString::updateProperties() const Appends the given \a ch character onto the end of this string. */ -/*! +/*! \fn std::string QString::toStdString() const Returns a std::string object with the data contained in this diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 6bea03b..3fd52ee 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -98,6 +98,8 @@ struct QVectorTypedData T array[1]; }; +class QRegion; + template <typename T> class QVector { diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index bff4e15..ff1a01f 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -2792,9 +2792,9 @@ QStringRef QXmlStreamReader::documentEncoding() const \inmodule QtXml \ingroup xml-tools - QXmlStreamWriter is the pendent to QXmlStreamReader for writing + QXmlStreamWriter is the counterpart to QXmlStreamReader for writing XML. Like its related class, it operates on a QIODevice specified - with setDevice(). The API is simple and straight forward: For every + with setDevice(). The API is simple and straightforward: for every XML token or event you want to write, the writer provides a specialized function. @@ -2814,6 +2814,15 @@ QStringRef QXmlStreamReader::documentEncoding() const writeStartElement(). A convenience method writeTextElement() can be used for writing terminal elements that contain nothing but text. + The following abridged code snippet shows the basic use of the class + to write formatted XML with indentation: + + \snippet doc/src/snippets/qxmlstreamwriter/main.cpp start stream + \dots + \snippet doc/src/snippets/qxmlstreamwriter/main.cpp write element + \dots + \snippet doc/src/snippets/qxmlstreamwriter/main.cpp finish stream + QXmlStreamWriter takes care of prefixing namespaces, all you have to do is specify the \c namespaceUri when writing elements or attributes. If you must conform to certain prefixes, you can force |