diff options
111 files changed, 1934 insertions, 430 deletions
diff --git a/demos/deform/main.cpp b/demos/deform/main.cpp index 4539973..bef075a 100644 --- a/demos/deform/main.cpp +++ b/demos/deform/main.cpp @@ -50,10 +50,7 @@ int main(int argc, char **argv) QApplication app(argc, argv); - bool smallScreen = false; - for (int i=0; i<argc; i++) - if (QString(argv[i]) == "-small-screen") - smallScreen = true; + bool smallScreen = QApplication::arguments().contains("-small-screen"); PathDeformWidget deformWidget(0, smallScreen); diff --git a/demos/pathstroke/main.cpp b/demos/pathstroke/main.cpp index 1465682..534b233 100644 --- a/demos/pathstroke/main.cpp +++ b/demos/pathstroke/main.cpp @@ -48,10 +48,7 @@ int main(int argc, char **argv) QApplication app(argc, argv); - bool smallScreen = false; - for (int i=0; i<argc; i++) - if (QString(argv[i]) == "-small-screen") - smallScreen = true; + bool smallScreen = QApplication::arguments().contains("-small-screen"); PathStrokeWidget pathStrokeWidget(smallScreen); QStyle *arthurStyle = new ArthurStyle(); diff --git a/demos/spectrum/app/engine.h b/demos/spectrum/app/engine.h index 16088b2..93733fe 100644 --- a/demos/spectrum/app/engine.h +++ b/demos/spectrum/app/engine.h @@ -61,10 +61,13 @@ #include <QDir> #endif +QT_BEGIN_NAMESPACE class QAudioInput; class QAudioOutput; -class FrequencySpectrum; class QFile; +QT_END_NAMESPACE + +class FrequencySpectrum; /** * This class interfaces with the QtMultimedia audio classes, and also with diff --git a/demos/spectrum/app/mainwidget.h b/demos/spectrum/app/mainwidget.h index 846b97a..c59dbd6 100644 --- a/demos/spectrum/app/mainwidget.h +++ b/demos/spectrum/app/mainwidget.h @@ -50,11 +50,14 @@ class Waveform; class LevelMeter; class SettingsDialog; class ToneGeneratorDialog; + +QT_BEGIN_NAMESPACE class QAudioFormat; class QLabel; class QPushButton; class QMenu; class QAction; +QT_END_NAMESPACE /** * Main application widget, responsible for connecting the various UI diff --git a/demos/spectrum/app/settingsdialog.h b/demos/spectrum/app/settingsdialog.h index 7215a50..fda518b 100644 --- a/demos/spectrum/app/settingsdialog.h +++ b/demos/spectrum/app/settingsdialog.h @@ -42,11 +42,13 @@ #include <QDialog> #include <QtMultimedia/QAudioDeviceInfo> +QT_BEGIN_NAMESPACE class QComboBox; class QCheckBox; class QSlider; class QSpinBox; class QGridLayout; +QT_END_NAMESPACE /** * Dialog used to control settings such as the audio input / output device diff --git a/demos/spectrum/app/spectrograph.h b/demos/spectrum/app/spectrograph.h index 6bfef33..a7790ff 100644 --- a/demos/spectrum/app/spectrograph.h +++ b/demos/spectrum/app/spectrograph.h @@ -41,7 +41,9 @@ #include <QWidget> #include "frequencyspectrum.h" +QT_BEGIN_NAMESPACE class QMouseEvent; +QT_END_NAMESPACE /** * Widget which displays a spectrograph showing the frequency spectrum diff --git a/demos/spectrum/app/spectrumanalyser.h b/demos/spectrum/app/spectrumanalyser.h index caeb1c1..f10da63 100644 --- a/demos/spectrum/app/spectrumanalyser.h +++ b/demos/spectrum/app/spectrumanalyser.h @@ -55,8 +55,11 @@ #include "FFTRealFixLenParam.h" #endif +QT_BEGIN_NAMESPACE class QAudioFormat; class QThread; +QT_END_NAMESPACE + class FFTRealWrapper; class SpectrumAnalyserThreadPrivate; diff --git a/demos/spectrum/app/tonegenerator.h b/demos/spectrum/app/tonegenerator.h index 419f7e4..d387768 100644 --- a/demos/spectrum/app/tonegenerator.h +++ b/demos/spectrum/app/tonegenerator.h @@ -41,8 +41,10 @@ #include <QtCore/qglobal.h> #include "spectrum.h" +QT_BEGIN_NAMESPACE class QAudioFormat; class QByteArray; +QT_END_NAMESPACE /** * Generate a sine wave diff --git a/demos/spectrum/app/tonegeneratordialog.h b/demos/spectrum/app/tonegeneratordialog.h index 35d69c2..d6fcffa 100644 --- a/demos/spectrum/app/tonegeneratordialog.h +++ b/demos/spectrum/app/tonegeneratordialog.h @@ -42,10 +42,12 @@ #include <QDialog> #include <QtMultimedia/QAudioDeviceInfo> +QT_BEGIN_NAMESPACE class QCheckBox; class QSlider; class QSpinBox; class QGridLayout; +QT_END_NAMESPACE /** * Dialog which controls the parameters of the tone generator. diff --git a/demos/spectrum/app/utils.h b/demos/spectrum/app/utils.h index 83467cd..548f884 100644 --- a/demos/spectrum/app/utils.h +++ b/demos/spectrum/app/utils.h @@ -41,7 +41,9 @@ #include <QtCore/qglobal.h> #include <QDebug> +QT_BEGIN_NAMESPACE class QAudioFormat; +QT_END_NAMESPACE //----------------------------------------------------------------------------- // Miscellaneous utility functions diff --git a/demos/spectrum/app/waveform.h b/demos/spectrum/app/waveform.h index 4de527f..909e5ee 100644 --- a/demos/spectrum/app/waveform.h +++ b/demos/spectrum/app/waveform.h @@ -43,7 +43,9 @@ #include <QPixmap> #include <QScopedPointer> +QT_BEGIN_NAMESPACE class QByteArray; +QT_END_NAMESPACE /** * Widget which displays a section of the audio waveform. diff --git a/dist/changes-4.7.0 b/dist/changes-4.7.0 index dff20dd..31130e8 100644 --- a/dist/changes-4.7.0 +++ b/dist/changes-4.7.0 @@ -54,8 +54,6 @@ QtCore * Significantly improved performance of the type() function - QState * [QTBUG-7741] Added a function to get the out-going transitions - - QStateMachine - * [QTBUG-8842] Reset history states when (re)starting machine - QXmlStreamReader * [QTBUG-9196] fixed crash when parsing - QTimer @@ -166,12 +164,6 @@ QtNetwork * [QTBUG-2515] Do not make OpenSSL prompt for a password * [QTBUG-6504, QTBUG-8924, QTBUG-5645] Fix memleak -QtOpenGL --------- - - QGLWidget - * [QTBUG-7865] Fixed bug where GL widgets were not fully updated on - Windows Vista/7 with Aero disabled. - QtScript -------- - Updated src/3rdparty/javascriptcore to a more recent version @@ -341,3 +333,10 @@ QtScript: Changes due to updating src/3rdparty/javascriptcore: a column number of 1. - QScriptValueIterator will include the "length" property when iterating over Array objects. + +QtCore: + - QChar no longer carries the Q_PACKED tag on ARM. This flag was + used to allow proper alignment of QChar on 2 bytes on older ARM + ABIs, but it also allowed for unaligned access. Qt never generates + or uses unaligned access and the new EABI aligns as expected, so + the flag was removed. diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc index 47504ae..62536c6 100644 --- a/doc/src/declarative/advtutorial.qdoc +++ b/doc/src/declarative/advtutorial.qdoc @@ -468,6 +468,6 @@ By following this tutorial you've seen how you can write a fully functional appl \endlist There is so much more to learn about QML that we haven't been able to cover in this tutorial. Check out all the -demos and examples and the \l {Declarative UI Using QML}{documentation} to find out all the things you can do with QML! +demos and examples and the \l {Qt Quick} documentation to see all the things you can do with QML! */ diff --git a/doc/src/declarative/integrating.qdoc b/doc/src/declarative/integrating.qdoc index c6f754b..728eb13 100644 --- a/doc/src/declarative/integrating.qdoc +++ b/doc/src/declarative/integrating.qdoc @@ -81,7 +81,7 @@ of simple and dynamic elements. \section2 Adding QML widgets to a QGraphicsScene -If you have an existing UI based on the \l{The Graphics View Framework}{Graphics View Framework}, +If you have an existing UI based on the \l{Graphics View Framework}, you can integrate QML widgets directly into your QGraphicsScene. Use QDeclarativeComponent to create a QGraphicsObject from a QML file, and place the graphics object into your scene using \l{QGraphicsScene::addItem()}, or diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc new file mode 100644 index 0000000..64a4949 --- /dev/null +++ b/doc/src/declarative/qml-intro.qdoc @@ -0,0 +1,967 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation 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$ +** +****************************************************************************/ + + + +/*! + +\page qml-intro.html +\title Beginning Qt Quick + + +\section1 Overview + + +QML is a high level, scripted language. Its commands, more correctly \e elements, +leverage the power and efficiency of the Qt libraries to make easy to use +commands that perform intuitive functions. Draw a rectangle, display an image at +a position and so on. Behind these elements are complex C++ libraries that +efficiently perform the action. As with any graphical application, always +consider that this ability to easily build graphically rich applications means +that some care may be needed to prevent performance problems. + +The language also allows more flexibility of these commands by using +Javascript rather than C++ to add new layers of logic to your application. +Javascript is easier to learn than C++ and can be embedded into the QML +files or imported from a separate file. + +\bold{In QML the types of various 'objects' are referred to as \l {QML +Elements}{ elements}}. + +An element usually has various \e properties that help define the element. For +example, if we created an element called Circle then the radius of the circle +would be a property. + + +\section1 A First Look + +The basic syntax of an \l {QML Elements}{element} is + + \code + SomeElement { + id: myObject + ... some other things here ... + } + \endcode + +Here we are defining a new object. We specify its 'type' first as SomeElement. +Then within matching braces { ... } we specify the various parts of our +element. + +The \c id is a unique identifier for the element, it must start with a lower +case letter and only contain letters, numbers and underscores. It is this +particular object's name. If this SomeElement \l {QML Elements}{element} was +a Rectangle instead and it was one of many then the \e optional unique id +would allow us to manipulate each element individually. + +Each visual element is ultimately based on, or inherits from, an element +called \l Item. \l Item has certain properties and actions that may be +useful. The properties have default values so you need only specify the +ones you will need. + +Take a simple element such as a \l Rectangle. It has an \c id, we will call +it \e myRectangle, it has a \c width and a \c height. Imagine that we +want a rectangle that is 500 pixels by 400 pixels in the x and y directions +(horizontal by vertical). + +We can implement this \l Rectangle with these properties this way + + \code + import Qt 4.7 + + // This is a comment. And below myRectangle is defined. + Rectangle { + id: myRectangle + width: 500 + height: 400 + } + \endcode + +This is a valid QML script. To run it, copy it and save it to a file, say +myexample.qml, and on the command line run the command + + \code + qml myexample.qml + \endcode + +It will create a very boring rectangle in its own window. + + + +\section1 Hello World! + +We can now add some color and text to make a Hello World QML program. + +\l Rectangle has the property \l {Rectangle::color}{color} to produce a +background color. + +Text is handled by a different element called \l Text. We need to create a +\l Text object inside the \l Rectangle and set its \l {Text::text}{text} +property to "Hello World!". So to set the text to 'Hello world' and the +background colour to light gray, + + \code + import Qt 4.7 + + Rectangle { + id: myRectangle + width: 500 + height: 400 + + Text { text: "Hello World!" } + + color: "lightgray" + } + \endcode + + +\section1 Hello World Again + +From now on we will not always show the import statement for Qt but it +should still be there when you create your QML scripts. + +To make our Hello World example a little nicer set the position of the text +to be at pixel position x = 100, y = 100 within the displayed window. This +position belongs to the \l Text element so we set the position inside its +definition. Note that we separate different QML statements on the same line +with a semi-colon, or we could have simply put each statement on a new line + + \code + Text { + text: "<h2>Hello World</h2>"; color: "darkgreen" + x: 100; y:100 + } + \endcode + +Not only did we reposition the text, but the text was altered by adding +HTML tags to change the font size. The text color was also changed from the +default black to dark green by using a standard string for the color's SVG +name. + +We could also have used a hexadecimal string for the RGB (red-green-blue, as +#rrggbb) values of the color similar to the method used in HTML. For +example, mostly blue with a green tint, + + \code + Text { + text: "<h1>Hello world again</h1>" + color: "#002288" + x: 100; y: 100 + } + \endcode + +All of these changes occurred within the \l Text object which is the scope +of these property changes. + +Other objects may use the information but it belongs to the element where +the property has been defined. + + +\section1 Images + +To add an image to our little application we use the \l Image element. An +\l Image uses a path to an image file, and has properties to control +the aspect ratio, the image size, to tile the area amongst others. The +source of the image, the path to the file, is a URL. Therefore the file can +be local: \e {mydir/myimage1.png}. Or it can be remote: +\e {"http://www.example.com/images/myimage1.png"}. + + \code + Image { + source: "images/qt-logo.png" + } + \endcode + +This displays the image, as we would expect, at the top left of the window. +The position of the default x = 0, y = 0 coordinate. The example here uses +a PNG file, but it could have been one of various supported formats, +including JPG and GIF. + +Let us reposition the image and enlarge it. Place it at the same 'x' offset +as the "Hello world again" text, but put it another 50 pixels below the +text, also make it 150 by 150 pixels in size, + + \code + Image { + source: "images/qt-logo.png" + x: 100; y: 150 + width: 150; height: 150 + } + \endcode + +Adding the Hello World example, with the text and the image example we can +write a simple piece of QML that starts to look a bit better. + + \code + import Qt 4.7 + + Rectangle { + id: myRectangle + width: 500 + height: 400 + + // A light gray background + color: "lightgray" + + // Position and color some text + Text { + text: "<h1>Hello world again</h1>" + color: "darkgreen" + x: 100; y: 100 + } + + // Using the opportunity to resize the image. + Image { + source: "images/qt-logo.png" + x: 100; y: 150 + width: 150; height: 150 + } + + } + \endcode + +The result is still quite simple + +\image qml-intro-helloa.png + + +\section1 Anchors: Aligning Elements + +Using absolute positioning, such as saying x = 100 and y = 150, works well +until the user or developer stretches or increases the size of the window. +Then the positions need to be recalculated. What would be nice would be a +relative means of positioning of objects in a window or rectangle. For +example, we want to place an image at the bottom of a rectangle, we would +like to specify the image's location as the 'bottom of the window', not a +specific coordinate. We can do this with the anchors property, which +objects inherit from Item. + +The anchors property is really a property group. It is a collection of +related properties. It has properties within it which can be used by means +of the dot notation. + +The dot notation uses object \c{id}s and property names to use a particular +object or property. Say I have a rectangle r1, which contains a rectangle +r2, which contains an Item item1, which has an 'x' property I want to +change. I just use the dot notation to identify it: r1.r2.item1.x + +If we want to position an image at the bottom of the rectangle it is +inside. I have to specify that the bottom of the image is also at the +bottom of the rectangle + + \code + import Qt 4.7 + + Rectangle { + id: myWin + width: 500 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + width: 150; height: 150 + anchors.bottom: myWin.bottom + } + } + \endcode + +This places the logo at the bottom left of the window. + +\image qml-intro-anchors1.png "A simple anchor" + +We would like it centered and not touching the bottom of the window, for +aesthetic reasons. For the centering we use the horizontalCenter property, +and to prevent the touching of the image to the bottom of the rectangle, +the bottomMargin property is used. So the new actions for the script are + + \list + \o set the bottom of the image (anchors.bottom) to be the bottom of the window + \o move the image to be in the horizontal center of the window + \o set a margin of 10 pixels so that the image does not touch the bottom window border + \endlist + +Encoded into QML the script becomes + + \code + import Qt 4.7 + + Rectangle { + id: myWin + width: 500 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + width: 150; height: 150 + anchors.bottom: myWin.bottom + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 10 + } + } + \endcode + + +Run this and resize the window. You will see that now the position of the +image adjusts during the resize. + +\image qml-intro-anchors2.png "Image Centered at the Bottom" + +You can also add another object say a block of descriptive text and place +it above or below the image or to the side. This code places some text just +above the image + + \code + Text { + text: "<h2>The Qt Logo</h2>" + anchors.bottom: image1.top + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 15 + } + \endcode + +\image qml-intro-anchors3.png + +\note \e anchors is a property group, to be used within the object. When +referencing these properties from another object we use the property +directly, instead of saying: + + \code + myRectangle.anchors.top // Wrong + \endcode + +we use + + \code + myRectangle.top // Correct + \endcode + + + + +\section1 Transformations + +We can transform a graphical object to get additional effects. Rotate a +piece of text by 180 degrees to display upside-down text. Rotate an image +by 90 degrees to lay it on its side. These transformations require +additonal information. + +For rotation, the additional information includes: the origin relative to +the object being rotated, the axis of rotation, and the angle in degrees to +rotate the image through in a clockwise direction. The axis does not have +to be the z-axis, the line between your eyes and the image, it could be +along the vertical y-axis or the horizontal x-axis. We have three +dimensions to play with. For simplicity in this example we will rotate +about the z-axis by 90 degrees in a negative direction, anti-clockwise. + +Rotation of text was also suggested. It could also be useful to scale the +text. We can do both. The \l {Item::transform}{transform} property is a +\e list of \l Transform elements, so using the list syntax + + \code + myList: [ listElement1, listElement2, ... } ] + \endcode + +we can produce a list of transformations. + +The text will be rotated by 45 degrees anti-clockwise and scaled +vertically by a factor of 1.5 and by 1.2 horizontally. + +Using the example above as the basis for this we have, + + \code + import Qt 4.7 + + Rectangle { + id: myWin + width: 500 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + width: 150; height: 150 + anchors.bottom: myWin.bottom + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 10 + + transform: Rotation { + origin.x: 75; origin.y: 75 + axis{ x: 0; y: 0; z:1 } angle: -90 + } + + } + + Text { + text: "<h2>The Qt Logo -- taking it easy</h2>" + anchors.bottom: image1.top + anchors.horizontalCenter: myWin.horizontalCenter + anchors.bottomMargin: 15 + + transform: [ + Scale { xScale: 1.5; yScale: 1.2 } , + + Rotation { + origin.x: 75; origin.y: 75 + axis{ x: 0; y: 0; z:1 } angle: -45 + } + ] + } + } + \endcode + +The code block in \c image1 starting with \c transform specifies that the +\l {Item::transform}{transform} property will be a Rotation through -90 +degrees, which is anti-clockwise, about the z-axis running through the +center of the image at (75,75), since the image is 150 x 150 pixels. + +The other transformation available is \l Translate. This produces a change +in position of the item. + +\note In a list of transformations the order of the transformations is +important. In the above example try swapping around the Scale transform with +the Rotation transform, remember to remove or add the comma. The results are +acceptable for our little test but not the same. + + +\section1 Animations + +Animation in QML is done by animating properties of objects. Properties +that are numbers, colors, Rectangles, points and directions. In QML these +are \l {QML Basic Types} named as real, int, color, rect, point, size, and +vector3d. There are a number of different ways to do animation. Here we +will look at a few of them. + +\section2 Number Animation + +Previously we have used a rotation transformation to change the orientation +of an image. We could easily animate this rotation so that instead of a +straight rotation counter-clockwise of 90 degrees we could rotate the image +through a full 360 degrees in an animation. The axis of rotation wont +change, the position of the center of the image will not change, only the +angle will change. Therefore, a NumberAnimation of a rotation's angle should +be enough for the task. If we wish for a simple rotation about the center +of the image then we can use the \c rotation property that is inherited +from \l Item. The rotation property is a real number that specifies the +angle in a clockwise direction for the rotation of the object. Here is the +code for our animated rotating image. + + \code + import Qt 4.7 + + Rectangle { + id: mainRec + width: 600 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + x: 200; y: 100 + width: 100; height: 100 + + // Animate a rotation + transformOrigin: Item.Center + NumberAnimation on rotation { + from: 0; to: 360 + duration: 2000 + loops: Animation.Infinite + } + } + } + \endcode + +The \c {transformOrigin: Item.Center} is redundant since this is the default +axis of rotation anyway. But if you change \c Center to \c BottomRight you +will see an interesting variation. + +Also if instead the \l Rotation transformation had been used then we would have +more control over the various parameters. We could vary the axis, to be not +just a different offset from the z-axis but along the y-axis, x-axis or +combination. For example, if the task had been to animate the rotation +about the y-axis passing through the center of the image then the following +code would do it. + + \code + import Qt 4.7 + + Rectangle { + id: mainRec + width: 600 + height: 400 + + Image { + id: image1 + source: "images/qt-logo.png" + x: 200; y: 100 + width: 100; height: 100 + + // Animate a rotation + transform: Rotation { + origin.x: 50; origin.y: 50; axis {x:0; y:1; z:0} angle:0 + NumberAnimation on angle { + from: 0; to: 360; + duration: 3000; + loops: Animation.Infinite + } + } + } + } + \endcode + +Here there is a rectangle 600 by 400 pixels. Placed within that rectangle +is an image 100 by 100 pixels. It is rotated about the center of the image +about the y-axis so that it looks as if it is rotating about an invisible +vertical string holding it up. The time it takes to complete the rotation is 3 +seconds (3,000 milliseconds). The NumberAnimation is applied to the angle +taking it from 0 (no change) to 360 degrees, back where it started. +Strictly speaking it isn't necessary to go from 0 to 360 since the same +location is duplicated, but it makes it easier to read in this example and +it has no visible effect on the animation. The number of loops that the +animation will execute is set to \c {Animation.Infinite} which means that the +animation is in an endless loop. + +To see an interesting variation. Change the axis to \c {axis { x:1; y:1; z:1 +}}. This is a line coming from the center of the image downwards to the +right and out of the screen. Although the change is simple the rotation +seems complex. + +\section2 Sequential Animation + +For a more complex animation we will need two images. The first image will +be placed at the center of a window (Rectangle) and the second image will +be at the upper left of the window. The animation will move the second +image from the top left of the window to the bottom right. In doing so we +will be animating the position and the size of the image. + +First create two images + + \code + import Qt 4.7 + + Rectangle { + id: mainRec + width: 600 + height: 400 + z: 0 + + Image { + id: image1 + source: "images/qt-logo.png" + x: 20; y: 20 ; z: 1 + width: 100; height: 100 + } + + Image { + id: image2 + source: "images/qt-logo.png" + width: 100; height: 100 + x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2 + z: 2 + } + } + \endcode + +We will add to 'image1' a SequentialAnimation from x = 20 to the target of +x = 450. The 'from' values will be used because we will be repeating the +animation, so the object needs to know where the original position is, both +x and y. The SequentialAnimation of x will set it to repeat by indicating +that the number of animation loops is infinite, meaning that the 'loop' +counter will be set to a value Animation.Infinite that indicates an endless +cycle. Also there will be a NumberAnimation to vary the numeric property +between the x values and over a given duration. After the NumberAnimation +there will be a PauseAnimation that will pause the animation for 500 +milliseconds (half a second) simply for the visual effect. + + \code + SequentialAnimation on x { + loops: Animation.Infinite + NumberAnimation { from: 20; to: 450; easing.type: "InOutQuad"; +duration: 2000 } + PauseAnimation { duration: 500 } + } + \endcode + +A similar block of code is written for the animation of the 'y' value of +the position. + +We will also animate the scale of the object, so as it goes from top left +to bottom right of the window it will become smaller until about midway, +and then become larger. To complete the animation we will set the 'z' +values of the images. 'z' is the stacking order, the z-axis effectively +points out from the screen to your eyes with the default value of 'z' being +0. So if we set the Rectangle to have z with value zero, just to be sure, +and image1 to 1 and image2 to 2 then image2 will be in the foreground and +image1 in the background. When image1 passes image2 it will pass behind it. +The completed code looks like + + \code + Rectangle { + id: mainRec + width: 600 + height: 400 + z: 0 + + Image { + id: image2 + source: "images/qt-logo.png" + width: 100; height: 100 + x: (mainRec.width - 100)/2; y: (mainRec.height - 100)/2 + z: 2 + } + + Image { + id: image1 + source: "images/qt-logo.png" + x: 20; y: 20 ; z: 1 + width: 100; height: 100 + + SequentialAnimation on x { + loops: Animation.Infinite + NumberAnimation { + from: 20; to: 450 + easing.type: "InOutQuad"; duration: 2000 + } + PauseAnimation { duration: 500 } + } + + SequentialAnimation on y { + loops: Animation.Infinite + NumberAnimation { + from: 20; to: 250 + easing.type: "InOutQuad"; duration: 2000 + } + PauseAnimation { duration: 500 } + } + + SequentialAnimation on scale { + loops: Animation.Infinite + NumberAnimation { from: 1; to: 0.5; duration: 1000 } + NumberAnimation { from: 0.5; to: 1; duration: 1000 } + PauseAnimation { duration: 500 } + } + } + } + \endcode + +The \c {easing.type} has many options, expressed as a string. It specifies the +kind of equation that describes the acceleration of the property value, not +necessarily position, over time. + +For example, \e InOutQuad means that at the start and the end of the animation the +'velocity' is low but the acceleration or deceleration is high. Much like a car +accelerating from stop, and decelerating to stop at the end of a journey, +with the maximum speed being in the middle. Examine the \l {PropertyAnimation::easing.type} +{easing} documentation and the various graphs that show the effect. The horizontal +axis, 'progress', can be thought of as time. The vertical axis is the value +of the particular property. + +In discussing animation we need to describe three objects: State, MouseArea +and Signals. Although independent of the animation elements, animation +delivers some of the best examples that illustrate these new elements. + + + +\section2 Animation Summary + +\table + \header + \o Name + \o Description + \row + \o PropertyAnimation + \o a property value on a target object is varied to a specified value over a given time. + + \row + \o NumberAnimation + \o animate a numeric property from one value to another over a given time. + + \row + \o PauseAnimation + \o results in the task waiting for the specified duration, in milliseconds. + + \row + \o SequentialAnimation + \o allows us to list in order the animation events we want to occur, first A then B then C and so on. + + \row + \o ParallelAnimation + \o enables us to run different animations at the same time instead of sequentially. + +\endtable + + + + + +\section1 Using States + +A state is a defined set of values in the configuration of an object and +often depends on the previous state. For example, a glass could be in a +state we call 'HalfFull' if it is being filled with a liquid and has +reached half of its total capacity. We could also have a state called +HalfEmpty which is the state that occurs when the amount of liquid drops to +half of the glass's capacity. Both states represent the same amount of +liquid, but we consider them different. Likewise, states in a program +represent not just values but may include how the current values were +reached. + +When a state changes a \e transition occurs. This is an opportunity to make +changes or take actions that depend on the movement to the new state. For +example, if we had a scene in the country where the state variable has two +states "daylight" and "night". Then when the state changes to "night" at +this transition the sky would be made dark, stars would be shown, the +countryside would be darkened. And when the state changes to "daylight" the +opposite changes would be made: the sky is now blue, the scenery is green, +there is a sun in the sky. + +Here is a simple QML program that shows the change of state in the above +example. We have two rectangles, the top one is the 'sky' and the bottom +one is the 'ground'. We will animate the change from daylight to night. +There will be two states, but we only need to define one since 'daylight' +will be the default state. We will just go to 'night' by clicking and +holding the left mouse button down, releasing the mouse button will reverse +the process + + \code + import Qt 4.7 + + Rectangle { + id: mainRectangle + width: 600 + height: 400 + color: "black" + + Rectangle { + id: sky + width: 600 + height: 200 + y: 0 + color: "lightblue" + } + + Rectangle { + id: ground + width: 600; height: 200 + y: 200 + color: "green" + } + + MouseArea { + id: mousearea + anchors.fill: mainRectangle + } + + states: [ State { + name: "night" + when: mousearea.pressed == true + PropertyChanges { target: sky; color: "darkblue" } + PropertyChanges { target: ground; color: "black" } + }, + State { + name: "daylight" + when: mousearea.pressed == false + PropertyChanges { target: sky; color: "lightblue" } + PropertyChanges { target: ground; color: "green" } + } + ] + + transitions: [ Transition { + from: "daylight"; to: "night" + ColorAnimation { duration: 1000 } + }, + Transition { + from: "night"; to: "daylight" + ColorAnimation { duration: 500 } + } + ] + } + \endcode + +Several new things appear in this sample. Firstly, we use a \l MouseArea +element to detect mouse clicks in the \e mainRectangle. Secondly, we use +the list notation [ thing1 , thing2, ... ] to build a list of states and a +list of transitions. + +\l MouseArea defines a region that will respond to mouse clicks. In this case +we are only concerned with when the mouse is pressed or not pressed, not +the particular button or other details. The area of the MouseArea is the +entire main window, mainRectangle, so that clicking anywhere in this region +will start the animation. Since we are using the 'pressed' mouse state, +then the animation will move from 'daylight' to 'night' only while the mouse +button remains pressed. + +When the button is released the 'daylight' state is entered and the +transition from 'night' to 'daylight' is triggered causing the animation to +run. The transition specifies the duration in milliseconds of the +ColorAnimation, while the state specifies the color of the new state. + +The PropertyChanges command is the way that we nominate which properties +will change in a change of state, and what new value the property will +take. Since, for example, we want the 'sky' region to turn to dark blue and +the 'ground' region to turn to black for the 'night' state, then the +rectangles for those regions are the 'target' and the property in the target +is 'color'. + + +\section1 Signals + +Signals are simply events that can be hooked up to actions we want performed. +In QML they are usually preceded by the word 'on', for example in the animation +using a MouseArea the signal was \l {MouseArea::onPressed}{onPressed}. If +you look at the C++ documentation you will see a lot of talk about +\l {Signals & Slots}{Signals and Slots}. Signals are connected to Slots. The +signal represents an event and the Slot is the function that does something +based on that event. You can also have Signals connected to other Signals, so +that one Signal (event) triggers another Signal (event), and so forth. It is +nice to know this is what happens beneath the QML layer but not essential for +using QML. + +Most elements do not have Signals associated with them. However, a few like +the \l Audio element have many signals. Some of the \l Audio signals are +used to represent events such as when the audio is stopped, play is pressed, +paused, and reaching the end of the media. They allow the developer to connect, + for example, the press of a user interface button (perhaps a MouseArea) to + some QML that will handle this event. + + +\section1 Analyzing An Example: Dial + +In the Qt \e {examples/declarative/toys} folder you will find a folder +\e {dial} which contains the \e dial example. + +\image qml-dial.png "QML Dial example with Slider" + +In essence this small application has a sliding bar that you can slide using +a mouse, and a graphical dial that responds to the position of the slider. + +The code for the example is in two parts: Dial.qml and dial-example.qml. + +\e {Dial.qml} can be found in the \e content sub-directory. It defines a Dial +component similar to an odometer. Eventually, the example will hook up a slider +component so that moving the slider will change the position of a needle on the +dial. + +The code for the Dial, identified by the name of the file, contains four images +in overlapping order: the background (numbers and divisions), the shadow of the +needle, the needle itself, and finally the 'glass' overlay (containing +transparent layers). + +The needle_shadow.png image has a Rotation assigned to the \e transform +attribute of the \l Image. The rotation is set to match the angle of the needle +image angle value \e {needleRotation.angle}. Both the needle and the +needle_shadow have the same default \e x and \e y values but the rotation origin +for the needle is slightly different so that a shadow will be evident as the +needle moves. + +\snippet ../../examples/declarative/toys/dial/content/Dial.qml needle_shadow + +And the needle + +\snippet ../../examples/declarative/toys/dial/content/Dial.qml needle + +The final image is the overlay which simply has a position defined. + +\snippet ../../examples/declarative/toys/dial/content/Dial.qml overlay + +\e {dial-example.qml} in the \e {examples/declarative/toys/dial} directory is the +main file of the example. It defines the visual environment that the Dial +will fit into. Because the \e Dial component and the images live in the \e +content sub-directory we will have to import this into \e dial-example. So the +start of the file looks like + + \code + import Qt 4.7 + import "content" + \endcode + +The visual space is bound by a 300 by 300 pixel \l Rectangle which is given +a gray color. Inside this rectangle is our component \e Dial and a \l Rectangle. +Inside the rectangle called 'container' is another rectangle with the +interesting name 'slider'. + +\snippet ../../examples/declarative/toys/dial/dial-example.qml 0 + +The Dial component, named 'dial, is \e anchored to the center of the main +rectangle. The \c value attribute of 'dial' is set to a value based on the +'slider' horizontal position and the 'container' width. So changes to the +'slider' position will change the Dial \c value which is used in Dial to compute +the rotation of the needle image. Notice this piece of code in Dial where +the change in \c value modifies the position of the needle. + + \code + SpringFollow on angle { + spring: 1.4 + damping: .15 + to: Math.min(Math.max(-130, root.value*2.6 - 130), 133) + } + \endcode + +This is part of the \c needleRotation that rotates the needle and causes the +rotation of its shadow. \l SpringFollow is an element that modifies the value +of that rotation angle \e to and mimics the oscillatory behavior of a spring, +with the appropriate \e spring constant to control the acceleration and the \e +damping to control how quickly the effect dies away. + +The 'container' is light gray with a color gradient defined using +\l GradientStop. The gradient is applied vertically. If you need a horizontal +gradient then you could apply the vertical gradient and then rotate the item +by 90 degrees. + +The 'slider' is dark gray and also has a vertical color gradient. The most +important thing about the 'slider' is that it has a MouseArea defined, which +specifies a \c {drag.target} on itself along the X-axis. With minimum +and maximum values on the X-axis defined. So we can click on the 'slider' and +drag it left and right within the confines of the 'container'. The motion of +the 'slider' will then change the \c value attribute in \e Dial as discussed +already. + +Also notice the use of a \c radius value for a rectangle. This produces rounded +corners. That is how the 'container' and 'slider' are displayed with a +pleasant rounded look. + + + +*/ + + + diff --git a/doc/src/demos/boxes.qdoc b/doc/src/demos/boxes.qdoc index aeb2513..367eb52 100644 --- a/doc/src/demos/boxes.qdoc +++ b/doc/src/demos/boxes.qdoc @@ -44,7 +44,7 @@ \title Boxes This demo shows Qt's ability to combine advanced OpenGL rendering with the - the \l{The Graphics View Framework}{Graphics View} framework. + the \l{Graphics View Framework}. \image boxes-demo.png diff --git a/doc/src/examples/diagramscene.qdoc b/doc/src/examples/diagramscene.qdoc index 87c973a..a39f89a7 100644 --- a/doc/src/examples/diagramscene.qdoc +++ b/doc/src/examples/diagramscene.qdoc @@ -54,13 +54,13 @@ colors, and it is possible to change the font, style, and underline of the text. - The Qt graphics view framework is designed to manage and - display custom 2D graphics items. The main classes of the - framework are QGraphicsItem, QGraphicsScene and QGraphicsView. The - graphics scene manages the items and provides a surface for them. + The Qt graphics view framework is designed to manage and display + custom 2D graphics items. The main classes of the framework are + QGraphicsItem, QGraphicsScene and QGraphicsView. The graphics + scene manages the items and provides a surface for them. QGraphicsView is a widget that is used to render a scene on the - screen. See the \l{The Graphics View Framework}{overview document} - for a more detailed description of the framework. + screen. See the \l{Graphics View Framework} for a more detailed + description of the framework. In this example we show how to create such custom graphics scenes and items by implementing classes that inherit diff --git a/doc/src/examples/drilldown.qdoc b/doc/src/examples/drilldown.qdoc index ca994e8..2b87840 100644 --- a/doc/src/examples/drilldown.qdoc +++ b/doc/src/examples/drilldown.qdoc @@ -292,7 +292,7 @@ \codeline \snippet examples/sql/drilldown/view.h 1 - The QGraphicsView class is part of the \l {The Graphics View + The QGraphicsView class is part of the \l {Graphics View Framework} which we will use to display the images of Nokia's Qt offices. To be able to respond to user interaction; i.e., showing the @@ -388,8 +388,8 @@ reason we must create a custom item class is that we want to catch the item's hover events, animating the item when the mouse cursor is hovering over the image (by default, no items accept hover - events). Please see the \l{The Graphics View Framework} - documentation and the \l{Graphics View Examples} for more details. + events). Please see the \l{Graphics View Framework} documentation + and the \l{Graphics View Examples} for more details. \snippet examples/sql/drilldown/view.cpp 5 @@ -399,7 +399,7 @@ function calls the private \c showInformation() function to pop up the associated information window. - \l {The Graphics View Framework} provides the qgraphicsitem_cast() + The \l {Graphics View Framework} provides the qgraphicsitem_cast() function to determine whether the given QGraphicsItem instance is of a given type. Note that if the event is not related to any of our image items, we pass it on to the base class implementation. @@ -456,7 +456,7 @@ borders. Finally, we store the location ID that this particular record is - associated with as well as a z-value. In the \l {The Graphics View + associated with as well as a z-value. In the \l {Graphics View Framework}, an item's z-value determines its position in the item stack. An item of high Z-value will be drawn on top of an item with a lower z-value if they share the same parent item. We also @@ -477,7 +477,7 @@ there is no current mouse grabber item. They are sent when the mouse cursor enters an item, when it moves around inside the item, and when the cursor leaves an item. As we mentioned earlier, none - of the \l {The Graphics View Framework}'s items accept hover + of the \l {Graphics View Framework}'s items accept hover event's by default. The QTimeLine class provides a timeline for controlling diff --git a/doc/src/examples/mandelbrot.qdoc b/doc/src/examples/mandelbrot.qdoc index 7a3c1cd..11173a8 100644 --- a/doc/src/examples/mandelbrot.qdoc +++ b/doc/src/examples/mandelbrot.qdoc @@ -285,7 +285,7 @@ \snippet examples/threads/mandelbrot/mandelbrotwidget.cpp 8 If the pixmap has the right scale factor, we draw the pixmap directly onto - the widget. Otherwise, we scale and translate the \l{The Coordinate + the widget. Otherwise, we scale and translate the \l{Coordinate System}{coordinate system} before we draw the pixmap. By reverse mapping the widget's rectangle using the scaled painter matrix, we also make sure that only the exposed areas of the pixmap are drawn. The calls to diff --git a/doc/src/examples/transformations.qdoc b/doc/src/examples/transformations.qdoc index 0d8de1d..0c246cb 100644 --- a/doc/src/examples/transformations.qdoc +++ b/doc/src/examples/transformations.qdoc @@ -87,7 +87,7 @@ tranformation matrix that you can retrieve using the QPainter::worldTransform() function. A matrix transforms a point in the plane to another point. For more information about the - transformation matrix, see the \l {The Coordinate System} and + transformation matrix, see the \l {Coordinate System} and QTransform documentation. \snippet examples/painting/transformations/renderarea.h 0 @@ -374,7 +374,7 @@ All the tranformation operations operate on QPainter's tranformation matrix. For more information about the - transformation matrix, see the \l {The Coordinate System} and + transformation matrix, see the \l {Coordinate System} and QTransform documentation. The Qt reference documentation provides several painting diff --git a/doc/src/examples/undoframework.qdoc b/doc/src/examples/undoframework.qdoc index adb38b6..aab25fa 100644 --- a/doc/src/examples/undoframework.qdoc +++ b/doc/src/examples/undoframework.qdoc @@ -67,7 +67,7 @@ available through the edit menu. The user can also select a command from the undo view. - We use the \l{The Graphics View Framework}{graphics view + We use the \l{Graphics View Framework}{graphics view framework} to implement the diagram. We only treat the related code briefly as the framework has examples of its own (e.g., the \l{Diagram Scene Example}). diff --git a/doc/src/frameworks-technologies/activeqt.qdoc b/doc/src/frameworks-technologies/activeqt.qdoc index 979d885..5a3b23e 100644 --- a/doc/src/frameworks-technologies/activeqt.qdoc +++ b/doc/src/frameworks-technologies/activeqt.qdoc @@ -71,16 +71,16 @@ \endlist For more information about using ActiveX with Qt, see - \l{Building ActiveX servers and controls with Qt}. + \l{Building ActiveX servers in Qt}. The ActiveQt framework consists of two modules: \list - \o The \l{Using ActiveX controls and COM objects in Qt}{QAxContainer} + \o The \l{Using ActiveX controls and COM in Qt}{QAxContainer} module is a static library implementing QObject and QWidget subclasses, QAxObject and QAxWidget, that act as containers for COM objects and ActiveX controls. - \o The \l{Building ActiveX servers and controls with Qt}{QAxServer} + \o The \l{Building ActiveX servers in Qt}{QAxServer} module is a static library that implements functionality for in-process and executable COM servers. This module provides the QAxAggregated, QAxBindable and QAxFactory diff --git a/doc/src/frameworks-technologies/dnd.qdoc b/doc/src/frameworks-technologies/dnd.qdoc index 0e952ad..f728972 100644 --- a/doc/src/frameworks-technologies/dnd.qdoc +++ b/doc/src/frameworks-technologies/dnd.qdoc @@ -58,9 +58,9 @@ This document describes the basic drag and drop mechanism and outlines the approach used to enable it in custom widgets. Drag and drop operations are also supported by Qt's item views and by - the graphics view framework; more information is available in the - \l{Using Drag and Drop with Item Views} and \l{The Graphics View - Framework} documents. + the graphics view framework. More information is available in + \l{Using Drag and Drop with Item Views} and \l{Graphics View + Framework}. \section1 Drag and Drop Classes diff --git a/doc/src/frameworks-technologies/graphicsview.qdoc b/doc/src/frameworks-technologies/graphicsview.qdoc index 681568e..b13f98e 100644 --- a/doc/src/frameworks-technologies/graphicsview.qdoc +++ b/doc/src/frameworks-technologies/graphicsview.qdoc @@ -220,9 +220,10 @@ allow you to map between the three coordinate systems. When rendering, Graphics View's scene coordinates correspond to - QPainter's \e logical coordinates, and view coordinates are the same as - \e device coordinates. In \l{The Coordinate System}, you can read about - the relationship between logical coordinates and device coordinates. + QPainter's \e logical coordinates, and view coordinates are the + same as \e device coordinates. In the \l{Coordinate System} + documentation, you can read about the relationship between + logical coordinates and device coordinates. \img graphicsview-parentchild.png @@ -435,11 +436,12 @@ \section2 Animation - Graphics View supports animation at several levels. You can easily - assemble animation by using the Animation Framework. For that you'll - need your items to inherit from QGraphicsObject and associate - QPropertyAnimation with them. QPropertyAnimation allows to animate any - QObject property. + Graphics View supports animation at several levels. You can + easily assemble animation by using the Animation Framework. + For that you'll need your items to inherit from + QGraphicsObject and associate QPropertyAnimation with + them. QPropertyAnimation allows to animate any QObject + property. Another option is to create a custom item that inherits from QObject and QGraphicsItem. The item can the set up its own timers, and control diff --git a/doc/src/getting-started/demos.qdoc b/doc/src/getting-started/demos.qdoc index f8c70fe..9d39e08 100644 --- a/doc/src/getting-started/demos.qdoc +++ b/doc/src/getting-started/demos.qdoc @@ -126,16 +126,15 @@ \section1 Graphics View \list - \o \l{demos/chip}{40000 Chips} uses the - \l{The Graphics View Framework}{Graphics View} framework to efficiently - display a large number of individual graphical items on a scrolling canvas, - highlighting features such as rotation, zooming, level of detail control, - and item selection. - \o \l{demos/embeddeddialogs}{Embedded Dialogs} showcases Qt 4.4's \e{Widgets on - the Canvas} feature by embedding a multitude of fully-working dialogs into a - scene. + \o \l{demos/chip}{40000 Chips} uses the \l{Graphics View Framework} to + efficiently display a large number of individual graphical items on + a scrolling canvas and highlighting features including rotation, + zooming, level of detail control, and item selection. + \o \l{demos/embeddeddialogs}{Embedded Dialogs} showcases Qt 4.4's + \e{Widgets on the Canvas} feature by embedding several + fully-functional dialogs in a scene. \o \l{demos/boxes}{Boxes} showcases Qt's OpenGL support and the - integration with the Graphics View framework. + integration with the \l{Graphics View Framework}. \endlist \section1 Tools @@ -185,7 +184,7 @@ \o \l{demos/embedded/fluidlauncher}{Fluid Launcher} demo application launcher for embedded screens \o \l{demos/embedded/lightmaps}{Light Maps} demonstrates OpenStreetMap integration with WebKit. \o \l{demos/embedded/raycasting}{Ray Casting} demonstrates the use of ray casting with the - \l{The Graphics View Framework}{Graphics View} framework. + \l{Graphics View Framework}. \o \l{demos/embedded/styledemo}{Embedded Styles} demonstrates the use of styles. \o \l{demos/embedded/weatherinfo}{Weather Info} fetches weather information from the Web. \endlist diff --git a/doc/src/getting-started/how-to-learn-qt.qdoc b/doc/src/getting-started/how-to-learn-qt.qdoc index ce8f521..642421b 100644 --- a/doc/src/getting-started/how-to-learn-qt.qdoc +++ b/doc/src/getting-started/how-to-learn-qt.qdoc @@ -59,11 +59,11 @@ If you want to design your user interfaces using a design tool, then read at least the first few chapters of the \l{Qt Designer manual}. - By now you'll have produced some small working applications and have a - broad feel for Qt programming. You could start work on your own - projects straight away, but we recommend reading a couple of key - overviews to deepen your understanding of Qt: \l{Qt Object Model} - and \l{Signals and Slots}. + By now you'll have produced some small working applications and + have a broad feel for Qt programming. You could start work on your + own projects straight away, but we recommend reading a couple of + key overviews to deepen your understanding of Qt: The Qt \l{Object + Model} and \l{Signals and Slots}. \beginfloatleft \inlineimage qtdemo-small.png diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 36abc10..4a96a39 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -959,7 +959,7 @@ applications using Qt for Symbian can start right away.} \l{http://www.microsoft.com/downloads/details.aspx?FamilyID=0baf2b35-c656-4969-ace8-e4c0c0716adb&DisplayLang=en}{here}. \endlist - \sa {Known Issues in %VERSION%} + \sa {Known Issues} */ /*! @@ -969,7 +969,7 @@ applications using Qt for Symbian can start right away.} \brief Setting up the Mac OS X environment for Qt. \previouspage General Qt Requirements - \sa {Known Issues in %VERSION%} + \sa {Known Issues} */ /*! @@ -1108,7 +1108,7 @@ applications using Qt for Symbian can start right away.} distributions; try searching for \c gstreamer or \c libgstreamer in your distribution's package repository to find suitable packages. - \sa {Known Issues in %VERSION%} + \sa {Known Issues} */ /*! @@ -1162,7 +1162,7 @@ applications using Qt for Symbian can start right away.} information on Windows CE Customization can be found \l{Windows CE - Working with Custom SDKs}{here}. - \sa {Known Issues in %VERSION%} + \sa {Known Issues} */ /*! @@ -1172,7 +1172,7 @@ applications using Qt for Symbian can start right away.} \brief Setting up the Embedded Linux environment for Qt. \previouspage General Qt Requirements - \sa {Known Issues in %VERSION%} + \sa {Known Issues} \section1 Building Qt for Embedded Linux with uclibc @@ -1272,5 +1272,5 @@ applications using Qt for Symbian can start right away.} We recommend you to take a look at \l{http://developer.symbian.org/wiki/index.php/Qt_Quick_Start}{Symbian Foundation - Qt Quick Start} to get more information about how to setup the development environment. - \sa {Known Issues in %VERSION%} + \sa {Known Issues} */ diff --git a/doc/src/getting-started/known-issues.qdoc b/doc/src/getting-started/known-issues.qdoc index cedebf9..5b6b2fc 100644 --- a/doc/src/getting-started/known-issues.qdoc +++ b/doc/src/getting-started/known-issues.qdoc @@ -41,7 +41,7 @@ /*! \page known-issues.html - \title Known Issues in this Qt Version + \title Known Issues \ingroup platform-specific \brief A summary of known issues in this Qt version at the time of release. diff --git a/doc/src/images/qml-dial.png b/doc/src/images/qml-dial.png Binary files differnew file mode 100644 index 0000000..da5c031 --- /dev/null +++ b/doc/src/images/qml-dial.png diff --git a/doc/src/images/qml-intro-anchors1.png b/doc/src/images/qml-intro-anchors1.png Binary files differnew file mode 100644 index 0000000..fdb301e --- /dev/null +++ b/doc/src/images/qml-intro-anchors1.png diff --git a/doc/src/images/qml-intro-anchors2.png b/doc/src/images/qml-intro-anchors2.png Binary files differnew file mode 100644 index 0000000..84f43bd --- /dev/null +++ b/doc/src/images/qml-intro-anchors2.png diff --git a/doc/src/images/qml-intro-anchors3.png b/doc/src/images/qml-intro-anchors3.png Binary files differnew file mode 100644 index 0000000..21ae97b --- /dev/null +++ b/doc/src/images/qml-intro-anchors3.png diff --git a/doc/src/images/qml-intro-helloa.png b/doc/src/images/qml-intro-helloa.png Binary files differnew file mode 100644 index 0000000..00b34b0 --- /dev/null +++ b/doc/src/images/qml-intro-helloa.png diff --git a/doc/src/objectmodel/object.qdoc b/doc/src/objectmodel/object.qdoc index f81577d..8ae91ec 100644 --- a/doc/src/objectmodel/object.qdoc +++ b/doc/src/objectmodel/object.qdoc @@ -59,11 +59,11 @@ communication called \l{signals and slots} \o queryable and designable \l{Qt's Property System}{object properties} - \o powerful \l{events and event filters} + \o powerful \l{The Event System}{events and event filters} \o contextual \l{i18n}{string translation for internationalization} \o sophisticated interval driven \l timers that make it possible to elegantly integrate many tasks in an event-driven GUI - \o hierarchical and queryable \l{Object Trees and Object Ownership}{object + \o hierarchical and queryable \l{Object Trees & Ownership}{object trees} that organize object ownership in a natural way \o guarded pointers (QPointer) that are automatically set to 0 when the referenced object is destroyed, unlike normal C++ @@ -113,7 +113,7 @@ \o might have a unique \l{QObject::objectName()}. If we copy a Qt Object, what name should we give the copy? - \o has a location in an \l{Object Trees and Object Ownership} + \o has a location in an \l{Object Trees & Ownership} {object hierarchy}. If we copy a Qt Object, where should the copy be located? diff --git a/doc/src/painting-and-printing/paintsystem.qdoc b/doc/src/painting-and-printing/paintsystem.qdoc index 44c84a2..c106f35 100644 --- a/doc/src/painting-and-printing/paintsystem.qdoc +++ b/doc/src/painting-and-printing/paintsystem.qdoc @@ -89,7 +89,7 @@ \o \l{Classes for Painting} \o \l{Paint Devices and Backends} \o \l{Drawing and Filling} - \o \l{The Coordinate System} + \o \l{Coordinate System} \o \l{Reading and Writing Image Files} \o \l{Styling} \o \l{Printing with Qt} @@ -339,10 +339,10 @@ Normally, QPainter draws in a "natural" coordinate system, but it is able to perform view and world transformations using the - QTransform class. For more information, see \l {The Coordinate - System} documentation which also describes the rendering process, - i.e. the relation between the logical representation and the - rendered pixels, and the benefits of anti-aliased painting. + QTransform class. For more information, see \l {Coordinate + System}, which also describes the rendering process, i.e. the + relation between the logical representation and the rendered + pixels, and the benefits of anti-aliased painting. \table 100% \row \o @@ -568,5 +568,5 @@ \endtable For more information about widget styling and appearance, see the - documentation about \l{Implementing Styles and Style Aware Widgets}. + \l{Styles & Style Aware Widgets}. */ diff --git a/doc/src/porting/porting4-canvas.qdoc b/doc/src/porting/porting4-canvas.qdoc index b69f53b..592f430 100644 --- a/doc/src/porting/porting4-canvas.qdoc +++ b/doc/src/porting/porting4-canvas.qdoc @@ -56,7 +56,7 @@ number of custom-made 2D graphical items, and a view widget for visualizing the items, with support for zooming and rotation. Graphics View was introduced in Qt 4.2, replacing its predecessor, QCanvas. For - more on Graphics View, see \l{The Graphics View Framework}. + more on Graphics View, see \l{Graphics View Framework}. This document walks through the steps needed, class by class and function by function, to port a QCanvas application to Graphics View. diff --git a/doc/src/porting/porting4.qdoc b/doc/src/porting/porting4.qdoc index 1b6eeb7..75fe844 100644 --- a/doc/src/porting/porting4.qdoc +++ b/doc/src/porting/porting4.qdoc @@ -1000,8 +1000,8 @@ \row \o \c QCanvasView \o Q3CanvasView \endtable - \l{The Graphics View Framework} replaces QCanvas. For more on porting to - Graphics View, see \l{Porting to Graphics View}. + The \l{Graphics View Framework} replaces QCanvas. For more on + porting to Graphics View, see \l{Porting to Graphics View}. \section1 QColor diff --git a/doc/src/scripting/scripting.qdoc b/doc/src/scripting/scripting.qdoc index 2c22989..1f203a6 100644 --- a/doc/src/scripting/scripting.qdoc +++ b/doc/src/scripting/scripting.qdoc @@ -362,7 +362,7 @@ By default, the script engine does not take ownership of the QObject that is passed to QScriptEngine::newQObject(); the object is managed according to Qt's object ownership (see - \l{Object Trees and Object Ownership}). This mode is appropriate + \l{Object Trees & Ownership}). This mode is appropriate when, for example, you are wrapping C++ objects that are part of your application's core; that is, they should persist regardless of what happens in the scripting environment. Another way of stating @@ -627,9 +627,9 @@ To completely understand how to make C++ objects available to Qt Script, some basic knowledge of the Qt meta-object system is very - helpful. We recommend that you read the \l{Qt Object Model}. The - information in this document and the documents it links to are very - useful for understanding how to implement application objects. + helpful. We recommend that you read about the Qt \l{Object Model} + and \l{The Meta-Object System}, which are useful for understanding + how to implement application objects. However, this knowledge is not essential in the simplest cases. To make an object available in QtScript, it must derive from diff --git a/doc/src/sql-programming/qsqldatatype-table.qdoc b/doc/src/sql-programming/qsqldatatype-table.qdoc index fb5fb49..329222b 100644 --- a/doc/src/sql-programming/qsqldatatype-table.qdoc +++ b/doc/src/sql-programming/qsqldatatype-table.qdoc @@ -46,7 +46,7 @@ \ingroup qt-sql - \section1 Data Types for Qt Supported Database Systems + \section1 Recommended Data Types for Qt-Supported Database Systems This table shows the recommended data types for extracting data from the databases supported in Qt. Note that types used in Qt are not diff --git a/doc/src/sql-programming/sql-programming.qdoc b/doc/src/sql-programming/sql-programming.qdoc index b34810c..936e555 100644 --- a/doc/src/sql-programming/sql-programming.qdoc +++ b/doc/src/sql-programming/sql-programming.qdoc @@ -73,7 +73,7 @@ \endlist \o \l{Executing SQL Statements} \list - \o \l{Recommended Use of Data Types in Databases} + \o \l{Data Types for Qt-supported Database Systems} \endlist \o \l{Using the SQL Model Classes} \o \l{Presenting Data in a Table View} @@ -240,8 +240,9 @@ QVariant::toString() and QVariant::toInt() to convert variants to QString and \c int. - For an overview of the recommended types used with Qt supported - Databases, please refer to \l{Recommended Use of Data Types in Databases}{this table}. + For an overview of the recommended types for use with Qt-supported + Databases, please refer to \l{Data Types for Qt-supported Database + Systems} {this table}. You can iterate back and forth using QSqlQuery::next(), QSqlQuery::previous(), QSqlQuery::first(), QSqlQuery::last(), and diff --git a/doc/src/template/scripts/functions.js b/doc/src/template/scripts/functions.js index 7d93486..58a0248 100755 --- a/doc/src/template/scripts/functions.js +++ b/doc/src/template/scripts/functions.js @@ -33,15 +33,27 @@ $('#bigA').click(function() { $(this).addClass('active') }); +$('.feedclose').click(function() { + $('.bd').show(); + $('.hd').show(); + $('.footer').show(); + $('#feedbackBox').hide(); + $('#blurpage').hide(); +}); +$('.feedback').click(function() { + $('.bd').hide(); + $('.hd').hide(); + $('.footer').hide(); + $('#feedbackBox').show(); + $('#blurpage').show(); +}); var lookupCount = 0; var articleCount = 0; var exampleCount = 0; var qturl = ""; // change from "http://doc.qt.nokia.com/4.6/" to 0 so we can have relative links function processNokiaData(response){ -$('.sidebar .search form input').addClass('loading'); - // debug $('.content').prepend('<li>handling search results</li>'); // debuging var propertyTags = response.getElementsByTagName('page'); for (var i=0; i< propertyTags.length; i++) { @@ -50,7 +62,6 @@ $('.sidebar .search form input').addClass('loading'); if(propertyTags[i].getElementsByTagName('pageType')[0].firstChild.nodeValue == 'APIPage'){ lookupCount++; - //$('.live001').css('display','block'); for (var j=0; j< propertyTags[i].getElementsByTagName('pageWords').length; j++){ @@ -65,7 +76,6 @@ $('.sidebar .search form input').addClass('loading'); if(propertyTags[i].getElementsByTagName('pageType')[0].firstChild.nodeValue == 'Article'){ articleCount++; - //$('.live002').css('display','block'); for (var j=0; j< propertyTags[i].getElementsByTagName('pageWords').length; j++){ @@ -79,7 +89,6 @@ $('.sidebar .search form input').addClass('loading'); } if(propertyTags[i].getElementsByTagName('pageType')[0].firstChild.nodeValue == 'Example'){ exampleCount++; - //$('.live003').css('display','block'); for (var j=0; j< propertyTags[i].getElementsByTagName('pageWords').length; j++){ @@ -91,10 +100,11 @@ $('.sidebar .search form input').addClass('loading'); } } + if(i==propertyTags.length){$('#pageType').removeClass('loading');} + } - if(lookupCount == 0){$('#ul001').prepend('<li class=\"liveResult noMatch\">Found no result</li>');$('#ul001 li').css('display','block');$('.sidebar .search form input').removeClass('loading'); -} + if(lookupCount == 0){$('#ul001').prepend('<li class=\"liveResult noMatch\">Found no result</li>');$('#ul001 li').css('display','block');$('.sidebar .search form input').removeClass('loading');} if(articleCount == 0){$('#ul002').prepend('<li class=\"liveResult noMatch\">Found no result</li>');$('#ul002 li').css('display','block');} if(exampleCount == 0){$('#ul003').prepend('<li class=\"liveResult noMatch\">Found no result</li>');$('#ul003 li').css('display','block');} // reset count variables; @@ -103,12 +113,18 @@ $('.sidebar .search form input').addClass('loading'); exampleCount = 0; } - //build regular expression object to find empty string or any number of blank var blankRE=/^\s*$/; function CheckEmptyAndLoadList() { + var pageUrl = window.location.href; + var pageVal = $('title').html(); + $('#feedUrl').remove(); + $('#pageVal').remove(); + $('#feedform').append('<input id="feedUrl" name="feedUrl" value="'+pageUrl+'" style="display:none;">'); + $('#feedform').append('<input id="pageVal" name="pageVal" value="'+pageVal+'" style="display:none;">'); $('.liveResult').remove(); + $('.defaultLink').css('display','block'); var value = document.getElementById('pageType').value; if((blankRE.test(value)) || (value.length < 3)) { @@ -131,8 +147,9 @@ else */ // Loads on doc ready $(document).ready(function () { + //alert(pageUrl); + //$('#pageUrl').attr('foo',pageUrl); var pageTitle = $('title').html(); - $('#feedform').append('<input id="page" name="pageVal" value="'+pageTitle+'" style="display:none;">'); var currentString = $('#pageType').val() ; if(currentString.length < 1){ $('.defaultLink').css('display','block'); @@ -142,6 +159,7 @@ else $('#pageType').keyup(function () { var searchString = $('#pageType').val() ; if ((searchString == null) || (searchString.length < 3)) { + $('#pageType').removeClass('loading'); $('.liveResult').remove(); // replaces removeResults(); CheckEmptyAndLoadList(); $('.report').remove(); @@ -150,6 +168,7 @@ else } if (this.timer) clearTimeout(this.timer); this.timer = setTimeout(function () { + $('#pageType').addClass('loading'); // debug$('.content').prepend('<li>new search started </li>');// debug // debug$('.content').prepend('<p class=\"report\">Search string ' +searchString +'</p>'); // debug @@ -162,6 +181,8 @@ else success: function (response, textStatus) { $('.liveResult').remove(); // replaces removeResults(); + $('#pageType').removeClass('loading'); + processNokiaData(response); } diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 5ad90e3..ebc1607 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -456,6 +456,7 @@ .wrap .content { padding: 30px; + word-wrap:break-word; } .wrap .content li @@ -843,7 +844,7 @@ background-color: #e6e7e8; z-index: 4; } - #feedcloseX a + #feedcloseX { display: inline; padding: 5px 5px 0 0; @@ -1067,6 +1068,7 @@ .indexboxcont .sectionlist { display: inline-block; + vertical-align:top; width: 32.5%; padding: 0; } @@ -1138,7 +1140,21 @@ /* end of screen media */ - +.flowList{ +display:inline-block; +width:260px; +} +.flowList dl{ +padding:0px; +} +.wrap .content .flowList p{ +padding:0px; +} +pre.highlightedCode { + display: block; + overflow:hidden; +} + } /* end of screen media */ diff --git a/doc/src/widgets-and-layouts/focus.qdoc b/doc/src/widgets-and-layouts/focus.qdoc index 71f41d5..5ccfb63 100644 --- a/doc/src/widgets-and-layouts/focus.qdoc +++ b/doc/src/widgets-and-layouts/focus.qdoc @@ -82,7 +82,7 @@ Pressing \key Tab is by far the most common way to move focus using the keyboard. (Sometimes in data-entry applications Enter does the same as \key{Tab}; this can easily be achieved in Qt by - implementing an \l{Events and Event Filters}{event filter}.) + implementing an \l{The Event System}{event filter}.) Pressing \key Tab, in all window systems in common use today, moves the keyboard focus to the next widget in a circular diff --git a/doc/src/widgets-and-layouts/styles.qdoc b/doc/src/widgets-and-layouts/styles.qdoc index 31dfe40..b031dec 100644 --- a/doc/src/widgets-and-layouts/styles.qdoc +++ b/doc/src/widgets-and-layouts/styles.qdoc @@ -47,7 +47,7 @@ /*! \page style-reference.html - \title Styles and Style Aware Widgets + \title Styles & Style Aware Widgets \ingroup qt-gui-concepts \brief Styles and the styling of widgets. diff --git a/doc/src/widgets-and-layouts/widgets.qdoc b/doc/src/widgets-and-layouts/widgets.qdoc index 9fe2d69..c93a380 100644 --- a/doc/src/widgets-and-layouts/widgets.qdoc +++ b/doc/src/widgets-and-layouts/widgets.qdoc @@ -48,11 +48,10 @@ \section1 Widgets Widgets are the primary elements for creating user interfaces in Qt. - \l{Widget Classes}{Widgets} can display data and status information, + \l{The Widget Classes}{Widgets} can display data and status information, receive user input, and provide a container for other widgets that should be grouped together. A widget that is not embedded in a - parent widget is called a \l{Application Windows and - Dialogs}{window}. + parent widget is called a \l{Window and Dialog Widgets} {window}. \image parent-child-widgets.png A parent widget containing various child widgets. @@ -82,11 +81,10 @@ \section1 Widget Styles - \l{Implementing Styles and Style Aware Widgets}{Styles} draw on - behalf of widgets and encapsulate the look and feel of a GUI. Qt's - built-in widgets use the QStyle class to perform nearly all of their - drawing, ensuring that they look exactly like the equivalent native - widgets. + \l{Styles & Style Aware Widgets}{Styles} draw on behalf of + widgets and encapsulate the look and feel of a GUI. Qt's built-in + widgets use the QStyle class to perform nearly all of their drawing, + ensuring that they look exactly like the equivalent native widgets. \table \row diff --git a/doc/src/windows-and-dialogs/mainwindow.qdoc b/doc/src/windows-and-dialogs/mainwindow.qdoc index c1e66d9..db9a636 100644 --- a/doc/src/windows-and-dialogs/mainwindow.qdoc +++ b/doc/src/windows-and-dialogs/mainwindow.qdoc @@ -49,7 +49,6 @@ \title Window and Dialog Widgets \brief Windows and Dialogs in Qt. \ingroup qt-gui-concepts - \ingroup frameworks-technologies A \l{Widgets Tutorial}{widget} that is not embedded in a parent widget is called a window. Usually, windows have a frame and a title bar, although it is also possible to create @@ -81,7 +80,7 @@ \section1 Main Windows and Dialogs - \l{The Application Main Window} provides the framework for building the + The \l{Application Main Window} provides the framework for building the application's main user interface, and are created by subclassing QMainWindow. QMainWindow has its own layout to which you can add a \l{QMenuBar}{menu bar}, \l{QToolBar}{tool bars}, \l{QDockWidget}{dockable widgets} and a diff --git a/examples/draganddrop/fridgemagnets/main.cpp b/examples/draganddrop/fridgemagnets/main.cpp index e8e0c8d..4a81696 100644 --- a/examples/draganddrop/fridgemagnets/main.cpp +++ b/examples/draganddrop/fridgemagnets/main.cpp @@ -44,16 +44,14 @@ int main(int argc, char *argv[]) { Q_INIT_RESOURCE(fridgemagnets); - bool smallScreen = false; - for (int i=0; i<argc; i++) - if (QString(argv[i]) == "-small-screen") - smallScreen = true; QApplication app(argc, argv); #ifdef QT_KEYPAD_NAVIGATION QApplication::setNavigationMode(Qt::NavigationModeCursorAuto); #endif DragWidget window; + + bool smallScreen = QApplication::arguments().contains("-small-screen"); if (smallScreen) window.showFullScreen(); else diff --git a/examples/script/context2d/main.cpp b/examples/script/context2d/main.cpp index d9ae4e7..1c5b8ac 100644 --- a/examples/script/context2d/main.cpp +++ b/examples/script/context2d/main.cpp @@ -45,14 +45,10 @@ int main(int argc, char **argv) { Q_INIT_RESOURCE(context2d); - bool smallScreen = false; - for (int i = 0; i < argc; i++) - if (QString(argv[i]) == "-small-screen") - smallScreen = true; - QApplication app(argc, argv); Window win; + bool smallScreen = QApplication::arguments().contains("-small-screen"); if (!smallScreen) { win.show(); } else { diff --git a/examples/widgets/wiggly/main.cpp b/examples/widgets/wiggly/main.cpp index 163c231..b8b523f 100644 --- a/examples/widgets/wiggly/main.cpp +++ b/examples/widgets/wiggly/main.cpp @@ -45,16 +45,13 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - bool smallScreen = false; - for (int i=0; i<argc; i++) - if (QString(argv[i]) == "-small-screen") - smallScreen = true; - Dialog dialog(0,smallScreen); - if (!smallScreen){ + bool smallScreen = QApplication::arguments().contains("-small-screen"); + + Dialog dialog(0, smallScreen); + + if (!smallScreen) dialog.show(); - } - else{ + else dialog.showFullScreen(); - } return app.exec(); } diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 9c64544..ad8750b 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -476,7 +476,7 @@ MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO) mkfile = new NmakeMakefileGenerator; } else if(gen == "MSBUILD") { // Visual Studio >= v11.0 - if(proj->first("TEMPLATE").indexOf(QRegExp("^vc.*")) != -1 || proj->first("TEMPLATE").indexOf(QRegExp("^ce.*")) != -1) + if (proj->first("TEMPLATE").startsWith("vc")) mkfile = new VcxprojGenerator; else mkfile = new NmakeMakefileGenerator; diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 99cdd11..75fc910 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -2656,6 +2656,14 @@ bool VCXFilter::outputFileConfig(XmlOutput &xml, XmlOutput &xmlFilter, const QSt xml << tag("ClCompile") << attrTag("Include",Option::fixPathToLocalOS(filename)); + } else if(filename.endsWith(".res")) { + + xmlFilter << tag("CustomBuild") + << attrTag("Include",Option::fixPathToLocalOS(filename)) + << attrTagS("Filter", filtername); + + xml << tag("CustomBuild") + << attrTag("Include",Option::fixPathToLocalOS(filename)); } else { xmlFilter << tag("CustomBuild") @@ -2665,6 +2673,16 @@ bool VCXFilter::outputFileConfig(XmlOutput &xml, XmlOutput &xmlFilter, const QSt xml << tag("CustomBuild") << attrTag("Include",Option::fixPathToLocalOS(filename)); } + } else if(filtername == "Root Files") { + + if (filename.endsWith(".rc")) { + + xmlFilter << tag("ResourceCompile") + << attrTag("Include",Option::fixPathToLocalOS(filename)); + + xml << tag("ResourceCompile") + << attrTag("Include",Option::fixPathToLocalOS(filename)); + } } } @@ -2696,8 +2714,6 @@ bool VCXFilter::outputFileConfig(XmlOutput &xml, XmlOutput &xmlFilter, const QSt << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg((*Config).Name)) << valueTag(CompilerTool.PrecompiledHeader); } - - //xml << CompilerTool; } } @@ -3023,6 +3039,14 @@ void VCXProject::outputFileConfigs(XmlOutput &xml, xml << tag("ClCompile") << attrTag("Include",Option::fixPathToLocalOS(info.file)); + } else if(info.file.endsWith(".res")) { + + xmlFilter << tag("CustomBuild") + << attrTag("Include",Option::fixPathToLocalOS(info.file)) + << attrTagS("Filter", filtername); + + xml << tag("CustomBuild") + << attrTag("Include",Option::fixPathToLocalOS(info.file)); } else { xmlFilter << tag("CustomBuild") @@ -3033,6 +3057,16 @@ void VCXProject::outputFileConfigs(XmlOutput &xml, << attrTag("Include",Option::fixPathToLocalOS(info.file)); } + } else if(filtername == "Root Files") { + + if (info.file.endsWith(".rc")) { + + xmlFilter << tag("ResourceCompile") + << attrTag("Include",Option::fixPathToLocalOS(info.file)); + + xml << tag("ResourceCompile") + << attrTag("Include",Option::fixPathToLocalOS(info.file)); + } } else { xmlFilter << tag("None") @@ -3329,6 +3363,7 @@ XmlOutput &operator<<(XmlOutput &xml, VCXProject &tool) for (int x = 0; x < tool.ExtraCompilers.count(); ++x) { tool.outputFilter(xml, xmlFilter, tool.ExtraCompilers.at(x)); } + tool.outputFilter(xml, xmlFilter, "Root Files"); xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets"); diff --git a/qmake/option.cpp b/qmake/option.cpp index 13e855c..8db3797 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -304,6 +304,7 @@ Option::parseCommandLine(int argc, char **argv, int skip) } else if(opt == "nodependheuristics") { Option::mkfile::do_dep_heuristics = false; } else if(opt == "E") { + fprintf(stderr, "-E is deprecated. Use -d instead.\n"); Option::mkfile::do_preprocess = true; } else if(opt == "cache") { Option::mkfile::cachefile = argv[++x]; @@ -558,7 +559,6 @@ void Option::applyHostMode() Option::dir_sep = "/"; Option::obj_ext = ".o"; } - Option::qmake_abslocation = Option::fixPathToTargetOS(Option::qmake_abslocation); } bool Option::postProcessProject(QMakeProject *project) diff --git a/qmake/project.cpp b/qmake/project.cpp index 998d173..2be68be 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1046,7 +1046,7 @@ QMakeProject::parse(const QString &t, QMap<QString, QStringList> &place, int num SKIP_WS(d, d_off, s.length()); QString vals = s.mid(d_off); // vals now contains the space separated list of values int rbraces = vals.count('}'), lbraces = vals.count('{'); - if(scope_blocks.count() > 1 && rbraces - lbraces == 1) { + if(scope_blocks.count() > 1 && rbraces - lbraces == 1 && vals.endsWith('}')) { debug_msg(1, "Project Parser: %s:%d : Leaving block %d", parser.file.toLatin1().constData(), parser.line_no, scope_blocks.count()); ScopeBlock sb = scope_blocks.pop(); @@ -1073,7 +1073,7 @@ QMakeProject::parse(const QString &t, QMap<QString, QStringList> &place, int num } if(vals.contains('=') && numLines > 1) - warn_msg(WarnParser, "Detected possible line continuation: {%s} %s:%d", + warn_msg(WarnParser, "Possible accidental line continuation: {%s} at %s:%d", var.toLatin1().constData(), parser.file.toLatin1().constData(), parser.line_no); QStringList &varlist = place[var]; // varlist is the list in the symbol table @@ -3099,13 +3099,12 @@ QStringList &QMakeProject::values(const QString &_var, QMap<QString, QStringList place[var] = QStringList(Option::obj_ext); } } else if (var == QLatin1String("QMAKE_QMAKE")) { - if (place[var].isEmpty()) { - if (!Option::qmake_abslocation.isNull()) - place[var] = QStringList(Option::qmake_abslocation); - else - place[var] = QStringList(Option::fixPathToTargetOS( - QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmake", false)); - } + if (place[var].isEmpty()) + place[var] = QStringList(Option::fixPathToTargetOS( + !Option::qmake_abslocation.isEmpty() + ? Option::qmake_abslocation + : QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmake", + false)); } else if (var == QLatin1String("EPOCROOT")) { if (place[var].isEmpty()) place[var] = QStringList(epocRoot()); diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 83fa044..e39d326 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -3,6 +3,7 @@ QPRO_PWD = $$PWD QT = DEFINES += QT_BUILD_CORE_LIB QT_NO_USING_NAMESPACE win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x67000000 +irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused include(../qbase.pri) include(animation/animation.pri) diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index bc68599..093312f 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -254,6 +254,29 @@ inline QDebug operator<<(QDebug debug, const QContiguousCache<T> &cache) return debug.space(); } +#if defined(FORCE_UREF) +template <class T> +inline QDebug &operator<<(QDebug debug, const QFlags<T> &flags) +#else +template <class T> +inline QDebug operator<<(QDebug debug, const QFlags<T> &flags) +#endif +{ + debug.nospace() << "QFlags("; + bool needSeparator = false; + for (uint i = 0; i < sizeof(T) * 8; ++i) { + if (flags.testFlag(T(1 << i))) { + if (needSeparator) + debug.nospace() << '|'; + else + needSeparator = true; + debug.nospace() << "0x" << QByteArray::number(T(1 << i), 16).constData(); + } + } + debug << ')'; + return debug.space(); +} + #if !defined(QT_NO_DEBUG_STREAM) Q_CORE_EXPORT_INLINE QDebug qDebug() { return QDebug(QtDebugMsg); } diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h index 205f911..b9e7e01 100644 --- a/src/corelib/tools/qchar.h +++ b/src/corelib/tools/qchar.h @@ -358,11 +358,7 @@ private: QChar(uchar c); #endif ushort ucs; -} -#if (defined(__arm__) || defined(__ARMEL__)) - Q_PACKED -#endif - ; +}; Q_DECLARE_TYPEINFO(QChar, Q_MOVABLE_TYPE); diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h index 5023201..f2fd892 100644 --- a/src/corelib/tools/qlocale.h +++ b/src/corelib/tools/qlocale.h @@ -685,11 +685,7 @@ public: struct Data { quint16 index; quint16 numberOptions; - } -#if (defined(__arm__) || defined(__ARMEL__)) - Q_PACKED -#endif - ; + }; private: friend struct QLocalePrivate; // ### We now use this field to pack an index into locale_data and NumberOptions. diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp index 1a7c417..4e9c1ad 100644 --- a/src/dbus/qdbusabstractinterface.cpp +++ b/src/dbus/qdbusabstractinterface.cpp @@ -42,6 +42,8 @@ #include "qdbusabstractinterface.h" #include "qdbusabstractinterface_p.h" +#include <qthread.h> + #include "qdbusargument.h" #include "qdbuspendingcall.h" #include "qdbusmessage_p.h" @@ -440,7 +442,8 @@ QDBusMessage QDBusAbstractInterface::callWithArgumentList(QDBus::CallMode mode, msg.setArguments(args); QDBusMessage reply = d->connection.call(msg, mode); - d->lastError = reply; // will clear if reply isn't an error + if (thread() == QThread::currentThread()) + d->lastError = reply; // will clear if reply isn't an error // ensure that there is at least one element if (reply.arguments().isEmpty()) diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 7c55009..151a9e9 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -140,7 +140,9 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType<QDeclarativeScaleGrid>(); qmlRegisterType<QValidator>(); qmlRegisterType<QDeclarativeVisualModel>(); +#ifndef QT_NO_ACTION qmlRegisterType<QAction>(); +#endif qmlRegisterType<QDeclarativePen>(); qmlRegisterType<QDeclarativeFlickableVisibleArea>(); #ifndef QT_NO_GRAPHICSEFFECT diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 9dfcd2c..a83b528 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -53,7 +53,7 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime < QGraphicsView visualizes the contents of a QGraphicsScene in a scrollable viewport. To create a scene with geometrical items, see QGraphicsScene's - documentation. QGraphicsView is part of \l{The Graphics View Framework}. + documentation. QGraphicsView is part of the \l{Graphics View Framework}. To visualize a scene, you start by constructing a QGraphicsView object, passing the address of the scene you want to visualize to QGraphicsView's diff --git a/src/gui/gui.pro b/src/gui/gui.pro index a6370b2..7f1cb78 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -3,6 +3,7 @@ QPRO_PWD = $$PWD QT = core DEFINES += QT_BUILD_GUI_LIB QT_NO_USING_NAMESPACE win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000 +irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused !win32:!embedded:!mac:!symbian:CONFIG += x11 diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 85be5b1..98f235e 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4812,7 +4812,7 @@ bool QImageData::doImageIO(const QImage *image, QImageWriter *writer, int qualit or as a BMP image if the stream's version is 1. Note that writing the stream to a file will not produce a valid image file. - \sa QImage::save(), {Format of the QDataStream Operators} + \sa QImage::save(), {Serializing Qt Data Types} */ QDataStream &operator<<(QDataStream &s, const QImage &image) @@ -4838,7 +4838,7 @@ QDataStream &operator<<(QDataStream &s, const QImage &image) Reads an image from the given \a stream and stores it in the given \a image. - \sa QImage::load(), {Format of the QDataStream Operators} + \sa QImage::load(), {Serializing Qt Data Types} */ QDataStream &operator>>(QDataStream &s, QImage &image) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 474cd2e..48c5d3f 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1281,7 +1281,7 @@ bool QPixmap::convertFromImage(const QImage &image, ColorMode mode) image. Note that writing the stream to a file will not produce a valid image file. - \sa QPixmap::save(), {Format of the QDataStream Operators} + \sa QPixmap::save(), {Serializing Qt Data Types} */ QDataStream &operator<<(QDataStream &stream, const QPixmap &pixmap) @@ -1294,7 +1294,7 @@ QDataStream &operator<<(QDataStream &stream, const QPixmap &pixmap) Reads an image from the given \a stream into the given \a pixmap. - \sa QPixmap::load(), {Format of the QDataStream Operators} + \sa QPixmap::load(), {Serializing Qt Data Types} */ QDataStream &operator>>(QDataStream &stream, QPixmap &pixmap) diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp index 125f0c4..da1d5db 100644 --- a/src/gui/itemviews/qlistwidget.cpp +++ b/src/gui/itemviews/qlistwidget.cpp @@ -791,7 +791,7 @@ QListWidgetItem &QListWidgetItem::operator=(const QListWidgetItem &other) This operator uses QListWidgetItem::write(). - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator<<(QDataStream &out, const QListWidgetItem &item) { @@ -806,7 +806,7 @@ QDataStream &operator<<(QDataStream &out, const QListWidgetItem &item) This operator uses QListWidgetItem::read(). - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator>>(QDataStream &in, QListWidgetItem &item) { diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/gui/itemviews/qstandarditemmodel.cpp index 9d52c78..767b5a9 100644 --- a/src/gui/itemviews/qstandarditemmodel.cpp +++ b/src/gui/itemviews/qstandarditemmodel.cpp @@ -1921,7 +1921,7 @@ void QStandardItem::write(QDataStream &out) const This operator uses QStandardItem::read(). - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator>>(QDataStream &in, QStandardItem &item) { @@ -1937,7 +1937,7 @@ QDataStream &operator>>(QDataStream &in, QStandardItem &item) This operator uses QStandardItem::write(). - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator<<(QDataStream &out, const QStandardItem &item) { diff --git a/src/gui/itemviews/qtablewidget.cpp b/src/gui/itemviews/qtablewidget.cpp index f653a41..5bb242e 100644 --- a/src/gui/itemviews/qtablewidget.cpp +++ b/src/gui/itemviews/qtablewidget.cpp @@ -1428,7 +1428,7 @@ void QTableWidgetItem::write(QDataStream &out) const This operator uses QTableWidgetItem::read(). - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator>>(QDataStream &in, QTableWidgetItem &item) { @@ -1443,7 +1443,7 @@ QDataStream &operator>>(QDataStream &in, QTableWidgetItem &item) This operator uses QTableWidgetItem::write(). - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator<<(QDataStream &out, const QTableWidgetItem &item) { diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp index 4c80325..0e06f34 100644 --- a/src/gui/itemviews/qtreewidget.cpp +++ b/src/gui/itemviews/qtreewidget.cpp @@ -2199,7 +2199,7 @@ void QTreeWidgetItem::executePendingSort() const This operator uses QTreeWidgetItem::write(). - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator<<(QDataStream &out, const QTreeWidgetItem &item) { @@ -2214,7 +2214,7 @@ QDataStream &operator<<(QDataStream &out, const QTreeWidgetItem &item) This operator uses QTreeWidgetItem::read(). - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator>>(QDataStream &in, QTreeWidgetItem &item) { diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 7b62de1..b805a72 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2218,15 +2218,17 @@ void QApplication::closeAllWindows() { bool did_close = true; QWidget *w; - while((w = activeModalWidget()) && did_close) { - if(!w->isVisible()) + while ((w = activeModalWidget()) && did_close) { + if (!w->isVisible() || w->data->is_closing) break; did_close = w->close(); } QWidgetList list = QApplication::topLevelWidgets(); for (int i = 0; did_close && i < list.size(); ++i) { w = list.at(i); - if (w->isVisible() && w->windowType() != Qt::Desktop) { + if (w->isVisible() + && w->windowType() != Qt::Desktop + && !w->data->is_closing) { did_close = w->close(); list = QApplication::topLevelWidgets(); i = -1; diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h index 5db121a..44fb4f0 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h +++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h @@ -73,6 +73,9 @@ ** ****************************************************************************/ +#ifndef QT_COCOA_HELPERS_MAC_P_H +#define QT_COCOA_HELPERS_MAC_P_H + // // W A R N I N G // ------------- @@ -216,3 +219,5 @@ bool qt_cocoaPostMessage(id target, SEL selector); void qt_mac_post_retranslateAppMenu(); QT_END_NAMESPACE + +#endif // QT_COCOA_HELPERS_MAC_P_H diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 1f2cd8c..1c7f6ac 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -670,8 +670,8 @@ void QWidget::setAutoFillBackground(bool enabled) (to move the keyboard focus), and passes on most of the other events to one of the more specialized handlers above. - Events and the mechanism used to deliver them are covered in the - \l{Events and Event Filters} document. + Events and the mechanism used to deliver them are covered in + \l{The Event System}. \section1 Groups of Functions and Properties diff --git a/src/gui/math3d/qgenericmatrix.cpp b/src/gui/math3d/qgenericmatrix.cpp index 96405a8b..be30cb6 100644 --- a/src/gui/math3d/qgenericmatrix.cpp +++ b/src/gui/math3d/qgenericmatrix.cpp @@ -252,7 +252,7 @@ QT_BEGIN_NAMESPACE Writes the given \a matrix to the given \a stream and returns a reference to the stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ /*! @@ -262,7 +262,7 @@ QT_BEGIN_NAMESPACE Reads a NxM matrix from the given \a stream into the given \a matrix and returns a reference to the stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ #endif diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index 62d740c..16c7f97 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -1878,7 +1878,7 @@ QDebug operator<<(QDebug dbg, const QMatrix4x4 &m) Writes the given \a matrix to the given \a stream and returns a reference to the stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator<<(QDataStream &stream, const QMatrix4x4 &matrix) @@ -1896,7 +1896,7 @@ QDataStream &operator<<(QDataStream &stream, const QMatrix4x4 &matrix) Reads a 4x4 matrix from the given \a stream into the given \a matrix and returns a reference to the stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator>>(QDataStream &stream, QMatrix4x4 &matrix) diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp index ad71836..2fd66eb 100644 --- a/src/gui/math3d/qquaternion.cpp +++ b/src/gui/math3d/qquaternion.cpp @@ -595,7 +595,7 @@ QDebug operator<<(QDebug dbg, const QQuaternion &q) Writes the given \a quaternion to the given \a stream and returns a reference to the stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator<<(QDataStream &stream, const QQuaternion &quaternion) @@ -612,7 +612,7 @@ QDataStream &operator<<(QDataStream &stream, const QQuaternion &quaternion) Reads a quaternion from the given \a stream into the given \a quaternion and returns a reference to the stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator>>(QDataStream &stream, QQuaternion &quaternion) diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp index b67e8a1..6a5cfc8 100644 --- a/src/gui/math3d/qvector2d.cpp +++ b/src/gui/math3d/qvector2d.cpp @@ -434,7 +434,7 @@ QDebug operator<<(QDebug dbg, const QVector2D &vector) Writes the given \a vector to the given \a stream and returns a reference to the stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator<<(QDataStream &stream, const QVector2D &vector) @@ -450,7 +450,7 @@ QDataStream &operator<<(QDataStream &stream, const QVector2D &vector) Reads a 2D vector from the given \a stream into the given \a vector and returns a reference to the stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator>>(QDataStream &stream, QVector2D &vector) diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp index 6a592b2..dfcce0e 100644 --- a/src/gui/math3d/qvector3d.cpp +++ b/src/gui/math3d/qvector3d.cpp @@ -585,7 +585,7 @@ QDebug operator<<(QDebug dbg, const QVector3D &vector) Writes the given \a vector to the given \a stream and returns a reference to the stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator<<(QDataStream &stream, const QVector3D &vector) @@ -602,7 +602,7 @@ QDataStream &operator<<(QDataStream &stream, const QVector3D &vector) Reads a 3D vector from the given \a stream into the given \a vector and returns a reference to the stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator>>(QDataStream &stream, QVector3D &vector) diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp index f2f3cc6..abff1ba 100644 --- a/src/gui/math3d/qvector4d.cpp +++ b/src/gui/math3d/qvector4d.cpp @@ -538,7 +538,7 @@ QDebug operator<<(QDebug dbg, const QVector4D &vector) Writes the given \a vector to the given \a stream and returns a reference to the stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator<<(QDataStream &stream, const QVector4D &vector) @@ -555,7 +555,7 @@ QDataStream &operator<<(QDataStream &stream, const QVector4D &vector) Reads a 4D vector from the given \a stream into the given \a vector and returns a reference to the stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator>>(QDataStream &stream, QVector4D &vector) diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index 96d547b..b468b11 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -329,8 +329,8 @@ struct QBrushDataPointerDeleter \endtable - For more information about painting in general, see \l{The Paint - System} documentation. + For more information about painting in general, see the \l{Paint + System}. \sa Qt::BrushStyle, QPainter, QColor */ @@ -1013,7 +1013,7 @@ QDebug operator<<(QDebug dbg, const QBrush &b) Writes the given \a brush to the given \a stream and returns a reference to the \a stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator<<(QDataStream &s, const QBrush &b) @@ -1081,7 +1081,7 @@ QDataStream &operator<<(QDataStream &s, const QBrush &b) Reads the given \a brush from the given \a stream and returns a reference to the \a stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator>>(QDataStream &s, QBrush &b) diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc index 8c73cc0..340db39 100644 --- a/src/gui/painting/qpaintdevice.qdoc +++ b/src/gui/painting/qpaintdevice.qdoc @@ -87,8 +87,7 @@ function returns the number of different colors available for the paint device. - \sa QPaintEngine, QPainter, {The Coordinate System}, {The Paint - System} + \sa QPaintEngine, QPainter, {Coordinate System}, {Paint System} */ /*! diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp index 6aabde8..a2d0337 100644 --- a/src/gui/painting/qpaintengine.cpp +++ b/src/gui/painting/qpaintengine.cpp @@ -172,7 +172,7 @@ QFont QTextItem::font() const possible to adapt to multiple technologies on each platform and take advantage of each to the fullest. - \sa QPainter, QPaintDevice::paintEngine(), {The Paint System} + \sa QPainter, QPaintDevice::paintEngine(), {Paint System} */ /*! diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index e290cbe..2e43984 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -92,7 +92,7 @@ typedef QPenPrivate QPenData; convenience functions to extract and set the color of the pen's brush, respectively. Pens may also be compared and streamed. - For more information about painting in general, see \l{The Paint + For more information about painting in general, see the \l{Paint System} documentation. \tableofcontents @@ -872,7 +872,7 @@ bool QPen::isDetached() Writes the given \a pen to the given \a stream and returns a reference to the \a stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator<<(QDataStream &s, const QPen &p) @@ -918,7 +918,7 @@ QDataStream &operator<<(QDataStream &s, const QPen &p) Reads a pen from the given \a stream into the given \a pen and returns a reference to the \a stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream &operator>>(QDataStream &s, QPen &p) diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index aaa241f..423cce9 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -148,8 +148,8 @@ QT_BEGIN_NAMESPACE coordinate system. The standard coordinate system of a QPaintDevice has its origin located at the top-left position. The \e x values increase to the right; \e y values increase - downward. For a complete description, see the \l {The Coordinate - System}{coordinate system} documentation. + downward. For a complete description, see the \l {Coordinate + System} {coordinate system} documentation. QPainter has functions to translate, scale, shear and rotate the coordinate system without using a QTransform. For example: @@ -223,7 +223,7 @@ QT_BEGIN_NAMESPACE \snippet doc/src/snippets/transform/main.cpp 2 \endtable - \sa QPainter, {The Coordinate System}, {demos/affine}{Affine + \sa QPainter, {Coordinate System}, {demos/affine}{Affine Transformations Demo}, {Transformations Example} */ @@ -1028,7 +1028,7 @@ void QTransform::reset() Writes the given \a matrix to the given \a stream and returns a reference to the stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream & operator<<(QDataStream &s, const QTransform &m) { @@ -1052,7 +1052,7 @@ QDataStream & operator<<(QDataStream &s, const QTransform &m) Reads the given \a matrix from the given \a stream and returns a reference to the stream. - \sa {Format of the QDataStream Operators} + \sa {Serializing Qt Data Types} */ QDataStream & operator>>(QDataStream &s, QTransform &t) { diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 2e2f374..f029602 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -100,23 +100,22 @@ #include <QtGui/qgraphicsproxywidget.h> #include <QtGui/qgraphicsview.h> #include <private/qt_cocoa_helpers_mac_p.h> +#include "qmacstyle_mac_p.h" #include <private/qstylehelper_p.h> QT_BEGIN_NAMESPACE -extern QRegion qt_mac_convert_mac_region(RgnHandle); //qregion_mac.cpp - // The following constants are used for adjusting the size // of push buttons so that they are drawn inside their bounds. -static const int PushButtonLeftOffset = 6; -static const int PushButtonTopOffset = 4; -static const int PushButtonRightOffset = 12; -static const int PushButtonBottomOffset = 12; -static const int MiniButtonH = 26; -static const int SmallButtonH = 30; -static const int BevelButtonW = 50; -static const int BevelButtonH = 22; -static const int PushButtonContentPadding = 6; +const int QMacStylePrivate::PushButtonLeftOffset = 6; +const int QMacStylePrivate::PushButtonTopOffset = 4; +const int QMacStylePrivate::PushButtonRightOffset = 12; +const int QMacStylePrivate::PushButtonBottomOffset = 12; +const int QMacStylePrivate::MiniButtonH = 26; +const int QMacStylePrivate::SmallButtonH = 30; +const int QMacStylePrivate::BevelButtonW = 50; +const int QMacStylePrivate::BevelButtonH = 22; +const int QMacStylePrivate::PushButtonContentPadding = 6; // These colors specify the titlebar gradient colors on // Leopard. Ideally we should get them from the system. @@ -132,25 +131,16 @@ static const QColor titlebarSeparatorLineInactive(131, 131, 131); static const QColor mainWindowGradientBegin(240, 240, 240); static const QColor mainWindowGradientEnd(200, 200, 200); -#if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5) -enum { - kThemePushButtonTextured = 31, - kThemePushButtonTexturedSmall = 32, - kThemePushButtonTexturedMini = 33 -}; - -/* Search fields */ -enum { - kHIThemeFrameTextFieldRound = 1000, - kHIThemeFrameTextFieldRoundSmall = 1001, - kHIThemeFrameTextFieldRoundMini = 1002 -}; -#endif +static const int DisclosureOffset = 4; // Resolve these at run-time, since the functions was moved in Leopard. typedef HIRect * (*PtrHIShapeGetBounds)(HIShapeRef, HIRect *); static PtrHIShapeGetBounds ptrHIShapeGetBounds = 0; +static int closeButtonSize = 12; + +extern QRegion qt_mac_convert_mac_region(RgnHandle); //qregion_mac.cpp + static bool isVerticalTabs(const QTabBar::Shape shape) { return (shape == QTabBar::RoundedEast || shape == QTabBar::TriangularEast @@ -158,8 +148,6 @@ static bool isVerticalTabs(const QTabBar::Shape shape) { || shape == QTabBar::TriangularWest); } -static int closeButtonSize = 12; - void drawTabCloseButton(QPainter *p, bool hover, bool active, bool selected) { // draw background circle @@ -378,32 +366,6 @@ void drawTabBase(QPainter *p, const QStyleOptionTabBarBaseV2 *tbb, const QWidget p->drawLine(tabRect.x(), height - 1, width, height - 1); } -/* - AHIG: - Apple Human Interface Guidelines - http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/ - - Builder: - Apple Interface Builder v. 3.1.1 -*/ - -// this works as long as we have at most 16 different control types -#define CT1(c) CT2(c, c) -#define CT2(c1, c2) ((uint(c1) << 16) | uint(c2)) - -enum QAquaWidgetSize { QAquaSizeLarge = 0, QAquaSizeSmall = 1, QAquaSizeMini = 2, - QAquaSizeUnknown = -1 }; - -#define SIZE(large, small, mini) \ - (controlSize == QAquaSizeLarge ? (large) : controlSize == QAquaSizeSmall ? (small) : (mini)) - -// same as return SIZE(...) but optimized -#define return_SIZE(large, small, mini) \ - do { \ - static const int sizes[] = { (large), (small), (mini) }; \ - return sizes[controlSize]; \ - } while (0) - static int getControlSize(const QStyleOption *option, const QWidget *widget) { if (option) { @@ -481,80 +443,9 @@ static inline ThemeTabDirection getTabDirection(QTabBar::Shape shape) return ttd; } -class QMacStylePrivate : public QObject -{ - Q_OBJECT - -public: - QMacStylePrivate(QMacStyle *style); - - // Stuff from QAquaAnimate: - bool addWidget(QWidget *); - void removeWidget(QWidget *); - - enum Animates { AquaPushButton, AquaProgressBar, AquaListViewItemOpen }; - bool animatable(Animates, const QWidget *) const; - void stopAnimate(Animates, QWidget *); - void startAnimate(Animates, QWidget *); - static ThemeDrawState getDrawState(QStyle::State flags); - QAquaWidgetSize aquaSizeConstrain(const QStyleOption *option, const QWidget *widg, - QStyle::ContentsType ct = QStyle::CT_CustomBase, - QSize szHint=QSize(-1, -1), QSize *insz = 0) const; - void getSliderInfo(QStyle::ComplexControl cc, const QStyleOptionSlider *slider, - HIThemeTrackDrawInfo *tdi, const QWidget *needToRemoveMe); - bool doAnimate(Animates); - inline int animateSpeed(Animates) const { return 33; } - - // Utility functions - void drawColorlessButton(const HIRect &macRect, HIThemeButtonDrawInfo *bdi, - QPainter *p, const QStyleOption *opt) const; - - QSize pushButtonSizeFromContents(const QStyleOptionButton *btn) const; - - HIRect pushButtonContentBounds(const QStyleOptionButton *btn, - const HIThemeButtonDrawInfo *bdi) const; - - void initComboboxBdi(const QStyleOptionComboBox *combo, HIThemeButtonDrawInfo *bdi, - const QWidget *widget, const ThemeDrawState &tds); - - static HIRect comboboxInnerBounds(const HIRect &outerBounds, int buttonKind); - - static QRect comboboxEditBounds(const QRect &outerBounds, const HIThemeButtonDrawInfo &bdi); - - static void drawCombobox(const HIRect &outerBounds, const HIThemeButtonDrawInfo &bdi, QPainter *p); - static void drawTableHeader(const HIRect &outerBounds, bool drawTopBorder, bool drawLeftBorder, - const HIThemeButtonDrawInfo &bdi, QPainter *p); - bool contentFitsInPushButton(const QStyleOptionButton *btn, HIThemeButtonDrawInfo *bdi, - ThemeButtonKind buttonKindToCheck) const; - void initHIThemePushButton(const QStyleOptionButton *btn, const QWidget *widget, - const ThemeDrawState tds, - HIThemeButtonDrawInfo *bdi) const; - QPixmap generateBackgroundPattern() const; -protected: - bool eventFilter(QObject *, QEvent *); - void timerEvent(QTimerEvent *); - -private slots: - void startAnimationTimer(); - -public: - QPointer<QPushButton> defaultButton; //default push buttons - int timerID; - QList<QPointer<QWidget> > progressBars; //existing progress bars that need animation - - struct ButtonState { - int frame; - enum { ButtonDark, ButtonLight } dir; - } buttonState; - UInt8 progressFrame; - QPointer<QFocusFrame> focusWidget; - CFAbsoluteTime defaultButtonStart; - QMacStyle *q; - bool mouseDown; -}; - QT_BEGIN_INCLUDE_NAMESPACE -#include "qmacstyle_mac.moc" +#include "moc_qmacstyle_mac.cpp" +#include "moc_qmacstyle_mac_p.cpp" QT_END_INCLUDE_NAMESPACE /***************************************************************************** @@ -1055,10 +946,10 @@ HIRect QMacStylePrivate::pushButtonContentBounds(const QStyleOptionButton *btn, // Adjust the bounds to correct for // carbon not calculating the content bounds fully correct if (bdi->kind == kThemePushButton || bdi->kind == kThemePushButtonSmall){ - outerBounds.origin.y += PushButtonTopOffset; - outerBounds.size.height -= PushButtonBottomOffset; + outerBounds.origin.y += QMacStylePrivate::PushButtonTopOffset; + outerBounds.size.height -= QMacStylePrivate::PushButtonBottomOffset; } else if (bdi->kind == kThemePushButtonMini) { - outerBounds.origin.y += PushButtonTopOffset; + outerBounds.origin.y += QMacStylePrivate::PushButtonTopOffset; } HIRect contentBounds; @@ -1074,7 +965,7 @@ QSize QMacStylePrivate::pushButtonSizeFromContents(const QStyleOptionButton *btn { QSize csz(0, 0); QSize iconSize = btn->icon.isNull() ? QSize(0, 0) - : (btn->iconSize + QSize(PushButtonContentPadding, 0)); + : (btn->iconSize + QSize(QMacStylePrivate::PushButtonContentPadding, 0)); QRect textRect = btn->text.isEmpty() ? QRect(0, 0, 1, 1) : btn->fontMetrics.boundingRect(QRect(), Qt::AlignCenter, btn->text); csz.setWidth(iconSize.width() + textRect.width() @@ -1149,12 +1040,12 @@ void QMacStylePrivate::initHIThemePushButton(const QStyleOptionButton *btn, // Choose the button kind that closest match the button rect, but at the // same time displays the button contents without clipping. bdi->kind = kThemeBevelButton; - if (btn->rect.width() >= BevelButtonW && btn->rect.height() >= BevelButtonH){ + if (btn->rect.width() >= QMacStylePrivate::BevelButtonW && btn->rect.height() >= QMacStylePrivate::BevelButtonH){ if (widget && widget->testAttribute(Qt::WA_MacVariableSize)) { - if (btn->rect.height() <= MiniButtonH){ + if (btn->rect.height() <= QMacStylePrivate::MiniButtonH){ if (contentFitsInPushButton(btn, bdi, kThemePushButtonMini)) bdi->kind = kThemePushButtonMini; - } else if (btn->rect.height() <= SmallButtonH){ + } else if (btn->rect.height() <= QMacStylePrivate::SmallButtonH){ if (contentFitsInPushButton(btn, bdi, kThemePushButtonSmall)) bdi->kind = kThemePushButtonSmall; } else if (contentFitsInPushButton(btn, bdi, kThemePushButton)) { @@ -3100,7 +2991,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai else bi.value = opt->direction == Qt::LeftToRight ? kThemeDisclosureRight : kThemeDisclosureLeft; bi.adornment = kThemeAdornmentNone; - HIRect hirect = qt_hirectForQRect(opt->rect); + HIRect hirect = qt_hirectForQRect(opt->rect.adjusted(DisclosureOffset,0,-DisclosureOffset,0)); HIThemeDrawButton(&hirect, &bi, cg, kHIThemeOrientationNormal, 0); break; } @@ -3494,21 +3385,21 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // the focus 'shadow' will be inside. HIRect newRect = qt_hirectForQRect(btn->rect); if (bdi.kind == kThemePushButton || bdi.kind == kThemePushButtonSmall) { - newRect.origin.x += PushButtonLeftOffset; - newRect.origin.y += PushButtonTopOffset; - newRect.size.width -= PushButtonRightOffset; - newRect.size.height -= PushButtonBottomOffset; + newRect.origin.x += QMacStylePrivate::PushButtonLeftOffset; + newRect.origin.y += QMacStylePrivate::PushButtonTopOffset; + newRect.size.width -= QMacStylePrivate::PushButtonRightOffset; + newRect.size.height -= QMacStylePrivate::PushButtonBottomOffset; } else if (bdi.kind == kThemePushButtonMini) { - newRect.origin.x += PushButtonLeftOffset - 2; - newRect.origin.y += PushButtonTopOffset; - newRect.size.width -= PushButtonRightOffset - 4; + newRect.origin.x += QMacStylePrivate::PushButtonLeftOffset - 2; + newRect.origin.y += QMacStylePrivate::PushButtonTopOffset; + newRect.size.width -= QMacStylePrivate::PushButtonRightOffset - 4; } HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0); if (btn->features & QStyleOptionButton::HasMenu) { int mbi = proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w); QRect ir = btn->rect; - HIRect arrowRect = CGRectMake(ir.right() - mbi - PushButtonRightOffset, + HIRect arrowRect = CGRectMake(ir.right() - mbi - QMacStylePrivate::PushButtonRightOffset, ir.height() / 2 - 4, mbi, ir.height() / 2); bool drawColorless = btn->palette.currentColorGroup() == QPalette::Active; if (drawColorless && tds == kThemeStateInactive) @@ -3602,14 +3493,14 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter if (btn->state & State_On) state = QIcon::On; QPixmap pixmap = btn->icon.pixmap(btn->iconSize, mode, state); - contentW += pixmap.width() + PushButtonContentPadding; + contentW += pixmap.width() + QMacStylePrivate::PushButtonContentPadding; int iconLeftOffset = freeContentRect.x() + (freeContentRect.width() - contentW) / 2; int iconTopOffset = freeContentRect.y() + (freeContentRect.height() - pixmap.height()) / 2; QRect iconDestRect(iconLeftOffset, iconTopOffset, pixmap.width(), pixmap.height()); QRect visualIconDestRect = visualRect(btn->direction, freeContentRect, iconDestRect); proxy()->drawItemPixmap(p, visualIconDestRect, Qt::AlignLeft | Qt::AlignVCenter, pixmap); int newOffset = iconDestRect.x() + iconDestRect.width() - + PushButtonContentPadding - textRect.x(); + + QMacStylePrivate::PushButtonContentPadding - textRect.x(); textRect.adjust(newOffset, 0, newOffset, 0); } // Draw the text: @@ -4352,6 +4243,15 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, int controlSize = getControlSize(opt, widget); switch (sr) { + case SE_ItemViewItemText: + if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) { + int fw = proxy()->pixelMetric(PM_FocusFrameHMargin, opt, widget); + // We add the focusframeargin between icon and text in commonstyle + rect = QCommonStyle::subElementRect(sr, opt, widget); + if (vopt->features & QStyleOptionViewItemV2::HasDecoration) + rect.adjust(-fw, 0, 0, 0); + } + break; case SE_ToolBoxTabContents: rect = QCommonStyle::subElementRect(sr, opt, widget); break; @@ -4369,9 +4269,9 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, case SE_HeaderLabel: if (qstyleoption_cast<const QStyleOptionHeader *>(opt)) { rect = QWindowsStyle::subElementRect(sr, opt, widget); - if (widget && widget->height() <= qt_mac_aqua_get_metric(kThemeMetricListHeaderHeight)){ - // We need to allow the text a bit more space when the header is as - // small as kThemeMetricListHeaderHeight, otherwise it gets clipped: + if (widget && widget->height() <= 22){ + // We need to allow the text a bit more space when the header is + // small, otherwise it gets clipped: rect.setY(0); rect.setHeight(widget->height()); } @@ -4398,8 +4298,9 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, HIRect outRect; HIThemeGetButtonShape(&inRect, &bdi, &shape); ptrHIShapeGetBounds(shape, &outRect); - rect = QRect(int(outRect.origin.x), int(outRect.origin.y), - int(contentRect.origin.x - outRect.origin.x), int(outRect.size.height)); + rect = QRect(int(outRect.origin.x + DisclosureOffset), int(outRect.origin.y), + int(contentRect.origin.x - outRect.origin.x + DisclosureOffset), + int(outRect.size.height)); break; } case SE_TabWidgetLeftCorner: @@ -5695,8 +5596,8 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, // By default, we fit the contents inside a normal rounded push button. // Do this by add enough space around the contents so that rounded // borders (including highlighting when active) will show. - sz.rwidth() += PushButtonLeftOffset + PushButtonRightOffset + 12; - sz.rheight() += PushButtonTopOffset + PushButtonBottomOffset; + sz.rwidth() += QMacStylePrivate::PushButtonLeftOffset + QMacStylePrivate::PushButtonRightOffset + 12; + sz.rheight() += QMacStylePrivate::PushButtonTopOffset + QMacStylePrivate::PushButtonBottomOffset; break; case QStyle::CT_MenuItem: if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { @@ -5788,6 +5689,13 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz = sz.expandedTo(QSize(sz.width(), minimumSize)); } break; + case CT_ItemViewItem: + if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) { + sz = QCommonStyle::sizeFromContents(ct, vopt, csz, widget); + sz.setHeight(sz.height() + 2); + } + break; + default: sz = QWindowsStyle::sizeFromContents(ct, opt, csz, widget); } diff --git a/src/gui/styles/qmacstyle_mac_p.h b/src/gui/styles/qmacstyle_mac_p.h new file mode 100644 index 0000000..5a0ba4c --- /dev/null +++ b/src/gui/styles/qmacstyle_mac_p.h @@ -0,0 +1,239 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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$ +** +****************************************************************************/ + + +#ifndef QMACSTYLE_MAC_P_H +#define QMACSTYLE_MAC_P_H + +#include <qmacstyle_mac.h> +#include <private/qapplication_p.h> +#include <private/qcombobox_p.h> +#include <private/qmacstylepixmaps_mac_p.h> +#include <private/qpaintengine_mac_p.h> +#include <private/qpainter_p.h> +#include <private/qprintengine_mac_p.h> +#include <private/qstylehelper_p.h> +#include <qapplication.h> +#include <qbitmap.h> +#include <qcheckbox.h> +#include <qcombobox.h> +#include <qdialogbuttonbox.h> +#include <qdockwidget.h> +#include <qevent.h> +#include <qfocusframe.h> +#include <qformlayout.h> +#include <qgroupbox.h> +#include <qhash.h> +#include <qheaderview.h> +#include <qlayout.h> +#include <qlineedit.h> +#include <qlistview.h> +#include <qmainwindow.h> +#include <qmap.h> +#include <qmenubar.h> +#include <qpaintdevice.h> +#include <qpainter.h> +#include <qpixmapcache.h> +#include <qpointer.h> +#include <qprogressbar.h> +#include <qpushbutton.h> +#include <qradiobutton.h> +#include <qrubberband.h> +#include <qsizegrip.h> +#include <qspinbox.h> +#include <qsplitter.h> +#include <qstyleoption.h> +#include <qtextedit.h> +#include <qtextstream.h> +#include <qtoolbar.h> +#include <qtoolbutton.h> +#include <qtreeview.h> +#include <qtableview.h> +#include <qwizard.h> +#include <qdebug.h> +#include <qlibrary.h> +#include <qdatetimeedit.h> +#include <qmath.h> +#include <QtGui/qgraphicsproxywidget.h> +#include <QtGui/qgraphicsview.h> +#include <private/qt_cocoa_helpers_mac_p.h> + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +QT_BEGIN_NAMESPACE + +#if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5) +enum { + kThemePushButtonTextured = 31, + kThemePushButtonTexturedSmall = 32, + kThemePushButtonTexturedMini = 33 +}; + +/* Search fields */ +enum { + kHIThemeFrameTextFieldRound = 1000, + kHIThemeFrameTextFieldRoundSmall = 1001, + kHIThemeFrameTextFieldRoundMini = 1002 +}; +#endif + +/* + AHIG: + Apple Human Interface Guidelines + http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/ + + Builder: + Apple Interface Builder v. 3.1.1 +*/ + +// this works as long as we have at most 16 different control types +#define CT1(c) CT2(c, c) +#define CT2(c1, c2) ((uint(c1) << 16) | uint(c2)) + +enum QAquaWidgetSize { QAquaSizeLarge = 0, QAquaSizeSmall = 1, QAquaSizeMini = 2, + QAquaSizeUnknown = -1 }; + +#define SIZE(large, small, mini) \ + (controlSize == QAquaSizeLarge ? (large) : controlSize == QAquaSizeSmall ? (small) : (mini)) + +// same as return SIZE(...) but optimized +#define return_SIZE(large, small, mini) \ + do { \ + static const int sizes[] = { (large), (small), (mini) }; \ + return sizes[controlSize]; \ + } while (0) + +class QMacStylePrivate : public QObject +{ + Q_OBJECT + +public: + QMacStylePrivate(QMacStyle *style); + + // Ideally these wouldn't exist, but since they already exist we need some accessors. + static const int PushButtonLeftOffset; + static const int PushButtonTopOffset; + static const int PushButtonRightOffset; + static const int PushButtonBottomOffset; + static const int MiniButtonH; + static const int SmallButtonH; + static const int BevelButtonW; + static const int BevelButtonH; + static const int PushButtonContentPadding; + + + // Stuff from QAquaAnimate: + bool addWidget(QWidget *); + void removeWidget(QWidget *); + + enum Animates { AquaPushButton, AquaProgressBar, AquaListViewItemOpen }; + bool animatable(Animates, const QWidget *) const; + void stopAnimate(Animates, QWidget *); + void startAnimate(Animates, QWidget *); + static ThemeDrawState getDrawState(QStyle::State flags); + QAquaWidgetSize aquaSizeConstrain(const QStyleOption *option, const QWidget *widg, + QStyle::ContentsType ct = QStyle::CT_CustomBase, + QSize szHint=QSize(-1, -1), QSize *insz = 0) const; + void getSliderInfo(QStyle::ComplexControl cc, const QStyleOptionSlider *slider, + HIThemeTrackDrawInfo *tdi, const QWidget *needToRemoveMe); + bool doAnimate(Animates); + inline int animateSpeed(Animates) const { return 33; } + + // Utility functions + void drawColorlessButton(const HIRect &macRect, HIThemeButtonDrawInfo *bdi, + QPainter *p, const QStyleOption *opt) const; + + QSize pushButtonSizeFromContents(const QStyleOptionButton *btn) const; + + HIRect pushButtonContentBounds(const QStyleOptionButton *btn, + const HIThemeButtonDrawInfo *bdi) const; + + void initComboboxBdi(const QStyleOptionComboBox *combo, HIThemeButtonDrawInfo *bdi, + const QWidget *widget, const ThemeDrawState &tds); + + static HIRect comboboxInnerBounds(const HIRect &outerBounds, int buttonKind); + + static QRect comboboxEditBounds(const QRect &outerBounds, const HIThemeButtonDrawInfo &bdi); + + static void drawCombobox(const HIRect &outerBounds, const HIThemeButtonDrawInfo &bdi, QPainter *p); + static void drawTableHeader(const HIRect &outerBounds, bool drawTopBorder, bool drawLeftBorder, + const HIThemeButtonDrawInfo &bdi, QPainter *p); + bool contentFitsInPushButton(const QStyleOptionButton *btn, HIThemeButtonDrawInfo *bdi, + ThemeButtonKind buttonKindToCheck) const; + void initHIThemePushButton(const QStyleOptionButton *btn, const QWidget *widget, + const ThemeDrawState tds, + HIThemeButtonDrawInfo *bdi) const; + QPixmap generateBackgroundPattern() const; +protected: + bool eventFilter(QObject *, QEvent *); + void timerEvent(QTimerEvent *); + +private slots: + void startAnimationTimer(); + +public: + QPointer<QPushButton> defaultButton; //default push buttons + int timerID; + QList<QPointer<QWidget> > progressBars; //existing progress bars that need animation + + struct ButtonState { + int frame; + enum { ButtonDark, ButtonLight } dir; + } buttonState; + UInt8 progressFrame; + QPointer<QFocusFrame> focusWidget; + CFAbsoluteTime defaultButtonStart; + QMacStyle *q; + bool mouseDown; +}; + +QT_END_NAMESPACE + +#endif // QMACSTYLE_MAC_P_H diff --git a/src/gui/styles/qmacstylepixmaps_mac_p.h b/src/gui/styles/qmacstylepixmaps_mac_p.h index 6a5e0e6..58038c3 100644 --- a/src/gui/styles/qmacstylepixmaps_mac_p.h +++ b/src/gui/styles/qmacstylepixmaps_mac_p.h @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#ifndef QMACSTYLEPIXMAPS_MAC_P_H +#define QMACSTYLEPIXMAPS_MAC_P_H + // // W A R N I N G // ------------- @@ -65,3 +68,5 @@ static const char * const qt_mac_toolbar_ext[]={ "aab###bb###baa", "ab###bb###baaa", ".###..###.aaaa"}; + +#endif // QMACSTYLEPIXMAPS_MAC_P_H diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp index 429dafe..4cfa93f 100644 --- a/src/gui/styles/qstyle.cpp +++ b/src/gui/styles/qstyle.cpp @@ -325,7 +325,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C control over size of header items and row and column sizes. \sa QStyleOption, QStylePainter, {Styles Example}, - {Implementing Styles and Style Aware Widgets}, QStyledItemDelegate + {Styles & Style Aware Widgets}, QStyledItemDelegate */ /*! diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index f920032..0a96272 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -46,7 +46,8 @@ x11{ contains( styles, mac ) { HEADERS += \ styles/qmacstyle_mac.h \ - styles/qmacstylepixmaps_mac_p.h + styles/qmacstylepixmaps_mac_p.h \ + styles/qmacstyle_mac_p.h OBJECTIVE_SOURCES += styles/qmacstyle_mac.mm !contains( styles, windows ) { diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp index 1a9adcc..8a18ed0 100644 --- a/src/gui/widgets/qpushbutton.cpp +++ b/src/gui/widgets/qpushbutton.cpp @@ -58,6 +58,10 @@ #include "qdebug.h" #include "qlayoutitem.h" #include "qdialogbuttonbox.h" +#ifdef Q_WS_MAC +#include "qmacstyle_mac.h" +#include "private/qmacstyle_mac_p.h" +#endif // Q_WS_MAC #ifndef QT_NO_ACCESSIBILITY #include "qaccessible.h" @@ -679,6 +683,37 @@ bool QPushButton::event(QEvent *e) return QAbstractButton::event(e); } +#ifdef Q_WS_MAC +/*! \reimp */ +bool QPushButton::hitButton(const QPoint &pos) const +{ + // This is only required if we are using the native style, so check that first. + QMacStyle *macStyle = qobject_cast<QMacStyle *>(style()); + // If this is a flat button we just bail out. + if(isFlat() || (0 == macStyle)) + return QAbstractButton::hitButton(pos); + // Now that we know we are using the native style, let's proceed. + Q_D(const QPushButton); + QPushButtonPrivate *nonConst = const_cast<QPushButtonPrivate *>(d); + // In OSX buttons are round, which causes the hit method to be special. + // We cannot simply relay on detecting if something is inside the rect or not, + // we need to check if it is inside the "rounded area" or not. A point might + // be inside the rect but not inside the rounded area. + // Notice this method is only reimplemented for OSX. + return nonConst->hitButton(pos); +} + +bool QPushButtonPrivate::hitButton(const QPoint &pos) +{ + Q_Q(QPushButton); + QRect roundedRect(q->rect().left() + QMacStylePrivate::PushButtonLeftOffset, + q->rect().top() + QMacStylePrivate::PushButtonContentPadding, + q->rect().width() - QMacStylePrivate::PushButtonRightOffset, + q->rect().height() - QMacStylePrivate::PushButtonBottomOffset); + return roundedRect.contains(pos); +} +#endif // Q_WS_MAC + #ifdef QT3_SUPPORT /*! Use one of the constructors that doesn't take the \a name diff --git a/src/gui/widgets/qpushbutton.h b/src/gui/widgets/qpushbutton.h index 2a4823d..cf28753 100644 --- a/src/gui/widgets/qpushbutton.h +++ b/src/gui/widgets/qpushbutton.h @@ -91,6 +91,9 @@ public Q_SLOTS: protected: bool event(QEvent *e); +#ifdef Q_WS_MAC + bool hitButton(const QPoint &pos) const; +#endif // Q_WS_MAC void paintEvent(QPaintEvent *); void keyPressEvent(QKeyEvent *); void focusInEvent(QFocusEvent *); diff --git a/src/gui/widgets/qpushbutton_p.h b/src/gui/widgets/qpushbutton_p.h index f2ee09d..6feb726 100644 --- a/src/gui/widgets/qpushbutton_p.h +++ b/src/gui/widgets/qpushbutton_p.h @@ -69,6 +69,9 @@ public: inline void init() { resetLayoutItemMargins(); } static QPushButtonPrivate* get(QPushButton *b) { return b->d_func(); } +#ifdef Q_WS_MAC + bool hitButton(const QPoint &pos); +#endif #ifndef QT_NO_MENU QPoint adjustedMenuPosition(); #endif diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 1c7661d..6669b5d 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -141,6 +141,32 @@ static void ensureInitialized() can be: \snippet doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp 1 + \section1 Network and Roaming support + + With the addition of the \l {Bearer Management} API to Qt 4.7 + QNetworkAccessManager gained the ability to manage network connections. + QNetworkAccessManager can start the network interface if the device is + offline and terminates the interface if the current process is the last + one to use the uplink. Note that some platform utilize grace periods from + when the last application stops using a uplink until the system actually + terminates the connectivity link. Roaming is equally transparent. Any + queued/pending network requests are automatically transferred to new + access point. + + Clients wanting to utilize this feature should not require any changes. In fact + it is likely that existing platform specific connection code can simply be + removed from the application. + + \note The network and roaming support in QNetworkAccessManager is conditional + upon the platform supporting connection management. The + \l QNetworkConfigurationManager::NetworkSessionRequired can be used to + detect whether QNetworkAccessManager utilizes this feature. Currently only + Meego/Harmattan and Symbian platforms provide connection management support. + + \note This feature cannot be used in combination with the Bearer Management + API as provided by QtMobility. Applications have to migrate to the Qt version + of Bearer Management. + \section1 Symbian Platform Security Requirements On Symbian, processes which use this class must have the diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 15795d2..d6011cf 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -5,6 +5,7 @@ DEFINES += QT_BUILD_OPENGL_LIB DEFINES += QT_NO_USING_NAMESPACE win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x63000000 solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2 +irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 3c24c54..4d90648 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -78,6 +78,10 @@ public: QNetworkSession::State sessionStateForId(const QString &id); + quint64 bytesWritten(const QString &id); + quint64 bytesReceived(const QString &id); + quint64 startTime(const QString &id); + QNetworkConfigurationManager::Capabilities capabilities() const; QNetworkSessionPrivate *createSessionBackend(); @@ -100,6 +104,8 @@ private: bool scanning; QScanThread *scanThread; + quint64 getBytes(const QString &interfaceName,bool b); + protected: void startNetworkChangeLoop(); diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 3206833..a9cb65b 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -67,6 +67,9 @@ #include <private/qt_cocoa_helpers_mac_p.h> #include "private/qcore_mac_p.h" +#include <net/if.h> +#include <ifaddrs.h> + @interface QNSListener : NSObject { NSNotificationCenter *center; @@ -157,7 +160,7 @@ void QScanThread::quit() void QScanThread::run() { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + QMacCocoaAutoReleasePool pool; QStringList found; mutex.lock(); CWInterface *currentInterface = [CWInterface interfaceWithName:qt_mac_QStringToNSString(interfaceName)]; @@ -167,6 +170,7 @@ void QScanThread::run() NSError *err = nil; NSDictionary *parametersDict = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], kCWScanKeyMerge, + [NSNumber numberWithInt:kCWScanTypeFast], kCWScanKeyScanType, [NSNumber numberWithInteger:100], kCWScanKeyRestTime, nil]; NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err]; @@ -204,11 +208,9 @@ void QScanThread::run() found.append(foundNetwork(id, networkSsid, state, interfaceName, purpose)); - } //end row -// [parametersDict release]; - - } //end error - } // endwifi power + } + } + } // add known configurations that are not around. QMapIterator<QString, QMap<QString,QString> > i(userProfiles); while (i.hasNext()) { @@ -248,7 +250,6 @@ void QScanThread::run() } } emit networksChanged(); - [pool release]; } QStringList QScanThread::foundNetwork(const QString &id, const QString &name, const QNetworkConfiguration::StateFlags state, const QString &interfaceName, const QNetworkConfiguration::Purpose purpose) @@ -426,6 +427,7 @@ QCoreWlanEngine::~QCoreWlanEngine() void QCoreWlanEngine::initialize() { QMutexLocker locker(&mutex); + QMacCocoaAutoReleasePool pool; if([[CWInterface supportedInterfaces] count] > 0 && !listener) { listener = [[QNSListener alloc] init]; @@ -659,7 +661,6 @@ bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName) QNetworkSession::State QCoreWlanEngine::sessionStateForId(const QString &id) { QMutexLocker locker(&mutex); - QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); if (!ptr) @@ -823,5 +824,90 @@ void QCoreWlanEngine::networksChanged() } +quint64 QCoreWlanEngine::bytesWritten(const QString &id) +{ + QMutexLocker locker(&mutex); + const QString interfaceStr = getInterfaceFromId(id); + return getBytes(interfaceStr,false); +} + +quint64 QCoreWlanEngine::bytesReceived(const QString &id) +{ + QMutexLocker locker(&mutex); + const QString interfaceStr = getInterfaceFromId(id); + return getBytes(interfaceStr,true); +} + +quint64 QCoreWlanEngine::startTime(const QString &id) +{ + QMutexLocker locker(&mutex); + QMacCocoaAutoReleasePool pool; + quint64 timestamp = 0; + + NSString *filePath = @"/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist"; + NSDictionary* plistDict = [[[NSDictionary alloc] initWithContentsOfFile:filePath] autorelease]; + NSString *input = @"KnownNetworks"; + NSString *timeStampStr = @"_timeStamp"; + + NSString *ssidStr = @"SSID_STR"; + + for (id key in plistDict) { + if ([input isEqualToString:key]) { + + NSDictionary *knownNetworksDict = [plistDict objectForKey:key]; + for (id networkKey in knownNetworksDict) { + bool isFound = false; + NSDictionary *itemDict = [knownNetworksDict objectForKey:networkKey]; + NSInteger dictSize = [itemDict count]; + id objects[dictSize]; + id keys[dictSize]; + + [itemDict getObjects:objects andKeys:keys]; + bool ok = false; + for(int i = 0; i < dictSize; i++) { + if([ssidStr isEqualToString:keys[i]]) { + const QString ident = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString(objects[i]))); + if(ident == id) { + ok = true; + } + } + if(ok && [timeStampStr isEqualToString:keys[i]]) { + timestamp = (quint64)[objects[i] timeIntervalSince1970]; + isFound = true; + break; + } + } + if(isFound) + break; + } + } + } + return timestamp; +} + +quint64 QCoreWlanEngine::getBytes(const QString &interfaceName, bool b) +{ + struct ifaddrs *ifAddressList, *ifAddress; + struct if_data *if_data; + + quint64 bytes = 0; + ifAddressList = nil; + if(getifaddrs(&ifAddressList) == 0) { + for(ifAddress = ifAddressList; ifAddress; ifAddress = ifAddress->ifa_next) { + if(interfaceName == ifAddress->ifa_name) { + if_data = (struct if_data*)ifAddress->ifa_data; + if(b) { + bytes = if_data->ifi_ibytes; + break; + } else { + bytes = if_data->ifi_obytes; + break; + } + } + } + freeifaddrs(ifAddressList); + } + return bytes; +} QT_END_NAMESPACE diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 9b6ffa0..1a55402 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -46,6 +46,7 @@ #include <QtNetwork/private/qnetworkconfiguration_p.h> #include <QtCore/qstringlist.h> +#include <QtCore/qcoreapplication.h> #include <QtCore/qdebug.h> @@ -79,38 +80,26 @@ void qNotificationCallback(WLAN_NOTIFICATION_DATA *data, QNativeWifiEngine *d) } QNativeWifiEngine::QNativeWifiEngine(QObject *parent) -: QBearerEngineImpl(parent), handle(0) +: QBearerEngineImpl(parent), handle(INVALID_HANDLE_VALUE) { - DWORD clientVersion; - - DWORD result = local_WlanOpenHandle(1, 0, &clientVersion, &handle); - if (result != ERROR_SUCCESS) { -#ifdef BEARER_MANAGEMENT_DEBUG - if (result != ERROR_SERVICE_NOT_ACTIVE) - qDebug("%s: WlanOpenHandle failed with error %ld\n", __FUNCTION__, result); -#endif - - return; - } - - result = local_WlanRegisterNotification(handle, WLAN_NOTIFICATION_SOURCE_ALL, true, - WLAN_NOTIFICATION_CALLBACK(qNotificationCallback), - this, 0, 0); -#ifdef BEARER_MANAGEMENT_DEBUG - if (result != ERROR_SUCCESS) - qDebug("%s: WlanRegisterNotification failed with error %ld\n", __FUNCTION__, result); -#endif + connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(closeHandle())); } QNativeWifiEngine::~QNativeWifiEngine() { - local_WlanCloseHandle(handle, 0); + closeHandle(); } void QNativeWifiEngine::scanComplete() { QMutexLocker locker(&mutex); + if (!available()) { + locker.unlock(); + emit updateCompleted(); + return; + } + // enumerate interfaces WLAN_INTERFACE_INFO_LIST *interfaceList; DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); @@ -249,6 +238,9 @@ QString QNativeWifiEngine::getInterfaceFromId(const QString &id) { QMutexLocker locker(&mutex); + if (!available()) + return QString(); + // enumerate interfaces WLAN_INTERFACE_INFO_LIST *interfaceList; DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); @@ -304,6 +296,9 @@ bool QNativeWifiEngine::hasIdentifier(const QString &id) { QMutexLocker locker(&mutex); + if (!available()) + return false; + // enumerate interfaces WLAN_INTERFACE_INFO_LIST *interfaceList; DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); @@ -364,6 +359,12 @@ void QNativeWifiEngine::connectToId(const QString &id) { QMutexLocker locker(&mutex); + if (!available()) { + locker.unlock(); + emit connectionError(id, InterfaceLookupError); + return; + } + WLAN_INTERFACE_INFO_LIST *interfaceList; DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); if (result != ERROR_SUCCESS) { @@ -440,6 +441,12 @@ void QNativeWifiEngine::disconnectFromId(const QString &id) { QMutexLocker locker(&mutex); + if (!available()) { + locker.unlock(); + emit connectionError(id, InterfaceLookupError); + return; + } + QString interface = getInterfaceFromId(id); if (interface.isEmpty()) { @@ -479,6 +486,12 @@ void QNativeWifiEngine::requestUpdate() { QMutexLocker locker(&mutex); + if (!available()) { + locker.unlock(); + emit updateCompleted(); + return; + } + // enumerate interfaces WLAN_INTERFACE_INFO_LIST *interfaceList; DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); @@ -555,6 +568,42 @@ QNetworkConfigurationPrivatePointer QNativeWifiEngine::defaultConfiguration() return QNetworkConfigurationPrivatePointer(); } +bool QNativeWifiEngine::available() +{ + if (handle != INVALID_HANDLE_VALUE) + return true; + + DWORD clientVersion; + + DWORD result = local_WlanOpenHandle(1, 0, &clientVersion, &handle); + if (result != ERROR_SUCCESS) { +#ifdef BEARER_MANAGEMENT_DEBUG + if (result != ERROR_SERVICE_NOT_ACTIVE) + qDebug("%s: WlanOpenHandle failed with error %ld\n", __FUNCTION__, result); +#endif + + return false; + } + + result = local_WlanRegisterNotification(handle, WLAN_NOTIFICATION_SOURCE_ALL, true, + WLAN_NOTIFICATION_CALLBACK(qNotificationCallback), + this, 0, 0); +#ifdef BEARER_MANAGEMENT_DEBUG + if (result != ERROR_SUCCESS) + qDebug("%s: WlanRegisterNotification failed with error %ld\n", __FUNCTION__, result); +#endif + + return handle != INVALID_HANDLE_VALUE; +} + +void QNativeWifiEngine::closeHandle() +{ + if (handle != INVALID_HANDLE_VALUE) { + local_WlanCloseHandle(handle, 0); + handle = INVALID_HANDLE_VALUE; + } +} + bool QNativeWifiEngine::requiresPolling() const { // On Windows XP SP2 and SP3 only connection and disconnection notifications are available. diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h index 3b21985..0e9576b 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.h +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h @@ -91,12 +91,13 @@ public: QNetworkConfigurationPrivatePointer defaultConfiguration(); - inline bool available() const { return handle != 0; } + bool available(); bool requiresPolling() const; -public Q_SLOTS: +private Q_SLOTS: void scanComplete(); + void closeHandle(); private: Qt::HANDLE handle; diff --git a/tests/auto/bic/gen.sh b/tests/auto/bic/gen.sh index 8005880..7bcad24 100755 --- a/tests/auto/bic/gen.sh +++ b/tests/auto/bic/gen.sh @@ -56,7 +56,7 @@ fi for module in $modules; do echo "#include <$module/$module>" >test.cpp - g++ -c -I$QTDIR/include -DQT_NO_STL -DQT3_SUPPORT -fdump-class-hierarchy test.cpp + ${CXX-g++} $CXXFLAGS -c -I$QTDIR/include -DQT_NO_STL -DQT3_SUPPORT -fdump-class-hierarchy test.cpp mv test.cpp*.class $module.$2.txt # Remove template classes from the output perl -pi -e '$skip = 1 if (/^(Class|Vtable).*</); diff --git a/tests/auto/bic/tst_bic.cpp b/tests/auto/bic/tst_bic.cpp index 400fcc1..504512d 100644 --- a/tests/auto/bic/tst_bic.cpp +++ b/tests/auto/bic/tst_bic.cpp @@ -178,13 +178,17 @@ void tst_Bic::sizesAndVTables_data() QSKIP("Test not implemented for this compiler/platform", SkipAll); #else -#if defined Q_OS_LINUX && defined Q_WS_X11 +#if defined(FILESUFFIX) + // cross-testing +#elif defined Q_OS_LINUX && defined Q_WS_X11 # if defined(__powerpc__) && !defined(__powerpc64__) # define FILESUFFIX "linux-gcc-ppc32" # elif defined(__amd64__) # define FILESUFFIX "linux-gcc-amd64" # elif defined(__i386__) # define FILESUFFIX "linux-gcc-ia32" +# elif defined(__ARMEL__) +# define FILESUFFIX "linux-gcc-armel" # endif #elif defined Q_OS_MAC && defined(__powerpc__) # define FILESUFFIX "macx-gcc-ppc32" @@ -233,9 +237,11 @@ QBic::Info tst_Bic::getCurrentInfo(const QString &libName) #ifdef Q_OS_WIN qtDir.replace('\\', '/'); #endif - QString compilerName = "g++"; + QString compilerName = QString::fromLocal8Bit(qgetenv("CXX")); + if (compilerName.isEmpty()) + compilerName = "g++"; - QStringList args; + QStringList args = QString::fromLocal8Bit(qgetenv("CXXFLAGS")).split(' '); args << "-c" << "-I" + qtDir + "/include" #ifdef Q_OS_MAC diff --git a/tests/auto/qapplication/tst_qapplication.cpp b/tests/auto/qapplication/tst_qapplication.cpp index 459ac2b..43fbba1 100644 --- a/tests/auto/qapplication/tst_qapplication.cpp +++ b/tests/auto/qapplication/tst_qapplication.cpp @@ -106,6 +106,7 @@ private slots: void lastWindowClosed(); void quitOnLastWindowClosed(); + void closeAllWindows(); void testDeleteLater(); void testDeleteLaterProcessEvents(); @@ -745,6 +746,83 @@ void tst_QApplication::quitOnLastWindowClosed() } } +class PromptOnCloseWidget : public QWidget +{ +public: + void closeEvent(QCloseEvent *event) + { + QMessageBox *messageBox = new QMessageBox(this); + messageBox->setWindowTitle("Unsaved data"); + messageBox->setText("Would you like to save or discard your current data?"); + messageBox->setStandardButtons(QMessageBox::Save|QMessageBox::Discard|QMessageBox::Cancel); + messageBox->setDefaultButton(QMessageBox::Save); + + messageBox->show(); + QTest::qWaitForWindowShown(messageBox); + + // verify that all windows are visible + foreach (QWidget *w, qApp->topLevelWidgets()) + QVERIFY(w->isVisible()); + // flush event queue + qApp->processEvents(); + // close all windows + qApp->closeAllWindows(); + + if (messageBox->standardButton(messageBox->clickedButton()) == QMessageBox::Cancel) + event->ignore(); + else + event->accept(); + + delete messageBox; + } +}; + +void tst_QApplication::closeAllWindows() +{ + int argc = 0; + QApplication app(argc, 0, QApplication::GuiServer); + + // create some windows + new QWidget; + new QWidget; + new QWidget; + + // show all windows + foreach (QWidget *w, app.topLevelWidgets()) { + w->show(); + QTest::qWaitForWindowShown(w); + } + // verify that they are visible + foreach (QWidget *w, app.topLevelWidgets()) + QVERIFY(w->isVisible()); + // empty event queue + app.processEvents(); + // close all windows + app.closeAllWindows(); + // all windows should no longer be visible + foreach (QWidget *w, app.topLevelWidgets()) + QVERIFY(!w->isVisible()); + + // add a window that prompts the user when closed + PromptOnCloseWidget *promptOnCloseWidget = new PromptOnCloseWidget; + // show all windows + foreach (QWidget *w, app.topLevelWidgets()) { + w->show(); + QTest::qWaitForWindowShown(w); + } + // close the last window to open the prompt (eventloop recurses) + promptOnCloseWidget->close(); + // all windows should not be visible, except the one that opened the prompt + foreach (QWidget *w, app.topLevelWidgets()) { + if (w == promptOnCloseWidget) + QVERIFY(w->isVisible()); + else + QVERIFY(!w->isVisible()); + } + + qDeleteAll(app.topLevelWidgets()); +} + bool isPathListIncluded(const QStringList &l, const QStringList &r) { int size = r.count(); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index dda2cf3..cf8ea7c 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1781,7 +1781,7 @@ void HtmlGenerator::generateHeader(const QString& title, { out() << QString("<?xml version=\"1.0\" encoding=\"%1\"?>\n").arg(outputEncoding); out() << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"; - out() << "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n"; + out() << QString("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"%1\" lang=\"%1\">\n").arg(naturalLanguage); out() << "<head>\n"; out() << " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"; QString shortVersion; @@ -2332,7 +2332,7 @@ void HtmlGenerator::generateCompactList(const Node *relative, QString commonPrefix) { const int NumParagraphs = 37; // '0' to '9', 'A' to 'Z', '_' - const int NumColumns = 3; // number of columns in the result + const int NumColumns = 1; // number of columns in the result if (classMap.isEmpty()) return; @@ -2479,19 +2479,19 @@ void HtmlGenerator::generateCompactList(const Node *relative, out() << "</b></p>\n"; } - out() << "<table class=\"generic\">\n"; + out() << "<div class=\"flowListDiv\">\n"; for (k = 0; k < numRows; k++) { if (++numTableRows % 2 == 1) - out() << "<tr class=\"odd topAlign\">"; + out() << "<dl class=\"flowList odd\">"; else - out() << "<tr class=\"even topAlign\">"; + out() << "<dl class=\"flowList even\">"; //break; // out() << "<tr>\n"; for (i = 0; i < NumColumns; i++) { if (currentOffset[i] >= firstOffset[i + 1]) { // this column is finished - out() << "<td>\n</td>\n"; // check why? + out() << "<dd>\n</dd>\n"; // check why? } else { while ((currentParagraphNo[i] < NumParagraphs) && @@ -2506,7 +2506,7 @@ void HtmlGenerator::generateCompactList(const Node *relative, currentParagraphNo[i] = NumParagraphs - 1; } #endif - out() << "<th class=\"rightAlign alphaChar\"><p>"; + out() << "<dt class=\"alphaChar\"><p>"; if (currentOffsetInParagraph[i] == 0) { // start a new paragraph if (includeAlphabet) { @@ -2517,9 +2517,9 @@ void HtmlGenerator::generateCompactList(const Node *relative, << paragraphName[currentParagraphNo[i]] << "</b>"; } - out() << "</p></th>\n"; + out() << "</p></dt>\n"; - out() << "<td><p>"; + out() << "<dd><p>"; if ((currentParagraphNo[i] < NumParagraphs) && !paragraphName[currentParagraphNo[i]].isEmpty()) { NodeMap::Iterator it; @@ -2545,15 +2545,15 @@ void HtmlGenerator::generateCompactList(const Node *relative, out() << ")"; } } - out() << "</p></td>\n"; + out() << "</p></dd>\n"; currentOffset[i]++; currentOffsetInParagraph[i]++; } } - out() << "</tr>\n"; + out() << "</dl>\n"; } - out() << "</table>\n"; + out() << "</div>\n"; } void HtmlGenerator::generateFunctionIndex(const Node *relative, diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index e394799..81ff93a 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -115,20 +115,7 @@ SOURCES += apigenerator.cpp \ ### Documentation for qdoc3 ### -win32:!win32-g++ { - unixstyle = false -} else :win32-g++:isEmpty(QMAKE_SH) { - unixstyle = false -} else { - unixstyle = true -} - -$$unixstyle { - QDOC = cd $$PWD/doc && $$[QT_INSTALL_BINS]/qdoc3 -} else { - QDOC = cd $$PWD/doc && $$[QT_INSTALL_BINS]/qdoc3.exe - QDOC = $$replace(QDOC, "/", "\\") -} +qtPrepareTool(QDOC, qdoc3) docs.commands = $$QDOC qdoc-manual.qdocconf diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf index 3711ec4..167bb19 100644 --- a/tools/qdoc3/test/assistant.qdocconf +++ b/tools/qdoc3/test/assistant.qdocconf @@ -30,6 +30,7 @@ qhp.Assistant.extraFiles = images/bg_l.png \ images/page.png \ images/page_bg.png \ images/sprites-combined.png \ + images/spinner.gif \ images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ images/coloreditorfactoryimage.png \ diff --git a/tools/qdoc3/test/designer.qdocconf b/tools/qdoc3/test/designer.qdocconf index 39da68b..48e3ea1 100644 --- a/tools/qdoc3/test/designer.qdocconf +++ b/tools/qdoc3/test/designer.qdocconf @@ -30,6 +30,7 @@ qhp.Designer.extraFiles = images/bg_l.png \ images/page.png \ images/page_bg.png \ images/sprites-combined.png \ + images/spinner.gif \ images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ images/coloreditorfactoryimage.png \ diff --git a/tools/qdoc3/test/linguist.qdocconf b/tools/qdoc3/test/linguist.qdocconf index dba4fb5..8974bd7 100644 --- a/tools/qdoc3/test/linguist.qdocconf +++ b/tools/qdoc3/test/linguist.qdocconf @@ -30,6 +30,7 @@ qhp.Linguist.extraFiles = images/bg_l.png \ images/page.png \ images/page_bg.png \ images/sprites-combined.png \ + images/spinner.gif \ images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ images/coloreditorfactoryimage.png \ diff --git a/tools/qdoc3/test/qdeclarative.qdocconf b/tools/qdoc3/test/qdeclarative.qdocconf index f744879..0f2e381 100644 --- a/tools/qdoc3/test/qdeclarative.qdocconf +++ b/tools/qdoc3/test/qdeclarative.qdocconf @@ -41,6 +41,7 @@ qhp.Qml.extraFiles = images/bg_l.png \ images/page.png \ images/page_bg.png \ images/sprites-combined.png \ + images/spinner.png \ images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ images/coloreditorfactoryimage.png \ diff --git a/tools/qdoc3/test/qmake.qdocconf b/tools/qdoc3/test/qmake.qdocconf index b7f4115..ea58059 100644 --- a/tools/qdoc3/test/qmake.qdocconf +++ b/tools/qdoc3/test/qmake.qdocconf @@ -30,6 +30,7 @@ qhp.qmake.extraFiles = images/bg_l.png \ images/page.png \ images/page_bg.png \ images/sprites-combined.png \ + images/spinner.gif \ images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ images/coloreditorfactoryimage.png \ diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index d3c855f..bd363a6 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -36,6 +36,7 @@ qhp.Qt.extraFiles = index.html \ images/page.png \ images/page_bg.png \ images/sprites-combined.png \ + images/spinner.gif \ images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ images/coloreditorfactoryimage.png \ diff --git a/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf b/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf index e9bc00c..caf5f73 100644 --- a/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt-build-docs_zh_CN.qdocconf @@ -44,6 +44,7 @@ qhp.Qt.extraFiles = index.html \ images/page.png \ images/page_bg.png \ images/sprites-combined.png \ + images/spinner.gif \ images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ images/coloreditorfactoryimage.png \ diff --git a/tools/qdoc3/test/qt-defines.qdocconf b/tools/qdoc3/test/qt-defines.qdocconf index f3291df..3e71d07 100644 --- a/tools/qdoc3/test/qt-defines.qdocconf +++ b/tools/qdoc3/test/qt-defines.qdocconf @@ -34,6 +34,7 @@ extraimages.HTML = qt-logo \ page.png \ page_bg.png \ sprites-combined.png \ + spinner.gif \ taskmenuextension-example.png \ coloreditorfactoryimage.png \ dynamiclayouts-example.png \ diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index e83e666..b72a1eb 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -54,8 +54,6 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <li class=\"defaultLink\"><a href=\"qdeclarativeelements.html\">QML elements</a></li>\n" \ " </ul> \n" \ " </div>\n" \ - " <div id=\"live001\" class=\"live\">\n" \ - " </div>\n" \ " </div>\n" \ " <div class=\"box bottombar\" id=\"topics\">\n" \ " <h2><span></span>\n" \ @@ -68,8 +66,6 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <li class=\"defaultLink\"><a href=\"platform-specific.html\">Platform-specific info</a></li>\n" \ " </ul> \n" \ " </div>\n" \ - " <div id=\"live002\" class=\"live\">\n" \ - " </div>\n" \ " </div>\n" \ " <div class=\"box\" id=\"examples\">\n" \ " <h2><span></span>\n" \ @@ -83,8 +79,6 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <li class=\"defaultLink\"><a href=\"qdeclarativeexamples.html#Demos\">QML Demos</a></li>\n" \ " </ul> \n" \ " </div>\n" \ - " <div id=\"live003\" class=\"live\">\n" \ - " </div>\n" \ " </div>\n" \ " </div>\n" \ " <div class=\"wrap\">\n" \ @@ -109,7 +103,7 @@ HTML.postpostheader = " </ul>\n" \ " <div class=\"content\">\n" HTML.footer = " <!-- /div -->\n" \ - " <div class=\"feedback t_button\" onclick=\"\$(\'.bd\').hide();\$(\'.hd\').hide();\$(\'.footer\').hide();\$(\'#feedbackBox\').show();\$(\'#blurpage\').show()\">\n" \ + " <div class=\"feedback t_button\">\n" \ " [+] Documentation Feedback</div>\n" \ " </div>\n" \ " </div>\n" \ @@ -127,14 +121,10 @@ HTML.footer = " <!-- /div -->\n" \ " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy</a></p>\n" \ " </div>\n" \ " <div id=\"feedbackBox\">\n" \ - " <div id=\"feedcloseX\">\n" \ - " <a href=\"#\" onclick=\"\$(\'.bd\').show();\$(\'.hd\').show();\$(\'.footer\').show();\$(\'#feedbackBox\').hide();\$(\'#blurpage\').hide()\">X</a>\n" \ - " </div>\n" \ - " <form id=\"feedform\" action=\"feedback.php\" method=\"get\">\n" \ + " <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \ + " <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \ " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit you feedback...</textarea></p>\n" \ - " <input id=\"page\" name=\"pageVal\" value=\"\$(\'title\').html();\" style=\"display:none;\">\n" \ - " <p><input id=\"feedsubmit\" type=\"submit\" onclick=\"\$(\'.bd\').show();\$(\'.hd\').show();\$(\'.footer\').show();\$(\'#feedbackBox\').hide();\$(\'#blurpage\').hide()\"\n" \ - " name=\"feedback\" /></p>\n" \ + " <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \ " </form>\n" \ " </div>\n" \ " <div id=\"blurpage\">\n" \ diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index 83a35a9..267d536 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -40,6 +40,7 @@ qhp.Qt.extraFiles = index.html \ images/page.png \ images/page_bg.png \ images/sprites-combined.png \ + images/spinner.gif \ images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ images/coloreditorfactoryimage.png \ diff --git a/tools/qdoc3/test/qt_zh_CN.qdocconf b/tools/qdoc3/test/qt_zh_CN.qdocconf index 9275b5c..db02478 100644 --- a/tools/qdoc3/test/qt_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt_zh_CN.qdocconf @@ -46,6 +46,7 @@ qhp.Qt.extraFiles = index.html \ images/page.png \ images/page_bg.png \ images/sprites-combined.png \ + images/spinner.gif \ images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ images/coloreditorfactoryimage.png \ |