diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-09-15 13:29:48 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-09-15 13:29:48 (GMT) |
commit | 9d96ff055390cea8996b68dc4aef39512fbd9c96 (patch) | |
tree | 525c1afc933bba0f3f00bbcbfc560d10db439179 | |
parent | b13365187b58ecc2d259589ab523a7d0da84dc83 (diff) | |
parent | f42f5c457b3368adb4c92e521dc56969f138bdd3 (diff) | |
download | Qt-9d96ff055390cea8996b68dc4aef39512fbd9c96.zip Qt-9d96ff055390cea8996b68dc4aef39512fbd9c96.tar.gz Qt-9d96ff055390cea8996b68dc4aef39512fbd9c96.tar.bz2 |
Merge commit 'qt-mainline/4.6' into kinetic-declarativeui
34 files changed, 292 insertions, 163 deletions
diff --git a/doc/src/frameworks-technologies/gestures.qdoc b/doc/src/frameworks-technologies/gestures.qdoc index 57f25ba..a0eab21 100644 --- a/doc/src/frameworks-technologies/gestures.qdoc +++ b/doc/src/frameworks-technologies/gestures.qdoc @@ -58,21 +58,21 @@ \section1 Overview - QGesture is the central class in Qt's gesture framework, providing the API - used by classes that represent specific gestures, such as QPanGesture, - QPinchGesture, and QSwipeGesture. These standard classes are ready to use, - and each exposes functions and properties that give gesture-specific - information about the user's input. This is described in the - \l{#Using Standard Gestures}{Using Standard Gestures} section. - - QGesture is also designed to be subclassed and extended so that support for - new gestures can be implemented by developers. Adding support for a new - gesture involves implementing code to recognize the gesture from incoming - events. This is described in the - \l{#Creating Your Own Gesture Recognizer}{Creating Your Own Gesture Recognizer} - section. - - \section1 Using Standard Gestures with Widgets + QGesture is the central class in Qt's gesture framework, providing + the API used by classes that represent specific gestures, such as + QPanGesture, QPinchGesture, and QSwipeGesture. These standard + classes are ready to use, and each exposes functions and + properties that give gesture-specific information about the user's + input. This is described in the section \l{Using Standard Gestures + With Widgets}. + + QGesture is also designed to be subclassed and extended so that + support for new gestures can be implemented by developers. Adding + support for a new gesture involves implementing code to recognize + the gesture from incoming events. This is described in the section + \l{Creating Your Own Gesture Recognizer}. + + \section1 Using Standard Gestures With Widgets Gesture objects are applied directly to widgets and other controls that accept user input \mdash these are the \e{target objects}. When a gesture object is @@ -91,10 +91,11 @@ \snippet examples/gestures/imageviewer/imagewidget.cpp connect swipe gesture - Here, the \l{QGesture::}{triggered()} signal is used to inform the application - that a gesture was used. More precise monitoring of a gesture can be implemented - by connecting its \l{QGesture::}{started()}, \l{QGesture::}{canceled()} and - \l{QGesture::}{finished()} signals to slots. + Here, the \l{QGesture::} {triggered()} signal is used to inform + the application that a gesture was used. More precise monitoring + of a gesture can be implemented by connecting its \l{QGesture::} + {started()}, \l{QGesture::} {canceled()} and \l{QGesture::} + {finished()} signals to slots. Responding to a signal is simply a matter of obtaining the gesture that sent it and examining the information it contains. @@ -141,7 +142,7 @@ \table \header \o New State \o Description \o QGesture Actions on Entering this State - \row \o Qt::NoGesture \o Initial value \o emit \l {QGesture::}{cancelled()} + \row \o Qt::NoGesture \o Initial value \o emit \l {QGesture::}{canceled()} \row \o Qt::GestureStarted \o A continuous gesture has started \o emit \l{QGesture::}{started()} and emit \l{QGesture::}{triggered()} \row \o Qt::GestureUpdated \o A gesture continues \o emit \l{QGesture::}{triggered()} \row \o Qt::GestureFinished \o A gesture has finished. \o emit \l{QGesture::}{finished()} diff --git a/doc/src/snippets/audio/main.cpp b/doc/src/snippets/audio/main.cpp new file mode 100644 index 0000000..a215d43 --- /dev/null +++ b/doc/src/snippets/audio/main.cpp @@ -0,0 +1,109 @@ + +#include <QtGui> + +#include <QAudioOutput> +#include <QAudioDeviceInfo> +#include <QAudioInput> + +class Window2 : public QWidget +{ + Q_OBJECT + +public slots: +//![0] + void stateChanged(QAudio::State newState) + { + switch(newState) { + case QAudio::StopState: + if (input->error() != QAudio::NoError) { + // Error handling + } else { + + } + break; +//![0] + default: + ; + } + } + +private: + QAudioInput *input; + +}; + +class Window : public QWidget +{ + Q_OBJECT + +public: + Window() + { + output = new QAudioOutput; + connect(output, SIGNAL(stateChanged(QAudio::State)), + this, SLOT(stateChanged(QAudio::State))); + } + +private: + void setupFormat() + { +//![1] + QAudioFormat format; + format.setFrequency(44100); +//![1] + format.setChannels(2); + format.setSampleSize(16); + format.setCodec("audio/pcm"); + format.setByteOrder(QAudioFormat::LittleEndian); +//![2] + format.setSampleType(QAudioFormat::SignedInt); + + QAudioDeviceId id = QAudioDeviceInfo::defaultOutputDevice(); + QAudioDeviceInfo info(id); + + if (!info.isFormatSupported(format)) + format = info.nearestFormat(format); +//![2] + } + +public slots: +//![3] + void stateChanged(QAudio::State newState) + { + switch (newState) { + case QAudio::StopState: + if (output->error() != QAudio::NoError) { + // Do your error handlin + } else { + // Normal stop + } + break; +//![3] + + // Handle + case QAudio::ActiveState: + // Handle active state... + break; + break; + default: + ; + } + } + +private: + QAudioOutput *output; +}; + +int main(int argv, char **args) +{ + QApplication app(argv, args); + + Window window; + window.show(); + + return app.exec(); +} + + +#include "main.moc" + diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp index f5441a3..58cef4a 100644 --- a/src/corelib/tools/qmargins.cpp +++ b/src/corelib/tools/qmargins.cpp @@ -59,6 +59,8 @@ QT_BEGIN_NAMESPACE QMargin objects can be streamed as well as compared. + \sa qDrawBorderPixmap + */ diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 26489c5..ee87323 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -493,6 +493,12 @@ void QGraphicsGrayscaleEffect::setStrength(qreal strength) emit strengthChanged(strength); } +/*! \fn void QGraphicsGrayscaleEffect::strengthChanged(qreal strength) + This signal is emitted whenever setStrength() changes the grayscale + strength property. \a strength contains the new strength value of + the grayscale effect. + */ + /*! \reimp */ @@ -602,6 +608,12 @@ void QGraphicsColorizeEffect::setStrength(qreal strength) emit strengthChanged(strength); } +/*! \fn void QGraphicsColorizeEffect::strengthChanged(qreal strength) + This signal is emitted whenever setStrength() changes the colorize + strength property. \a strength contains the new strength value of + the colorize effect. + */ + /*! \fn void QGraphicsColorizeEffect::colorChanged(const QColor &color) @@ -782,6 +794,8 @@ void QGraphicsPixelizeEffect::draw(QPainter *painter, QGraphicsEffectSource *sou QGraphicsBlurEffect::QGraphicsBlurEffect(QObject *parent) : QGraphicsEffect(*new QGraphicsBlurEffectPrivate, parent) { + Q_D(QGraphicsBlurEffect); + d->filter->setQuality(Qt::SmoothTransformation); } /*! diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index f57f65f..5897ae4 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -257,9 +257,9 @@ void QGraphicsAnchorLayout::addCornerAnchors(QGraphicsLayoutItem *firstItem, } /*! - Anchors two or four edges of \a firstItem with the corresponding edges of \secondItem, - so that \a firstItem has the same size as \a secondItem in the dimensions specified by - \a orientation. + Anchors two or four edges of \a firstItem with the corresponding + edges of \a secondItem, so that \a firstItem has the same size as + \a secondItem in the dimensions specified by \a orientations. Calling this convenience function with the following arguments \code @@ -288,45 +288,6 @@ void QGraphicsAnchorLayout::addAnchors(QGraphicsLayoutItem *firstItem, } /*! - \fn QGraphicsAnchorLayout::addLeftAndRightAnchors(QGraphicsLayoutItem *firstItem, QGraphicsLayoutItem *secondItem) - - Anchors the left and right edges of \a firstItem to the same edges of - \a secondItem. - - This convenience function is equivalent to calling - \code - l->addAnchor(firstItem, Qt::AnchorLeft, secondItem, Qt::AnchorLeft); - l->addAnchor(firstItem, Qt::AnchorRight, secondItem, Qt::AnchorRight); - \endcode -*/ - -/*! - \fn QGraphicsAnchorLayout::addTopAndBottomAnchors(QGraphicsLayoutItem *firstItem, QGraphicsLayoutItem *secondItem) - - Anchors the top and bottom edges of \a firstItem to the same edges of - \a secondItem. - - This convenience function is equivalent to calling - \code - l->addAnchor(firstItem, Qt::AnchorTop, secondItem, Qt::AnchorTop); - l->addAnchor(firstItem, Qt::AnchorBottom, secondItem, Qt::AnchorBottom); - \endcode -*/ - -/*! - \fn QGraphicsAnchorLayout::addAllAnchors(QGraphicsLayoutItem *firstItem, QGraphicsLayoutItem *secondItem) - - Anchors all edges (left, right, top and bottom) of \a firstItem to the same edges of - \a secondItem. - - This convenience function is equivalent to calling - \code - l->addLeftAndRightAnchors(firstItem, secondItem); - l->addTopAndBottomAnchors(firstItem, secondItem); - \endcode -*/ - -/*! Sets the default horizontal spacing for the anchor layout to \a spacing. \sa horizontalSpacing(), setVerticalSpacing(), setSpacing() diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 838bd34..81eeb39 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -2830,6 +2830,8 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim if (climb) { while (f->d_ptr->focusScopeItem && f->d_ptr->focusScopeItem->isVisible()) f = f->d_ptr->focusScopeItem; + if (f != q_ptr) + f->d_ptr->setSubFocus(); } // Update the scene's focus item. @@ -4979,7 +4981,7 @@ void QGraphicsItemPrivate::clearSubFocus(QGraphicsItem *rootItem) if (parent->d_ptr->subFocusItem != q_ptr) break; parent->d_ptr->subFocusItem = 0; - subFocusItemChange(); + parent->d_ptr->subFocusItemChange(); } while (!parent->isPanel() && (parent = parent->d_ptr->parent)); } diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index bc0f30f..665f33f 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -551,7 +551,6 @@ Q_SIGNALS: void zChanged(); void rotationChanged(); void scaleChanged(); - void focusChanged(); protected: QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene); diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 5cd768f..aff186b 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -696,13 +696,12 @@ bool QImageReader::autoDetectImageFormat() const /*! - Specifies that the image reader should decide which plugin to use solely based on the contents in the datastream. Setting this flag means that all image plugins gets loaded. Each plugin will read the first bytes in the image data and decide if - the plugin is compatible or not. + the plugin is compatible or not. The flag is set to \a ignored. This also disables auto detecting image format. */ diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 2530f38..aec757f 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -145,7 +145,7 @@ static int qtkeyForMacSymbol(const QChar ch) #else static bool qt_sequence_no_mnemonics = false; #endif -void Q_AUTOTEST_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemonics = !b; } +void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemonics = !b; } /*! \class QKeySequence diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp index 17cf196..7be8e04 100644 --- a/src/gui/painting/qdrawutil.cpp +++ b/src/gui/painting/qdrawutil.cpp @@ -1044,7 +1044,7 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs, Holds the rules used to draw a pixmap or image split into nine segments, similar to \l{http://www.w3.org/TR/css3-background/}{CSS3 border-images}. - \sa Qt::TileRule, QMargins + \sa Qt::TileRule, QMargins, qDrawBorderPixmap */ /*! \fn QTileRules::QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule) @@ -1060,7 +1060,7 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs, /*! \fn void qDrawBorderPixmap(QPainter *painter, const QRect &target, const QMargins &margins, const QPixmap &pixmap) \since 4.6 - \relates QMargins + \relates QPainter Draws the given \a pixmap into the given \a target rectangle, using the given \a painter. The pixmap will be split into nine segments and drawn @@ -1156,6 +1156,8 @@ static inline void qDrawHorizontallyRoundedPixmap(QPainter *painter, const QRect /*! \since 4.6 + \relates QPainter + Draws the indicated \a sourceRect rectangle from the given \a pixmap into the given \a targetRect rectangle, using the given \a painter. The pixmap will be split into nine segments according to the given \a targetMargins diff --git a/src/gui/painting/qdrawutil.h b/src/gui/painting/qdrawutil.h index ce89e22..3a2dd0e 100644 --- a/src/gui/painting/qdrawutil.h +++ b/src/gui/painting/qdrawutil.h @@ -135,7 +135,7 @@ Q_GUI_EXPORT QT3_SUPPORT void qDrawArrow(QPainter *p, Qt::ArrowType type, Qt::GU struct QTileRules { - inline QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule = Qt::Stretch) + inline QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule) : horizontal(horizontalRule), vertical(verticalRule) {} inline QTileRules(Qt::TileRule rule = Qt::Stretch) : horizontal(rule), vertical(rule) {} diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index a55ca8e..37e57cf 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -2047,7 +2047,11 @@ void QLineEdit::changeEvent(QEvent *ev) d->control->setFont(font()); break; case QEvent::StyleChange: - d->control->setPasswordCharacter(style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter)); + { + QStyleOptionFrameV2 opt; + initStyleOption(&opt); + d->control->setPasswordCharacter(style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, this)); + } update(); break; case QEvent::LayoutDirectionChange: diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp index 4fe02a2..148da1b 100644 --- a/src/gui/widgets/qlineedit_p.cpp +++ b/src/gui/widgets/qlineedit_p.cpp @@ -159,7 +159,10 @@ void QLineEditPrivate::init(const QString& txt) QObject::connect(control, SIGNAL(updateNeeded(const QRect &)), q, SLOT(update())); - control->setPasswordCharacter(q->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter)); + + QStyleOptionFrameV2 opt; + q->initStyleOption(&opt); + control->setPasswordCharacter(q->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, q)); #ifndef QT_NO_CURSOR q->setCursor(Qt::IBeamCursor); #endif diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp index e349733..e38a91e 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo.cpp @@ -71,7 +71,11 @@ QT_BEGIN_NAMESPACE audio plugins installed and the audio device capabilities. If you need a specific format, you can check if the device supports it with isFormatSupported(), or fetch a supported format that is as close as possible to the format with - nearestFormat(). + nearestFormat(). For instance: + + \snippet doc/src/snippets/audio/main.cpp 1 + \dots 8 + \snippet doc/src/snippets/audio/main.cpp 2 A QAudioDeviceInfo is constructed with a QAudioDeviceId, which is an identifier for a physical device. It is used by Qt to construct diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp index ddfcc2c..c23e454 100644 --- a/src/multimedia/audio/qaudioformat.cpp +++ b/src/multimedia/audio/qaudioformat.cpp @@ -134,7 +134,8 @@ public: through functions in QAudioDeviceInfo. This class also lets you query available parameter values for a device, so that you can set the parameters yourself. See the QAudioDeviceInfo class - description for details. + description for details. You need to know the format of the audio + streams you wish to play. Qt does not set up formats for you. */ /*! diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp index edf6dd6..3c0d98e 100644 --- a/src/multimedia/audio/qaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput.cpp @@ -128,7 +128,12 @@ QT_BEGIN_NAMESPACE which states the QAudioInput has been in. If an error should occur, you can fetch its reason with error(). - The possible error reasons are described by the QAudio::Error enum. + The possible error reasons are described by the QAudio::Error + enum. The QAudioInput will enter the \l{QAudio::}{StopState} when + an error is encountered. Connect to the stateChanged() signal to + handle the error: + + \snippet doc/src/snippets/audio/main.cpp 0 \sa QAudioOutput, QAudioDeviceInfo */ diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp index 556b616..8a8edb4 100644 --- a/src/multimedia/audio/qaudiooutput.cpp +++ b/src/multimedia/audio/qaudiooutput.cpp @@ -129,9 +129,12 @@ QT_BEGIN_NAMESPACE If an error occurs, you can fetch the \l{QAudio::Error}{error type} with the error() function. Please see the QAudio::Error enum - for a description of the possible errors that are reported. + for a description of the possible errors that are reported. When + an error is encountered, the state changes to QAudio::StopState. + You can check for errors by connecting to the stateChanged() + signal: - If an error is encountered state changes to QAudio::StopState. + \snippet doc/src/snippets/audio/main.cpp 3 \sa QAudioInput, QAudioDeviceInfo */ diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp index 9e2b0e4..2c7e250 100644 --- a/src/network/kernel/qnetworkproxy_mac.cpp +++ b/src/network/kernel/qnetworkproxy_mac.cpp @@ -170,8 +170,7 @@ QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query) (CFStringRef)CFDictionaryGetValue(dict, kSCPropNetProxiesProxyAutoConfigURLString); QString url = QCFString::toQString(pacUrl); - // ### Use PAC somehow - qDebug("Mac system proxy: found PAC script at \"%s\"", qPrintable(url)); + // ### TODO: Use PAC somehow } } diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index 3478130..63fe78e 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -917,9 +917,15 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxL int wsaRet = ::WSARecvFrom(socketDescriptor, &buf, 1, &bytesRead, &flags, &aa.a, &sz,0,0); if (wsaRet == SOCKET_ERROR) { int err = WSAGetLastError(); - WS_ERROR_DEBUG(err); - setError(QAbstractSocket::NetworkError, ReceiveDatagramErrorString); - ret = -1; + if (err == WSAEMSGSIZE) { + // it is ok the buffer was to small if bytesRead is larger than + // maxLength then assume bytes read is really maxLenth + ret = qint64(bytesRead) > maxLength ? maxLength : qint64(bytesRead); + } else { + WS_ERROR_DEBUG(err); + setError(QAbstractSocket::NetworkError, ReceiveDatagramErrorString); + ret = -1; + } } else { ret = qint64(bytesRead); } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 5e790cf..e41d0b4 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1385,6 +1385,7 @@ void QGL2PaintEngineEx::ensureActive() d->device->ensureActiveTarget(); if (d->needsSync) { + d->transferMode(BrushDrawingMode); glViewport(0, 0, d->width, d->height); glDepthMask(false); glDepthFunc(GL_LESS); diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 6ebc397..7876661 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -68,17 +68,16 @@ void QGLPixmapFilterBase::drawImpl(QPainter *painter, const QPointF &pos, const processGL(painter, pos, src, source); } -class QGLPixmapColorizeFilter: public QGLPixmapFilter<QPixmapColorizeFilter> +class QGLPixmapColorizeFilter: public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapColorizeFilter> { public: - QGLPixmapColorizeFilter(); + void setUniforms(QGLShaderProgram *program); protected: bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &pixmap, const QRectF &srcRect) const; private: - mutable QGLShaderProgram m_program; - int m_colorUniform; + mutable QGLShader *m_shader; }; class QGLPixmapConvolutionFilter: public QGLPixmapFilter<QPixmapConvolutionFilter> @@ -104,9 +103,6 @@ private: class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter<QPixmapBlurFilter> { public: - QGLPixmapBlurFilter(); - ~QGLPixmapBlurFilter(); - void setUniforms(QGLShaderProgram *program); protected: @@ -120,8 +116,6 @@ private: mutable QSize m_textureSize; mutable bool m_horizontalBlur; - - QGLShaderProgram *m_program; }; extern QGLWidget *qt_gl_share_widget(); @@ -183,41 +177,34 @@ static void qgl_drawTexture(const QRectF &rect, int tx_width, int tx_height, con } static const char *qt_gl_colorize_filter = - "uniform sampler2D texture;" - "uniform vec3 color;" - "void main(void)" + "uniform lowp vec4 colorizeColor;" + "uniform lowp float colorizeStrength;" + "lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords)" "{" - " vec2 coords = gl_TexCoord[0].st;" - " vec4 src = texture2D(texture, coords);" - " float gray = dot(src.rgb, vec3(0.212671, 0.715160, 0.072169));" - " vec3 colorizeed = 1.0-((1.0-gray)*(1.0-color));" - " gl_FragColor = vec4(colorizeed, src.a);" + " lowp vec4 srcPixel = texture2D(src, srcCoords);" + " lowp float gray = dot(srcPixel.rgb, vec3(0.212671, 0.715160, 0.072169));" + " lowp vec3 colorized = 1.0-((1.0-gray)*(1.0-colorizeColor.rgb));" + " return vec4(mix(srcPixel.rgb, colorized * srcPixel.a, colorizeStrength), srcPixel.a);" "}"; -QGLPixmapColorizeFilter::QGLPixmapColorizeFilter() +bool QGLPixmapColorizeFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const { - m_program.addShader(QGLShader::FragmentShader, qt_gl_colorize_filter); - m_program.link(); - m_program.enable(); - m_program.setUniformValue(m_program.uniformLocation("texture"), GLint(0)); // GL_TEXTURE_0 - m_colorUniform = m_program.uniformLocation("color"); -} + QGLPixmapColorizeFilter *filter = const_cast<QGLPixmapColorizeFilter *>(this); + filter->setSource(qt_gl_colorize_filter); -bool QGLPixmapColorizeFilter::processGL(QPainter *, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const -{ - bindTexture(src); - - QColor col = color(); - m_program.enable(); - m_program.setUniformValue(m_colorUniform, col.redF(), col.greenF(), col.blueF()); - - QRectF target = (srcRect.isNull() ? QRectF(src.rect()) : srcRect).translated(pos); - qgl_drawTexture(target, src.width(), src.height(), srcRect); - m_program.disable(); + filter->setOnPainter(painter); + painter->drawPixmap(pos, src); + filter->removeFromPainter(painter); return true; } +void QGLPixmapColorizeFilter::setUniforms(QGLShaderProgram *program) +{ + program->setUniformValue("colorizeColor", color()); + program->setUniformValue("colorizeStrength", float(strength())); +} + // generates convolution filter code for arbitrary sized kernel QByteArray QGLPixmapConvolutionFilter::generateConvolutionShader() const { QByteArray code; @@ -310,14 +297,6 @@ bool QGLPixmapConvolutionFilter::processGL(QPainter *, const QPointF &pos, const return true; } -QGLPixmapBlurFilter::QGLPixmapBlurFilter() -{ -} - -QGLPixmapBlurFilter::~QGLPixmapBlurFilter() -{ -} - bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const { QGLPixmapBlurFilter *filter = const_cast<QGLPixmapBlurFilter *>(this); @@ -384,8 +363,6 @@ void QGLPixmapBlurFilter::setUniforms(QGLShaderProgram *program) program->setUniformValue("delta", 1.0, 0.0); else program->setUniformValue("delta", 0.0, 1.0); - - m_program = program; } static inline qreal gaussian(qreal dx, qreal sigma) diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index ff00f29..bd3883a 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -5625,20 +5625,6 @@ void QOpenGLPaintEnginePrivate::ensureDrawableTexture() #endif } -QPixmapFilter *QOpenGLPaintEngine::createPixmapFilter(int type) const -{ -#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) - if (QGLContext::currentContext()) - return QGLContext::currentContext()->d_func()->createPixmapFilter(type); - else - return 0; -#else - Q_UNUSED(type); - return 0; -#endif -} - - QT_END_NAMESPACE #include "qpaintengine_opengl.moc" diff --git a/src/opengl/qpaintengine_opengl_p.h b/src/opengl/qpaintengine_opengl_p.h index c8f460a..4fea638 100644 --- a/src/opengl/qpaintengine_opengl_p.h +++ b/src/opengl/qpaintengine_opengl_p.h @@ -136,8 +136,6 @@ public: void drawEllipse(const QRectF &rect); - QPixmapFilter *createPixmapFilter(int type) const; - #ifdef Q_WS_WIN HDC handle() const; #else diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 0bc46e1..d5398a9 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -149,6 +149,7 @@ void QGLPixmapGLPaintDevice::beginPaint() if (data->needsFill()) { const QColor &c = data->fillColor(); float alpha = c.alphaF(); + glDisable(GL_SCISSOR_TEST); glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha); glClear(GL_COLOR_BUFFER_BIT); } @@ -157,8 +158,21 @@ void QGLPixmapGLPaintDevice::beginPaint() // uploaded from an image or rendered into before), we need to // copy it from the texture to the render FBO. + glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + glDisable(GL_BLEND); + + glMatrixMode(GL_MODELVIEW_MATRIX); + glLoadIdentity(); + + glMatrixMode(GL_PROJECTION_MATRIX); + glLoadIdentity(); + glOrtho(0, data->width(), data->height(), 0, -999999, 999999); + + glViewport(0, 0, data->width(), data->height()); + // Pass false to bind so it doesn't copy the FBO into the texture! - context()->drawTexture(QPointF(0.0, 0.0), data->bind(false)); + context()->drawTexture(QRect(0, 0, data->width(), data->height()), data->bind(false)); } } diff --git a/src/svg/qgraphicssvgitem.cpp b/src/svg/qgraphicssvgitem.cpp index ea26c78..bcdd821 100644 --- a/src/svg/qgraphicssvgitem.cpp +++ b/src/svg/qgraphicssvgitem.cpp @@ -265,6 +265,12 @@ int QGraphicsSvgItem::type() const return Type; } +/*! + \property QGraphicsSvgItem::maximumCacheSize + + This property holds the maximum size of the device coordinate cache + for this item. + */ /*! Sets the maximum device coordinate cache size of the item to \a size. @@ -305,8 +311,13 @@ QSize QGraphicsSvgItem::maximumCacheSize() const } /*! - Sets the XML ID of the element that this item should render to \a - id. + \property QGraphicsSvgItem::elementId + + This property holds the element's XML ID. + */ + +/*! + Sets the XML ID of the element to \a id. */ void QGraphicsSvgItem::setElementId(const QString &id) { @@ -318,7 +329,7 @@ void QGraphicsSvgItem::setElementId(const QString &id) /*! Returns the XML ID the element that is currently - being renderer. Returns an empty string if the whole + being rendered. Returns an empty string if the whole file is being rendered. */ QString QGraphicsSvgItem::elementId() const diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result index f2d109b..d3a5fdf 100644 --- a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result @@ -4,7 +4,7 @@ <context> <name>QApplication</name> <message> - <location filename="../src/main.cpp" line="10"/> + <location filename="../src/main.cpp" line="51"/> <source>QT_LAYOUT_DIRECTION</source> <comment>Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout.</comment> <translation type="unfinished"></translation> diff --git a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result index 93adae4..b27d239 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parseui/project.ts.result @@ -4,12 +4,12 @@ <context> <name>FindDialog</name> <message> - <location filename="project.ui" line="48"/> + <location filename="project.ui" line="55"/> <source>Qt Assistant - Finn text</source> <translation type="unfinished"></translation> </message> <message utf8="true"> - <location filename="project.ui" line="51"/> + <location filename="project.ui" line="58"/> <source>Finn tekst - Der Bjørn möchte auch mal.</source> <translation type="unfinished"></translation> </message> diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index d5205cd..ba3783b 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -41,6 +41,7 @@ #include <QtTest/QtTest> +#include <QtGui/qdesktopwidget.h> #include <QtGui/qgraphicseffect.h> #include <QtGui/qgraphicsview.h> #include <QtGui/qgraphicsscene.h> @@ -369,6 +370,11 @@ void tst_QGraphicsEffect::opacity() void tst_QGraphicsEffect::grayscale() { + if (qApp->desktop()->depth() < 24) { + QSKIP("Test only works on 32 bit displays", SkipAll); + return; + } + QGraphicsScene scene(0, 0, 100, 100); QGraphicsRectItem *item = scene.addRect(0, 0, 50, 50); @@ -412,6 +418,11 @@ void tst_QGraphicsEffect::grayscale() void tst_QGraphicsEffect::colorize() { + if (qApp->desktop()->depth() < 24) { + QSKIP("Test only works on 32 bit displays", SkipAll); + return; + } + QGraphicsScene scene(0, 0, 100, 100); QGraphicsRectItem *item = scene.addRect(0, 0, 50, 50); diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 0744fa5..304330e 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -8332,6 +8332,22 @@ void tst_QGraphicsItem::focusScope() rect4->setParentItem(0); QCOMPARE(scope3->focusScopeItem(), (QGraphicsItem *)0); QVERIFY(!scope3->hasFocus()); + + QGraphicsRectItem *rectA = new QGraphicsRectItem; + QGraphicsRectItem *scopeA = new QGraphicsRectItem(rectA); + scopeA->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsFocusScope); + scopeA->setFocus(); + QGraphicsRectItem *scopeB = new QGraphicsRectItem(scopeA); + scopeB->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsFocusScope); + scopeB->setFocus(); + + scene.addItem(rectA); + QVERIFY(rect5->hasFocus()); + QVERIFY(!scopeB->hasFocus()); + + scopeA->setFocus(); + QVERIFY(scopeB->hasFocus()); + QCOMPARE(scopeB->focusItem(), (QGraphicsItem *)scopeB); } QTEST_MAIN(tst_QGraphicsItem) diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 626a691..c86d9e3 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -1507,7 +1507,7 @@ void tst_QGraphicsProxyWidget::scrollUpdate() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&view); #endif - QTRY_COMPARE(view.npaints, 1); + QTRY_VERIFY(view.npaints >= 1); QTest::qWait(20); widget->paintEventRegion = QRegion(); widget->npaints = 0; diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index ad814fd..04b7b39 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -9236,13 +9236,15 @@ void tst_QWidget::destroyBackingStore() w.reset(); w.update(); - QApplication::processEvents(); delete qt_widget_private(&w)->topData()->backingStore; qt_widget_private(&w)->topData()->backingStore = 0; qt_widget_private(&w)->topData()->backingStore = new QWidgetBackingStore(&w); w.update(); QApplication::processEvents(); +#ifdef Q_WS_QWS + QApplication::processEvents(); +#endif QCOMPARE(w.numPaintEvents, 1); // Check one more time, because the second time around does more caching. diff --git a/tests/auto/uic/tst_uic.cpp b/tests/auto/uic/tst_uic.cpp index c4759e2..60367b9 100644 --- a/tests/auto/uic/tst_uic.cpp +++ b/tests/auto/uic/tst_uic.cpp @@ -55,16 +55,16 @@ class tst_uic : public QObject public: tst_uic(); - + private Q_SLOTS: void initTestCase(); - + void run(); void run_data() const; void compare(); void compare_data() const; - + void cleanupTestCase(); private: @@ -105,8 +105,8 @@ void tst_uic::initTestCase() qDebug() << msg; process.terminate(); - QCOMPARE(QFileInfo(QLatin1String("baseline")).exists(), true); - QCOMPARE(QFileInfo(QLatin1String("generated_ui")).exists(), true); + QCOMPARE(QFileInfo(QLatin1String(SRCDIR "baseline")).exists(), true); + QCOMPARE(QFileInfo(QLatin1String(SRCDIR "generated_ui")).exists(), true); } void tst_uic::run() @@ -163,23 +163,23 @@ void tst_uic::compare() QFile genFile(generatedFile); if (!orgFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - QString err(QLatin1String("Could not read file: %1...")); + QString err(QLatin1String("Could not read file: %1...")); QFAIL(err.arg(orgFile.fileName()).toUtf8()); } if (!genFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - QString err(QLatin1String("Could not read file: %1...")); + QString err(QLatin1String("Could not read file: %1...")); QFAIL(err.arg(genFile.fileName()).toUtf8()); } originalFile = orgFile.readAll(); originalFile.replace(QRegExp(QLatin1String("Created:.{0,25}[\\d]{4,4}")), ""); originalFile.replace(QRegExp(QLatin1String("by: Qt User Interface Compiler version [.\\d]{5,5}")), ""); - + generatedFile = genFile.readAll(); generatedFile.replace(QRegExp(QLatin1String("Created:.{0,25}[\\d]{4,4}")), ""); generatedFile.replace(QRegExp(QLatin1String("by: Qt User Interface Compiler version [.\\d]{5,5}")), ""); - + QCOMPARE(generatedFile, originalFile); } diff --git a/tests/auto/uic/uic.pro b/tests/auto/uic/uic.pro index 411a993..355cb56 100644 --- a/tests/auto/uic/uic.pro +++ b/tests/auto/uic/uic.pro @@ -5,4 +5,4 @@ SOURCES += tst_uic.cpp TARGET = tst_uic # This test is not run on wince (I think) -DEFINES += SRCDIR=\\\"$$PWD\\\" +DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tools/linguist/lupdate/java.cpp b/tools/linguist/lupdate/java.cpp index 05b1987..3f532d5 100644 --- a/tools/linguist/lupdate/java.cpp +++ b/tools/linguist/lupdate/java.cpp @@ -631,7 +631,6 @@ bool loadJava(Translator &translator, const QString &filename, ConversionData &c yyFileName = filename; yyCurLineNo = 1; yyParenLineNo = 1; - yyCh = getChar(); parse(&translator); |