diff options
author | Keith Isdale <keith.isdale@nokia.com> | 2009-08-10 07:36:49 (GMT) |
---|---|---|
committer | Keith Isdale <keith.isdale@nokia.com> | 2009-08-10 07:36:49 (GMT) |
commit | 4942e2834c1da00bfceec6430ce351888efc1976 (patch) | |
tree | 944be213e12faa16fb260f5dec4f97d5fcc7c5fc | |
parent | 6cc14b9bd84de30471db40f73b119ba33356a6ba (diff) | |
parent | 5d01d0cde28f2ac1ff9b5d8ca731edcf38725051 (diff) | |
download | Qt-4942e2834c1da00bfceec6430ce351888efc1976.zip Qt-4942e2834c1da00bfceec6430ce351888efc1976.tar.gz Qt-4942e2834c1da00bfceec6430ce351888efc1976.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
246 files changed, 3236 insertions, 1378 deletions
diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml index 1b0b533..6c8ddb0 100644 --- a/demos/qtdemo/xml/examples.xml +++ b/demos/qtdemo/xml/examples.xml @@ -183,6 +183,7 @@ </category> <category dirname="statemachine" name="State Machine"> <example filename="eventtransitions" name="Event Transitions" /> + <example filename="rogue" name="Rogue" /> <example filename="tankgame" name="Tank Game" /> <example filename="trafficlight" name="Traffic Light" /> <example filename="twowaybutton" name="Two-way Button" /> diff --git a/doc/src/examples.qdoc b/doc/src/examples.qdoc index 74a9bd8..7f9264b 100644 --- a/doc/src/examples.qdoc +++ b/doc/src/examples.qdoc @@ -330,6 +330,7 @@ \o \l{statemachine/eventtransitions}{Event Transitions}\raisedaster \o \l{statemachine/factorial}{Factorial States}\raisedaster \o \l{statemachine/pingpong}{Ping Pong States}\raisedaster + \o \l{statemachine/rogue}{Rogue}\raisedaster \o \l{statemachine/trafficlight}{Traffic Light}\raisedaster \o \l{statemachine/twowaybutton}{Two-way Button}\raisedaster \endlist diff --git a/doc/src/examples/rogue.qdoc b/doc/src/examples/rogue.qdoc new file mode 100644 index 0000000..8fa2c69 --- /dev/null +++ b/doc/src/examples/rogue.qdoc @@ -0,0 +1,222 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example statemachine/rogue + \title Rogue Example + + The Rogue example shows how to use the Qt state machine for event + handling. + + \image rogue-example.png + + This example implements a simple text based game. Do you see the + \c{@} in the screenshot? That's you, the rogue. The \c{#} + characters are walls, and the dots represent floor. In a real + game, other ASCII characters would represent all kinds of objects + and creatures. For instance, ancient dragons (\c{D}'s) or food + rations (\c{%}'s). But let's not get carried away. In this game, + the rogue is simply running around in an empty room. + + The rogue is moved with the keypad (2, 4, 8, 6). That aside, we + have implemented a \c quit command that triggers if the player + types \c {q}. The player is then asked if he/she really wants to + quit. + + Most games have commands that need more than one key press and + that may require a different sequence of keys based on questions + asked the user. In this game, only the \c quit command falls under + this category, but for the sake of argument, let's imagine a + fully-fledged game with a rich set of commands. If we were to + implement these by catching key events in + \l{QWidget::}{keyPressEvent()}, we would have to keep a lot of + class member variables to track the sequence of keys already typed + (or find some other way of deducing the current state of a + command). This can easily lead to spaghetti, which is--as we all + well know, I'm sure--unpleasant. With a state machine, on the + other hand, separate states can wait for a single key press, and + that makes our lives a lot simpler. + + The example consists of two classes: + + \list + \o \c Window draws the text display of the game and sets + up the state machine. The window also has a status bar + above the area in which the rouge moves. + \o \c MovementTransition is a transition that carries out + a single move of the rogue. + \endlist + + Before we embark on a code walkthrough, it is necessary to take a + closer look at the design of the machine. Here is a state chart + that shows what we want to achieve: + + \image rogue-statechart.png + + The input state waits for a key press to start a new command. + When receiving a key it recognizes, it transitions to one of the + two commands of the game; though, as we will see, movement is + handled by the transition itself. The quit state waits for the + player to answer yes or no (by typing \c y or \c n) when asked + whether he/she really wants to quit the game. + + The chart demonstrates how we use one state to wait for a single + key press. The press received may trigger one of the transitions + connected to the state. + + \section1 Window Class Definition + + The \c Window class is a widget that draws the text display of the + game. It also sets up the state machine, i.e., creates and + connects the states in the machine. It is the key events from this + widget that are used by the machine. + + \snippet examples/statemachine/rogue/window.h 0 + + \c Direction specifies the direction in which the rogue is to + move. We use this in \c movePlayer(), which moves the rogue and + repaints the window. The game has a status line above the area in + which the rogue moves. The \c status property contains the text of + this line. We use a property because the QState class allows + setting any Qt \l{Qt's Property System}{property} when entered. + More on this later. + + \snippet examples/statemachine/rogue/window.h 1 + + The \c map is an array with the characters that are currently + displayed. We set up the array in \c setupMap(), and update it + when the rogue is moved. \c pX and \c pY is the current position + of the rogue. \c WIDTH and \c HEIGHT are macros specifying the + dimensions of the map. + + The \c paintEvent() function is left out of this walkthrough. We + also do not discuss other code that does not concern the state + machine (the \c setupMap(), \c status(), \c setStatus(), \c + movePlayer(), and \c sizeHint() functions). If you wish to take a + look at the code, click on the link for the \c window.cpp file at + the top of this page. + + \section1 Window Class Implementation + + Here is the constructor of \c Window: + + \snippet examples/statemachine/rogue/window.cpp 0 + \dots + \snippet examples/statemachine/rogue/window.cpp 1 + + The player starts off at position (5, 5). We then set up the map + and statemachine. Let's proceed with the \c buildMachine() + function: + + \snippet examples/statemachine/rogue/window.cpp 2 + + We enter \c inputState when the machine is started and from the \c + quitState if the user wants to continue playing. We then set the + status to a helpful reminder of how to play the game. + + First, the \c Movement transition is added to the input state. + This will enable the rogue to be moved with the keypad. Notice + that we don't set a target state for the movement transition. This + will cause the transition to be triggered (and the + \l{QAbstractTransition::}{onTransition()} function to be invoked), + but the machine will not leave the \c inputState. If we had set \c + inputState as the target state, we would first have left and then + entered the \c inputState again. + + \snippet examples/statemachine/rogue/window.cpp 3 + + When we enter \c quitState, we update the status bar of the + window. + + \c QKeyEventTransition is a utility class that removes the hassle + of implementing transitions for \l{QKeyEvent}s. We simply need to + specify the key on which the transition should trigger and the + target state of the transition. + + \snippet examples/statemachine/rogue/window.cpp 4 + + The transition from \c inputState allows triggering the quit state + when the player types \c {q}. + + \snippet examples/statemachine/rogue/window.cpp 5 + + The machine is set up, so it's time to start it. + + \section1 The MovementTransition Class + + \c MovementTransition is triggered when the player request the + rogue to be moved (by typing 2, 4, 6, or 8) when the machine is in + the \c inputState. + + \snippet examples/statemachine/rogue/movementtransition.h 0 + + In the constructor, we tell QEventTransition to only send + \l{QEvent::}{KeyPress} events to the + \l{QAbstractTransition::}{eventTest()} function: + + \snippet examples/statemachine/rogue/movementtransition.h 1 + + The KeyPress events come wrapped in \l{QWrappedEvent}s. \c event + must be confirmed to be a wrapped event because Qt uses other + events internally. After that, it is simply a matter of checking + which key has been pressed. + + Let's move on to the \c onTransition() function: + + \snippet examples/statemachine/rogue/movementtransition.h 2 + + When \c onTransition() is invoked, we know that we have a + \l{QEvent::}{KeyPress} event with 2, 4, 6, or 8, i.e., the event + is already unwrapped. + + \section1 The Roguelike Tradition + + You might have been wondering why the game features a rogue. Well, + these kinds of text based dungeon exploration games date back to a + game called, yes, "Rogue". Although outflanked by the technology + of modern 3D computer games, roguelikes have a solid community of + hard-core, devoted followers. + + Playing these games can be surprisingly addictive (despite the + lack of graphics). Angband, the perhaps most well-known rougelike, + is found here: \l{http://rephial.org/}. +*/ + diff --git a/doc/src/images/rogue-example.png b/doc/src/images/rogue-example.png Binary files differnew file mode 100644 index 0000000..7aeb0e5 --- /dev/null +++ b/doc/src/images/rogue-example.png diff --git a/doc/src/images/rogue-statechart.png b/doc/src/images/rogue-statechart.png Binary files differnew file mode 100644 index 0000000..c5f4048 --- /dev/null +++ b/doc/src/images/rogue-statechart.png diff --git a/examples/gestures/imageviewer/imagewidget.cpp b/examples/gestures/imageviewer/imagewidget.cpp index 99889ed..c0d1e2d 100644 --- a/examples/gestures/imageviewer/imagewidget.cpp +++ b/examples/gestures/imageviewer/imagewidget.cpp @@ -67,6 +67,7 @@ ImageWidget::ImageWidget(QWidget *parent) tapAndHoldGesture = new TapAndHoldGesture(this); connect(tapAndHoldGesture, SIGNAL(triggered()), this, SLOT(gestureTriggered())); + connect(tapAndHoldGesture, SIGNAL(finished()), this, SLOT(gestureTriggered())); } void ImageWidget::paintEvent(QPaintEvent*) @@ -112,7 +113,7 @@ void ImageWidget::paintEvent(QPaintEvent*) touchFeedback.position + QPoint(-10, 10), touchFeedback.position + QPoint(-15, 0) }; - for (int i = 0; i < (touchFeedback.tapAndHoldState-20)/10; ++i) + for (int i = 0; i < touchFeedback.tapAndHoldState/5; ++i) p.drawEllipse(pts[i], 3, 3); } } else if (touchFeedback.sliding) { @@ -156,10 +157,9 @@ void ImageWidget::mouseDoubleClickEvent(QMouseEvent *event) void ImageWidget::gestureTriggered() { - touchFeedback.tapped = false; - touchFeedback.doubleTapped = false; - if (sender() == panGesture) { + touchFeedback.tapped = false; + touchFeedback.doubleTapped = false; QPanGesture *pg = qobject_cast<QPanGesture*>(sender()); if (zoomedIn) { #ifndef QT_NO_CURSOR @@ -174,7 +174,6 @@ void ImageWidget::gestureTriggered() #endif horizontalOffset += pg->lastOffset().width(); verticalOffset += pg->lastOffset().height(); - update(); } else { // only slide gesture should be accepted if (pg->state() == Qt::GestureFinished) { @@ -187,6 +186,7 @@ void ImageWidget::gestureTriggered() updateImage(); } } + update(); feedbackFadeOutTimer.start(500, this); } else if (sender() == tapAndHoldGesture) { if (tapAndHoldGesture->state() == Qt::GestureFinished) { @@ -199,6 +199,9 @@ void ImageWidget::gestureTriggered() menu.addAction("Action 2"); menu.addAction("Action 3"); menu.exec(mapToGlobal(tapAndHoldGesture->pos())); + } else { + ++touchFeedback.tapAndHoldState; + update(); } feedbackFadeOutTimer.start(500, this); } diff --git a/examples/gestures/imageviewer/tapandholdgesture.cpp b/examples/gestures/imageviewer/tapandholdgesture.cpp index ff5284e..5fe52cc 100644 --- a/examples/gestures/imageviewer/tapandholdgesture.cpp +++ b/examples/gestures/imageviewer/tapandholdgesture.cpp @@ -43,6 +43,8 @@ #include <QtGui/qevent.h> +// #define TAPANDHOLD_USING_MOUSE + /*! \class TapAndHoldGesture \since 4.6 @@ -95,6 +97,26 @@ bool TapAndHoldGesture::filterEvent(QEvent *event) case QEvent::TouchEnd: reset(); break; +#ifdef TAPANDHOLD_USING_MOUSE + case QEvent::MouseButtonPress: { + if (timer.isActive()) + timer.stop(); + timer.start(TapAndHoldGesture::iterationTimeout, this); + const QPoint p = static_cast<QMouseEvent*>(event)->pos(); + position = startPosition = p; + break; + } + case QEvent::MouseMove: { + const QPoint startPos = startPosition; + const QPoint pos = static_cast<QMouseEvent*>(event)->pos(); + if ((startPos - pos).manhattanLength() > 15) + reset(); + break; + } + case QEvent::MouseButtonRelease: + reset(); + break; +#endif // TAPANDHOLD_USING_MOUSE default: break; } @@ -108,11 +130,9 @@ void TapAndHoldGesture::timerEvent(QTimerEvent *event) return; if (iteration == TapAndHoldGesture::iterationCount) { timer.stop(); - setState(Qt::GestureFinished); - emit triggered(); + updateState(Qt::GestureFinished); } else { - setState(Qt::GestureStarted); - emit triggered(); + updateState(Qt::GestureUpdated); } ++iteration; } @@ -120,11 +140,10 @@ void TapAndHoldGesture::timerEvent(QTimerEvent *event) /*! \internal */ void TapAndHoldGesture::reset() { - if (state() != Qt::NoGesture) - emit cancelled(); - setState(Qt::NoGesture); timer.stop(); iteration = 0; + position = startPosition = QPoint(); + updateState(Qt::NoGesture); } /*! diff --git a/examples/gestures/imageviewer/tapandholdgesture.h b/examples/gestures/imageviewer/tapandholdgesture.h index e0d50b5..61fabc2 100644 --- a/examples/gestures/imageviewer/tapandholdgesture.h +++ b/examples/gestures/imageviewer/tapandholdgesture.h @@ -66,6 +66,7 @@ private: QBasicTimer timer; int iteration; QPoint position; + QPoint startPosition; static const int iterationCount; static const int iterationTimeout; }; diff --git a/examples/script/calculator/calculator.js b/examples/script/calculator/calculator.js index 62c2cba..ac3c1b6 100644 --- a/examples/script/calculator/calculator.js +++ b/examples/script/calculator/calculator.js @@ -1,10 +1,19 @@ +Function.prototype.bind = function() { + var func = this; + var thisObject = arguments[0]; + var args = Array.prototype.slice.call(arguments, 1); + return function() { + return func.apply(thisObject, args); + } +} + //! [0] function Calculator(ui) { this.ui = ui; - this.pendingAdditiveOperator = ""; - this.pendingMultiplicativeOperator = ""; + this.pendingAdditiveOperator = Calculator.NO_OPERATOR; + this.pendingMultiplicativeOperator = Calculator.NO_OPERATOR; this.sumInMemory = 0; this.sumSoFar = 0; this.factorSoFar = 0; @@ -13,16 +22,16 @@ function Calculator(ui) with (ui) { display.text = "0"; - zeroButton.clicked.connect(this, this.digitClicked); - oneButton.clicked.connect(this, "digitClicked"); - twoButton.clicked.connect(this, "digitClicked"); - threeButton.clicked.connect(this, "digitClicked"); - fourButton.clicked.connect(this, "digitClicked"); - fiveButton.clicked.connect(this, "digitClicked"); - sixButton.clicked.connect(this, "digitClicked"); - sevenButton.clicked.connect(this, "digitClicked"); - eightButton.clicked.connect(this, "digitClicked"); - nineButton.clicked.connect(this, "digitClicked"); + zeroButton.clicked.connect(this.digitClicked.bind(this, 0)); + oneButton.clicked.connect(this.digitClicked.bind(this, 1)); + twoButton.clicked.connect(this.digitClicked.bind(this, 2)); + threeButton.clicked.connect(this.digitClicked.bind(this, 3)); + fourButton.clicked.connect(this.digitClicked.bind(this, 4)); + fiveButton.clicked.connect(this.digitClicked.bind(this, 5)); + sixButton.clicked.connect(this.digitClicked.bind(this, 6)); + sevenButton.clicked.connect(this.digitClicked.bind(this, 7)); + eightButton.clicked.connect(this.digitClicked.bind(this, 8)); + nineButton.clicked.connect(this.digitClicked.bind(this, 9)); pointButton.clicked.connect(this, "pointClicked"); changeSignButton.clicked.connect(this, "changeSignClicked"); @@ -36,19 +45,28 @@ function Calculator(ui) setMemoryButton.clicked.connect(this, "setMemory"); addToMemoryButton.clicked.connect(this, "addToMemory"); - divisionButton.clicked.connect(this, "multiplicativeOperatorClicked"); - timesButton.clicked.connect(this, "multiplicativeOperatorClicked"); - minusButton.clicked.connect(this, "additiveOperatorClicked"); - plusButton.clicked.connect(this, "additiveOperatorClicked"); - - squareRootButton.clicked.connect(this, "unaryOperatorClicked"); - powerButton.clicked.connect(this, "unaryOperatorClicked"); - reciprocalButton.clicked.connect(this, "unaryOperatorClicked"); + divisionButton.clicked.connect(this.multiplicativeOperatorClicked.bind(this, Calculator.DIVISION_OPERATOR)); + timesButton.clicked.connect(this.multiplicativeOperatorClicked.bind(this, Calculator.TIMES_OPERATOR)); + minusButton.clicked.connect(this.additiveOperatorClicked.bind(this, Calculator.MINUS_OPERATOR)); + plusButton.clicked.connect(this.additiveOperatorClicked.bind(this, Calculator.PLUS_OPERATOR)); + + squareRootButton.clicked.connect(this.unaryOperatorClicked.bind(this, Calculator.SQUARE_OPERATOR)); + powerButton.clicked.connect(this.unaryOperatorClicked.bind(this, Calculator.POWER_OPERATOR)); + reciprocalButton.clicked.connect(this.unaryOperatorClicked.bind(this, Calculator.RECIPROCAL_OPERATOR)); equalButton.clicked.connect(this, "equalClicked"); } } //! [0] +Calculator.NO_OPERATOR = 0; +Calculator.SQUARE_OPERATOR = 1; +Calculator.POWER_OPERATOR = 2; +Calculator.RECIPROCAL_OPERATOR = 3; +Calculator.DIVISION_OPERATOR = 4; +Calculator.TIMES_OPERATOR = 5; +Calculator.MINUS_OPERATOR = 6; +Calculator.PLUS_OPERATOR = 7; + Calculator.prototype.abortOperation = function() { this.clearAll(); @@ -57,24 +75,23 @@ Calculator.prototype.abortOperation = function() Calculator.prototype.calculate = function(rightOperand, pendingOperator) { - if (pendingOperator == "+") { + if (pendingOperator == Calculator.PLUS_OPERATOR) { this.sumSoFar += rightOperand; - } else if (pendingOperator == "-") { + } else if (pendingOperator == Calculator.MINUS_OPERATOR) { this.sumSoFar -= rightOperand; - } else if (pendingOperator == "*") { + } else if (pendingOperator == Calculator.TIMES_OPERATOR) { this.factorSoFar *= rightOperand; - } else if (pendingOperator == "/") { + } else if (pendingOperator == Calculator.DIVISION_OPERATOR) { if (rightOperand == 0) - return false; + return false; this.factorSoFar /= rightOperand; } return true; } //! [1] -Calculator.prototype.digitClicked = function() +Calculator.prototype.digitClicked = function(digitValue) { - var digitValue = __qt_sender__.text - 0; if ((digitValue == 0) && (this.ui.display.text == "0")) return; if (this.waitingForOperand) { @@ -85,19 +102,19 @@ Calculator.prototype.digitClicked = function() } //! [1] -Calculator.prototype.unaryOperatorClicked = function() +Calculator.prototype.unaryOperatorClicked = function(op) { var operand = this.ui.display.text - 0; var result = 0; - if (__qt_sender__.text == "Sqrt") { + if (op == Calculator.SQUARE_OPERATOR) { if (operand < 0) { this.abortOperation(); return; } result = Math.sqrt(operand); - } else if (__qt_sender__.text == "x^2") { + } else if (op == Calculator.POWER_OPERATOR) { result = Math.pow(operand, 2); - } else if (__qt_sender__.text == "1/x") { + } else if (op == Calculator.RECIPROCAL_OPERATOR) { if (operand == 0.0) { this.abortOperation(); return; @@ -108,11 +125,11 @@ Calculator.prototype.unaryOperatorClicked = function() this.waitingForOperand = true; } -Calculator.prototype.additiveOperatorClicked = function() +Calculator.prototype.additiveOperatorClicked = function(op) { var operand = this.ui.display.text - 0; - if (this.pendingMultiplicativeOperator.length != 0) { + if (this.pendingMultiplicativeOperator != Calculator.NO_OPERATOR) { if (!this.calculate(operand, this.pendingMultiplicativeOperator)) { this.abortOperation(); return; @@ -120,10 +137,10 @@ Calculator.prototype.additiveOperatorClicked = function() this.ui.display.text = this.factorSoFar + ""; operand = this.factorSoFar; this.factorSoFar = 0; - this.pendingMultiplicativeOperator = ""; + this.pendingMultiplicativeOperator = Calculator.NO_OPERATOR; } - if (this.pendingAdditiveOperator.length != 0) { + if (this.pendingAdditiveOperator != Calculator.NO_OPERATOR) { if (!this.calculate(operand, this.pendingAdditiveOperator)) { this.abortOperation(); return; @@ -133,15 +150,15 @@ Calculator.prototype.additiveOperatorClicked = function() this.sumSoFar = operand; } - this.pendingAdditiveOperator = __qt_sender__.text; + this.pendingAdditiveOperator = op; this.waitingForOperand = true; } -Calculator.prototype.multiplicativeOperatorClicked = function() +Calculator.prototype.multiplicativeOperatorClicked = function(op) { var operand = this.ui.display.text - 0; - if (this.pendingMultiplicativeOperator.length != 0) { + if (this.pendingMultiplicativeOperator != Calculator.NO_OPERATOR) { if (!this.calculate(operand, this.pendingMultiplicativeOperator)) { this.abortOperation(); return; @@ -151,7 +168,7 @@ Calculator.prototype.multiplicativeOperatorClicked = function() this.factorSoFar = operand; } - this.pendingMultiplicativeOperator = __qt_sender__.text; + this.pendingMultiplicativeOperator = op; this.waitingForOperand = true; } @@ -159,21 +176,21 @@ Calculator.prototype.equalClicked = function() { var operand = this.ui.display.text - 0; - if (this.pendingMultiplicativeOperator.length != 0) { + if (this.pendingMultiplicativeOperator != Calculator.NO_OPERATOR) { if (!this.calculate(operand, this.pendingMultiplicativeOperator)) { this.abortOperation(); return; } operand = this.factorSoFar; this.factorSoFar = 0.0; - this.pendingMultiplicativeOperator = ""; + this.pendingMultiplicativeOperator = Calculator.NO_OPERATOR; } - if (this.pendingAdditiveOperator.length != 0) { + if (this.pendingAdditiveOperator != Calculator.NO_OPERATOR) { if (!this.calculate(operand, this.pendingAdditiveOperator)) { this.abortOperation(); return; } - this.pendingAdditiveOperator = ""; + this.pendingAdditiveOperator = Calculator.NO_OPERATOR; } else { this.sumSoFar = operand; } @@ -234,8 +251,8 @@ Calculator.prototype.clearAll = function() { this.sumSoFar = 0.0; this.factorSoFar = 0.0; - this.pendingAdditiveOperator = ""; - this.pendingMultiplicativeOperator = ""; + this.pendingAdditiveOperator = Calculator.NO_OPERATOR; + this.pendingMultiplicativeOperator = Calculator.NO_OPERATOR; this.ui.display.text = "0"; this.waitingForOperand = true; } diff --git a/examples/script/customclass/bytearrayclass.cpp b/examples/script/customclass/bytearrayclass.cpp index 2044a16..8fe1a96 100644 --- a/examples/script/customclass/bytearrayclass.cpp +++ b/examples/script/customclass/bytearrayclass.cpp @@ -297,7 +297,7 @@ void ByteArrayClassPropertyIterator::toBack() QScriptString ByteArrayClassPropertyIterator::name() const { - return QScriptString(); + return object().engine()->toStringHandle(QString::number(m_last)); } uint ByteArrayClassPropertyIterator::id() const diff --git a/examples/statemachine/rogue/main.cpp b/examples/statemachine/rogue/main.cpp new file mode 100644 index 0000000..0c2fb2d --- /dev/null +++ b/examples/statemachine/rogue/main.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> + +#include "window.h" + +int main(int argv, char **args) +{ + QApplication app(argv, args); + + Window window; + window.show(); + + return app.exec(); +} + diff --git a/examples/statemachine/rogue/movementtransition.h b/examples/statemachine/rogue/movementtransition.h new file mode 100644 index 0000000..929077d --- /dev/null +++ b/examples/statemachine/rogue/movementtransition.h @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOVEMENTTRANSITION_H +#define MOVEMENTTRANSITION_H + +#include <QtGui> + +#include "window.h" + +//![0] +class MovementTransition : public QEventTransition +{ + Q_OBJECT + +public: + MovementTransition(Window *window) : + QEventTransition(window, QEvent::KeyPress) { + this->window = window; + } +//![0] + +//![1] +protected: + bool eventTest(QEvent *event) { + if (event->type() == QEvent::Wrapped && + static_cast<QWrappedEvent *>(event)->event()->type() == QEvent::KeyPress) { + QEvent *wrappedEvent = static_cast<QWrappedEvent *>(event)->event(); + + QKeyEvent *keyEvent = static_cast<QKeyEvent *>(wrappedEvent); + int key = keyEvent->key(); + + return key == Qt::Key_2 || key == Qt::Key_8 || key == Qt::Key_6 || + key == Qt::Key_4; + } + return false; + } +//![1] + +//![2] + void onTransition(QEvent *event) { + QKeyEvent *keyEvent = static_cast<QKeyEvent *>( + static_cast<QWrappedEvent *>(event)->event()); + + int key = keyEvent->key(); + switch (key) { + case Qt::Key_4: + window->movePlayer(Window::Left); + break; + case Qt::Key_8: + window->movePlayer(Window::Up); + break; + case Qt::Key_6: + window->movePlayer(Window::Right); + break; + case Qt::Key_2: + window->movePlayer(Window::Down); + break; + default: + ; + } + } +//![2] + +private: + Window *window; +}; + +#endif + diff --git a/examples/statemachine/rogue/rogue.pro b/examples/statemachine/rogue/rogue.pro new file mode 100644 index 0000000..1571854 --- /dev/null +++ b/examples/statemachine/rogue/rogue.pro @@ -0,0 +1,11 @@ +HEADERS = window.h \ + movementtransition.h +SOURCES = main.cpp \ + window.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/rogue +sources.files = $$SOURCES $$HEADERS *.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/rogue +INSTALLS += target sources + diff --git a/examples/statemachine/rogue/window.cpp b/examples/statemachine/rogue/window.cpp new file mode 100644 index 0000000..39565a3 --- /dev/null +++ b/examples/statemachine/rogue/window.cpp @@ -0,0 +1,201 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> + +#include "window.h" +#include "movementtransition.h" + +//![0] +Window::Window() +{ + pX = 5; + pY = 5; +//![0] + + QFontDatabase database; + QFont font; + if (database.families().contains("Monospace")) + font = QFont("Monospace", 12); + else { + foreach (QString family, database.families()) { + if (database.isFixedPitch(family)) { + font = QFont(family, 12); + break; + } + } + } + setFont(font); + +//![1] + setupMap(); + buildMachine(); +} +//![1] + +void Window::setStatus(const QString &status) +{ + myStatus = status; + repaint(); +} + +QString Window::status() const +{ + return myStatus; +} + +void Window::paintEvent(QPaintEvent * /* event */) +{ + QFontMetrics metrics(font()); + QPainter painter(this); + int fontHeight = metrics.height(); + int fontWidth = metrics.width('X'); + int yPos = fontHeight; + int xPos; + + painter.fillRect(rect(), Qt::black); + painter.setPen(Qt::white); + + painter.drawText(QPoint(0, yPos), status()); + + for (int y = 0; y < HEIGHT; ++y) { + yPos += fontHeight; + xPos = 0; + + for (int x = 0; x < WIDTH; ++x) { + if (y == pY && x == pX) { + xPos += fontWidth; + continue; + } + + painter.drawText(QPoint(xPos, yPos), map[x][y]); + xPos += fontWidth; + } + } + painter.drawText(QPoint(pX * fontWidth, (pY + 2) * fontHeight), QChar('@')); +} + +QSize Window::sizeHint() const +{ + QFontMetrics metrics(font()); + + return QSize(metrics.width('X') * WIDTH, metrics.height() * (HEIGHT + 1)); +} + +//![2] +void Window::buildMachine() +{ + machine = new QStateMachine; + + QState *inputState = new QState(machine); + inputState->assignProperty(this, "status", "Move the rogue with 2, 4, 6, and 8"); + + MovementTransition *transition = new MovementTransition(this); + inputState->addTransition(transition); +//![2] + +//![3] + QState *quitState = new QState(machine); + quitState->assignProperty(this, "status", "Really quit(y/n)?"); + + QKeyEventTransition *yesTransition = new + QKeyEventTransition(this, QEvent::KeyPress, Qt::Key_Y); + yesTransition->setTargetState(new QFinalState(machine)); + quitState->addTransition(yesTransition); + + QKeyEventTransition *noTransition = + new QKeyEventTransition(this, QEvent::KeyPress, Qt::Key_N); + noTransition->setTargetState(inputState); + quitState->addTransition(noTransition); +//![3] + +//![4] + QKeyEventTransition *quitTransition = + new QKeyEventTransition(this, QEvent::KeyPress, Qt::Key_Q); + quitTransition->setTargetState(quitState); + inputState->addTransition(quitTransition); +//![4] + +//![5] + machine->setInitialState(inputState); + + connect(machine, SIGNAL(finished()), qApp, SLOT(quit())); + + machine->start(); +} +//![5] + +void Window::movePlayer(Direction direction) +{ + switch (direction) { + case Left: + if (map[pX - 1][pY] != '#') + --pX; + break; + case Right: + if (map[pX + 1][pY] != '#') + ++pX; + break; + case Up: + if (map[pX][pY - 1] != '#') + --pY; + break; + case Down: + if (map[pX][pY + 1] != '#') + ++pY; + break; + } + repaint(); +} + +void Window::setupMap() +{ + qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); + + for (int x = 0; x < WIDTH; ++x) + for (int y = 0; y < HEIGHT; ++y) { + if (x == 0 || x == WIDTH - 1 || y == 0 || y == HEIGHT - 1 || qrand() % 40 == 0) + map[x][y] = '#'; + else + map[x][y] = '.'; + } +} + diff --git a/examples/statemachine/rogue/window.h b/examples/statemachine/rogue/window.h new file mode 100644 index 0000000..bcd86bd --- /dev/null +++ b/examples/statemachine/rogue/window.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef WINDOW_H +#define WINDOW_H + +#include <QWidget> + +class QState; +class QStateMachine; +class QTransition; + +#define WIDTH 35 +#define HEIGHT 20 + +//![0] +class Window : public QWidget +{ + Q_OBJECT + Q_PROPERTY(QString status READ status WRITE setStatus) + +public: + enum Direction { Up, Down, Left, Right }; + + Window(); + + void movePlayer(Direction direction); + void setStatus(const QString &status); + QString status() const; + + QSize sizeHint() const; + +protected: + void paintEvent(QPaintEvent *event); +//![0] + +//![1] +private: + void buildMachine(); + void setupMap(); + + QChar map[WIDTH][HEIGHT]; + int pX, pY; + + QStateMachine *machine; + QString myStatus; +}; +//![1] + +#endif + diff --git a/examples/statemachine/statemachine.pro b/examples/statemachine/statemachine.pro index ea3e7a8..298c0ae 100644 --- a/examples/statemachine/statemachine.pro +++ b/examples/statemachine/statemachine.pro @@ -3,6 +3,7 @@ SUBDIRS = \ eventtransitions \ factorial \ pingpong \ + rogue \ trafficlight \ twowaybutton diff --git a/examples/webkit/framecapture/framecapture.cpp b/examples/webkit/framecapture/framecapture.cpp new file mode 100644 index 0000000..ef31f6d --- /dev/null +++ b/examples/webkit/framecapture/framecapture.cpp @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "framecapture.h" + +#include <iostream> +#include <QtWebKit> + +FrameCapture::FrameCapture(): QObject(), m_percent(0) +{ + connect(&m_page, SIGNAL(loadProgress(int)), this, SLOT(printProgress(int))); + connect(&m_page, SIGNAL(loadFinished(bool)), this, SLOT(saveResult(bool))); +} + +void FrameCapture::load(const QUrl &url, const QString &outputFileName) +{ + std::cout << "Loading " << qPrintable(url.toString()) << std::endl; + m_percent = 0; + int index = outputFileName.lastIndexOf('.'); + m_fileName = (index == -1) ? outputFileName + ".png" : outputFileName; + m_page.mainFrame()->load(url); + m_page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); + m_page.mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); +} + +void FrameCapture::printProgress(int percent) +{ + if (m_percent >= percent) + return; + + while (m_percent++ < percent) + std::cout << "#" << std::flush; +} + +void FrameCapture::saveResult(bool ok) +{ + std::cout << std::endl; + + // crude error-checking + if (!ok) { + std::cerr << "Failed loading " << qPrintable(m_page.mainFrame()->url().toString()) << std::endl; + emit finished(); + return; + } + + // save each internal frame in different image files + int frameCounter = 0; + foreach(QWebFrame *frame, m_page.mainFrame()->childFrames()) { + QString fileName(m_fileName); + int index = m_fileName.lastIndexOf('.'); + fileName = fileName.insert(index, "_frame" + QString::number(++frameCounter)); + + frame->setClipRenderToViewport(false); + + QImage image(frame->contentsSize(), QImage::Format_ARGB32_Premultiplied); + image.fill(Qt::transparent); + + saveFrame(frame, image, fileName); + } + + // save the main frame + m_page.setViewportSize(m_page.mainFrame()->contentsSize()); + QImage image(m_page.mainFrame()->contentsSize(), QImage::Format_ARGB32_Premultiplied); + image.fill(Qt::transparent); + saveFrame(m_page.mainFrame(), image, m_fileName); + + emit finished(); +} + +void FrameCapture::saveFrame(QWebFrame *frame, QImage image, QString fileName) +{ + QPainter painter(&image); + painter.setRenderHint(QPainter::Antialiasing, true); + painter.setRenderHint(QPainter::TextAntialiasing, true); + painter.setRenderHint(QPainter::SmoothPixmapTransform, true); + + frame->render(&painter); + + painter.end(); + + image.save(fileName); +} + diff --git a/examples/webkit/framecapture/framecapture.h b/examples/webkit/framecapture/framecapture.h new file mode 100644 index 0000000..ffc93ac --- /dev/null +++ b/examples/webkit/framecapture/framecapture.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef FRAMECAPTURE_H +#define FRAMECAPTURE_H + +#include <QtWebKit> + +class FrameCapture : public QObject +{ + Q_OBJECT + +public: + FrameCapture(); + void load(const QUrl &url, const QString &outputFileName); + +signals: + void finished(); + +private slots: + void printProgress(int percent); + void saveResult(bool ok); + +private: + QWebPage m_page; + QString m_fileName; + int m_percent; + + void saveFrame(QWebFrame *frame, QImage image, QString fileName); +}; + +#endif diff --git a/examples/webkit/framecapture/framecapture.pro b/examples/webkit/framecapture/framecapture.pro new file mode 100644 index 0000000..6f2f093 --- /dev/null +++ b/examples/webkit/framecapture/framecapture.pro @@ -0,0 +1,11 @@ +QT += webkit + +HEADERS = framecapture.h +SOURCES = main.cpp \ + framecapture.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/webkit/framecapture +sources.files = $$SOURCES $$HEADERS +sources.path = $$[QT_INSTALL_EXAMPLES]/webkit/framecapture +INSTALLS += target sources diff --git a/examples/webkit/framecapture/main.cpp b/examples/webkit/framecapture/main.cpp new file mode 100644 index 0000000..fcdb62a --- /dev/null +++ b/examples/webkit/framecapture/main.cpp @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "framecapture.h" + +#include <iostream> +#include <QtGui> + +int main(int argc, char * argv[]) +{ + if (argc != 3) { + std::cout << "Capture a web page and save its internal frames in different images" << std::endl << std::endl; + std::cout << " framecapture <url> <outputfile>" << std::endl; + std::cout << std::endl; + std::cout << "Notes:" << std::endl; + std::cout << " 'url' is the URL of the web page to be captured" << std::endl; + std::cout << " 'outputfile' is the prefix of the image files to be generated" << std::endl; + std::cout << std::endl; + std::cout << "Example: " << std::endl; + std::cout << " framecapture www.trolltech.com trolltech.png" << std::endl; + std::cout << std::endl; + std::cout << "Result:" << std::endl; + std::cout << " trolltech.png (full page)" << std::endl; + std::cout << " trolltech_frame1.png (...) trolltech_frameN.png ('N' number of internal frames)" << std::endl; + return 0; + } + + QUrl url = QWebView::guessUrlFromString(QString::fromLatin1(argv[1])); + QString fileName = QString::fromLatin1(argv[2]); + + QApplication a(argc, argv); + FrameCapture capture; + QObject::connect(&capture, SIGNAL(finished()), QApplication::instance(), SLOT(quit())); + capture.load(url, fileName); + + return a.exec(); +} + diff --git a/mkspecs/linux-g++-gles2-experimental/qmake.conf b/mkspecs/linux-g++-gles2-experimental/qmake.conf new file mode 100644 index 0000000..9c28d17 --- /dev/null +++ b/mkspecs/linux-g++-gles2-experimental/qmake.conf @@ -0,0 +1,22 @@ +# +# Experimental qmake configuration for GLES2 +# + +MAKEFILE_GENERATOR = UNIX +TEMPLATE = app +CONFIG += qt warn_on release incremental link_prl +QT += core gui +QMAKE_INCREMENTAL_STYLE = sublib + +include(../common/g++.conf) + +QMAKE_LFLAGS += -Wl,-rpath-link=/usr/lib + +include(../common/linux.conf) + +QMAKE_LIBS_EGL = -lEGL +QMAKE_LIBS_OPENGL = -lGLESv2 +QMAKE_LIBS_OPENGL_QT = -lGLESv2 -lEGL + + +load(qt_config) diff --git a/mkspecs/linux-g++-gles2-experimental/qplatformdefs.h b/mkspecs/linux-g++-gles2-experimental/qplatformdefs.h new file mode 100644 index 0000000..b9a94e2 --- /dev/null +++ b/mkspecs/linux-g++-gles2-experimental/qplatformdefs.h @@ -0,0 +1,164 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec 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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMDEFS_H +#define QPLATFORMDEFS_H + +// Get Qt defines/settings + +#include "qglobal.h" + +// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs + +// 1) need to reset default environment if _BSD_SOURCE is defined +// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0 +// 3) it seems older glibc need this to include the X/Open stuff +#ifndef _GNU_SOURCE +# define _GNU_SOURCE +#endif + +#include <unistd.h> + + +// We are hot - unistd.h should have turned on the specific APIs we requested + +#include <features.h> +#include <pthread.h> +#include <dirent.h> +#include <fcntl.h> +#include <grp.h> +#include <pwd.h> +#include <signal.h> +#include <dlfcn.h> + +#include <sys/types.h> +#include <sys/ioctl.h> +#include <sys/ipc.h> +#include <sys/time.h> +#include <sys/shm.h> +#include <sys/socket.h> +#include <sys/stat.h> +#include <sys/wait.h> +#include <netinet/in.h> +#ifndef QT_NO_IPV6IFNAME +#include <net/if.h> +#endif + +#ifdef QT_LARGEFILE_SUPPORT +#define QT_STATBUF struct stat64 +#define QT_STATBUF4TSTAT struct stat64 +#define QT_STAT ::stat64 +#define QT_FSTAT ::fstat64 +#define QT_LSTAT ::lstat64 +#define QT_OPEN ::open64 +#define QT_TRUNCATE ::truncate64 +#define QT_FTRUNCATE ::ftruncate64 +#define QT_LSEEK ::lseek64 +#else +#define QT_STATBUF struct stat +#define QT_STATBUF4TSTAT struct stat +#define QT_STAT ::stat +#define QT_FSTAT ::fstat +#define QT_LSTAT ::lstat +#define QT_OPEN ::open +#define QT_TRUNCATE ::truncate +#define QT_FTRUNCATE ::ftruncate +#define QT_LSEEK ::lseek +#endif + +#ifdef QT_LARGEFILE_SUPPORT +#define QT_FOPEN ::fopen64 +#define QT_FSEEK ::fseeko64 +#define QT_FTELL ::ftello64 +#define QT_FGETPOS ::fgetpos64 +#define QT_FSETPOS ::fsetpos64 +#define QT_FPOS_T fpos64_t +#define QT_OFF_T off64_t +#else +#define QT_FOPEN ::fopen +#define QT_FSEEK ::fseek +#define QT_FTELL ::ftell +#define QT_FGETPOS ::fgetpos +#define QT_FSETPOS ::fsetpos +#define QT_FPOS_T fpos_t +#define QT_OFF_T long +#endif + +#define QT_STAT_REG S_IFREG +#define QT_STAT_DIR S_IFDIR +#define QT_STAT_MASK S_IFMT +#define QT_STAT_LNK S_IFLNK +#define QT_SOCKET_CONNECT ::connect +#define QT_SOCKET_BIND ::bind +#define QT_FILENO fileno +#define QT_CLOSE ::close +#define QT_READ ::read +#define QT_WRITE ::write +#define QT_ACCESS ::access +#define QT_GETCWD ::getcwd +#define QT_CHDIR ::chdir +#define QT_MKDIR ::mkdir +#define QT_RMDIR ::rmdir +#define QT_OPEN_LARGEFILE O_LARGEFILE +#define QT_OPEN_RDONLY O_RDONLY +#define QT_OPEN_WRONLY O_WRONLY +#define QT_OPEN_RDWR O_RDWR +#define QT_OPEN_CREAT O_CREAT +#define QT_OPEN_TRUNC O_TRUNC +#define QT_OPEN_APPEND O_APPEND + +#define QT_SIGNAL_RETTYPE void +#define QT_SIGNAL_ARGS int +#define QT_SIGNAL_IGNORE SIG_IGN + +#if defined(__GLIBC__) && (__GLIBC__ >= 2) +#define QT_SOCKLEN_T socklen_t +#else +#define QT_SOCKLEN_T int +#endif + +#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) +#define QT_SNPRINTF ::snprintf +#define QT_VSNPRINTF ::vsnprintf +#endif + + +#endif // QPLATFORMDEFS_H diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 5f250bf..9759e7d 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1261,7 +1261,13 @@ void VcprojGenerator::initDeploymentTool() searchPath = info.absoluteFilePath(); } else { nameFilter = source.split('\\').last(); - searchPath = info.absolutePath(); + if (source.contains('*')) { + source = source.split('*').first(); + info = QFileInfo(source); + } + searchPath = info.absolutePath(); + if (!info.exists()) + fprintf(stderr, "Deployment file is missing %s\n", source.toLatin1().constData()); } int pathSize = searchPath.size(); diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 607b734..168eac2 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -162,7 +162,17 @@ private: QMap<int, QProcessInfo *> children; }; -Q_GLOBAL_STATIC(QProcessManager, processManager) + +Q_GLOBAL_STATIC(QMutex, processManagerGlobalMutex) + +static QProcessManager *processManager() { + // The constructor of QProcessManager should be called only once + // so we cannot use Q_GLOBAL_STATIC directly for QProcessManager + QMutex *mutex = processManagerGlobalMutex(); + QMutexLocker locker(mutex); + static QProcessManager processManager; + return &processManager; +} QProcessManager::QProcessManager() { diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index e37b6d3..6520170 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -843,9 +843,9 @@ QObject::~QObject() if (senderLists) senderLists->dirty = true; + node = node->next; if (needToUnlock) m->unlock(); - node = node->next; } } diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index 056dee3..5d17bfd 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE class QVariant; class QThreadData; class QObjectConnectionListVector; -namespace QtSharedPointer { class ExternalRefCountData; } +namespace QtSharedPointer { struct ExternalRefCountData; } /* mirrored in QtTestLib, DON'T CHANGE without prior warning */ struct QSignalSpyCallbackSet diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 2b5ea0a..4166944 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -161,6 +161,9 @@ static void construct(QVariant::Private *x, const void *copy) case QMetaType::Float: x->data.f = copy ? *static_cast<const float*>(copy) : 0.0f; break; + case QMetaType::QObjectStar: + x->data.o = copy ? *static_cast<QObject *const*>(copy) : 0; + break; case QVariant::LongLong: x->data.ll = copy ? *static_cast<const qlonglong *>(copy) : Q_INT64_C(0); break; @@ -257,6 +260,7 @@ static void clear(QVariant::Private *d) case QVariant::ULongLong: case QVariant::Double: case QMetaType::Float: + case QMetaType::QObjectStar: break; case QVariant::Invalid: case QVariant::UserType: @@ -326,6 +330,7 @@ static bool isNull(const QVariant::Private *d) case QVariant::Bool: case QVariant::Double: case QMetaType::Float: + case QMetaType::QObjectStar: break; } return d->is_null; @@ -419,6 +424,8 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b) return a->data.d == b->data.d; case QMetaType::Float: return a->data.f == b->data.f; + case QMetaType::QObjectStar: + return a->data.o == b->data.o; case QVariant::Date: return *v_cast<QDate>(a) == *v_cast<QDate>(b); case QVariant::Time: @@ -1048,6 +1055,9 @@ static void streamDebug(QDebug dbg, const QVariant &v) case QMetaType::Float: dbg.nospace() << qVariantValue<float>(v); break; + case QMetaType::QObjectStar: + dbg.nospace() << qVariantValue<QObject *>(v); + break; case QVariant::Double: dbg.nospace() << v.toDouble(); break; @@ -1361,7 +1371,7 @@ void QVariant::create(int type, const void *copy) QVariant::~QVariant() { - if (d.type > Char && d.type != QMetaType::Float && (!d.is_shared || !d.data.shared->ref.deref())) + if (d.type > Char && d.type != QMetaType::Float && d.type != QMetaType::QObjectStar && (!d.is_shared || !d.data.shared->ref.deref())) handler->clear(&d); } @@ -1377,7 +1387,7 @@ QVariant::QVariant(const QVariant &p) { if (d.is_shared) { d.data.shared->ref.ref(); - } else if (p.d.type > Char && p.d.type != QMetaType::Float) { + } else if (p.d.type > Char && p.d.type != QMetaType::Float && p.d.type != QMetaType::QObjectStar) { handler->construct(&d, p.constData()); d.is_null = p.d.is_null; } @@ -1733,7 +1743,7 @@ QVariant& QVariant::operator=(const QVariant &variant) if (variant.d.is_shared) { variant.d.data.shared->ref.ref(); d = variant.d; - } else if (variant.d.type > Char && variant.d.type != QMetaType::Float) { + } else if (variant.d.type > Char && variant.d.type != QMetaType::Float && variant.d.type != QMetaType::QObjectStar) { d.type = variant.d.type; handler->construct(&d, variant.constData()); d.is_null = variant.d.is_null; diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index a68939d..4489e95 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -358,6 +358,7 @@ class Q_CORE_EXPORT QVariant float f; qlonglong ll; qulonglong ull; + QObject *o; void *ptr; PrivateShared *shared; } data; diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp index aee592c..0357a7a 100644 --- a/src/gui/dialogs/qcolordialog.cpp +++ b/src/gui/dialogs/qcolordialog.cpp @@ -1836,8 +1836,8 @@ QRgb QColorDialog::getRgba(QRgb initial, bool *ok, QWidget *parent) QColorDialog::~QColorDialog() { - Q_D(QColorDialog); #if defined(Q_WS_MAC) + Q_D(QColorDialog); if (d->delegate) { d->releaseCocoaColorPanelDelegate(); QColorDialogPrivate::sharedColorPanelAvailable = true; diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp index 5fd341a..114456d 100644 --- a/src/gui/dialogs/qfiledialog_win.cpp +++ b/src/gui/dialogs/qfiledialog_win.cpp @@ -59,7 +59,8 @@ #endif #include <shlobj.h> -#if !defined(Q_WS_WINCE) +//At some point we can hope that mingw will support that interface +#if !defined(Q_WS_WINCE) && !defined(Q_CC_MINGW) #include <shobjidl.h> #endif #include <objbase.h> diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index beaf42b..8d9a1f8 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -9837,20 +9837,25 @@ void QGraphicsItemGroup::addToGroup(QGraphicsItem *item) } // COMBINE - // ### Use itemTransform() instead. - QTransform oldSceneMatrix = item->sceneTransform(); + bool ok; + QTransform itemTransform = item->itemTransform(this, &ok); + + if (!ok) { + qWarning("QGraphicsItemGroup::addToGroup: could not find a valid transformation from item to group coordinates"); + return; + } + + QTransform newItemTransform(itemTransform); item->setPos(mapFromItem(item, 0, 0)); item->setParentItem(this); - QTransform newItemTransform(oldSceneMatrix); - newItemTransform *= sceneTransform().inverted(); + + // removing position from translation component of the new transform if (!item->pos().isNull()) newItemTransform *= QTransform::fromTranslate(-item->x(), -item->y()); + item->setTransform(newItemTransform); item->d_func()->setIsMemberOfGroup(true); prepareGeometryChange(); - QTransform itemTransform(item->transform()); - if (!item->pos().isNull()) - itemTransform *= QTransform::fromTranslate(item->x(), item->y()); d->itemsBoundingRect |= itemTransform.mapRect(item->boundingRect() | item->childrenBoundingRect()); update(); } diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp index 778cd94..775a0d5 100644 --- a/src/gui/graphicsview/qgraphicstransform.cpp +++ b/src/gui/graphicsview/qgraphicstransform.cpp @@ -80,11 +80,7 @@ #include "qgraphicsitem_p.h" #include "qgraphicstransform_p.h" #include <QDebug> - -#include <math.h> -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif +#include <QtCore/qmath.h> QT_BEGIN_NAMESPACE @@ -355,7 +351,6 @@ public: QGraphicsRotationPrivate() : angle(0) {} QPointF origin; - qreal originY; qreal angle; }; @@ -475,13 +470,18 @@ void QGraphicsRotation::applyTo(QTransform *t) const By default the axis is (0, 0, 1), giving QGraphicsRotation3D the same default behavior as QGraphicsRotation (i.e., rotation around the Z axis). + Note: the final rotation is the combined effect of a rotation in + 3D space followed by a projection back to 2D. If several rotations + are performed in succession, they will not behave as expected unless + they were all around the Z axis. + \sa QGraphicsTransform, QGraphicsItem::setRotation(), QTransform::rotate() */ class QGraphicsRotation3DPrivate : public QGraphicsRotationPrivate { public: - QGraphicsRotation3DPrivate() {} + QGraphicsRotation3DPrivate() : axis(0, 0, 1) {} QVector3D axis; }; @@ -522,10 +522,14 @@ QVector3D QGraphicsRotation3D::axis() void QGraphicsRotation3D::setAxis(const QVector3D &axis) { Q_D(QGraphicsRotation3D); + if (d->axis == axis) + return; d->axis = axis; update(); + emit axisChanged(); } +const qreal deg2rad = qreal(0.017453292519943295769); // pi/180 static const qreal inv_dist_to_plane = 1. / 1024.; /*! @@ -535,13 +539,27 @@ void QGraphicsRotation3D::applyTo(QTransform *t) const { Q_D(const QGraphicsRotation3D); - if (d->angle == 0. || + qreal a = d->angle; + + if (a == 0. || (d->axis.z() == 0. && d->axis.y() == 0 && d->axis.x() == 0)) return; - qreal rad = d->angle * 2. * M_PI / 360.; - qreal c = ::cos(rad); - qreal s = ::sin(rad); + qreal c, s; + if (a == 90. || a == -270.) { + s = 1.; + c = 0.; + } else if (a == 270. || a == -90.) { + s = -1.; + c = 0.; + } else if (a == 180.) { + s = 0.; + c = -1.; + } else { + qreal b = deg2rad*a; + s = qSin(b); + c = qCos(b); + } qreal x = d->axis.x(); qreal y = d->axis.y(); diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index ca55f2e..92f8816 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -2209,8 +2209,7 @@ QPolygonF QGraphicsView::mapToScene(const QRect &rect) const QPointF br = scrollOffset + r.bottomRight(); QPointF bl = scrollOffset + r.bottomLeft(); - QPolygonF poly; - poly.resize(4); + QPolygonF poly(4); if (!d->identityMatrix) { QTransform x = d->matrix.inverted(); poly[0] = x.map(tl); @@ -2313,8 +2312,7 @@ QPolygon QGraphicsView::mapFromScene(const QRectF &rect) const br -= scrollOffset; bl -= scrollOffset; - QPolygon poly; - poly.resize(4); + QPolygon poly(4); poly[0] = tl.toPoint(); poly[1] = tr.toPoint(); poly[2] = br.toPoint(); @@ -3647,8 +3645,7 @@ QRectF QGraphicsViewPrivate::mapToScene(const QRectF &rect) const QPointF br = scrollOffset + rect.bottomRight(); QPointF bl = scrollOffset + rect.bottomLeft(); - QPolygonF poly; - poly.resize(4); + QPolygonF poly(4); if (!identityMatrix) { QTransform x = matrix.inverted(); poly[0] = x.map(tl); diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index ed2b3c5..421d511 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -960,7 +960,8 @@ void QAbstractItemView::reset() d->currentIndexSet = false; setState(NoState); setRootIndex(QModelIndex()); - d->selectionModel->reset(); + if (d->selectionModel) + d->selectionModel->reset(); } /*! @@ -2649,7 +2650,7 @@ void QAbstractItemView::keyboardSearch(const QString &search) if (search.isEmpty() || (d->keyboardInputTime.msecsTo(now) > QApplication::keyboardInputInterval())) { d->keyboardInput = search; - skipRow = true; + skipRow = currentIndex().isValid(); //if it is not valid we should really start at QModelIndex(0,0) } else { d->keyboardInput += search; } diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp index 9dad95f..0f35ac1 100644 --- a/src/gui/itemviews/qitemselectionmodel.cpp +++ b/src/gui/itemviews/qitemselectionmodel.cpp @@ -593,10 +593,30 @@ void QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(const QModelIndex &pare // update selectionsx QModelIndex tl = model->index(start, 0, parent); QModelIndex br = model->index(end, model->columnCount(parent) - 1, parent); - q->select(QItemSelection(tl, br), QItemSelectionModel::Deselect); + recursiveDeselect(QItemSelectionRange(tl, br)); finalize(); } +void QItemSelectionModelPrivate::recursiveDeselect(const QItemSelectionRange &range) +{ + Q_Q(QItemSelectionModel); + + QItemSelection sel(range.topLeft(), range.bottomRight()); + q->select(sel, QItemSelectionModel::Deselect); + + QModelIndexList idxList = range.indexes(); + QModelIndexList::const_iterator it = idxList.begin(); + for (; it != idxList.end(); ++it) + { + if (!model->hasChildren(*it)) + continue; + + const QModelIndex &firstChild = it->child(0,0); + const QModelIndex &lastChild = it->child(model->rowCount(*it) - 1, model->columnCount(*it) - 1); + recursiveDeselect(QItemSelectionRange(firstChild, lastChild)); + } +} + /*! \internal */ diff --git a/src/gui/itemviews/qitemselectionmodel_p.h b/src/gui/itemviews/qitemselectionmodel_p.h index 18ad506..8176d4c 100644 --- a/src/gui/itemviews/qitemselectionmodel_p.h +++ b/src/gui/itemviews/qitemselectionmodel_p.h @@ -77,6 +77,8 @@ public: void _q_layoutAboutToBeChanged(); void _q_layoutChanged(); + void recursiveDeselect(const QItemSelectionRange &range); + inline void remove(QList<QItemSelectionRange> &r) { QList<QItemSelectionRange>::const_iterator it = r.constBegin(); diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp index 2565657..b518ff2 100644 --- a/src/gui/itemviews/qlistwidget.cpp +++ b/src/gui/itemviews/qlistwidget.cpp @@ -447,21 +447,20 @@ Qt::DropActions QListModel::supportedDropActions() const \ingroup model-view - QListWidgetItem is used to represent items in a list provided by the - QListWidget class. Each item can hold several pieces of information, - and will display these appropriately. + A QListWidgetItem represents a single item in a QListWidget. Each item can + hold several pieces of information, and will display them appropriately. - The item view convenience classes use a classic item-based interface - rather than a pure model/view approach. For a more flexible list view - widget, consider using the QListView class with a standard model. + The item view convenience classes use a classic item-based interface rather + than a pure model/view approach. For a more flexible list view widget, + consider using the QListView class with a standard model. - List items can be automatically inserted into a list when they are - constructed by specifying the list widget: + List items can be inserted automatically into a list, when they are + constructed, by specifying the list widget: \snippet doc/src/snippets/qlistwidget-using/mainwindow.cpp 2 - They can also be created without a parent widget, and later inserted into - a list (see \l{QListWidget::insertItem()}). + Alternatively, list items can also be created without a parent widget, and + later inserted into a list using QListWidget::insertItem(). List items are typically used to display text() and an icon(). These are set with the setText() and setIcon() functions. The appearance of the text @@ -471,22 +470,24 @@ Qt::DropActions QListModel::supportedDropActions() const with setToolTip(), setStatusTip(), and setWhatsThis(). By default, items are enabled, selectable, checkable, and can be the source - of a drag and drop operation. + of drag and drop operations. + Each item's flags can be changed by calling setFlags() with the appropriate - value (see \l{Qt::ItemFlags}). Checkable items can be checked, unchecked and + value (see Qt::ItemFlags). Checkable items can be checked, unchecked and partially checked with the setCheckState() function. The corresponding - checkState() function indicates what check state the item currently has. + checkState() function indicates the item's current check state. + + The isHidden() function can be used to determine whether the item is + hidden. To hide an item, use setHidden(). - The isHidden() function can be used to determine whether the - item is hidden. Items can be hidden with setHidden(). \section1 Subclassing When subclassing QListWidgetItem to provide custom items, it is possible to - define new types for them so that they can be distinguished from standard - items. The constructors for subclasses that require this feature need to - call the base class constructor with a new type value equal to or greater - than \l UserType. + define new types for them enabling them to be distinguished from standard + items. For subclasses that require this feature, ensure that you call the + base class constructor with a new type value equal to or greater than + \l UserType, within \e your constructor. \sa QListWidget, {Model/View Programming}, QTreeWidgetItem, QTableWidgetItem */ @@ -515,59 +516,58 @@ Qt::DropActions QListModel::supportedDropActions() const /*! \fn QListWidget *QListWidgetItem::listWidget() const - Returns the list widget that contains the item. + Returns the list widget containing the item. */ /*! - \fn void QListWidgetItem::setSelected(bool select) - \since 4.2 + \fn void QListWidgetItem::setSelected(bool select) + \since 4.2 - Sets the selected state of the item to \a select. + Sets the selected state of the item to \a select. - \sa isSelected() + \sa isSelected() */ /*! - \fn bool QListWidgetItem::isSelected() const - \since 4.2 + \fn bool QListWidgetItem::isSelected() const + \since 4.2 - Returns true if the item is selected, otherwise returns false. + Returns true if the item is selected; otherwise returns false. - \sa setSelected() + \sa setSelected() */ /*! - \fn void QListWidgetItem::setHidden(bool hide) - \since 4.2 + \fn void QListWidgetItem::setHidden(bool hide) + \since 4.2 - Hides the item if \a hide is true, otherwise shows the item. + Hides the item if \a hide is true; otherwise shows the item. - \sa isHidden() + \sa isHidden() */ /*! - \fn bool QListWidgetItem::isHidden() const - \since 4.2 + \fn bool QListWidgetItem::isHidden() const + \since 4.2 - Returns true if the item is hidden, otherwise returns false. + Returns true if the item is hidden; otherwise returns false. - \sa setHidden() + \sa setHidden() */ /*! \fn QListWidgetItem::QListWidgetItem(QListWidget *parent, int type) Constructs an empty list widget item of the specified \a type with the - given \a parent. - If the parent is not specified, the item will need to be inserted into a - list widget with QListWidget::insertItem(). - - \note that this constructor inserts this same object into the model of - the parent that is passed to the constructor. If the model is sorted then - the behavior of the insert is undetermined since the model will call - the '<' operator method on this object which has still not yet been - constructed. In this case it would be better not to specify the parent - and use the QListWidget::insertItem method to insert the item instead. + given \a parent. If \a parent is not specified, the item will need to be + inserted into a list widget with QListWidget::insertItem(). + + This constructor inserts the item into the model of the parent that is + passed to the constructor. If the model is sorted then the behavior of the + insert is undetermined since the model will call the \c '<' operator method + on the item which, at this point, is not yet constructed. To avoid the + undetermined behavior, we recommend not to specify the parent and use + QListWidget::insertItem() instead. \sa type() */ @@ -586,16 +586,15 @@ QListWidgetItem::QListWidgetItem(QListWidget *view, int type) \fn QListWidgetItem::QListWidgetItem(const QString &text, QListWidget *parent, int type) Constructs an empty list widget item of the specified \a type with the - given \a text and \a parent. - If the parent is not specified, the item will need to be inserted into a - list widget with QListWidget::insertItem(). - - \note that this constructor inserts this same object into the model of - the parent that is passed to the constructor. If the model is sorted then - the behavior of the insert is undetermined since the model will call - the '<' operator method on this object which has still not yet been - constructed. In this case it would be better not to specify the parent - and use the QListWidget::insertItem method to insert the item instead. + given \a text and \a parent. If the parent is not specified, the item will + need to be inserted into a list widget with QListWidget::insertItem(). + + This constructor inserts the item into the model of the parent that is + passed to the constructor. If the model is sorted then the behavior of the + insert is undetermined since the model will call the \c '<' operator method + on the item which, at this point, is not yet constructed. To avoid the + undetermined behavior, we recommend not to specify the parent and use + QListWidget::insertItem() instead. \sa type() */ @@ -616,17 +615,17 @@ QListWidgetItem::QListWidgetItem(const QString &text, QListWidget *view, int typ \fn QListWidgetItem::QListWidgetItem(const QIcon &icon, const QString &text, QListWidget *parent, int type) Constructs an empty list widget item of the specified \a type with the - given \a icon, \a text and \a parent. - If the parent is not specified, the item will need to be inserted into a - list widget with QListWidget::insertItem(). - - \note that this constructor inserts this same object into the model of - the parent that is passed to the constructor. If the model is sorted then - the behavior of the insert is undetermined since the model will call - the '<' operator method on this object which has still not yet been - constructed. In this case it would be better not to specify the parent - and use the QListWidget::insertItem method to insert the item instead. - + given \a icon, \a text and \a parent. If the parent is not specified, the + item will need to be inserted into a list widget with + QListWidget::insertItem(). + + This constructor inserts the item into the model of the parent that is + passed to the constructor. If the model is sorted then the behavior of the + insert is undetermined since the model will call the \c '<' operator method + on the item which, at this point, is not yet constructed. To avoid the + undetermined behavior, we recommend not to specify the parent and use + QListWidget::insertItem() instead. + \sa type() */ QListWidgetItem::QListWidgetItem(const QIcon &icon,const QString &text, @@ -645,7 +644,7 @@ QListWidgetItem::QListWidgetItem(const QIcon &icon,const QString &text, } /*! - Destroys the list item. + Destroys the list item. */ QListWidgetItem::~QListWidgetItem() { @@ -655,7 +654,7 @@ QListWidgetItem::~QListWidgetItem() } /*! - Creates an exact copy of the item. + Creates an exact copy of the item. */ QListWidgetItem *QListWidgetItem::clone() const { @@ -663,11 +662,10 @@ QListWidgetItem *QListWidgetItem::clone() const } /*! - This function sets the data for a given \a role to the given \a value (see - \l{Qt::ItemDataRole}). Reimplement this function if you need - extra roles or special behavior for certain roles. + Sets the data for a given \a role to the given \a value. Reimplement this + function if you need extra roles or special behavior for certain roles. - \sa Qt::ItemDataRole, data() + \sa Qt::ItemDataRole, data() */ void QListWidgetItem::setData(int role, const QVariant &value) { @@ -689,9 +687,10 @@ void QListWidgetItem::setData(int role, const QVariant &value) } /*! - This function returns the item's data for a given \a role (see - Qt::ItemDataRole). Reimplement this function if you need - extra roles or special behavior for certain roles. + Returns the item's data for a given \a role. Reimplement this function if + you need extra roles or special behavior for certain roles. + + \sa Qt::ItemDataRole, setData() */ QVariant QListWidgetItem::data(int role) const { @@ -703,8 +702,8 @@ QVariant QListWidgetItem::data(int role) const } /*! - Returns true if this item's text is less then \a other item's text; - otherwise returns false. + Returns true if this item's text is less then \a other item's text; + otherwise returns false. */ bool QListWidgetItem::operator<(const QListWidgetItem &other) const { @@ -740,8 +739,8 @@ void QListWidgetItem::write(QDataStream &out) const /*! \since 4.1 - Constructs a copy of \a other. Note that type() and listWidget() - are not copied. + Constructs a copy of \a other. Note that type() and listWidget() are not + copied. This function is useful when reimplementing clone(). @@ -756,8 +755,8 @@ QListWidgetItem::QListWidgetItem(const QListWidgetItem &other) } /*! - Assigns \a other's data and flags to this item. Note that type() - and listWidget() are not copied. + Assigns \a other's data and flags to this item. Note that type() and + listWidget() are not copied. This function is useful when reimplementing clone(). @@ -805,9 +804,9 @@ QDataStream &operator>>(QDataStream &in, QListWidgetItem &item) #endif // QT_NO_DATASTREAM /*! - \fn Qt::ItemFlags QListWidgetItem::flags() const + \fn Qt::ItemFlags QListWidgetItem::flags() const - Returns the item flags for this item (see \l{Qt::ItemFlags}). + Returns the item flags for this item (see \l{Qt::ItemFlags}). */ /*! @@ -851,15 +850,17 @@ QDataStream &operator>>(QDataStream &in, QListWidgetItem &item) */ /*! - \fn QFont QListWidgetItem::font() const + \fn QFont QListWidgetItem::font() const - Returns the font used to display this list item's text. + Returns the font used to display this list item's text. */ /*! - \fn int QListWidgetItem::textAlignment() const + \fn int QListWidgetItem::textAlignment() const - Returns the text alignment for the list item (see \l{Qt::AlignmentFlag}). + Returns the text alignment for the list item. + + \sa Qt::AlignmentFlag */ /*! @@ -905,26 +906,26 @@ QDataStream &operator>>(QDataStream &in, QListWidgetItem &item) */ /*! - \fn QSize QListWidgetItem::sizeHint() const - \since 4.1 + \fn QSize QListWidgetItem::sizeHint() const + \since 4.1 - Returns the size hint set for the list item. + Returns the size hint set for the list item. */ /*! - \fn void QListWidgetItem::setSizeHint(const QSize &size) - \since 4.1 + \fn void QListWidgetItem::setSizeHint(const QSize &size) + \since 4.1 - Sets the size hint for the list item to be \a size. - If no size hint is set, the item delegate will compute the - size hint based on the item data. + Sets the size hint for the list item to be \a size. If no size hint is set, + the item delegate will compute the size hint based on the item data. */ /*! - \fn void QListWidgetItem::setFlags(Qt::ItemFlags flags) + \fn void QListWidgetItem::setFlags(Qt::ItemFlags flags) - Sets the item flags for the list item to \a flags (see - \l{Qt::ItemFlags}). + Sets the item flags for the list item to \a flags. + + \sa Qt::ItemFlags */ void QListWidgetItem::setFlags(Qt::ItemFlags aflags) { itemFlags = aflags; @@ -953,10 +954,10 @@ void QListWidgetItem::setFlags(Qt::ItemFlags aflags) { \fn void QListWidgetItem::setStatusTip(const QString &statusTip) Sets the status tip for the list item to the text specified by - \a statusTip. QListWidget mouse tracking needs to be enabled for this + \a statusTip. QListWidget mouseTracking needs to be enabled for this feature to work. - \sa statusTip() setToolTip() setWhatsThis() + \sa statusTip(), setToolTip(), setWhatsThis(), QWidget::setMouseTracking() */ /*! @@ -964,29 +965,30 @@ void QListWidgetItem::setFlags(Qt::ItemFlags aflags) { Sets the tooltip for the list item to the text specified by \a toolTip. - \sa toolTip() setStatusTip() setWhatsThis() + \sa toolTip(), setStatusTip(), setWhatsThis() */ /*! \fn void QListWidgetItem::setWhatsThis(const QString &whatsThis) - Sets the "What's This?" help for the list item to the text specified - by \a whatsThis. + Sets the "What's This?" help for the list item to the text specified by + \a whatsThis. - \sa whatsThis() setStatusTip() setToolTip() + \sa whatsThis(), setStatusTip(), setToolTip() */ /*! - \fn void QListWidgetItem::setFont(const QFont &font) + \fn void QListWidgetItem::setFont(const QFont &font) - Sets the font used when painting the item to the given \a font. + Sets the font used when painting the item to the given \a font. */ /*! - \fn void QListWidgetItem::setTextAlignment(int alignment) + \fn void QListWidgetItem::setTextAlignment(int alignment) + + Sets the list item's text alignment to \a alignment. - Sets the list item's text alignment to \a alignment (see - \l{Qt::AlignmentFlag}). + \sa Qt::AlignmentFlag */ /*! @@ -1127,10 +1129,10 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, \ingroup model-view \mainclass - QListWidget is a convenience class that provides a list view similar to - the one supplied by QListView, but with a classic item-based interface - for adding and removing items. QListWidget uses an internal model to - manage each QListWidgetItem in the list. + QListWidget is a convenience class that provides a list view similar to the + one supplied by QListView, but with a classic item-based interface for + adding and removing items. QListWidget uses an internal model to manage + each QListWidgetItem in the list. For a more flexible list view widget, use the QListView class with a standard model. @@ -1145,23 +1147,23 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, function. There are two ways to add items to the list: they can be constructed with - the list widget as their parent widget, or they can be constructed with - no parent widget and added to the list later. If a list widget already - exists when the items are constructed, the first method is easier to use: + the list widget as their parent widget, or they can be constructed with no + parent widget and added to the list later. If a list widget already exists + when the items are constructed, the first method is easier to use: \snippet doc/src/snippets/qlistwidget-using/mainwindow.cpp 1 - If you need to insert a new item into the list at a particular position, - it is more required to construct the item without a parent widget and - use the insertItem() function to place it within the list. The list - widget will take ownership of the item. + If you need to insert a new item into the list at a particular position, it + is more required to construct the item without a parent widget and use the + insertItem() function to place it within the list. The list widget will + take ownership of the item. \snippet doc/src/snippets/qlistwidget-using/mainwindow.cpp 6 \snippet doc/src/snippets/qlistwidget-using/mainwindow.cpp 7 - For multiple items, insertItems() can be used instead. The number of - items in the list is found with the count() function. - To remove items from the list, use takeItem(). + For multiple items, insertItems() can be used instead. The number of items + in the list is found with the count() function. To remove items from the + list, use takeItem(). The current item in the list can be found with currentItem(), and changed with setCurrentItem(). The user can also change the current item by @@ -1187,9 +1189,9 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, Inserts the \a item at the end of the list widget. - \warning A QListWidgetItem can only be added to a - QListWidget once. Adding the same QListWidgetItem multiple - times to a QListWidget will result in undefined behavior. + \warning A QListWidgetItem can only be added to a QListWidget once. Adding + the same QListWidgetItem multiple times to a QListWidget will result in + undefined behavior. \sa insertItem() */ @@ -1197,8 +1199,7 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, /*! \fn void QListWidget::addItem(const QString &label) - Inserts an item with the text \a label at the end of the list - widget. + Inserts an item with the text \a label at the end of the list widget. */ /*! @@ -1212,8 +1213,8 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, /*! \fn void QListWidget::itemPressed(QListWidgetItem *item) - This signal is emitted with the specified \a item when a mouse button is pressed - on an item in the widget. + This signal is emitted with the specified \a item when a mouse button is + pressed on an item in the widget. \sa itemClicked(), itemDoubleClicked() */ @@ -1221,8 +1222,8 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, /*! \fn void QListWidget::itemClicked(QListWidgetItem *item) - This signal is emitted with the specified \a item when a mouse button is clicked - on an item in the widget. + This signal is emitted with the specified \a item when a mouse button is + clicked on an item in the widget. \sa itemPressed(), itemDoubleClicked() */ @@ -1230,8 +1231,8 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, /*! \fn void QListWidget::itemDoubleClicked(QListWidgetItem *item) - This signal is emitted with the specified \a item when a mouse button is double - clicked on an item in the widget. + This signal is emitted with the specified \a item when a mouse button is + double clicked on an item in the widget. \sa itemClicked(), itemPressed() */ @@ -1239,20 +1240,21 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, /*! \fn void QListWidget::itemActivated(QListWidgetItem *item) - This signal is emitted when the \a item is activated. The \a item - is activated when the user clicks or double clicks on it, - depending on the system configuration. It is also activated when - the user presses the activation key (on Windows and X11 this is - the \gui Return key, on Mac OS X it is \key{Ctrl+0}). + This signal is emitted when the \a item is activated. The \a item is + activated when the user clicks or double clicks on it, depending on the + system configuration. It is also activated when the user presses the + activation key (on Windows and X11 this is the \gui Return key, on Mac OS + X it is \key{Ctrl+0}). */ /*! \fn void QListWidget::itemEntered(QListWidgetItem *item) - This signal is emitted when the mouse cursor enters an item. The - \a item is the item entered. This signal is only emitted when - mouseTracking is turned on, or when a mouse button is pressed - while moving into an item. + This signal is emitted when the mouse cursor enters an item. The \a item is + the item entered. This signal is only emitted when mouseTracking is turned + on, or when a mouse button is pressed while moving into an item. + + \sa QWidget::setMouseTracking() */ /*! @@ -1264,24 +1266,28 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, /*! \fn void QListWidget::currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous) - This signal is emitted whenever the current item changes. The \a - previous item is the item that previously had the focus, \a - current is the new current item. + This signal is emitted whenever the current item changes. + + \a previous is the item that previously had the focus; \a current is the + new current item. */ /*! - \fn void QListWidget::currentTextChanged(const QString ¤tText) + \fn void QListWidget::currentTextChanged(const QString ¤tText) - This signal is emitted whenever the current item changes. The \a currentText - is the text data in the current item. If there is no current item, the \a currentText - is invalid. + This signal is emitted whenever the current item changes. + + \a currentText is the text data in the current item. If there is no current + item, the \a currentText is invalid. */ /*! - \fn void QListWidget::currentRowChanged(int currentRow) + \fn void QListWidget::currentRowChanged(int currentRow) + + This signal is emitted whenever the current item changes. - This signal is emitted whenever the current item changes. The \a currentRow - is the row of the current item. If there is no current item, the \a currentRow is -1. + \a currentRow is the row of the current item. If there is no current item, + the \a currentRow is -1. */ /*! @@ -1289,15 +1295,15 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, This signal is emitted whenever the selection changes. - \sa selectedItems() QListWidgetItem::isSelected() currentItemChanged() + \sa selectedItems(), QListWidgetItem::isSelected(), currentItemChanged() */ /*! - \since 4.3 + \since 4.3 - \fn void QListWidget::removeItemWidget(QListWidgetItem *item) + \fn void QListWidget::removeItemWidget(QListWidgetItem *item) - Removes the widget set on the given \a item. + Removes the widget set on the given \a item. */ /*! @@ -1361,8 +1367,8 @@ void QListWidget::insertItem(int row, QListWidgetItem *item) } /*! - Inserts an item with the text \a label in the list widget at the - position given by \a row. + Inserts an item with the text \a label in the list widget at the position + given by \a row. \sa addItem() */ @@ -1387,11 +1393,11 @@ void QListWidget::insertItems(int row, const QStringList &labels) } /*! - Removes and returns the item from the given \a row in the list widget; otherwise - returns 0. + Removes and returns the item from the given \a row in the list widget; + otherwise returns 0. - Items removed from a list widget will not be managed by Qt, and will need to be - deleted manually. + Items removed from a list widget will not be managed by Qt, and will need + to be deleted manually. \sa insertItem(), addItem() */ @@ -1405,8 +1411,8 @@ QListWidgetItem *QListWidget::takeItem(int row) } /*! - \property QListWidget::count - \brief the number of items in the list including any hidden items. + \property QListWidget::count + \brief the number of items in the list including any hidden items. */ int QListWidget::count() const @@ -1416,7 +1422,7 @@ int QListWidget::count() const } /*! - Returns the current item. + Returns the current item. */ QListWidgetItem *QListWidget::currentItem() const { @@ -1426,9 +1432,9 @@ QListWidgetItem *QListWidget::currentItem() const /*! - Sets the current item to \a item. + Sets the current item to \a item. - Depending on the current selection mode, the item may also be selected. + Depending on the current selection mode, the item may also be selected. */ void QListWidget::setCurrentItem(QListWidgetItem *item) { @@ -1436,8 +1442,8 @@ void QListWidget::setCurrentItem(QListWidgetItem *item) } /*! - \since 4.4 - Set the current item to \a item, using the given \a command. + \since 4.4 + Set the current item to \a item, using the given \a command. */ void QListWidget::setCurrentItem(QListWidgetItem *item, QItemSelectionModel::SelectionFlags command) { @@ -1445,10 +1451,10 @@ void QListWidget::setCurrentItem(QListWidgetItem *item, QItemSelectionModel::Sel } /*! - \property QListWidget::currentRow - \brief the row of the current item. + \property QListWidget::currentRow + \brief the row of the current item. - Depending on the current selection mode, the row may also be selected. + Depending on the current selection mode, the row may also be selected. */ int QListWidget::currentRow() const @@ -1469,9 +1475,9 @@ void QListWidget::setCurrentRow(int row) } /*! - \since 4.4 + \since 4.4 - Sets the current row to be the given \a row, using the given \a command, + Sets the current row to be the given \a row, using the given \a command, */ void QListWidget::setCurrentRow(int row, QItemSelectionModel::SelectionFlags command) { @@ -1498,7 +1504,7 @@ QListWidgetItem *QListWidget::itemAt(const QPoint &p) const /*! - Returns the rectangle on the viewport occupied by the item at \a item. + Returns the rectangle on the viewport occupied by the item at \a item. */ QRect QListWidget::visualItemRect(const QListWidgetItem *item) const { @@ -1508,7 +1514,7 @@ QRect QListWidget::visualItemRect(const QListWidgetItem *item) const } /*! - Sorts all the items in the list widget according to the specified \a order. + Sorts all the items in the list widget according to the specified \a order. */ void QListWidget::sortItems(Qt::SortOrder order) { @@ -1522,8 +1528,10 @@ void QListWidget::sortItems(Qt::SortOrder order) \property QListWidget::sortingEnabled \brief whether sorting is enabled - If this property is true, sorting is enabled for the list; if the - property is false, sorting is not enabled. The default value is false. + If this property is true, sorting is enabled for the list; if the property + is false, sorting is not enabled. + + The default value is false. */ void QListWidget::setSortingEnabled(bool enable) { @@ -1538,7 +1546,7 @@ bool QListWidget::isSortingEnabled() const } /*! - \internal + \internal */ Qt::SortOrder QListWidget::sortOrder() const { @@ -1547,7 +1555,7 @@ Qt::SortOrder QListWidget::sortOrder() const } /*! - Starts editing the \a item if it is editable. + Starts editing the \a item if it is editable. */ void QListWidget::editItem(QListWidgetItem *item) @@ -1557,9 +1565,10 @@ void QListWidget::editItem(QListWidgetItem *item) } /*! - Opens an editor for the given \a item. The editor remains open after editing. + Opens an editor for the given \a item. The editor remains open after + editing. - \sa closePersistentEditor() + \sa closePersistentEditor() */ void QListWidget::openPersistentEditor(QListWidgetItem *item) { @@ -1569,9 +1578,9 @@ void QListWidget::openPersistentEditor(QListWidgetItem *item) } /*! - Closes the persistent editor for the given \a item. + Closes the persistent editor for the given \a item. - \sa openPersistentEditor() + \sa openPersistentEditor() */ void QListWidget::closePersistentEditor(QListWidgetItem *item) { @@ -1597,9 +1606,10 @@ QWidget *QListWidget::itemWidget(QListWidgetItem *item) const Sets the \a widget to be displayed in the give \a item. - This function should only be used to display static content in the place of a list - widget item. If you want to display custom dynamic content or implement a custom - editor widget, use QListView and subclass QItemDelegate instead. + This function should only be used to display static content in the place of + a list widget item. If you want to display custom dynamic content or + implement a custom editor widget, use QListView and subclass QItemDelegate + instead. \sa {Delegate Classes} */ @@ -1611,11 +1621,11 @@ void QListWidget::setItemWidget(QListWidgetItem *item, QWidget *widget) } /*! - Returns true if \a item is selected; otherwise returns false. + Returns true if \a item is selected; otherwise returns false. - \obsolete + \obsolete - This function is deprecated. Use \l{QListWidgetItem::isSelected()} instead. + This function is deprecated. Use QListWidgetItem::isSelected() instead. */ bool QListWidget::isItemSelected(const QListWidgetItem *item) const { @@ -1625,12 +1635,12 @@ bool QListWidget::isItemSelected(const QListWidgetItem *item) const } /*! - Selects or deselects the given \a item depending on whether \a select is - true of false. + Selects or deselects the given \a item depending on whether \a select is + true of false. - \obsolete + \obsolete - This function is deprecated. Use \l{QListWidgetItem::setSelected()} instead. + This function is deprecated. Use QListWidgetItem::setSelected() instead. */ void QListWidget::setItemSelected(const QListWidgetItem *item, bool select) { @@ -1650,7 +1660,7 @@ void QListWidget::setItemSelected(const QListWidgetItem *item, bool select) } /*! - Returns a list of all selected items in the list widget. + Returns a list of all selected items in the list widget. */ QList<QListWidgetItem*> QListWidget::selectedItems() const @@ -1664,7 +1674,8 @@ QList<QListWidgetItem*> QListWidget::selectedItems() const } /*! - Finds items with the text that matches the string \a text using the given \a flags. + Finds items with the text that matches the string \a text using the given + \a flags. */ QList<QListWidgetItem*> QListWidget::findItems(const QString &text, Qt::MatchFlags flags) const @@ -1679,11 +1690,11 @@ QList<QListWidgetItem*> QListWidget::findItems(const QString &text, Qt::MatchFla } /*! - Returns true if the \a item is explicitly hidden; otherwise returns false. + Returns true if the \a item is explicitly hidden; otherwise returns false. - \obsolete + \obsolete - This function is deprecated. Use \l{QListWidgetItem::isHidden()} instead. + This function is deprecated. Use QListWidgetItem::isHidden() instead. */ bool QListWidget::isItemHidden(const QListWidgetItem *item) const { @@ -1691,11 +1702,11 @@ bool QListWidget::isItemHidden(const QListWidgetItem *item) const } /*! - If \a hide is true, the \a item will be hidden; otherwise it will be shown. + If \a hide is true, the \a item will be hidden; otherwise it will be shown. - \obsolete + \obsolete - This function is deprecated. Use \l{QListWidgetItem::setHidden()} instead. + This function is deprecated. Use QListWidgetItem::setHidden() instead. */ void QListWidget::setItemHidden(const QListWidgetItem *item, bool hide) { @@ -1703,9 +1714,9 @@ void QListWidget::setItemHidden(const QListWidgetItem *item, bool hide) } /*! - Scrolls the view if necessary to ensure that the \a item is - visible. The \a hint parameter specifies more precisely where the - \a item should be located after the operation. + Scrolls the view if necessary to ensure that the \a item is visible. + + \a hint specifies where the \a item should be located after the operation. */ void QListWidget::scrollToItem(const QListWidgetItem *item, QAbstractItemView::ScrollHint hint) @@ -1718,7 +1729,7 @@ void QListWidget::scrollToItem(const QListWidgetItem *item, QAbstractItemView::S /*! Removes all items and selections in the view. - \note All items will be permanently deleted. + \warning All items will be permanently deleted. */ void QListWidget::clear() { @@ -1743,8 +1754,8 @@ QStringList QListWidget::mimeTypes() const \a items. The format used to describe the items is obtained from the mimeTypes() function. - If the list of items is empty, 0 is returned rather than a serialized - empty list. + If the list of items is empty, 0 is returned instead of a serialized empty + list. */ QMimeData *QListWidget::mimeData(const QList<QListWidgetItem*>) const { @@ -1753,10 +1764,9 @@ QMimeData *QListWidget::mimeData(const QList<QListWidgetItem*>) const #ifndef QT_NO_DRAGANDDROP /*! - Handles the \a data supplied by an external drag and drop operation - that ended with the given \a action in the given \a index. - Returns true if the data and action can be handled by the model; - otherwise returns false. + Handles \a data supplied by an external drag and drop operation that ended + with the given \a action in the given \a index. Returns true if \a data and + \a action can be handled by the model; otherwise returns false. \sa supportedDropActions() */ @@ -1823,9 +1833,9 @@ void QListWidget::dropEvent(QDropEvent *event) { } /*! - Returns the drop actions supported by this view. + Returns the drop actions supported by this view. - \sa Qt::DropActions + \sa Qt::DropActions */ Qt::DropActions QListWidget::supportedDropActions() const { @@ -1835,9 +1845,9 @@ Qt::DropActions QListWidget::supportedDropActions() const #endif // QT_NO_DRAGANDDROP /*! - Returns a list of pointers to the items contained in the \a data object. - If the object was not created by a QListWidget in the same process, the list - is empty. + Returns a list of pointers to the items contained in the \a data object. If + the object was not created by a QListWidget in the same process, the list + is empty. */ QList<QListWidgetItem*> QListWidget::items(const QMimeData *data) const { @@ -1848,7 +1858,7 @@ QList<QListWidgetItem*> QListWidget::items(const QMimeData *data) const } /*! - Returns the QModelIndex assocated with the given \a item. + Returns the QModelIndex assocated with the given \a item. */ QModelIndex QListWidget::indexFromItem(QListWidgetItem *item) const @@ -1858,7 +1868,7 @@ QModelIndex QListWidget::indexFromItem(QListWidgetItem *item) const } /*! - Returns a pointer to the QListWidgetItem assocated with the given \a index. + Returns a pointer to the QListWidgetItem assocated with the given \a index. */ QListWidgetItem *QListWidget::itemFromIndex(const QModelIndex &index) const @@ -1870,7 +1880,7 @@ QListWidgetItem *QListWidget::itemFromIndex(const QModelIndex &index) const } /*! - \internal + \internal */ void QListWidget::setModel(QAbstractItemModel * /*model*/) { diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/gui/itemviews/qstandarditemmodel.cpp index e71d8f9..6f99fb5 100644 --- a/src/gui/itemviews/qstandarditemmodel.cpp +++ b/src/gui/itemviews/qstandarditemmodel.cpp @@ -1745,15 +1745,17 @@ QList<QStandardItem*> QStandardItem::takeRow(int row) if (d->model) d->model->d_func()->rowsAboutToBeRemoved(this, row, row); QList<QStandardItem*> items; - int index = d->childIndex(row, 0); - int col_count = d->columnCount(); - for (int column = 0; column < col_count; ++column) { - QStandardItem *ch = d->children.at(index + column); - if (ch) - ch->d_func()->setParentAndModel(0, 0); - items.append(ch); + int index = d->childIndex(row, 0); // Will return -1 if there are no columns + if (index != -1) { + int col_count = d->columnCount(); + for (int column = 0; column < col_count; ++column) { + QStandardItem *ch = d->children.at(index + column); + if (ch) + ch->d_func()->setParentAndModel(0, 0); + items.append(ch); + } + d->children.remove(index, col_count); } - d->children.remove(index, col_count); d->rows--; if (d->model) d->model->d_func()->rowsRemoved(this, row, 1); diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index e6eff6e..d9deefe 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -100,7 +100,8 @@ unix:x11 { INCLUDEPATH += ../3rdparty/xorg HEADERS += \ kernel/qx11embed_x11.h \ - kernel/qx11info_x11.h + kernel/qx11info_x11.h \ + kernel/qkde_p.h SOURCES += \ kernel/qapplication_x11.cpp \ @@ -114,7 +115,8 @@ unix:x11 { kernel/qwidgetcreate_x11.cpp \ kernel/qx11embed_x11.cpp \ kernel/qx11info_x11.cpp \ - kernel/qkeymapper_x11.cpp + kernel/qkeymapper_x11.cpp \ + kernel/qkde.cpp contains(QT_CONFIG, glib) { SOURCES += \ diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 595f220..c4ce2ea 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -234,6 +234,8 @@ typedef struct tagGESTUREINFO # define GC_PAN_WITH_SINGLE_FINGER_VERTICALLY 0x00000002 # define GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY 0x00000004 +# define GC_ZOOM 0x00000001 + typedef struct tagGESTURECONFIG { DWORD dwID; @@ -247,11 +249,12 @@ typedef struct tagGESTURECONFIG class QPanGesture; class QPinchGesture; -struct StandardGestures +struct QStandardGestures { QPanGesture *pan; QPinchGesture *pinch; - StandardGestures() : pan(0), pinch(0) { } + + QStandardGestures() : pan(0), pinch(0) { } }; @@ -281,7 +284,6 @@ public: #if defined(Q_WS_X11) #ifndef QT_NO_SETTINGS - static QString kdeHome(); static QString x11_desktop_style(); static bool x11_apply_settings(); #endif @@ -513,6 +515,9 @@ public: QTouchEvent::DeviceType deviceType, const QList<QTouchEvent::TouchPoint> &touchPoints); + typedef QMap<QWidget*, QStandardGestures> WidgetStandardGesturesMap; + WidgetStandardGesturesMap widgetGestures; + #if defined(Q_WS_WIN) static PtrRegisterTouchWindow RegisterTouchWindow; static PtrGetTouchInputInfo GetTouchInputInfo; @@ -522,10 +527,6 @@ public: QList<QTouchEvent::TouchPoint> appAllTouchPoints; bool translateTouchEvent(const MSG &msg); - typedef QMap<QWidget*, StandardGestures> WidgetStandardGesturesMap; - WidgetStandardGesturesMap widgetGestures; - ulong lastGestureId; - PtrGetGestureInfo GetGestureInfo; PtrGetGestureExtraArgs GetGestureExtraArgs; PtrCloseGestureInfoHandle CloseGestureInfoHandle; diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 2bded5c..bdee6ec 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -815,8 +815,6 @@ void qt_init(QApplicationPrivate *priv, int) ptrSetProcessDPIAware(); #endif - priv->lastGestureId = 0; - priv->GetGestureInfo = (PtrGetGestureInfo)QLibrary::resolve(QLatin1String("user32"), "GetGestureInfo"); @@ -3718,13 +3716,8 @@ bool QETWidget::translateCloseEvent(const MSG &) bool QETWidget::translateGestureEvent(const MSG &msg) { GESTUREINFO gi; + memset(&gi, 0, sizeof(GESTUREINFO)); gi.cbSize = sizeof(GESTUREINFO); - gi.dwFlags = 0; - gi.ptsLocation.x = 0; - gi.ptsLocation.y = 0; - gi.dwID = 0; - gi.dwInstanceID = 0; - gi.dwSequenceID = 0; QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); BOOL bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi); @@ -3747,7 +3740,7 @@ bool QETWidget::translateGestureEvent(const MSG &msg) event.gestureType = QNativeGestureEvent::GestureEnd; break; case GID_ZOOM: - event.gestureType = QNativeGestureEvent::Pinch; + event.gestureType = QNativeGestureEvent::Zoom; break; case GID_PAN: event.gestureType = QNativeGestureEvent::Pan; @@ -3758,6 +3751,7 @@ bool QETWidget::translateGestureEvent(const MSG &msg) default: break; } + qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam); if (event.gestureType != QNativeGestureEvent::None) qt_sendSpontaneousEvent(widget, &event); } else { @@ -3765,7 +3759,6 @@ bool QETWidget::translateGestureEvent(const MSG &msg) if (dwErr > 0) qWarning() << "translateGestureEvent: error = " << dwErr; } - qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam); return true; } diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 4016563..32e7e3c 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -83,6 +83,7 @@ #include "qtimer.h" #include "qlibrary.h" #include <private/qgraphicssystemfactory_p.h> +#include "qkde_p.h" #if !defined (QT_NO_TABLET) extern "C" { @@ -813,33 +814,6 @@ Q_GUI_EXPORT void qt_x11_apply_settings_in_all_apps() PropModeReplace, (unsigned char *)stamp.data(), stamp.size()); } -static int kdeSessionVersion() -{ - static int kdeVersion = 0; - if (!kdeVersion) - kdeVersion = QString::fromLocal8Bit(qgetenv("KDE_SESSION_VERSION")).toInt(); - return kdeVersion; -} - -/*! \internal - Gets the current KDE 3 or 4 home path -*/ -QString QApplicationPrivate::kdeHome() -{ - static QString kdeHomePath; - if (kdeHomePath.isEmpty()) { - kdeHomePath = QString::fromLocal8Bit(qgetenv("KDEHOME")); - if (kdeHomePath.isEmpty()) { - QDir homeDir(QDir::homePath()); - QString kdeConfDir(QLatin1String("/.kde")); - if (4 == kdeSessionVersion() && homeDir.exists(QLatin1String(".kde4"))) - kdeConfDir = QLatin1String("/.kde4"); - kdeHomePath = QDir::homePath() + kdeConfDir; - } - } - return kdeHomePath; -} - /*! \internal apply the settings to the application */ @@ -905,8 +879,8 @@ bool QApplicationPrivate::x11_apply_settings() QFont font(QApplication::font()); QString fontDescription; // Override Qt font if KDE4 settings can be used - if (4 == kdeSessionVersion()) { - QSettings kdeSettings(kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); + if (X11->desktopEnvironment == DE_KDE && X11->desktopVersion >= 4) { + QSettings kdeSettings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); fontDescription = kdeSettings.value(QLatin1String("font")).toString(); if (fontDescription.isEmpty()) { // KDE stores fonts without quotes @@ -936,7 +910,6 @@ bool QApplicationPrivate::x11_apply_settings() // read new QStyle QString stylename = settings.value(QLatin1String("style")).toString(); - if (stylename.isEmpty() && QApplicationPrivate::styleOverride.isNull() && X11->use_xrender) { stylename = x11_desktop_style(); } @@ -1094,22 +1067,6 @@ static void qt_set_input_encoding() XFree((char *)data); } -// Reads a KDE color setting -static QColor kdeColor(const QString &key, const QSettings &kdeSettings) -{ - QVariant variant = kdeSettings.value(key); - if (variant.isValid()) { - QStringList values = variant.toStringList(); - if (values.size() == 3) { - int r = values[0].toInt(); - int g = values[1].toInt(); - int b = values[2].toInt(); - return QColor(r, g, b); - } - } - return QColor(); -} - // set font, foreground and background from x11 resources. The // arguments may override the resource settings. static void qt_set_x11_resources(const char* font = 0, const char* fg = 0, @@ -1276,9 +1233,10 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0, QApplicationPrivate::setSystemFont(fnt); } + // QGtkStyle sets it's own system palette + bool gtkStyle = QApplicationPrivate::app_style && QApplicationPrivate::app_style->inherits("QGtkStyle"); bool kdeColors = (QApplication::desktopSettingsAware() && X11->desktopEnvironment == DE_KDE); - - if (kdeColors || (button || !resBG.isEmpty() || !resFG.isEmpty())) {// set app colors + if (!gtkStyle && (kdeColors || (button || !resBG.isEmpty() || !resFG.isEmpty()))) {// set app colors bool allowX11ColorNames = QColor::allowX11ColorNames(); QColor::setAllowX11ColorNames(true); @@ -1314,45 +1272,6 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0, bright_mode = true; } - if (kdeColors) { - const QSettings theKdeSettings( - QApplicationPrivate::kdeHome() - + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); - - // Setup KDE palette - QColor color; - color = kdeColor(QLatin1String("buttonBackground"), theKdeSettings); - if (!color.isValid()) - color = kdeColor(QLatin1String("Colors:Button/BackgroundNormal"), theKdeSettings); - if (color.isValid()) - btn = color; - - color = kdeColor(QLatin1String("background"), theKdeSettings); - if (!color.isValid()) - color = kdeColor(QLatin1String("Colors:Window/BackgroundNormal"), theKdeSettings); - if (color.isValid()) - bg = color; - - color = kdeColor(QLatin1String("foreground"), theKdeSettings); - if (!color.isValid()) - color = kdeColor(QLatin1String("Colors:View/ForegroundNormal"), theKdeSettings); - if (color.isValid()) { - fg = color; - } - - color = kdeColor(QLatin1String("windowForeground"), theKdeSettings); - if (!color.isValid()) - color = kdeColor(QLatin1String("Colors:Window/ForegroundNormal"), theKdeSettings); - if (color.isValid()) - wfg = color; - - color = kdeColor(QLatin1String("windowBackground"), theKdeSettings); - if (!color.isValid()) - color = kdeColor(QLatin1String("Colors:View/BackgroundNormal"), theKdeSettings); - if (color.isValid()) - base = color; - } - QPalette pal(fg, btn, btn.lighter(125), btn.darker(130), btn.darker(120), wfg.isValid() ? wfg : fg, Qt::white, base, bg); QColor disabled((fg.red() + btn.red()) / 2, (fg.green() + btn.green())/ 2, @@ -1365,50 +1284,6 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0, highlight = QColor(selectBackground); highlightText = QColor(selectForeground); } - // Use KDE3 or KDE4 color settings if present - if (kdeColors) { - const QSettings theKdeSettings( - QApplicationPrivate::kdeHome() - + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); - - QColor color = kdeColor(QLatin1String("selectBackground"), theKdeSettings); - if (!color.isValid()) - color = kdeColor(QLatin1String("Colors:Selection/BackgroundNormal"), theKdeSettings); - if (color.isValid()) - highlight = color; - - color = kdeColor(QLatin1String("selectForeground"), theKdeSettings); - if (!color.isValid()) - color = kdeColor(QLatin1String("Colors:Selection/ForegroundNormal"), theKdeSettings); - if (color.isValid()) - highlightText = color; - - color = kdeColor(QLatin1String("alternateBackground"), theKdeSettings); - if (!color.isValid()) - color = kdeColor(QLatin1String("Colors:View/BackgroundAlternate"), theKdeSettings); - if (color.isValid()) - pal.setColor(QPalette::AlternateBase, color); - else - pal.setBrush(QPalette::AlternateBase, pal.base().color().darker(110)); - - color = kdeColor(QLatin1String("buttonForeground"), theKdeSettings); - if (!color.isValid()) - color = kdeColor(QLatin1String("Colors:Button/ForegroundNormal"), theKdeSettings); - if (color.isValid()) - pal.setColor(QPalette::ButtonText, color); - - color = kdeColor(QLatin1String("linkColor"), theKdeSettings); - if (!color.isValid()) - color = kdeColor(QLatin1String("Colors:View/ForegroundLink"), theKdeSettings); - if (color.isValid()) - pal.setColor(QPalette::Link, color); - - color = kdeColor(QLatin1String("visitedLinkColor"), theKdeSettings); - if (!color.isValid()) - color = kdeColor(QLatin1String("Colors:View/ForegroundVisited"), theKdeSettings); - if (color.isValid()) - pal.setColor(QPalette::LinkVisited, color); - } if (highlight.isValid() && highlightText.isValid()) { pal.setColor(QPalette::Highlight, highlight); @@ -1431,10 +1306,9 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0, pal.setColor(QPalette::Disabled, QPalette::Highlight, Qt::darkBlue); } - // QGtkStyle sets it's own system palette - if (!(QApplicationPrivate::app_style && QApplicationPrivate::app_style->inherits("QGtkStyle"))) { - QApplicationPrivate::setSystemPalette(pal); - } + if (kdeColors) + pal = QKde::kdePalette().resolve(pal); + QApplicationPrivate::setSystemPalette(pal); QColor::setAllowX11ColorNames(allowX11ColorNames); } @@ -2315,6 +2189,7 @@ void qt_init(QApplicationPrivate *priv, int, X11->compositingManagerRunning = XGetSelectionOwner(X11->display, ATOM(_NET_WM_CM_S0)); X11->desktopEnvironment = DE_UNKNOWN; + X11->desktopVersion = 0; // See if the current window manager is using the freedesktop.org spec to give its name Window windowManagerWindow = XNone; @@ -2390,6 +2265,9 @@ void qt_init(QApplicationPrivate *priv, int, XFree((char *)data); } + if (X11->desktopEnvironment == DE_KDE) + X11->desktopVersion = QString::fromLocal8Bit(qgetenv("KDE_SESSION_VERSION")).toInt(); + qt_set_input_encoding(); qt_set_x11_resources(appFont, appFGCol, appBGCol, appBTNCol); @@ -2657,44 +2535,30 @@ void qt_init(QApplicationPrivate *priv, int, QString QApplicationPrivate::x11_desktop_style() { QString stylename; - QStringList availableStyles = QStyleFactory::keys(); - // Override Qt style if KDE4 settings can be used - if (4 == kdeSessionVersion()) { - QSettings kdeSettings(kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); - QString kde4Style = kdeSettings.value(QLatin1String("widgetStyle"), - QLatin1String("Oxygen")).toString(); - foreach (const QString &style, availableStyles) { - if (style.toLower() == kde4Style.toLower()) - stylename = kde4Style; - } - // Set QGtkStyle for GNOME - } else if (X11->desktopEnvironment == DE_GNOME) { + switch(X11->desktopEnvironment) { + case DE_KDE: + stylename = QKde::kdeStyle(); + break; + case DE_GNOME: { + QStringList availableStyles = QStyleFactory::keys(); + // Set QGtkStyle for GNOME if available QString gtkStyleKey = QString::fromLatin1("GTK+"); - if (availableStyles.contains(gtkStyleKey)) + if (availableStyles.contains(gtkStyleKey)) { stylename = gtkStyleKey; - } - - if (stylename.isEmpty()) { - switch(X11->desktopEnvironment) { - case DE_KDE: - if (X11->use_xrender) - stylename = QLatin1String("plastique"); - else - stylename = QLatin1String("windows"); - break; - case DE_GNOME: - if (X11->use_xrender) - stylename = QLatin1String("cleanlooks"); - else - stylename = QLatin1String("windows"); - break; - case DE_CDE: - stylename = QLatin1String("cde"); - break; - default: - // Don't do anything break; } + if (X11->use_xrender) + stylename = QLatin1String("cleanlooks"); + else + stylename = QLatin1String("windows"); + break; + } + case DE_CDE: + stylename = QLatin1String("cde"); + break; + default: + // Don't do anything + break; } return stylename; } diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 1d352cb..8c6f394 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -50,6 +50,7 @@ #include <private/qdnd_p.h> #include <private/qmacinputcontext_p.h> #include <private/qmultitouch_mac_p.h> +#include <private/qevent_p.h> #include <qscrollarea.h> #include <qhash.h> @@ -868,32 +869,65 @@ extern "C" { - (void)magnifyWithEvent:(NSEvent *)event; { - Q_UNUSED(event); -// qDebug() << "magnifyWithEvent"; + if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) + return; + + QNativeGestureEvent qNGEvent; + qNGEvent.gestureType = QNativeGestureEvent::Zoom; + NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]]; + qNGEvent.position = flipPoint(p).toPoint(); + qNGEvent.percentage = [event magnification]; + qApp->sendEvent(qwidget, &qNGEvent); } - (void)rotateWithEvent:(NSEvent *)event; { - Q_UNUSED(event); -// qDebug() << "rotateWithEvent"; + if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) + return; + + QNativeGestureEvent qNGEvent; + qNGEvent.gestureType = QNativeGestureEvent::Rotate; + NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]]; + qNGEvent.position = flipPoint(p).toPoint(); + qNGEvent.percentage = [event rotation]; + qApp->sendEvent(qwidget, &qNGEvent); } - (void)swipeWithEvent:(NSEvent *)event; { - Q_UNUSED(event); -// qDebug() << "swipeWithEvent"; + if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) + return; + + QNativeGestureEvent qNGEvent; + qNGEvent.gestureType = QNativeGestureEvent::Swipe; + NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]]; + qNGEvent.position = flipPoint(p).toPoint(); + qNGEvent.direction = QSize(-[event deltaX], -[event deltaY]); + qApp->sendEvent(qwidget, &qNGEvent); } - (void)beginGestureWithEvent:(NSEvent *)event; { - Q_UNUSED(event); -// qDebug() << "beginGestureWithEvent"; + if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) + return; + + QNativeGestureEvent qNGEvent; + qNGEvent.gestureType = QNativeGestureEvent::GestureBegin; + NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]]; + qNGEvent.position = flipPoint(p).toPoint(); + qApp->sendEvent(qwidget, &qNGEvent); } - (void)endGestureWithEvent:(NSEvent *)event; { - Q_UNUSED(event); -// qDebug() << "endGestureWithEvent"; + if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) + return; + + QNativeGestureEvent qNGEvent; + qNGEvent.gestureType = QNativeGestureEvent::GestureEnd; + NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]]; + qNGEvent.position = flipPoint(p).toPoint(); + qApp->sendEvent(qwidget, &qNGEvent); } #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 diff --git a/src/gui/kernel/qdesktopwidget_x11.cpp b/src/gui/kernel/qdesktopwidget_x11.cpp index 1555fc0..8b0c215 100644 --- a/src/gui/kernel/qdesktopwidget_x11.cpp +++ b/src/gui/kernel/qdesktopwidget_x11.cpp @@ -285,26 +285,36 @@ const QRect QDesktopWidget::availableGeometry(int screen) const if (d->workareas[screen].isValid()) return d->workareas[screen]; - if ((d->screenCount == 1 || !isVirtualDesktop()) - && X11->isSupportedByWM(ATOM(_NET_WORKAREA))) { + if (X11->isSupportedByWM(ATOM(_NET_WORKAREA))) { + int x11Screen = isVirtualDesktop() ? DefaultScreen(X11->display) : screen; + Atom ret; int format, e; unsigned char *data = 0; unsigned long nitems, after; e = XGetWindowProperty(X11->display, - QX11Info::appRootWindow(screen), - ATOM(_NET_WORKAREA), 0, 4, False, XA_CARDINAL, - &ret, &format, &nitems, &after, &data); + QX11Info::appRootWindow(x11Screen), + ATOM(_NET_WORKAREA), 0, 4, False, XA_CARDINAL, + &ret, &format, &nitems, &after, &data); + QRect workArea; if (e == Success && ret == XA_CARDINAL && format == 32 && nitems == 4) { long *workarea = (long *) data; - d->workareas[screen].setRect(workarea[0], workarea[1], - workarea[2], workarea[3]); + workArea = QRect(workarea[0], workarea[1], workarea[2], workarea[3]); } else { - d->workareas[screen] = screenGeometry(screen); + workArea = screenGeometry(screen); + } + + if (isVirtualDesktop()) { + // intersect the workarea (which spawns all Xinerama screens) with the rect for the + // requested screen + workArea &= screenGeometry(screen); } + + d->workareas[screen] = workArea; + if (data) XFree(data); } else { diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index 92c4fc1..b21b35c 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -127,11 +127,13 @@ public: GestureBegin, GestureEnd, Pan, - Pinch + Zoom, + Rotate, + Swipe }; QNativeGestureEvent() - : QEvent(QEvent::NativeGesture), gestureType(None) + : QEvent(QEvent::NativeGesture), gestureType(None), percentage(0), direction(0, 0) #ifdef Q_WS_WIN , sequenceId(0) #endif @@ -139,8 +141,10 @@ public: } Type gestureType; -#ifdef Q_WS_WIN + float percentage; QPoint position; + QSize direction; +#ifdef Q_WS_WIN ulong sequenceId; #endif }; diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 8075ad9..38e8851 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -197,11 +197,44 @@ Qt::GestureState QGesture::state() const } /*! - Sets this gesture's recognition state to \a state. + Sets this gesture's recognition state to \a state and emits appropriate + signals. + + This functions emits the signals according to the old state and the new + \a state, and it should be called after all the internal properties have been + initialized. + + \sa started, triggered, finished, cancelled */ -void QGesture::setState(Qt::GestureState state) +void QGesture::updateState(Qt::GestureState state) { - d_func()->state = state; + Q_D(QGesture); + if (d->state == state) { + if (state == Qt::GestureUpdated) + emit triggered(); + return; + } + const Qt::GestureState oldState = d->state; + d->state = state; + if (state != Qt::NoGesture && oldState > state) { + // comparing the state as ints: state should only be changed from + // started to (optionally) updated and to finished. + qWarning("QGesture::updateState: incorrect new state"); + return; + } + if (oldState == Qt::NoGesture) + emit started(); + if (state == Qt::GestureUpdated) + emit triggered(); + else if (state == Qt::GestureFinished) + emit finished(); + else if (state == Qt::NoGesture) + emit cancelled(); + + if (state == Qt::GestureFinished) { + // gesture is finished, so we reset the internal state. + d->state = Qt::NoGesture; + } } /*! @@ -238,14 +271,13 @@ QGraphicsItem* QGesture::graphicsItem() const Resets the internal state of the gesture. This function might be called by the filterEvent() implementation in a derived class, or by the user to - cancel a gesture. The base class implementation emits the cancelled() - signal if the state() of the gesture wasn't empty. + cancel a gesture. The base class implementation calls + updateState(Qt::NoGesture) which emits the cancelled() + signal if the state() of the gesture indicated it was active. */ void QGesture::reset() { - if (state() != Qt::NoGesture) - emit cancelled(); - setState(Qt::NoGesture); + updateState(Qt::NoGesture); } QT_END_NAMESPACE diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index 0735160..7da37c4 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -81,7 +81,7 @@ protected: QGesture(QGesturePrivate &dd, QObject *parent); bool eventFilter(QObject*, QEvent*); - void setState(Qt::GestureState state); + void updateState(Qt::GestureState state); Q_SIGNALS: void started(); diff --git a/src/gui/kernel/qkde.cpp b/src/gui/kernel/qkde.cpp new file mode 100644 index 0000000..96ff21e --- /dev/null +++ b/src/gui/kernel/qkde.cpp @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include "qkde_p.h" +#include <QtCore/QLibrary> +#include <QtCore/QDir> +#include <QtCore/qdebug.h> +#include <QtCore/QSettings> +#include "QtGui/qstylefactory.h" +#include "qt_x11_p.h" + +#if defined(Q_WS_X11) + +QT_BEGIN_NAMESPACE + +/*! \internal +Gets the current KDE home path +like "/home/troll/.kde" +*/ +QString QKde::kdeHome() +{ + static QString kdeHomePath; + if (kdeHomePath.isEmpty()) { + kdeHomePath = QString::fromLocal8Bit(qgetenv("KDEHOME")); + if (kdeHomePath.isEmpty()) { + QDir homeDir(QDir::homePath()); + QString kdeConfDir(QLatin1String("/.kde")); + if (4 == X11->desktopVersion && homeDir.exists(QLatin1String(".kde4"))) + kdeConfDir = QLatin1String("/.kde4"); + kdeHomePath = QDir::homePath() + kdeConfDir; + } + } + return kdeHomePath; +} + +/*!\internal + Reads the color from the config, and store it in the palette with the given color role if found + */ +static bool kdeColor(QPalette *pal, QPalette::ColorRole role, const QSettings &kdeSettings, const QString &kde4Key, const QString &kde3Key = QString()) +{ + QVariant variant = kdeSettings.value(kde4Key); + if (!variant.isValid()) + QVariant variant = kdeSettings.value(kde3Key); + if (variant.isValid()) { + QStringList values = variant.toStringList(); + if (values.size() == 3) { + int r = values[0].toInt(); + int g = values[1].toInt(); + int b = values[2].toInt(); + pal->setBrush(role, QColor(r, g, b)); + return true; + } + } + return false; +} + + +/*!\internal + Returns the KDE palette +*/ +QPalette QKde::kdePalette() +{ + const QSettings theKdeSettings(QKde::kdeHome() + + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); + QPalette pal; + + // Setup KDE palette + kdeColor(&pal, QPalette::Button, theKdeSettings, QLatin1String("Colors:Button/BackgroundNormal"), QLatin1String("buttonBackground")); + kdeColor(&pal, QPalette::Window, theKdeSettings, QLatin1String("Colors:Window/BackgroundNormal"), QLatin1String("background")); + kdeColor(&pal, QPalette::Text, theKdeSettings, QLatin1String("Colors:View/ForegroundNormal"), QLatin1String("foreground")); + kdeColor(&pal, QPalette::WindowText, theKdeSettings, QLatin1String("Colors:Window/ForegroundNormal"), QLatin1String("windowForeground")); + kdeColor(&pal, QPalette::Base, theKdeSettings, QLatin1String("Colors:View/BackgroundNormal"), QLatin1String("windowBackground")); + kdeColor(&pal, QPalette::Highlight, theKdeSettings, QLatin1String("Colors:Selection/BackgroundNormal"), QLatin1String("selectBackground")); + kdeColor(&pal, QPalette::HighlightedText, theKdeSettings, QLatin1String("Colors:Selection/ForegroundNormal"), QLatin1String("selectForeground")); + kdeColor(&pal, QPalette::AlternateBase, theKdeSettings, QLatin1String("Colors:View/BackgroundAlternate"), QLatin1String("alternateBackground")); + kdeColor(&pal, QPalette::ButtonText, theKdeSettings, QLatin1String("Colors:Button/ForegroundNormal"), QLatin1String("buttonForeground")); + kdeColor(&pal, QPalette::Link, theKdeSettings, QLatin1String("Colors:View/ForegroundLink"), QLatin1String("linkColor")); + kdeColor(&pal, QPalette::LinkVisited, theKdeSettings, QLatin1String("Colors:View/ForegroundVisited"), QLatin1String("visitedLinkColor")); + //## TODO tooltip color + + return pal; +} + +/*!\internal + Returns the name of the QStyle to use. + (read from the kde config if needed) +*/ +QString QKde::kdeStyle() +{ + if (X11->desktopVersion >= 4) { + QSettings kdeSettings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); + QString style = kdeSettings.value(QLatin1String("widgetStyle"), QLatin1String("Oxygen")).toString(); + + QStringList availableStyles = QStyleFactory::keys(); + if(availableStyles.contains(style, Qt::CaseInsensitive)) + return style; + } + + if (X11->use_xrender) + return QLatin1String("plastique"); + else + return QLatin1String("windows"); + + return QString(); +} + +/*!\internal + placeholder to load icon from kde. + to be implemented + */ +QIcon QKde::kdeIcon(const QString &name) +{ + //###todo + return QIcon(); +} + +QT_END_NAMESPACE + +#endif //Q_WS_X11 + diff --git a/src/gui/kernel/qkde_p.h b/src/gui/kernel/qkde_p.h new file mode 100644 index 0000000..ac760bd --- /dev/null +++ b/src/gui/kernel/qkde_p.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (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 either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QKDE_H +#define QKDE_H + +#include <QtCore/qglobal.h> +#include <QtGui/QPalette> +#include <QtGui/QIcon> + +// +// 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. +// +#if defined(Q_WS_X11) + + +QT_BEGIN_NAMESPACE + +// This namespace contains helper function to help KDE integration +namespace QKde { + QString kdeHome(); + QString kdeStyle(); + QPalette kdePalette(); + QIcon kdeIcon(const QString &name); +} + + +QT_END_NAMESPACE + +#endif // Q_WS_X11 +#endif // QKDE_H diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index 4753416..7078dbf 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -46,11 +46,12 @@ #include <qscrollbar.h> #include <private/qapplication_p.h> #include <private/qevent_p.h> +#include <private/qwidget_p.h> QT_BEGIN_NAMESPACE #ifdef Q_WS_WIN -QApplicationPrivate* getQApplicationPrivateInternal(); +QWidgetPrivate *qt_widget_private(QWidget *widget); #endif /*! @@ -71,32 +72,38 @@ QApplicationPrivate* getQApplicationPrivateInternal(); QPanGesture::QPanGesture(QWidget *parent) : QGesture(*new QPanGesturePrivate, parent) { -#ifdef Q_WS_WIN if (parent) { - QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); qAppPriv->widgetGestures[parent].pan = this; - } +#ifdef Q_WS_WIN + qt_widget_private(parent)->winSetupGestures(); #endif + } } /*! \internal */ bool QPanGesture::event(QEvent *event) { -#ifdef Q_WS_WIN - QApplicationPrivate* getQApplicationPrivateInternal(); switch (event->type()) { case QEvent::ParentAboutToChange: - if (QWidget *w = qobject_cast<QWidget*>(parent())) - getQApplicationPrivateInternal()->widgetGestures[w].pan = 0; + if (QWidget *w = qobject_cast<QWidget*>(parent())) { + QApplicationPrivate::instance()->widgetGestures[w].pan = 0; +#ifdef Q_WS_WIN + qt_widget_private(w)->winSetupGestures(); +#endif + } break; case QEvent::ParentChange: - if (QWidget *w = qobject_cast<QWidget*>(parent())) - getQApplicationPrivateInternal()->widgetGestures[w].pan = this; + if (QWidget *w = qobject_cast<QWidget*>(parent())) { + QApplicationPrivate::instance()->widgetGestures[w].pan = this; +#ifdef Q_WS_WIN + qt_widget_private(w)->winSetupGestures(); +#endif + } break; default: break; } -#endif #if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA) Q_D(QPanGesture); @@ -106,9 +113,7 @@ bool QPanGesture::event(QEvent *event) killTimer(d->panFinishedTimer); d->panFinishedTimer = 0; d->lastOffset = QSize(0, 0); - setState(Qt::GestureFinished); - emit triggered(); - setState(Qt::NoGesture); + updateState(Qt::GestureFinished); } } #endif @@ -119,38 +124,37 @@ bool QPanGesture::event(QEvent *event) bool QPanGesture::eventFilter(QObject *receiver, QEvent *event) { #ifdef Q_WS_WIN + Q_D(QPanGesture); if (receiver->isWidgetType() && event->type() == QEvent::NativeGesture) { QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event); - QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); QApplicationPrivate::WidgetStandardGesturesMap::iterator it; it = qAppPriv->widgetGestures.find(static_cast<QWidget*>(receiver)); if (it == qAppPriv->widgetGestures.end()) return false; QPanGesture *gesture = it.value().pan; - if (!gesture) + if (this != gesture) return false; - Qt::GestureState nextState = state(); + Qt::GestureState nextState = Qt::NoGesture; switch(ev->gestureType) { case QNativeGestureEvent::GestureBegin: // next we might receive the first gesture update event, so we // prepare for it. - setState(Qt::GestureStarted); + d->state = Qt::NoGesture; return false; case QNativeGestureEvent::Pan: nextState = Qt::GestureUpdated; + event->accept(); break; case QNativeGestureEvent::GestureEnd: - if (state() != QNativeGestureEvent::Pan) + if (state() == Qt::NoGesture) return false; // some other gesture has ended - setState(Qt::GestureFinished); nextState = Qt::GestureFinished; break; default: return false; } - QPanGesturePrivate *d = gesture->d_func(); - if (state() == Qt::GestureStarted) { - d->lastPosition = ev->position; + if (state() == Qt::NoGesture) { d->lastOffset = d->totalOffset = QSize(); } else { d->lastOffset = QSize(ev->position.x() - d->lastPosition.x(), @@ -158,14 +162,7 @@ bool QPanGesture::eventFilter(QObject *receiver, QEvent *event) d->totalOffset += d->lastOffset; } d->lastPosition = ev->position; - - if (state() == Qt::GestureStarted) - emit gesture->started(); - emit gesture->triggered(); - if (state() == Qt::GestureFinished) - emit gesture->finished(); - event->accept(); - gesture->setState(nextState); + gesture->updateState(nextState); return true; } #endif @@ -185,7 +182,6 @@ bool QPanGesture::filterEvent(QEvent *event) d->lastOffset = d->totalOffset = QSize(); } else if (event->type() == QEvent::TouchEnd) { if (state() != Qt::NoGesture) { - setState(Qt::GestureFinished); if (!ev->touchPoints().isEmpty()) { QTouchEvent::TouchPoint p = ev->touchPoints().at(0); const QPoint pos = p.pos().toPoint(); @@ -194,10 +190,8 @@ bool QPanGesture::filterEvent(QEvent *event) d->lastOffset = QSize(pos.x() - lastPos.x(), pos.y() - lastPos.y()); d->totalOffset = QSize(pos.x() - startPos.x(), pos.y() - startPos.y()); } - emit triggered(); - emit finished(); + updateState(Qt::GestureFinished); } - setState(Qt::NoGesture); reset(); } else if (event->type() == QEvent::TouchUpdate) { QTouchEvent::TouchPoint p = ev->touchPoints().at(0); @@ -208,11 +202,7 @@ bool QPanGesture::filterEvent(QEvent *event) d->totalOffset = QSize(pos.x() - startPos.x(), pos.y() - startPos.y()); if (d->totalOffset.width() > 10 || d->totalOffset.height() > 10 || d->totalOffset.width() < -10 || d->totalOffset.height() < -10) { - if (state() == Qt::NoGesture) - setState(Qt::GestureStarted); - else - setState(Qt::GestureUpdated); - emit triggered(); + updateState(Qt::GestureUpdated); } } #ifdef Q_OS_MAC @@ -231,16 +221,14 @@ bool QPanGesture::filterEvent(QEvent *event) d->lastOffset = wev->orientation() == Qt::Horizontal ? QSize(offset, 0) : QSize(0, offset); if (state() == Qt::NoGesture) { - setState(Qt::GestureStarted); d->totalOffset = d->lastOffset; } else { - setState(Qt::GestureUpdated); d->totalOffset += d->lastOffset; } killTimer(d->panFinishedTimer); d->panFinishedTimer = startTimer(200); - emit triggered(); + updateState(Qt::GestureUpdated); #endif return true; } diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h index 1ac51e0..44652d3 100644 --- a/src/gui/kernel/qt_x11_p.h +++ b/src/gui/kernel/qt_x11_p.h @@ -515,7 +515,8 @@ struct QX11Data char *startupId; - DesktopEnvironment desktopEnvironment; + DesktopEnvironment desktopEnvironment : 8; + uint desktopVersion : 8; /* Used only for KDE */ /* Warning: if you modify this list, modify the names of atoms in qapplication_x11.cpp as well! */ enum X11Atom { diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index a827967..f705761 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -3480,27 +3480,27 @@ bool QWidgetPrivate::setMinimumSize_helper(int &minw, int &minh) } } #endif + int mw = minw, mh = minh; + if (mw == QWIDGETSIZE_MAX) + mw = 0; + if (mh == QWIDGETSIZE_MAX) + mh = 0; if (minw > QWIDGETSIZE_MAX || minh > QWIDGETSIZE_MAX) { qWarning("QWidget::setMinimumSize: (%s/%s) " "The largest allowed size is (%d,%d)", q->objectName().toLocal8Bit().data(), q->metaObject()->className(), QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); - minw = qMin<int>(minw, QWIDGETSIZE_MAX); - minh = qMin<int>(minh, QWIDGETSIZE_MAX); + minw = mw = qMin<int>(minw, QWIDGETSIZE_MAX); + minh = mh = qMin<int>(minh, QWIDGETSIZE_MAX); } if (minw < 0 || minh < 0) { qWarning("QWidget::setMinimumSize: (%s/%s) Negative sizes (%d,%d) " "are not possible", q->objectName().toLocal8Bit().data(), q->metaObject()->className(), minw, minh); - minw = qMax(minw, 0); - minh = qMax(minh, 0); + minw = mw = qMax(minw, 0); + minh = mh = qMax(minh, 0); } createExtra(); - int mw = minw, mh = minh; - if (mw == QWIDGETSIZE_MAX) - mw = 0; - if (mh == QWIDGETSIZE_MAX) - mh = 0; if (extra->minw == mw && extra->minh == mh) return false; extra->minw = mw; @@ -7990,10 +7990,12 @@ void QWidget::changeEvent(QEvent * event) case QEvent::FontChange: case QEvent::StyleChange: { + Q_D(QWidget); update(); updateGeometry(); + if (d->layout) + d->layout->invalidate(); #ifdef Q_WS_QWS - Q_D(QWidget); if (isWindow()) d->data.fstrut_dirty = true; #endif @@ -11114,8 +11116,6 @@ Q_GUI_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget) } - - #ifndef QT_NO_GRAPHICSVIEW /*! \since 4.5 diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 998181e..ac145b7 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -558,6 +558,7 @@ public: #endif void grabMouseWhileInWindow(); void registerTouchWindow(); + void winSetupGestures(); #elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC // This is new stuff uint needWindowChange : 1; diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index b11b661..7cfa111 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -56,6 +56,10 @@ #include "private/qbackingstore_p.h" #include "private/qwindowsurface_raster_p.h" +#include "qscrollbar.h" +#include "qabstractscrollarea.h" +#include <private/qabstractscrollarea_p.h> + #include <qdebug.h> #include <private/qapplication_p.h> @@ -2049,6 +2053,58 @@ void QWidgetPrivate::registerTouchWindow() QApplicationPrivate::RegisterTouchWindow(q->effectiveWinId(), 0); } +void QWidgetPrivate::winSetupGestures() +{ + Q_Q(QWidget); + if (!q) + return; + extern QApplicationPrivate* getQApplicationPrivateInternal(); + QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); + bool needh = false; + bool needv = false; + bool singleFingerPanEnabled = false; + QStandardGestures gestures = qAppPriv->widgetGestures[q]; + WId winid = 0; + + if (QAbstractScrollArea *asa = qobject_cast<QAbstractScrollArea*>(q)) { + winid = asa->viewport()->winId(); + QScrollBar *hbar = asa->horizontalScrollBar(); + QScrollBar *vbar = asa->verticalScrollBar(); + Qt::ScrollBarPolicy hbarpolicy = asa->horizontalScrollBarPolicy(); + Qt::ScrollBarPolicy vbarpolicy = asa->verticalScrollBarPolicy(); + needh = (hbarpolicy == Qt::ScrollBarAlwaysOn + || (hbarpolicy == Qt::ScrollBarAsNeeded && hbar->minimum() < hbar->maximum())); + needv = (vbarpolicy == Qt::ScrollBarAlwaysOn + || (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum())); + singleFingerPanEnabled = asa->d_func()->singleFingerPanEnabled; + } else { + winid = q->winId(); + } + if (qAppPriv->SetGestureConfig) { + GESTURECONFIG gc[2]; + gc[0].dwID = GID_PAN; + if (gestures.pan || needh || needv) { + gc[0].dwWant = GC_PAN; + gc[0].dwBlock = 0; + if (needv && singleFingerPanEnabled) + gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY; + if (needh && singleFingerPanEnabled) + gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY; + } else { + gc[0].dwWant = 0; + gc[0].dwBlock = GC_PAN; + } + + gc[1].dwID = GID_ZOOM; + if (gestures.pinch) { + gc[1].dwWant = GC_ZOOM; + gc[1].dwBlock = 0; + } + Q_ASSERT(winid); + qAppPriv->SetGestureConfig(winid, 0, sizeof(gc)/sizeof(gc[0]), gc, sizeof(gc[0])); + } +} + QT_END_NAMESPACE #ifdef Q_WS_WINCE diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h index 55c871d..9a1b590 100644 --- a/src/gui/math3d/qquaternion.h +++ b/src/gui/math3d/qquaternion.h @@ -198,24 +198,17 @@ inline QQuaternion &QQuaternion::operator*=(qreal factor) inline const QQuaternion operator*(const QQuaternion &q1, const QQuaternion& q2) { - // Algorithm from: - // http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q53 - float x = q1.wp * q2.xp + - q1.xp * q2.wp + - q1.yp * q2.zp - - q1.zp * q2.yp; - float y = q1.wp * q2.yp + - q1.yp * q2.wp + - q1.zp * q2.xp - - q1.xp * q2.zp; - float z = q1.wp * q2.zp + - q1.zp * q2.wp + - q1.xp * q2.yp - - q1.yp * q2.xp; - float w = q1.wp * q2.wp - - q1.xp * q2.xp - - q1.yp * q2.yp - - q1.zp * q2.zp; + float ww = (q1.zp + q1.xp) * (q2.xp + q2.yp); + float yy = (q1.wp - q1.yp) * (q2.wp + q2.zp); + float zz = (q1.wp + q1.yp) * (q2.wp - q2.zp); + float xx = ww + yy + zz; + float qq = 0.5 * (xx + (q1.zp - q1.xp) * (q2.xp - q2.yp)); + + float w = qq - ww + (q1.zp - q1.yp) * (q2.yp - q2.zp); + float x = qq - xx + (q1.xp + q1.wp) * (q2.xp + q2.wp); + float y = qq - yy + (q1.wp - q1.xp) * (q2.yp + q2.zp); + float z = qq - zz + (q1.zp + q1.yp) * (q2.wp - q2.xp); + return QQuaternion(w, x, y, z, 1); } diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 74456dd..b260f41 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2542,6 +2542,9 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe qDebug() << " - QRasterPaintEngine::drawImage(), r=" << r << " sr=" << sr << " image=" << img.size() << "depth=" << img.depth(); #endif + if (r.isEmpty()) + return; + Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); const bool aa = s->flags.antialiased || s->flags.bilinear; diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index ba28e75..c7feb25 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -63,7 +63,7 @@ #include <qtoolbar.h> #include <qtoolbutton.h> #include <qrubberband.h> -#include <private/qapplication_p.h> +#include <../kernel/qkde_p.h> #include <private/qcommonstylepixmaps_p.h> #include <private/qmath_p.h> #include <private/qstylehelper_p.h> @@ -842,12 +842,6 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut #ifdef Q_WS_X11 // These functions are used to parse the X11 freedesktop icon spec -static int kdeVersion() -{ - static int kdeVersion = qgetenv("KDE_SESSION_VERSION").toInt(); - return kdeVersion; -} - void QCommonStylePrivate::lookupIconTheme() const { if (!themeName.isEmpty()) @@ -856,7 +850,7 @@ void QCommonStylePrivate::lookupIconTheme() const QString dataDirs = QString::fromLocal8Bit(getenv("XDG_DATA_DIRS")); if (dataDirs.isEmpty()) dataDirs = QLatin1String("/usr/local/share/:/usr/share/"); - dataDirs += QLatin1Char(':') + QApplicationPrivate::kdeHome() + QLatin1String("/share"); + dataDirs += QLatin1Char(':') + QKde::kdeHome() + QLatin1String("/share"); dataDirs.prepend(QDir::homePath() + QLatin1String("/:")); QStringList kdeDirs = QString::fromLocal8Bit(getenv("KDEDIRS")).split(QLatin1Char(':'), QString::SkipEmptyParts); foreach (const QString &dirName, kdeDirs) @@ -865,9 +859,10 @@ void QCommonStylePrivate::lookupIconTheme() const QFileInfo fileInfo(QLatin1String("/usr/share/icons/default.kde")); QDir dir(fileInfo.canonicalFilePath()); - QString kdeDefault = kdeVersion() >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg"); + QString kdeDefault = (X11->desktopEnvironment != DE_KDE || X11->desktopVersion >= 4) + ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg"); QString defaultTheme = fileInfo.exists() ? dir.dirName() : kdeDefault; - QSettings settings(QApplicationPrivate::kdeHome() + + QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); settings.beginGroup(QLatin1String("Icons")); themeName = settings.value(QLatin1String("Theme"), defaultTheme).toString(); @@ -979,8 +974,15 @@ QPixmap QCommonStylePrivate::findIconHelper(int size, return pixmap; } +/*! \internal + find a pixmap with the given size and name from the freedesktop theme. +*/ QPixmap QCommonStylePrivate::findIcon(int size, const QString &name) const { + QIcon icon = QKde::kdeIcon(name); + if (!icon.isNull()) + return icon.pixmap(size); + QPixmap pixmap; QString pixmapName = QLatin1String("$qt") + name + QString::number(size); @@ -995,12 +997,17 @@ QPixmap QCommonStylePrivate::findIcon(int size, const QString &name) const return pixmap; } +/*! \internal + create an Icon from the freedesktop theme. + */ QIcon QCommonStylePrivate::createIcon(const QString &name) const { - QIcon icon; - icon.addPixmap(findIcon(16, name)); - icon.addPixmap(findIcon(24, name)); - icon.addPixmap(findIcon(32, name)); + QIcon icon = QKde::kdeIcon(name); + if (icon.isNull()) { + icon.addPixmap(findIcon(16, name)); + icon.addPixmap(findIcon(24, name)); + icon.addPixmap(findIcon(32, name)); + } return icon; } /*!internal @@ -1012,8 +1019,8 @@ from the KDE configuration file int QCommonStylePrivate::lookupToolButtonStyle() const { int result = Qt::ToolButtonIconOnly; - if (kdeVersion() >= 4) { - QSettings settings(QApplicationPrivate::kdeHome() + + if (X11->desktopEnvironment == DE_KDE && X11->desktopVersion >= 4) { + QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); settings.beginGroup(QLatin1String("Toolbar style")); QString toolbarStyle = settings.value(QLatin1String("ToolButtonStyle"), QLatin1String("TextBesideIcon")).toString(); diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 2f93034..235cba6 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -5510,9 +5510,15 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op break; } case SC_SpinBoxEditField: - ret.setRect(fw, fw, - spin->rect.width() - spinner_w - fw * 2 - spinBoxSep, - spin->rect.height() - fw * 2); + if (spin->buttonSymbols == QAbstractSpinBox::NoButtons) { + ret.setRect(fw, fw, + spin->rect.width() - fw * 2, + spin->rect.height() - fw * 2); + } else { + ret.setRect(fw, fw, + spin->rect.width() - fw * 2 - spinBoxSep - spinner_w, + spin->rect.height() - fw * 2); + } ret = visualRect(spin->direction, spin->rect, ret); break; default: diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index dd92e17..f6c1892 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -159,7 +159,7 @@ QT_BEGIN_NAMESPACE QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate() :hbar(0), vbar(0), vbarpolicy(Qt::ScrollBarAsNeeded), hbarpolicy(Qt::ScrollBarAsNeeded), viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0), - xoffset(0), yoffset(0), viewportFilter(0) + xoffset(0), yoffset(0), viewportFilter(0), panGesture(0) #ifdef Q_WS_WIN , singleFingerPanEnabled(false) #endif @@ -294,33 +294,18 @@ void QAbstractScrollAreaPrivate::init() q->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); layoutChildren(); + + panGesture = new QPanGesture(q); + QObject::connect(panGesture, SIGNAL(triggered()), q, SLOT(_q_gestureTriggered())); } -void QAbstractScrollAreaPrivate::setupGestures() +#ifdef Q_WS_WIN +void QAbstractScrollAreaPrivate::setSingleFingerPanEnabled(bool on) { -#ifdef Q_OS_WIN - if (!viewport) - return; - QApplicationPrivate* getQApplicationPrivateInternal(); - QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal(); - bool needh = (hbarpolicy == Qt::ScrollBarAlwaysOn - || (hbarpolicy == Qt::ScrollBarAsNeeded && hbar->minimum() < hbar->maximum())); - - bool needv = (vbarpolicy == Qt::ScrollBarAlwaysOn - || (vbarpolicy == Qt::ScrollBarAsNeeded && vbar->minimum() < vbar->maximum())); - if (qAppPriv->SetGestureConfig && (needh || needv)) { - GESTURECONFIG gc[1]; - gc[0].dwID = GID_PAN; - gc[0].dwWant = GC_PAN; - gc[0].dwBlock = 0; - if (needv && singleFingerPanEnabled) - gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY; - if (needh && singleFingerPanEnabled) - gc[0].dwWant |= GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY; - qAppPriv->SetGestureConfig(viewport->winId(), 0, 1, gc, sizeof(gc)); - } -#endif // Q_OS_WIN + singleFingerPanEnabled = on; + winSetupGestures(); } +#endif // Q_WS_WIN void QAbstractScrollAreaPrivate::layoutChildren() { @@ -1267,7 +1252,11 @@ void QAbstractScrollAreaPrivate::_q_vslide(int y) void QAbstractScrollAreaPrivate::_q_showOrHideScrollBars() { layoutChildren(); - setupGestures(); +#ifdef Q_OS_WIN + // Need to re-subscribe to gestures as the content changes to make sure we + // enable/disable panning when needed. + winSetupGestures(); +#endif // Q_OS_WIN } QPoint QAbstractScrollAreaPrivate::contentsOffset() const @@ -1332,6 +1321,25 @@ void QAbstractScrollArea::setupViewport(QWidget *viewport) Q_UNUSED(viewport); } +void QAbstractScrollAreaPrivate::_q_gestureTriggered() +{ + Q_Q(QAbstractScrollArea); + QPanGesture *g = qobject_cast<QPanGesture*>(q->sender()); + if (!g) + return; + QScrollBar *hBar = q->horizontalScrollBar(); + QScrollBar *vBar = q->verticalScrollBar(); + QSize delta = g->lastOffset(); + if (!delta.isNull()) { + if (QApplication::isRightToLeft()) + delta.rwidth() *= -1; + int newX = hBar->value() - delta.width(); + int newY = vBar->value() - delta.height(); + hbar->setValue(newX); + vbar->setValue(newY); + } +} + QT_END_NAMESPACE #include "moc_qabstractscrollarea.cpp" diff --git a/src/gui/widgets/qabstractscrollarea.h b/src/gui/widgets/qabstractscrollarea.h index 3ec41d1..9178629 100644 --- a/src/gui/widgets/qabstractscrollarea.h +++ b/src/gui/widgets/qabstractscrollarea.h @@ -128,8 +128,10 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_hslide(int)) Q_PRIVATE_SLOT(d_func(), void _q_vslide(int)) Q_PRIVATE_SLOT(d_func(), void _q_showOrHideScrollBars()) + Q_PRIVATE_SLOT(d_func(), void _q_gestureTriggered()) friend class QStyleSheetStyle; + friend class QWidgetPrivate; }; #endif // QT_NO_SCROLLAREA diff --git a/src/gui/widgets/qabstractscrollarea_p.h b/src/gui/widgets/qabstractscrollarea_p.h index aef8ac5..8011ed5 100644 --- a/src/gui/widgets/qabstractscrollarea_p.h +++ b/src/gui/widgets/qabstractscrollarea_p.h @@ -60,6 +60,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_SCROLLAREA +class QPanGesture; class QScrollBar; class QAbstractScrollAreaScrollBarContainer; class Q_AUTOTEST_EXPORT QAbstractScrollAreaPrivate: public QFramePrivate @@ -100,10 +101,12 @@ public: { return q_func()->viewportEvent(event); } QObject *viewportFilter; + virtual void _q_gestureTriggered(); + QPanGesture *panGesture; #ifdef Q_WS_WIN bool singleFingerPanEnabled; + void setSingleFingerPanEnabled(bool on = true); #endif - void setupGestures(); }; class QAbstractScrollAreaFilter : public QObject diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index ee29b55..cad6903 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -1545,7 +1545,7 @@ void QDockAreaLayoutInfo::apply(bool animate) QRect geo = w->geometry(); widgetAnimator.animate(w, r, animate); - if (!w->isHidden()) { + if (!w->isHidden() && w->window()->isVisible()) { QDockWidget *dw = qobject_cast<QDockWidget*>(w); if (!r.isValid() && geo.right() >= 0 && geo.bottom() >= 0) { dw->lower(); diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp index 5810c81..e60f099 100644 --- a/src/gui/widgets/qdockwidget.cpp +++ b/src/gui/widgets/qdockwidget.cpp @@ -1390,7 +1390,7 @@ bool QDockWidget::event(QEvent *event) break; case QEvent::Show: d->toggleViewAction->setChecked(true); - emit visibilityChanged(true); + emit visibilityChanged(geometry().right() >= 0 && geometry().bottom() >= 0); break; #endif case QEvent::ApplicationLayoutDirectionChange: diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index d90d53b..f4a2348 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -257,6 +257,7 @@ void QLineControl::setSelection(int start, int length) m_cursor = m_selstart; } emit selectionChanged(); + emitCursorPositionChanged(); } void QLineControl::_q_clipboardChanged() diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index e047cb0..ad4e4e4 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -641,7 +641,7 @@ inline void QLineControl::setCursorPosition(int pos) { if (pos < 0) pos = 0; - if (pos < m_text.length()) + if (pos <= m_text.length()) moveCursor(pos); } diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 05426a0..ccf81f8 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -204,6 +204,8 @@ void QMenuPrivate::updateActionRects() const Q_Q(const QMenu); if (!itemsDirty) return; + + q->ensurePolished(); //let's reinitialize the buffer actionRects.resize(actions.count()); @@ -1705,12 +1707,9 @@ QRect QMenu::actionGeometry(QAction *act) const QSize QMenu::sizeHint() const { Q_D(const QMenu); - ensurePolished(); d->updateActionRects(); QSize s; - QStyleOption opt(0); - opt.init(this); for (int i = 0; i < d->actionRects.count(); ++i) { const QRect &rect = d->actionRects.at(i); if (rect.isNull()) @@ -1723,15 +1722,11 @@ QSize QMenu::sizeHint() const // Note that the action rects calculated above already include // the top and left margins, so we only need to add margins for // the bottom and right. - if (const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, &opt, this)) { - s.rwidth() += fw; - s.rheight() += fw; - } - - s.rwidth() += style()->pixelMetric(QStyle::PM_MenuHMargin, &opt, this); - s.rheight() += style()->pixelMetric(QStyle::PM_MenuVMargin, &opt, this); - - s += QSize(d->rightmargin, d->bottommargin); + QStyleOption opt(0); + opt.init(this); + const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, &opt, this); + s.rwidth() += style()->pixelMetric(QStyle::PM_MenuHMargin, &opt, this) + fw + d->rightmargin; + s.rheight() += style()->pixelMetric(QStyle::PM_MenuVMargin, &opt, this) + fw + d->bottommargin; return style()->sizeFromContents(QStyle::CT_Menu, &opt, s.expandedTo(QApplication::globalStrut()), this); diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 4a900d6..389b65f 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -272,6 +272,9 @@ QRect QMenuBarPrivate::actionRect(QAction *act) const //makes sure the geometries are up-to-date const_cast<QMenuBarPrivate*>(this)->updateGeometries(); + if (index >= actionRects.count()) + return QRect(); // that can happen in case of native menubar + QRect ret = actionRects.at(index); return QStyle::visualRect(q->layoutDirection(), q->rect(), ret); } diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index c095f5c..0a41d74 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -114,7 +114,7 @@ QTextEditPrivate::QTextEditPrivate() showCursorOnInitialShow = true; inDrag = false; #ifdef Q_WS_WIN - singleFingerPanEnabled = true; + setSingleFingerPanEnabled(true); #endif } @@ -183,8 +183,6 @@ void QTextEditPrivate::init(const QString &html) #ifndef QT_NO_CURSOR viewport->setCursor(Qt::IBeamCursor); #endif - panGesture = new QPanGesture(q); - QObject::connect(panGesture, SIGNAL(triggered()), q, SLOT(_q_gestureTriggered())); } void QTextEditPrivate::_q_repaintContents(const QRectF &contentsRect) @@ -2617,26 +2615,6 @@ void QTextEdit::ensureCursorVisible() d->control->ensureCursorVisible(); } -void QTextEditPrivate::_q_gestureTriggered() -{ - Q_Q(QTextEdit); - QPanGesture *g = qobject_cast<QPanGesture*>(q->sender()); - if (!g) - return; - QScrollBar *hBar = q->horizontalScrollBar(); - QScrollBar *vBar = q->verticalScrollBar(); - QSize delta = g->lastOffset(); - if (!delta.isNull()) { - if (QApplication::isRightToLeft()) - delta.rwidth() *= -1; - int newX = hBar->value() - delta.width(); - int newY = vBar->value() - delta.height(); - hbar->setValue(newX); - vbar->setValue(newY); - } -} - - /*! \enum QTextEdit::KeyboardAction diff --git a/src/gui/widgets/qtextedit.h b/src/gui/widgets/qtextedit.h index 9e10e07..617822a 100644 --- a/src/gui/widgets/qtextedit.h +++ b/src/gui/widgets/qtextedit.h @@ -414,7 +414,6 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_currentCharFormatChanged(const QTextCharFormat &)) Q_PRIVATE_SLOT(d_func(), void _q_adjustScrollbars()) Q_PRIVATE_SLOT(d_func(), void _q_ensureVisible(const QRectF &)) - Q_PRIVATE_SLOT(d_func(), void _q_gestureTriggered()) friend class QTextEditControl; friend class QTextDocument; friend class QTextControl; diff --git a/src/gui/widgets/qtextedit_p.h b/src/gui/widgets/qtextedit_p.h index 249331e..3d14af6 100644 --- a/src/gui/widgets/qtextedit_p.h +++ b/src/gui/widgets/qtextedit_p.h @@ -70,7 +70,6 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_TEXTEDIT class QMimeData; -class QPanGesture; class QTextEditPrivate : public QAbstractScrollAreaPrivate { Q_DECLARE_PUBLIC(QTextEdit) @@ -129,9 +128,6 @@ public: QString anchorToScrollToWhenVisible; - void _q_gestureTriggered(); - QPanGesture *panGesture; - #ifdef QT_KEYPAD_NAVIGATION QBasicTimer deleteAllTimer; #endif diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index e5b6e0d..3478e51 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -55,6 +55,7 @@ //#define DEBUG_AUDIO 1 +static CRITICAL_SECTION waveInCriticalSection; QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFormat& audioFormat): settings(audioFormat) diff --git a/src/multimedia/audio/qaudioinput_win32_p.h b/src/multimedia/audio/qaudioinput_win32_p.h index 32464f0..aa0d0b3 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.h +++ b/src/multimedia/audio/qaudioinput_win32_p.h @@ -68,8 +68,6 @@ #include <QtMultimedia/qaudioengine.h> -static CRITICAL_SECTION waveInCriticalSection; - class QAudioInputPrivate : public QAbstractAudioInput { Q_OBJECT diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index f681936..dbf0a66 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -54,6 +54,8 @@ //#define DEBUG_AUDIO 1 +static CRITICAL_SECTION waveOutCriticalSection; + QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioFormat& audioFormat): settings(audioFormat) { diff --git a/src/multimedia/audio/qaudiooutput_win32_p.h b/src/multimedia/audio/qaudiooutput_win32_p.h index 91f14f5..50a3992 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.h +++ b/src/multimedia/audio/qaudiooutput_win32_p.h @@ -67,8 +67,6 @@ #include <QtMultimedia/qaudioengine.h> -static CRITICAL_SECTION waveOutCriticalSection; - class QAudioOutputPrivate : public QAbstractAudioOutput { Q_OBJECT diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index 90fd9a5..6f2024f 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -341,4 +341,29 @@ QImage::Format QVGPixmapData::sourceFormat() const return QImage::Format_ARGB32_Premultiplied; } +/* + \internal + + Returns the VGImage that is storing the contents of \a pixmap. + Returns VG_INVALID_HANDLE if \a pixmap is not owned by the OpenVG + graphics system or \a pixmap is invalid. + + This function is typically used to access the backing store + for a pixmap when executing raw OpenVG calls. It must only + be used when a QPainter is active and the OpenVG paint engine + is in use by the QPainter. + + \sa {QtOpenVG Module} +*/ +Q_OPENVG_EXPORT VGImage qPixmapToVGImage(const QPixmap& pixmap) +{ + QPixmapData *pd = pixmap.pixmapData(); + if (pd->classId() == QPixmapData::OpenVGClass) { + QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pd); + if (vgpd->isValid()) + return vgpd->toVGImage(); + } + return VG_INVALID_HANDLE; +} + QT_END_NAMESPACE diff --git a/src/script/qscriptable.cpp b/src/script/qscriptable.cpp index 5da9e95..94468de 100644 --- a/src/script/qscriptable.cpp +++ b/src/script/qscriptable.cpp @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#ifndef QT_NO_QOBJECT - #include "qscriptable.h" +#ifndef QT_NO_QOBJECT + #ifndef QT_NO_SCRIPT #include "qscriptable_p.h" diff --git a/src/script/qscriptable_p.h b/src/script/qscriptable_p.h index 8ea65ed..1d297d9 100644 --- a/src/script/qscriptable_p.h +++ b/src/script/qscriptable_p.h @@ -55,7 +55,7 @@ // We mean it. // -#if !defined(QT_NO_QOBJECT) && !defined(QT_NO_SCRIPT) +#ifndef QT_NO_SCRIPT QT_BEGIN_NAMESPACE @@ -79,6 +79,6 @@ public: QT_END_NAMESPACE -#endif // QT_NO_QOBJECT && QT_NO_SCRIPT +#endif // QT_NO_SCRIPT #endif diff --git a/src/script/qscriptclassdata.cpp b/src/script/qscriptclassdata.cpp index 08e7220..576a519 100644 --- a/src/script/qscriptclassdata.cpp +++ b/src/script/qscriptclassdata.cpp @@ -114,4 +114,4 @@ QScriptClassDataIterator::~QScriptClassDataIterator() QT_END_NAMESPACE -#endif +#endif // QT_NO_SCRIPT diff --git a/src/testlib/qabstracttestlogger.cpp b/src/testlib/qabstracttestlogger.cpp index 6482ec9..2fa535e 100644 --- a/src/testlib/qabstracttestlogger.cpp +++ b/src/testlib/qabstracttestlogger.cpp @@ -43,8 +43,11 @@ #include "QtTest/private/qtestlog_p.h" #include "QtTest/qtestassert.h" +#include "QtCore/qbytearray.h" + #include <stdio.h> #include <stdlib.h> +#include <stdarg.h> #ifndef Q_OS_WIN #include <unistd.h> @@ -106,4 +109,48 @@ void QAbstractTestLogger::stopLogging() QTest::stream = 0; } +namespace QTest +{ + +extern void filter_unprintable(char *str); + +/*! \internal + */ +int qt_asprintf(QTestCharBuffer *str, const char *format, ...) +{ + static const int MAXSIZE = 1024*1024*2; + + Q_ASSERT(str); + + int size = str->size(); + + va_list ap; + int res = 0; + + for (;;) { + va_start(ap, format); + res = qvsnprintf(str->data(), size, format, ap); + va_end(ap); + str->data()[size - 1] = '\0'; + if (res >= 0 && res < size) { + // We succeeded + break; + } + // buffer wasn't big enough, try again. + // Note, we're assuming that a result of -1 is always due to running out of space. + size *= 2; + if (size > MAXSIZE) { + break; + } + if (!str->reset(size)) + break; // out of memory - take what we have + } + + filter_unprintable(str->data()); + + return res; +} + +} + QT_END_NAMESPACE diff --git a/src/testlib/qabstracttestlogger_p.h b/src/testlib/qabstracttestlogger_p.h index 588184e..1834086 100644 --- a/src/testlib/qabstracttestlogger_p.h +++ b/src/testlib/qabstracttestlogger_p.h @@ -101,27 +101,26 @@ public: struct QTestCharBuffer { - inline QTestCharBuffer() - : buf(0) - {} + enum { InitialSize = 512 }; - inline ~QTestCharBuffer() + inline QTestCharBuffer() + : _size(InitialSize), buf(staticBuf) { - delete[] buf; - buf = 0; + staticBuf[0] = '\0'; } - inline operator void*() + inline ~QTestCharBuffer() { - return buf; + if (buf != staticBuf) + qFree(buf); } - inline operator char*() + inline char *data() { return buf; } - inline operator char**() + inline char **buffer() { return &buf; } @@ -131,10 +130,43 @@ struct QTestCharBuffer return buf; } + inline int size() const + { + return _size; + } + + inline bool reset(int newSize) + { + char *newBuf = 0; + if (buf == staticBuf) { + // if we point to our internal buffer, we need to malloc first + newBuf = reinterpret_cast<char *>(qMalloc(newSize)); + } else { + // if we already malloc'ed, just realloc + newBuf = reinterpret_cast<char *>(qRealloc(buf, newSize)); + } + + // if the allocation went wrong (newBuf == 0), we leave the object as is + if (!newBuf) + return false; + + _size = newSize; + buf = newBuf; + return true; + } + private: + int _size; char* buf; + char staticBuf[InitialSize]; }; +namespace QTest +{ + int qt_asprintf(QTestCharBuffer *buf, const char *format, ...); +} + + QT_END_NAMESPACE #endif diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp index 7bebaa1..2515c51 100644 --- a/src/testlib/qplaintestlogger.cpp +++ b/src/testlib/qplaintestlogger.cpp @@ -148,11 +148,13 @@ namespace QTest { static void outputMessage(const char *str) { #if defined(Q_OS_WINCE) - int length = strlen(str); - for (int pos = 0; pos < length; pos +=255) { - QString uniText = QString::fromLatin1(str + pos, 255); - OutputDebugString((wchar_t*)uniText.utf16()); - } + QString strUtf16 = QString::fromLatin1(str); + const int maxOutputLength = 255; + do { + QString tmp = strUtf16.left(maxOutputLength); + OutputDebugString((wchar_t*)tmp.utf16()); + strUtf16.remove(0, maxOutputLength); + } while (!strUtf16.isEmpty()); if (QTestLog::outputFileName()) #elif defined(Q_OS_WIN) EnterCriticalSection(&outputCriticalSection); @@ -178,7 +180,7 @@ namespace QTest { : ""; const char *filler = (tag[0] && gtag[0]) ? ":" : ""; if (file) { - QTest::qt_asprintf(buf, "%s: %s::%s(%s%s%s)%s%s\n" + QTest::qt_asprintf(&buf, "%s: %s::%s(%s%s%s)%s%s\n" #ifdef Q_OS_WIN "%s(%d) : failure location\n" #else @@ -187,14 +189,14 @@ namespace QTest { , type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag, msg[0] ? " " : "", msg, file, line); } else { - QTest::qt_asprintf(buf, "%s: %s::%s(%s%s%s)%s%s\n", + QTest::qt_asprintf(&buf, "%s: %s::%s(%s%s%s)%s%s\n", type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag, msg[0] ? " " : "", msg); } // In colored mode, printf above stripped our nonprintable control characters. // Put them back. - memcpy(buf, type, strlen(type)); - outputMessage(buf); + memcpy(buf.data(), type, strlen(type)); + outputMessage(buf.data()); } template <typename T> @@ -205,7 +207,7 @@ namespace QTest { int digits = 0; qreal divisor = 1; - + while (num / divisor >= 1) { divisor *= 10; ++digits; diff --git a/src/testlib/qtest_global.h b/src/testlib/qtest_global.h index c40f0ad..b5b0fc0 100644 --- a/src/testlib/qtest_global.h +++ b/src/testlib/qtest_global.h @@ -82,7 +82,6 @@ namespace QTest enum TestFailMode { Abort = 1, Continue = 2 }; int Q_TESTLIB_EXPORT qt_snprintf(char *str, int size, const char *format, ...); - int qt_asprintf(char **str, const char *format, ...); } QT_END_NAMESPACE diff --git a/src/testlib/qtestbasicstreamer.cpp b/src/testlib/qtestbasicstreamer.cpp index aac57ba..89de7d8 100644 --- a/src/testlib/qtestbasicstreamer.cpp +++ b/src/testlib/qtestbasicstreamer.cpp @@ -68,39 +68,39 @@ QTestBasicStreamer::QTestBasicStreamer() QTestBasicStreamer::~QTestBasicStreamer() {} -void QTestBasicStreamer::formatStart(const QTestElement *element, char **formatted) const +void QTestBasicStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const { if(!element || !formatted ) return; - QTest::qt_asprintf(formatted, ""); + formatted->data()[0] = '\0'; } -void QTestBasicStreamer::formatEnd(const QTestElement *element, char **formatted) const +void QTestBasicStreamer::formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const { if(!element || !formatted ) return; - QTest::qt_asprintf(formatted, ""); + formatted->data()[0] = '\0'; } -void QTestBasicStreamer::formatBeforeAttributes(const QTestElement *element, char **formatted) const +void QTestBasicStreamer::formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const { if(!element || !formatted ) return; - QTest::qt_asprintf(formatted, ""); + formatted->data()[0] = '\0'; } -void QTestBasicStreamer::formatAfterAttributes(const QTestElement *element, char **formatted) const +void QTestBasicStreamer::formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const { if(!element || !formatted ) return; - QTest::qt_asprintf(formatted, ""); + formatted->data()[0] = '\0'; } -void QTestBasicStreamer::formatAttributes(const QTestElement *, const QTestElementAttribute *attribute, char **formatted) const +void QTestBasicStreamer::formatAttributes(const QTestElement *, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const { if(!attribute || !formatted ) return; - QTest::qt_asprintf(formatted, ""); + formatted->data()[0] = '\0'; } void QTestBasicStreamer::output(QTestElement *element) const @@ -125,22 +125,22 @@ void QTestBasicStreamer::outputElements(QTestElement *element, bool) const while (element) { hasChildren = element->childElements(); - formatStart(element, buf); - outputString(buf); + formatStart(element, &buf); + outputString(buf.data()); - formatBeforeAttributes(element, buf); - outputString(buf); + formatBeforeAttributes(element, &buf); + outputString(buf.data()); outputElementAttributes(element, element->attributes()); - formatAfterAttributes(element, buf); - outputString(buf); + formatAfterAttributes(element, &buf); + outputString(buf.data()); if(hasChildren) outputElements(element->childElements(), true); - formatEnd(element, buf); - outputString(buf); + formatEnd(element, &buf); + outputString(buf.data()); element = element->previousElement(); } @@ -150,8 +150,8 @@ void QTestBasicStreamer::outputElementAttributes(const QTestElement* element, QT { QTestCharBuffer buf; while(attribute){ - formatAttributes(element, attribute, buf); - outputString(buf); + formatAttributes(element, attribute, &buf); + outputString(buf.data()); attribute = attribute->nextElement(); } } diff --git a/src/testlib/qtestbasicstreamer.h b/src/testlib/qtestbasicstreamer.h index 432dd22..cabbf34 100644 --- a/src/testlib/qtestbasicstreamer.h +++ b/src/testlib/qtestbasicstreamer.h @@ -53,6 +53,7 @@ QT_MODULE(Test) class QTestElement; class QTestElementAttribute; class QTestLogger; +class QTestCharBuffer; class QTestBasicStreamer { @@ -71,11 +72,11 @@ class QTestBasicStreamer const QTestLogger *logger() const; protected: - virtual void formatStart(const QTestElement *element, char **formatted) const; - virtual void formatEnd(const QTestElement *element, char **formatted) const; - virtual void formatBeforeAttributes(const QTestElement *element, char **formatted) const; - virtual void formatAfterAttributes(const QTestElement *element, char **formatted) const; - virtual void formatAttributes(const QTestElement *element, const QTestElementAttribute *attribute, char **formatted) const; + virtual void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const; + virtual void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const; + virtual void formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const; + virtual void formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const; + virtual void formatAttributes(const QTestElement *element, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const; virtual void outputElements(QTestElement *element, bool isChildElement = false) const; virtual void outputElementAttributes(const QTestElement *element, QTestElementAttribute *attribute) const; diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index ac4ca83..1866197 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -820,43 +820,6 @@ void filter_unprintable(char *str) /*! \internal */ -int qt_asprintf(char **str, const char *format, ...) -{ - static const int MAXSIZE = 1024*1024*2; - - int size = 32; - delete[] *str; - *str = new char[size]; - - va_list ap; - int res = 0; - - for (;;) { - va_start(ap, format); - res = qvsnprintf(*str, size, format, ap); - va_end(ap); - (*str)[size - 1] = '\0'; - if (res >= 0 && res < size) { - // We succeeded - break; - } - // buffer wasn't big enough, try again. - // Note, we're assuming that a result of -1 is always due to running out of space. - size *= 2; - if (size > MAXSIZE) { - break; - } - delete[] *str; - *str = new char[size]; - } - - filter_unprintable(*str); - - return res; -} - -/*! \internal - */ int qt_snprintf(char *str, int size, const char *format, ...) { va_list ap; diff --git a/src/testlib/qtestlightxmlstreamer.cpp b/src/testlib/qtestlightxmlstreamer.cpp index e176201..b84f531 100644 --- a/src/testlib/qtestlightxmlstreamer.cpp +++ b/src/testlib/qtestlightxmlstreamer.cpp @@ -59,7 +59,7 @@ QTestLightXmlStreamer::QTestLightXmlStreamer() QTestLightXmlStreamer::~QTestLightXmlStreamer() {} -void QTestLightXmlStreamer::formatStart(const QTestElement *element, char **formatted) const +void QTestLightXmlStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const { if(!element || !formatted) return; @@ -67,14 +67,14 @@ void QTestLightXmlStreamer::formatStart(const QTestElement *element, char **form switch(element->elementType()){ case QTest::LET_TestCase: { QTestCharBuffer quotedTf; - QXmlTestLogger::xmlQuote(quotedTf, element->attributeValue(QTest::AI_Name)); + QXmlTestLogger::xmlQuote("edTf, element->attributeValue(QTest::AI_Name)); QTest::qt_asprintf(formatted, "<TestFunction name=\"%s\">\n", quotedTf.constData()); break; } case QTest::LET_Failure: { QTestCharBuffer cdataDesc; - QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description)); + QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description)); QTest::qt_asprintf(formatted, " <Description><![CDATA[%s]]></Description>\n", cdataDesc.constData()); @@ -84,8 +84,8 @@ void QTestLightXmlStreamer::formatStart(const QTestElement *element, char **form // assuming type and attribute names don't need quoting QTestCharBuffer quotedFile; QTestCharBuffer cdataDesc; - QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File)); - QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description)); + QXmlTestLogger::xmlQuote("edFile, element->attributeValue(QTest::AI_File)); + QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description)); QTest::qt_asprintf(formatted, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n <Description><![CDATA[%s]]></Description>\n</Message>\n", element->attributeValue(QTest::AI_Type), @@ -100,8 +100,8 @@ void QTestLightXmlStreamer::formatStart(const QTestElement *element, char **form // assuming value and iterations don't need quoting QTestCharBuffer quotedMetric; QTestCharBuffer quotedTag; - QXmlTestLogger::xmlQuote(quotedMetric, element->attributeValue(QTest::AI_Metric)); - QXmlTestLogger::xmlQuote(quotedTag, element->attributeValue(QTest::AI_Tag)); + QXmlTestLogger::xmlQuote("edMetric, element->attributeValue(QTest::AI_Metric)); + QXmlTestLogger::xmlQuote("edTag, element->attributeValue(QTest::AI_Tag)); QTest::qt_asprintf(formatted, "<BenchmarkResult %s=\"%s\" %s=\"%s\" %s=\"%s\" %s=\"%s\" />\n", element->attributeName(QTest::AI_Metric), @@ -115,11 +115,11 @@ void QTestLightXmlStreamer::formatStart(const QTestElement *element, char **form break; } default: - QTest::qt_asprintf(formatted, ""); + formatted->data()[0] = '\0'; } } -void QTestLightXmlStreamer::formatEnd(const QTestElement *element, char **formatted) const +void QTestLightXmlStreamer::formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const { if(!element || !formatted) return; @@ -129,47 +129,47 @@ void QTestLightXmlStreamer::formatEnd(const QTestElement *element, char **format QTest::qt_asprintf(formatted, "</Incident>\n</TestFunction>\n"); else QTest::qt_asprintf(formatted, "</TestFunction>\n"); + } else { + formatted->data()[0] = '\0'; } - else - QTest::qt_asprintf(formatted, ""); } -void QTestLightXmlStreamer::formatBeforeAttributes(const QTestElement *element, char **formatted) const +void QTestLightXmlStreamer::formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const { if(!element || !formatted) return; - if (element->elementType() == QTest::LET_TestCase && element->attribute(QTest::AI_Result)){ - QTestCharBuffer buf; - QTestCharBuffer quotedFile; - QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File)); - - QTest::qt_asprintf(buf, "%s=\"%s\" %s=\"%s\"", - element->attributeName(QTest::AI_File), - quotedFile.constData(), - element->attributeName(QTest::AI_Line), - element->attributeValue(QTest::AI_Line)); - - if( !element->childElements() ) - QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s/>\n", - element->attributeValue(QTest::AI_Result), buf.constData()); - else - QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s>\n", - element->attributeValue(QTest::AI_Result), buf.constData()); - }else{ - QTest::qt_asprintf(formatted, ""); + if (element->elementType() == QTest::LET_TestCase && element->attribute(QTest::AI_Result)) { + QTestCharBuffer buf; + QTestCharBuffer quotedFile; + QXmlTestLogger::xmlQuote("edFile, element->attributeValue(QTest::AI_File)); + + QTest::qt_asprintf(&buf, "%s=\"%s\" %s=\"%s\"", + element->attributeName(QTest::AI_File), + quotedFile.constData(), + element->attributeName(QTest::AI_Line), + element->attributeValue(QTest::AI_Line)); + + if( !element->childElements() ) + QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s/>\n", + element->attributeValue(QTest::AI_Result), buf.constData()); + else + QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s>\n", + element->attributeValue(QTest::AI_Result), buf.constData()); + } else { + formatted->data()[0] = '\0'; } } void QTestLightXmlStreamer::output(QTestElement *element) const { QTestCharBuffer buf; - QTest::qt_asprintf(buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n", + QTest::qt_asprintf(&buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n", qVersion(), QTEST_VERSION_STR ); - outputString(buf); + outputString(buf.constData()); - QTest::qt_asprintf(buf, "</Environment>\n"); - outputString(buf); + QTest::qt_asprintf(&buf, "</Environment>\n"); + outputString(buf.constData()); QTestBasicStreamer::output(element); } diff --git a/src/testlib/qtestlightxmlstreamer.h b/src/testlib/qtestlightxmlstreamer.h index 6dafdcc..e147e5c 100644 --- a/src/testlib/qtestlightxmlstreamer.h +++ b/src/testlib/qtestlightxmlstreamer.h @@ -59,9 +59,9 @@ class QTestLightXmlStreamer: public QTestBasicStreamer QTestLightXmlStreamer(); ~QTestLightXmlStreamer(); - void formatStart(const QTestElement *element, char **formatted) const; - void formatEnd(const QTestElement *element, char **formatted) const; - void formatBeforeAttributes(const QTestElement *element, char **formatted) const; + void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const; + void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const; + void formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const; void output(QTestElement *element) const; }; diff --git a/src/testlib/qtestxmlstreamer.cpp b/src/testlib/qtestxmlstreamer.cpp index 1b6e674..c72d648 100644 --- a/src/testlib/qtestxmlstreamer.cpp +++ b/src/testlib/qtestxmlstreamer.cpp @@ -60,7 +60,7 @@ QTestXmlStreamer::QTestXmlStreamer() QTestXmlStreamer::~QTestXmlStreamer() {} -void QTestXmlStreamer::formatStart(const QTestElement *element, char **formatted) const +void QTestXmlStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const { if(!element || !formatted) return; @@ -68,20 +68,20 @@ void QTestXmlStreamer::formatStart(const QTestElement *element, char **formatted switch(element->elementType()){ case QTest::LET_TestCase: { QTestCharBuffer quotedTf; - QXmlTestLogger::xmlQuote(quotedTf, element->attributeValue(QTest::AI_Name)); + QXmlTestLogger::xmlQuote("edTf, element->attributeValue(QTest::AI_Name)); QTest::qt_asprintf(formatted, "<TestFunction name=\"%s\">\n", quotedTf.constData()); break; } case QTest::LET_Failure: { QTestCharBuffer cdataDesc; - QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description)); + QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description)); QTestCharBuffer location; QTestCharBuffer quotedFile; - QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File)); + QXmlTestLogger::xmlQuote("edFile, element->attributeValue(QTest::AI_File)); - QTest::qt_asprintf(location, "%s=\"%s\" %s=\"%s\"", + QTest::qt_asprintf(&location, "%s=\"%s\" %s=\"%s\"", element->attributeName(QTest::AI_File), quotedFile.constData(), element->attributeName(QTest::AI_Line), @@ -89,7 +89,7 @@ void QTestXmlStreamer::formatStart(const QTestElement *element, char **formatted if (element->attribute(QTest::AI_Tag)) { QTestCharBuffer cdataTag; - QXmlTestLogger::xmlCdata(cdataTag, element->attributeValue(QTest::AI_Tag)); + QXmlTestLogger::xmlCdata(&cdataTag, element->attributeValue(QTest::AI_Tag)); QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s>\n" " <DataTag><![CDATA[%s]]></DataTag>\n" " <Description><![CDATA[%s]]></Description>\n" @@ -108,8 +108,8 @@ void QTestXmlStreamer::formatStart(const QTestElement *element, char **formatted // assuming type and attribute names don't need quoting QTestCharBuffer quotedFile; QTestCharBuffer cdataDesc; - QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File)); - QXmlTestLogger::xmlCdata(cdataDesc, element->attributeValue(QTest::AI_Description)); + QXmlTestLogger::xmlQuote("edFile, element->attributeValue(QTest::AI_File)); + QXmlTestLogger::xmlCdata(&cdataDesc, element->attributeValue(QTest::AI_Description)); QTest::qt_asprintf(formatted, "<Message type=\"%s\" %s=\"%s\" %s=\"%s\">\n <Description><![CDATA[%s]]></Description>\n</Message>\n", element->attributeValue(QTest::AI_Type), @@ -124,8 +124,8 @@ void QTestXmlStreamer::formatStart(const QTestElement *element, char **formatted // assuming value and iterations don't need quoting QTestCharBuffer quotedMetric; QTestCharBuffer quotedTag; - QXmlTestLogger::xmlQuote(quotedMetric, element->attributeValue(QTest::AI_Metric)); - QXmlTestLogger::xmlQuote(quotedTag, element->attributeValue(QTest::AI_Tag)); + QXmlTestLogger::xmlQuote("edMetric, element->attributeValue(QTest::AI_Metric)); + QXmlTestLogger::xmlQuote("edTag, element->attributeValue(QTest::AI_Tag)); QTest::qt_asprintf(formatted, "<BenchmarkResult %s=\"%s\" %s=\"%s\" %s=\"%s\" %s=\"%s\" />\n", element->attributeName(QTest::AI_Metric), @@ -139,23 +139,23 @@ void QTestXmlStreamer::formatStart(const QTestElement *element, char **formatted break; } default: - QTest::qt_asprintf(formatted, ""); + formatted->data()[0] = '\0'; } } -void QTestXmlStreamer::formatEnd(const QTestElement *element, char **formatted) const +void QTestXmlStreamer::formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const { if(!element || !formatted) return; if (element->elementType() == QTest::LET_TestCase) { QTest::qt_asprintf(formatted, "</TestFunction>\n"); + } else { + formatted->data()[0] = '\0'; } - else - QTest::qt_asprintf(formatted, ""); } -void QTestXmlStreamer::formatBeforeAttributes(const QTestElement *element, char **formatted) const +void QTestXmlStreamer::formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const { if(!element || !formatted) return; @@ -163,9 +163,9 @@ void QTestXmlStreamer::formatBeforeAttributes(const QTestElement *element, char if (element->elementType() == QTest::LET_TestCase && element->attribute(QTest::AI_Result)){ QTestCharBuffer buf; QTestCharBuffer quotedFile; - QXmlTestLogger::xmlQuote(quotedFile, element->attributeValue(QTest::AI_File)); + QXmlTestLogger::xmlQuote("edFile, element->attributeValue(QTest::AI_File)); - QTest::qt_asprintf(buf, "%s=\"%s\" %s=\"%s\"", + QTest::qt_asprintf(&buf, "%s=\"%s\" %s=\"%s\"", element->attributeName(QTest::AI_File), quotedFile.constData(), element->attributeName(QTest::AI_Line), @@ -174,12 +174,11 @@ void QTestXmlStreamer::formatBeforeAttributes(const QTestElement *element, char if( !element->childElements() ) { QTest::qt_asprintf(formatted, "<Incident type=\"%s\" %s/>\n", element->attributeValue(QTest::AI_Result), buf.constData()); + } else { + formatted->data()[0] = '\0'; } - else { - QTest::qt_asprintf(formatted, ""); - } - }else{ - QTest::qt_asprintf(formatted, ""); + } else { + formatted->data()[0] = '\0'; } } @@ -187,23 +186,23 @@ void QTestXmlStreamer::output(QTestElement *element) const { QTestCharBuffer buf; QTestCharBuffer quotedTc; - QXmlTestLogger::xmlQuote(quotedTc, QTestResult::currentTestObjectName()); + QXmlTestLogger::xmlQuote("edTc, QTestResult::currentTestObjectName()); - QTest::qt_asprintf(buf, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<TestCase name=\"%s\">\n", + QTest::qt_asprintf(&buf, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<TestCase name=\"%s\">\n", quotedTc.constData()); - outputString(buf); + outputString(buf.constData()); - QTest::qt_asprintf(buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n", + QTest::qt_asprintf(&buf, "<Environment>\n <QtVersion>%s</QtVersion>\n <QTestVersion>%s</QTestVersion>\n", qVersion(), QTEST_VERSION_STR ); - outputString(buf); + outputString(buf.constData()); - QTest::qt_asprintf(buf, "</Environment>\n"); - outputString(buf); + QTest::qt_asprintf(&buf, "</Environment>\n"); + outputString(buf.constData()); QTestBasicStreamer::output(element); - QTest::qt_asprintf(buf, "</TestCase>\n"); - outputString(buf); + QTest::qt_asprintf(&buf, "</TestCase>\n"); + outputString(buf.constData()); } QT_END_NAMESPACE diff --git a/src/testlib/qtestxmlstreamer.h b/src/testlib/qtestxmlstreamer.h index a601f60..6e1ae84 100644 --- a/src/testlib/qtestxmlstreamer.h +++ b/src/testlib/qtestxmlstreamer.h @@ -59,9 +59,9 @@ class QTestXmlStreamer: public QTestBasicStreamer QTestXmlStreamer(); ~QTestXmlStreamer(); - void formatStart(const QTestElement *element, char **formatted) const; - void formatEnd(const QTestElement *element, char **formatted) const; - void formatBeforeAttributes(const QTestElement *element, char **formatted) const; + void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const; + void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const; + void formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const; void output(QTestElement *element) const; }; diff --git a/src/testlib/qtestxunitstreamer.cpp b/src/testlib/qtestxunitstreamer.cpp index d5d2631..932b70b 100644 --- a/src/testlib/qtestxunitstreamer.cpp +++ b/src/testlib/qtestxunitstreamer.cpp @@ -73,7 +73,7 @@ void QTestXunitStreamer::indentForElement(const QTestElement* element, char* buf } } -void QTestXunitStreamer::formatStart(const QTestElement *element, char **formatted) const +void QTestXunitStreamer::formatStart(const QTestElement *element, QTestCharBuffer *formatted) const { if(!element || !formatted ) return; @@ -85,8 +85,7 @@ void QTestXunitStreamer::formatStart(const QTestElement *element, char **formatt if (element->elementType() == QTest::LET_Error) { if (element->parentElement()->elementType() == QTest::LET_SystemError) { QTest::qt_asprintf(formatted, "<![CDATA["); - } - else { + } else { QTest::qt_asprintf(formatted, "%s<!--", indent); } return; @@ -95,13 +94,13 @@ void QTestXunitStreamer::formatStart(const QTestElement *element, char **formatt QTest::qt_asprintf(formatted, "%s<%s", indent, element->elementName()); } -void QTestXunitStreamer::formatEnd(const QTestElement *element, char **formatted) const +void QTestXunitStreamer::formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const { - if(!element || !formatted ) + if (!element || !formatted ) return; - if(!element->childElements()){ - QTest::qt_asprintf(formatted, ""); + if (!element->childElements()){ + formatted->data()[0] = '\0'; return; } @@ -111,7 +110,7 @@ void QTestXunitStreamer::formatEnd(const QTestElement *element, char **formatted QTest::qt_asprintf(formatted, "%s</%s>\n", indent, element->elementName()); } -void QTestXunitStreamer::formatAttributes(const QTestElement* element, const QTestElementAttribute *attribute, char **formatted) const +void QTestXunitStreamer::formatAttributes(const QTestElement* element, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const { if(!attribute || !formatted ) return; @@ -136,15 +135,14 @@ void QTestXunitStreamer::formatAttributes(const QTestElement* element, const QTe if (key) { QTestCharBuffer quotedValue; - QXmlTestLogger::xmlQuote(quotedValue, attribute->value()); + QXmlTestLogger::xmlQuote("edValue, attribute->value()); QTest::qt_asprintf(formatted, " %s=\"%s\"", key, quotedValue.constData()); - } - else { - QTest::qt_asprintf(formatted, ""); + } else { + formatted->data()[0] = '\0'; } } -void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, char **formatted) const +void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const { if(!element || !formatted ) return; @@ -153,8 +151,7 @@ void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, char if (element->elementType() == QTest::LET_Error) { if (element->parentElement()->elementType() == QTest::LET_SystemError) { QTest::qt_asprintf(formatted, "]]>\n"); - } - else { + } else { QTest::qt_asprintf(formatted, " -->\n"); } return; @@ -187,22 +184,22 @@ void QTestXunitStreamer::outputElements(QTestElement *element, bool) const hasChildren = element->childElements(); if(element->elementType() != QTest::LET_Benchmark){ - formatStart(element, buf); - outputString(buf); + formatStart(element, &buf); + outputString(buf.data()); - formatBeforeAttributes(element, buf); - outputString(buf); + formatBeforeAttributes(element, &buf); + outputString(buf.data()); outputElementAttributes(element, element->attributes()); - formatAfterAttributes(element, buf); - outputString(buf); + formatAfterAttributes(element, &buf); + outputString(buf.data()); if(hasChildren) outputElements(element->childElements(), true); - formatEnd(element, buf); - outputString(buf); + formatEnd(element, &buf); + outputString(buf.data()); } element = element->previousElement(); } diff --git a/src/testlib/qtestxunitstreamer.h b/src/testlib/qtestxunitstreamer.h index 044307f..43ff03d 100644 --- a/src/testlib/qtestxunitstreamer.h +++ b/src/testlib/qtestxunitstreamer.h @@ -58,10 +58,10 @@ class QTestXunitStreamer: public QTestBasicStreamer QTestXunitStreamer(); ~QTestXunitStreamer(); - void formatStart(const QTestElement *element, char **formatted) const; - void formatEnd(const QTestElement *element, char **formatted) const; - void formatAfterAttributes(const QTestElement *element, char **formatted) const; - void formatAttributes(const QTestElement *element, const QTestElementAttribute *attribute, char **formatted) const; + void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const; + void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const; + void formatAfterAttributes(const QTestElement *element, QTestCharBuffer *formatted) const; + void formatAttributes(const QTestElement *element, const QTestElementAttribute *attribute, QTestCharBuffer *formatted) const; void output(QTestElement *element) const; void outputElements(QTestElement *element, bool isChildElement = false) const; diff --git a/src/testlib/qxmltestlogger.cpp b/src/testlib/qxmltestlogger.cpp index fca7bfc..494acb4 100644 --- a/src/testlib/qxmltestlogger.cpp +++ b/src/testlib/qxmltestlogger.cpp @@ -108,19 +108,19 @@ void QXmlTestLogger::startLogging() if (xmlmode == QXmlTestLogger::Complete) { QTestCharBuffer quotedTc; - xmlQuote(quotedTc, QTestResult::currentTestObjectName()); - QTest::qt_asprintf(buf, + xmlQuote("edTc, QTestResult::currentTestObjectName()); + QTest::qt_asprintf(&buf, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" "<TestCase name=\"%s\">\n", quotedTc.constData()); - outputString(buf); + outputString(buf.constData()); } - QTest::qt_asprintf(buf, + QTest::qt_asprintf(&buf, "<Environment>\n" " <QtVersion>%s</QtVersion>\n" " <QTestVersion>"QTEST_VERSION_STR"</QTestVersion>\n" "</Environment>\n", qVersion()); - outputString(buf); + outputString(buf.constData()); } void QXmlTestLogger::stopLogging() @@ -136,9 +136,9 @@ void QXmlTestLogger::enterTestFunction(const char *function) { QTestCharBuffer buf; QTestCharBuffer quotedFunction; - xmlQuote(quotedFunction, function); - QTest::qt_asprintf(buf, "<TestFunction name=\"%s\">\n", quotedFunction.constData()); - outputString(buf); + xmlQuote("edFunction, function); + QTest::qt_asprintf(&buf, "<TestFunction name=\"%s\">\n", quotedFunction.constData()); + outputString(buf.constData()); } void QXmlTestLogger::leaveTestFunction() @@ -219,12 +219,12 @@ void QXmlTestLogger::addIncident(IncidentTypes type, const char *description, QTestCharBuffer cdataTag; QTestCharBuffer cdataDescription; - xmlQuote(quotedFile, file); - xmlCdata(cdataGtag, gtag); - xmlCdata(cdataTag, tag); - xmlCdata(cdataDescription, description); + xmlQuote("edFile, file); + xmlCdata(&cdataGtag, gtag); + xmlCdata(&cdataTag, tag); + xmlCdata(&cdataDescription, description); - QTest::qt_asprintf(buf, + QTest::qt_asprintf(&buf, QTest::incidentFormatString(QTest::isEmpty(description), notag), QTest::xmlIncidentType2String(type), quotedFile.constData(), line, @@ -233,7 +233,7 @@ void QXmlTestLogger::addIncident(IncidentTypes type, const char *description, cdataTag.constData(), cdataDescription.constData()); - outputString(buf); + outputString(buf.constData()); } void QXmlTestLogger::addBenchmarkResult(const QBenchmarkResult &result) @@ -242,18 +242,18 @@ void QXmlTestLogger::addBenchmarkResult(const QBenchmarkResult &result) QTestCharBuffer quotedMetric; QTestCharBuffer quotedTag; - xmlQuote(quotedMetric, + xmlQuote("edMetric, QBenchmarkGlobalData::current->measurer->metricText().toAscii().constData()); - xmlQuote(quotedTag, result.context.tag.toAscii().constData()); + xmlQuote("edTag, result.context.tag.toAscii().constData()); QTest::qt_asprintf( - buf, + &buf, QTest::benchmarkResultFormatString(), quotedMetric.constData(), quotedTag.constData(), QByteArray::number(result.value).constData(), //no 64-bit qt_snprintf support result.iterations); - outputString(buf); + outputString(buf.constData()); } void QXmlTestLogger::addMessage(MessageTypes type, const char *message, @@ -270,12 +270,12 @@ void QXmlTestLogger::addMessage(MessageTypes type, const char *message, QTestCharBuffer cdataTag; QTestCharBuffer cdataDescription; - xmlQuote(quotedFile, file); - xmlCdata(cdataGtag, gtag); - xmlCdata(cdataTag, tag); - xmlCdata(cdataDescription, message); + xmlQuote("edFile, file); + xmlCdata(&cdataGtag, gtag); + xmlCdata(&cdataTag, tag); + xmlCdata(&cdataDescription, message); - QTest::qt_asprintf(buf, + QTest::qt_asprintf(&buf, QTest::messageFormatString(QTest::isEmpty(message), notag), QTest::xmlMessageType2String(type), quotedFile.constData(), line, @@ -284,7 +284,7 @@ void QXmlTestLogger::addMessage(MessageTypes type, const char *message, cdataTag.constData(), cdataDescription.constData()); - outputString(buf); + outputString(buf.constData()); } /* @@ -292,10 +292,11 @@ void QXmlTestLogger::addMessage(MessageTypes type, const char *message, XML characters as necessary so that dest is suitable for use in an XML quoted attribute string. */ -int QXmlTestLogger::xmlQuote(char* dest, char const* src, size_t n) +int QXmlTestLogger::xmlQuote(QTestCharBuffer* destBuf, char const* src, size_t n) { if (n == 0) return 0; + char *dest = destBuf->data(); *dest = 0; if (!src) return 0; @@ -351,10 +352,12 @@ int QXmlTestLogger::xmlQuote(char* dest, char const* src, size_t n) Copy up to n characters from the src string into dest, escaping any special strings such that dest is suitable for use in an XML CDATA section. */ -int QXmlTestLogger::xmlCdata(char* dest, char const* src, size_t n) +int QXmlTestLogger::xmlCdata(QTestCharBuffer *destBuf, char const* src, size_t n) { if (!n) return 0; + char *dest = destBuf->data(); + if (!src || n == 1) { *dest = 0; return 0; @@ -394,25 +397,23 @@ int QXmlTestLogger::xmlCdata(char* dest, char const* src, size_t n) return (dest-begin); } -typedef int (*StringFormatFunction)(char*,char const*,size_t); +typedef int (*StringFormatFunction)(QTestCharBuffer*,char const*,size_t); /* A wrapper for string functions written to work with a fixed size buffer so they can be called with a dynamically allocated buffer. */ -int allocateStringFn(char** str, char const* src, StringFormatFunction func) +int allocateStringFn(QTestCharBuffer* str, char const* src, StringFormatFunction func) { static const int MAXSIZE = 1024*1024*2; - int size = 32; - delete[] *str; - *str = new char[size]; + int size = str->size(); int res = 0; for (;;) { - res = func(*str, src, size); - (*str)[size - 1] = '\0'; + res = func(str, src, size); + str->data()[size - 1] = '\0'; if (res < size) { // We succeeded or fatally failed break; @@ -422,19 +423,19 @@ int allocateStringFn(char** str, char const* src, StringFormatFunction func) if (size > MAXSIZE) { break; } - delete[] *str; - *str = new char[size]; + if (!str->reset(size)) + break; // ran out of memory - bye } return res; } -int QXmlTestLogger::xmlQuote(char** str, char const* src) +int QXmlTestLogger::xmlQuote(QTestCharBuffer* str, char const* src) { return allocateStringFn(str, src, QXmlTestLogger::xmlQuote); } -int QXmlTestLogger::xmlCdata(char** str, char const* src) +int QXmlTestLogger::xmlCdata(QTestCharBuffer* str, char const* src) { return allocateStringFn(str, src, QXmlTestLogger::xmlCdata); } diff --git a/src/testlib/qxmltestlogger_p.h b/src/testlib/qxmltestlogger_p.h index a7cc00a..e14504c 100644 --- a/src/testlib/qxmltestlogger_p.h +++ b/src/testlib/qxmltestlogger_p.h @@ -79,10 +79,10 @@ public: void addMessage(MessageTypes type, const char *message, const char *file = 0, int line = 0); - static int xmlCdata(char** dest, char const* src); - static int xmlQuote(char** dest, char const* src); - static int xmlCdata(char* dest, char const* src, size_t n); - static int xmlQuote(char* dest, char const* src, size_t n); + static int xmlCdata(QTestCharBuffer *dest, char const* src); + static int xmlQuote(QTestCharBuffer *dest, char const* src); + static int xmlCdata(QTestCharBuffer *dest, char const* src, size_t n); + static int xmlQuote(QTestCharBuffer *dest, char const* src, size_t n); private: XmlMode xmlmode; diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp index bbb3af7..14576e2 100644 --- a/src/tools/uic/uic.cpp +++ b/src/tools/uic/uic.cpp @@ -184,9 +184,9 @@ DomUI *Uic::parseUiFile(QXmlStreamReader &reader) if (reader.hasError()) { delete ui; ui = 0; - fprintf(stderr, "uic: Error in line %llu, column %llu : %s\n", - reader.lineNumber(), reader.columnNumber(), - reader.errorString().toAscii().constData()); + fprintf(stderr, "%s\n", qPrintable(QString::fromLatin1("uic: Error in line %1, column %2 : %3") + .arg(reader.lineNumber()).arg(reader.columnNumber()) + .arg(reader.errorString()))); } return ui; diff --git a/tests/auto/linguist/lconvert/.gitignore b/tests/auto/linguist/lconvert/.gitignore new file mode 100644 index 0000000..042d7ac --- /dev/null +++ b/tests/auto/linguist/lconvert/.gitignore @@ -0,0 +1,2 @@ +tst_lconvert +data/plural-?.po diff --git a/tests/auto/linguist/lrelease/.gitignore b/tests/auto/linguist/lrelease/.gitignore new file mode 100644 index 0000000..cf7059c --- /dev/null +++ b/tests/auto/linguist/lrelease/.gitignore @@ -0,0 +1,2 @@ +tst_lrelease +testdata/*.qm diff --git a/tests/auto/linguist/lrelease/testdata/idbased.ts b/tests/auto/linguist/lrelease/testdata/idbased.ts new file mode 100644 index 0000000..61497de --- /dev/null +++ b/tests/auto/linguist/lrelease/testdata/idbased.ts @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name></name> + <message id="test_id"> + <source>Completely irrelevant source text</source> + <translation>This is a test string.</translation> + </message> + <message id="untranslated_id"> + <source>This has no translation.</source> + </message> + <message id="this_another_id"> + <source>Foo bar.</source> + <comment>Warn me!</comment> + </message> + <message> + <source>Drop me!</source> + </message> +</context> +</TS> diff --git a/tests/auto/linguist/lupdate/.gitignore b/tests/auto/linguist/lupdate/.gitignore new file mode 100644 index 0000000..4ba5b79 --- /dev/null +++ b/tests/auto/linguist/lupdate/.gitignore @@ -0,0 +1,4 @@ +tst_lupdate +testdata/good/*/project.ts +testdata/output_ts/toplevel/library/tools/translations/project.ts +testdata/recursivescan/*.ts diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index fcf8582..97400d9 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -93,13 +93,24 @@ void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn } else if (i == ei) { ei = 0; break; - } else if (err ? !QRegExp(expected.at(i)).exactMatch(actual.at(i)) : - (actual.at(i) != expected.at(i))) { - while ((ei - 1) >= i && (gi - 1) >= i && - (err ? QRegExp(expected.at(ei - 1)).exactMatch(actual.at(gi - 1)) : - (actual.at(gi - 1) == expected.at(ei - 1)))) - ei--, gi--; - break; + } else { + QString act = actual.at(i); + act.remove('\r'); + if (err ? !QRegExp(expected.at(i)).exactMatch(act) : + (act != expected.at(i))) { + bool cond = true; + while (cond) { + act = actual.at(gi - 1); + act.remove('\r'); + cond = (ei - 1) >= i && (gi - 1) >= i && + (err ? QRegExp(expected.at(ei - 1)).exactMatch(act) : + (act == expected.at(ei - 1))); + if (cond) { + ei--, gi--; + } + } + break; + } } } QByteArray diff; diff --git a/tests/auto/q3progressbar/tst_q3progressbar.cpp b/tests/auto/q3progressbar/tst_q3progressbar.cpp index 0378d15..549c8a4 100644 --- a/tests/auto/q3progressbar/tst_q3progressbar.cpp +++ b/tests/auto/q3progressbar/tst_q3progressbar.cpp @@ -102,7 +102,7 @@ void tst_Q3ProgressBar::setProgress() { MyCustomProgressBar * m_progressBar = new MyCustomProgressBar(); m_progressBar->show(); - QTest::qWait(500); + QApplication::processEvents(); //case with total steps = 0 m_progressBar->setTotalSteps(0); @@ -110,15 +110,16 @@ void tst_Q3ProgressBar::setProgress() m_progressBar->paintNumber = 0; m_progressBar->setProgress(m_progressBar->progress() + 1); QCOMPARE(oldValue + 1,m_progressBar->progress()); - QCOMPARE(m_progressBar->paintNumber,1); + QApplication::processEvents(); + QVERIFY(m_progressBar->paintNumber >= 1); //it might be more than 1 because it is animated //standard case m_progressBar->setTotalSteps(3); m_progressBar->setProgress(0); m_progressBar->paintNumber = 0; m_progressBar->setProgress(m_progressBar->progress() + 1); + QApplication::processEvents(); QCOMPARE(m_progressBar->paintNumber,1); - } QTEST_MAIN(tst_Q3ProgressBar) diff --git a/tests/auto/qboxlayout/tst_qboxlayout.cpp b/tests/auto/qboxlayout/tst_qboxlayout.cpp index be6f3dd..5803985 100644 --- a/tests/auto/qboxlayout/tst_qboxlayout.cpp +++ b/tests/auto/qboxlayout/tst_qboxlayout.cpp @@ -222,6 +222,8 @@ void tst_QBoxLayout::setStyleShouldChangeSpacing() QHBoxLayout *hbox = new QHBoxLayout(window); QPushButton *pb1 = new QPushButton(tr("The spacing between this")); QPushButton *pb2 = new QPushButton(tr("and this button should depend on the style of the parent widget"));; + pb1->setAttribute(Qt::WA_LayoutUsesWidgetRect); + pb2->setAttribute(Qt::WA_LayoutUsesWidgetRect); hbox->addWidget(pb1); hbox->addWidget(pb2); CustomLayoutStyle *style1 = new CustomLayoutStyle; @@ -238,7 +240,6 @@ void tst_QBoxLayout::setStyleShouldChangeSpacing() window->setStyle(style2); QTest::qWait(100); spacing = pb2->geometry().left() - pb1->geometry().right() - 1; - QEXPECT_FAIL("", "Fix for next minor release", Continue); QCOMPARE(spacing, 10); delete window; diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index 67c9ac9..4797698 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -139,6 +139,7 @@ private slots: void task190205_setModelAdjustToContents(); void task248169_popupWithMinimalSize(); void task247863_keyBoardSelection(); + void task220195_keyBoardSelection2(); void setModelColumn(); void noScrollbar_data(); void noScrollbar(); @@ -2092,7 +2093,7 @@ void tst_QComboBox::task190205_setModelAdjustToContents() #endif // box should be resized to the same size as correctBox - QCOMPARE(box.size(), correctBox.size()); + QTRY_COMPARE(box.size(), correctBox.size()); } void tst_QComboBox::task248169_popupWithMinimalSize() @@ -2138,6 +2139,40 @@ void tst_QComboBox::task247863_keyBoardSelection() QCOMPARE(spy.count(), 1); } +void tst_QComboBox::task220195_keyBoardSelection2() +{ + QComboBox combo; + combo.setEditable(false); + combo.addItem( QLatin1String("foo1")); + combo.addItem( QLatin1String("foo2")); + combo.addItem( QLatin1String("foo3")); + combo.show(); + QApplication::setActiveWindow(&combo); + QTest::qWait(100); + + combo.setCurrentIndex(-1); + QVERIFY(combo.currentText().isNull()); + + QTest::keyClick(&combo, 'f'); + QCOMPARE(combo.currentText(), QLatin1String("foo1")); + QTest::qWait(QApplication::keyboardInputInterval() + 30); + QTest::keyClick(&combo, 'f'); + QCOMPARE(combo.currentText(), QLatin1String("foo2")); + QTest::qWait(QApplication::keyboardInputInterval() + 30); + QTest::keyClick(&combo, 'f'); + QCOMPARE(combo.currentText(), QLatin1String("foo3")); + QTest::qWait(QApplication::keyboardInputInterval() + 30); + QTest::keyClick(&combo, 'f'); + QCOMPARE(combo.currentText(), QLatin1String("foo1")); + QTest::qWait(QApplication::keyboardInputInterval() + 30); + + combo.setCurrentIndex(1); + QCOMPARE(combo.currentText(), QLatin1String("foo2")); + QTest::keyClick(&combo, 'f'); + QCOMPARE(combo.currentText(), QLatin1String("foo3")); +} + + void tst_QComboBox::setModelColumn() { QStandardItemModel model(5,3); @@ -2199,7 +2234,7 @@ void tst_QComboBox::noScrollbar() QVERIFY(!comboBox.view()->horizontalScrollBar()->isVisible()); QVERIFY(!comboBox.view()->verticalScrollBar()->isVisible()); } - + { QTableWidget *table = new QTableWidget(2,2); QComboBox comboBox; @@ -2238,5 +2273,6 @@ void tst_QComboBox::task253944_itemDelegateIsReset() QCOMPARE(comboBox.itemDelegate(), itemDelegate); } + QTEST_MAIN(tst_QComboBox) #include "tst_qcombobox.moc" diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index a65490d..9c436fa 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -1316,14 +1316,20 @@ void tst_QCompleter::task253125_lineEditCompletion() edit.show(); edit.setFocus(); - QTest::qWait(100); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&edit); +#endif + QTest::qWait(100); QTest::keyClick(&edit, 'i'); QCOMPARE(edit.completer()->currentCompletion(), QString("iota")); QTest::keyClick(edit.completer()->popup(), Qt::Key_Down); QTest::keyClick(edit.completer()->popup(), Qt::Key_Enter); QCOMPARE(edit.text(), QString("iota")); + + delete completer; + delete model; } void tst_QCompleter::task247560_keyboardNavigation() @@ -1345,6 +1351,10 @@ void tst_QCompleter::task247560_keyboardNavigation() edit.show(); edit.setFocus(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&edit); +#endif + QTest::qWait(100); QTest::keyClick(&edit, 'r'); diff --git a/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp b/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp index c6fac8d..d2b0d8a 100644 --- a/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp +++ b/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp @@ -99,9 +99,17 @@ void tst_QDesktopWidget::availableGeometry() { QDesktopWidget desktop; - QRect total = desktop.screenGeometry(); - QRect available = desktop.availableGeometry(); + QRect total; + QRect available; + for (int i = 0; i < desktop.screenCount(); ++i) { + total = desktop.screenGeometry(i); + available = desktop.availableGeometry(i); + QVERIFY(total.contains(available)); + } + + total = desktop.screenGeometry(); + available = desktop.availableGeometry(); QVERIFY(total.contains(available)); QCOMPARE(desktop.availableGeometry(desktop.primaryScreen()), available); QCOMPARE(desktop.screenGeometry(desktop.primaryScreen()), total); diff --git a/tests/auto/qdockwidget/tst_qdockwidget.cpp b/tests/auto/qdockwidget/tst_qdockwidget.cpp index 9b0e706..16bb12d 100644 --- a/tests/auto/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/qdockwidget/tst_qdockwidget.cpp @@ -91,6 +91,7 @@ private slots: void task169808_setFloating(); void task237438_setFloatingCrash(); void task248604_infiniteResize(); + void task258459_visibilityChanged(); }; // Testing get/set functions @@ -730,7 +731,7 @@ void tst_QDockWidget::task169808_setFloating() return QSize(20,20); } - void paintEvent(QPaintEvent *e) + void paintEvent(QPaintEvent *) { QPainter p(this); p.fillRect(rect(), Qt::red); @@ -798,5 +799,21 @@ void tst_QDockWidget::task248604_infiniteResize() } +void tst_QDockWidget::task258459_visibilityChanged() +{ + QMainWindow win; + QDockWidget dock1, dock2; + win.addDockWidget(Qt::RightDockWidgetArea, &dock1); + win.tabifyDockWidget(&dock1, &dock2); + QSignalSpy spy1(&dock1, SIGNAL(visibilityChanged(bool))); + QSignalSpy spy2(&dock2, SIGNAL(visibilityChanged(bool))); + win.show(); + QTest::qWait(200); + QCOMPARE(spy1.count(), 1); + QCOMPARE(spy1.first().first().toBool(), false); //dock1 is invisible + QCOMPARE(spy2.count(), 1); + QCOMPARE(spy2.first().first().toBool(), true); //dock1 is visible +} + QTEST_MAIN(tst_QDockWidget) #include "tst_qdockwidget.moc" diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp index 66f29dd..249b702 100644 --- a/tests/auto/qfile/tst_qfile.cpp +++ b/tests/auto/qfile/tst_qfile.cpp @@ -915,6 +915,7 @@ void tst_QFile::copyAfterFail() QVERIFY(file1.open(QIODevice::ReadWrite) && "(test-precondition)"); QVERIFY(file2.open(QIODevice::ReadWrite) && "(test-precondition)"); + file2.close(); QVERIFY(!QFile::exists("copied-file-1.txt") && "(test-precondition)"); QVERIFY(!QFile::exists("copied-file-2.txt") && "(test-precondition)"); diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp index 512f2b6..a87e306 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp @@ -749,7 +749,7 @@ void tst_QFileInfo::size() void tst_QFileInfo::systemFiles() { -#ifndef Q_OS_WIN +#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) QSKIP("This is a Windows only test", SkipAll); #endif QFileInfo fi("c:\\pagefile.sys"); @@ -1077,7 +1077,13 @@ void tst_QFileInfo::isWritable() { QVERIFY(QFileInfo("tst_qfileinfo.cpp").isWritable()); #ifdef Q_OS_WIN - QVERIFY(!QFileInfo("c:\\pagefile.sys").isWritable()); +#ifdef Q_OS_WINCE + QFileInfo fi("\\Windows\\wince.nls"); +#else + QFileInfo fi("c:\\pagefile.sys"); +#endif + QVERIFY(fi.exists()); + QVERIFY(!fi.isWritable()); #endif #ifdef Q_OS_UNIX if (::getuid() == 0) diff --git a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index c883c63..b89890e 100644 --- a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -399,6 +399,15 @@ void tst_QFileSystemWatcher::removePaths() watcher.removePaths(paths); } +#if 0 +class SignalTest : public QObject { + Q_OBJECT; + public slots: + void fileSlot(const QString &file) { qDebug() << "file " << file;} + void dirSlot(const QString &dir) { qDebug() << "dir" << dir;} +}; +#endif + void tst_QFileSystemWatcher::watchFileAndItsDirectory() { QFETCH(QString, backend); @@ -423,6 +432,12 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() watcher.addPath(testDir.dirName()); watcher.addPath(testFileName); + /* + SignalTest signalTest; + QObject::connect(&watcher, SIGNAL(fileChanged(const QString &)), &signalTest, SLOT(fileSlot(const QString &))); + QObject::connect(&watcher, SIGNAL(directoryChanged(const QString &)), &signalTest, SLOT(dirSlot(const QString &))); + */ + QSignalSpy fileChangedSpy(&watcher, SIGNAL(fileChanged(const QString &))); QSignalSpy dirChangedSpy(&watcher, SIGNAL(directoryChanged(const QString &))); QEventLoop eventLoop; @@ -440,9 +455,12 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() timer.start(3000); eventLoop.exec(); - QCOMPARE(fileChangedSpy.count(), 1); + QVERIFY(fileChangedSpy.count() > 0); QCOMPARE(dirChangedSpy.count(), 0); + if (backend == "dnotify") + QSKIP("dnotify is broken, skipping the rest of the test.", SkipSingle); + fileChangedSpy.clear(); QFile secondFile(secondFileName); secondFile.open(QIODevice::WriteOnly | QIODevice::Truncate); @@ -460,7 +478,7 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() timer.start(3000); eventLoop.exec(); - QCOMPARE(fileChangedSpy.count(), 1); + QVERIFY(fileChangedSpy.count() > 0); QCOMPARE(dirChangedSpy.count(), 1); fileChangedSpy.clear(); diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp index 672b1f1..c9481da 100644 --- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp +++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp @@ -137,7 +137,10 @@ void tst_QGraphicsTransform::rotation() void tst_QGraphicsTransform::rotation3d() { QGraphicsRotation3D rotation; - rotation.setOrigin(QPointF(10, 10)); + QCOMPARE(rotation.axis().x(), (qreal)0); + QCOMPARE(rotation.axis().y(), (qreal)0); + QCOMPARE(rotation.axis().z(), (qreal)1); + QCOMPARE(rotation.angle(), (qreal)0); QTransform t; rotation.applyTo(&t); @@ -147,6 +150,23 @@ void tst_QGraphicsTransform::rotation3d() rotation.setAngle(180); + QTransform t180; + t180.rotate(180.0f); + + QCOMPARE(t, QTransform()); + QVERIFY(qFuzzyCompare(rotation.transform(), t180)); + + rotation.setAxis(QVector3D(0, 0, 0)); + rotation.setOrigin(QPointF(10, 10)); + + t = QTransform(); + rotation.applyTo(&t); + + QCOMPARE(t, QTransform()); + QCOMPARE(rotation.transform(), QTransform()); + + rotation.setAngle(180); + QCOMPARE(t, QTransform()); QCOMPARE(rotation.transform(), QTransform()); diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp index c3d7c2d..86b70e1 100644 --- a/tests/auto/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp @@ -214,10 +214,7 @@ void tst_QHostInfo::lookupIPv4_data() QTest::newRow("empty") << "" << "" << int(QHostInfo::HostNotFound); - QTest::newRow("lupinella_00") << "l" << lupinellaIp << int(QHostInfo::NoError); - QTest::newRow("lupinella_01") << "lupinella" << lupinellaIp << int(QHostInfo::NoError); - QTest::newRow("lupinella_02") << "lupinella.troll.no" << lupinellaIp << int(QHostInfo::NoError); - QTest::newRow("lupinella_03") << "lupinella.trolltech.com" << lupinellaIp << int(QHostInfo::NoError); + QTest::newRow("single_ip4") << "lupinella.troll.no" << lupinellaIp << int(QHostInfo::NoError); QTest::newRow("multiple_ip4") << "multi.dev.troll.no" << "1.2.3.4 1.2.3.5 10.3.3.31" << int(QHostInfo::NoError); QTest::newRow("literal_ip4") << lupinellaIp << lupinellaIp << int(QHostInfo::NoError); QTest::newRow("notfound") << "this-name-does-not-exist-hopefully." << "" << int(QHostInfo::HostNotFound); diff --git a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp index 6714de3..06018b9 100644 --- a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp @@ -1153,7 +1153,7 @@ void tst_QItemDelegate::task257859_finalizeEdit() QTimer::singleShot(100, &dialog, SLOT(close())); dialog.exec(); - QTest::qWait(10); + QTest::qWait(100); QVERIFY(!editor); } diff --git a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp index 0541b46..05e23f1 100644 --- a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -90,6 +90,7 @@ private slots: void merge(); void task119433_isRowSelected(); void task252069_rowIntersectsSelection(); + void task232634_childrenDeselectionSignal(); private: QAbstractItemModel *model; @@ -2187,5 +2188,28 @@ void tst_QItemSelectionModel::task252069_rowIntersectsSelection() QVERIFY(!selected.columnIntersectsSelection(5, QModelIndex())); } +void tst_QItemSelectionModel::task232634_childrenDeselectionSignal() +{ + QStandardItemModel model; + + QStandardItem *parentItem = model.invisibleRootItem(); + for (int i = 0; i < 4; ++i) { + QStandardItem *item = new QStandardItem(QString("item %0").arg(i)); + parentItem->appendRow(item); + parentItem = item; + } + + QModelIndex root = model.index(0,0); + QModelIndex par = root.child(0,0); + QModelIndex sel = par.child(0,0); + + QItemSelectionModel selectionModel(&model); + selectionModel.select(sel, QItemSelectionModel::SelectCurrent); + + QSignalSpy deselectSpy(&selectionModel, SIGNAL(selectionChanged(const QItemSelection& , const QItemSelection&))); + model.removeRows(0, 1, root); + QVERIFY(deselectSpy.count() == 1); +} + QTEST_MAIN(tst_QItemSelectionModel) #include "tst_qitemselectionmodel.moc" diff --git a/tests/auto/qitemview/tst_qitemview.cpp b/tests/auto/qitemview/tst_qitemview.cpp index 73c08d1..2f9ac96 100644 --- a/tests/auto/qitemview/tst_qitemview.cpp +++ b/tests/auto/qitemview/tst_qitemview.cpp @@ -173,8 +173,6 @@ public: } QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const { - Q_ASSERT(row >= 0 && row <= rowCount(parent)); - Q_ASSERT(column >= 0 && column <= columnCount(parent)); return QStandardItemModel::index(row, column, parent); }; diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp index a41eecd..177648d 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -555,14 +555,17 @@ void tst_QLocalSocket::readBufferOverflow() QVERIFY(server.hasPendingConnections()); QLocalSocket* serverSocket = server.nextPendingConnection(); - char* buffer = (char*)qMalloc(dataBufferSize); + char buffer[dataBufferSize]; memset(buffer, 0, dataBufferSize); serverSocket->write(buffer, dataBufferSize); serverSocket->flush(); - qFree(buffer); QVERIFY(client.waitForReadyRead()); - QCOMPARE(client.readAll().size(), dataBufferSize); + QCOMPARE(client.read(buffer, readBufferSize), qint64(readBufferSize)); +#ifdef QT_LOCALSOCKET_TCP + QTest::qWait(250); +#endif + QCOMPARE(client.read(buffer, readBufferSize), qint64(readBufferSize)); } // QLocalSocket/Server can take a name or path, check that it works as expected @@ -918,6 +921,7 @@ void tst_QLocalSocket::writeOnlySocket() QVERIFY(server.waitForNewConnection()); QLocalSocket* serverSocket = server.nextPendingConnection(); + QVERIFY(serverSocket); QCOMPARE(client.bytesAvailable(), qint64(0)); QCOMPARE(client.state(), QLocalSocket::ConnectedState); diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp index 6ae7a3e..f81dd82 100644 --- a/tests/auto/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp @@ -550,6 +550,9 @@ void tst_QMainWindow::menuBar() mw.setMenuBar(mb1); QVERIFY(mw.menuBar() != 0); QCOMPARE(mw.menuBar(), (QMenuBar *)mb1); +#ifdef Q_WS_WINCE_WM + QSKIP("With native menubar integration the menubar is not a child", SkipSingle); +#endif QCOMPARE(mb1->parentWidget(), (QWidget *)&mw); mw.setMenuBar(0); diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 6ba6466..23bb0c2 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -50,6 +50,7 @@ #include <QStatusBar> #include <QListWidget> #include <QWidgetAction> +#include <QDesktopWidget> #include <qmenu.h> #include <qstyle.h> @@ -692,6 +693,12 @@ void tst_QMenu::task250673_activeMultiColumnSubMenuPosition() }; QMenu sub; + + if (sub.style()->styleHint(QStyle::SH_Menu_Scrollable, 0, &sub)) { + //the style prevents the menus from getting columns + QSKIP("the style doesn't support multiple columns, it makes the menu scrollable", SkipSingle); + } + sub.addAction("Sub-Item1"); QAction *subAction = sub.addAction("Sub-Item2"); @@ -703,6 +710,7 @@ void tst_QMenu::task250673_activeMultiColumnSubMenuPosition() uint i = 2; while (main.columnCount() < 2) { main.addAction(QString("Item %1").arg(i)); + qDebug() << "adding action" << i; ++i; Q_ASSERT(i<1000); } @@ -784,7 +792,7 @@ void tst_QMenu::task258920_mouseBorder() Menu258920 menu; QAction *action = menu.addAction("test"); - menu.popup(QPoint()); + menu.popup(QApplication::desktop()->availableGeometry().center()); QTest::qWait(100); QRect actionRect = menu.actionGeometry(action); QTest::mouseMove(&menu, actionRect.center()); diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index 1245de1..3ccd0c8 100644 --- a/tests/auto/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/qmenubar/tst_qmenubar.cpp @@ -59,6 +59,8 @@ #include <qobject.h> +#include "../../shared/util.h" + QT_FORWARD_DECLARE_CLASS(QMainWindow) #include <qmenubar.h> @@ -1527,6 +1529,7 @@ void tst_QMenuBar::task223138_triggered() void tst_QMenuBar::task256322_highlight() { QMainWindow win; + win.menuBar()->setNativeMenuBar(false); //we can't check the geometry of native menubars QMenu menu; QAction *file = win.menuBar()->addMenu(&menu); file->setText("file"); @@ -1536,27 +1539,24 @@ void tst_QMenuBar::task256322_highlight() QAction *nothing = win.menuBar()->addAction("nothing"); win.show(); + QTest::qWait(200); + QTest::mouseMove(win.menuBar(), win.menuBar()->actionGeometry(file).center()); QTest::mouseClick(win.menuBar(), Qt::LeftButton, 0, win.menuBar()->actionGeometry(file).center()); - QVERIFY(menu.isVisible()); + QTRY_VERIFY(menu.isVisible()); QVERIFY(!menu2.isVisible()); QCOMPARE(win.menuBar()->activeAction(), file); QTest::mouseMove(win.menuBar(), win.menuBar()->actionGeometry(file2).center()); - QVERIFY(!menu.isVisible()); + QTRY_VERIFY(!menu.isVisible()); QVERIFY(menu2.isVisible()); QCOMPARE(win.menuBar()->activeAction(), file2); - QTest::mouseMove(win.menuBar(), win.menuBar()->actionGeometry(nothing).center()); + QPoint nothingCenter = win.menuBar()->actionGeometry(nothing).center(); + QTest::mouseMove(win.menuBar(), nothingCenter); + QTRY_VERIFY(!menu2.isVisible()); QVERIFY(!menu.isVisible()); - QVERIFY(!menu2.isVisible()); QCOMPARE(win.menuBar()->activeAction(), nothing); - - QTest::mouseMove(&win, win.menuBar()->geometry().bottomLeft() + QPoint(1,1)); - - QVERIFY(!menu.isVisible()); - QVERIFY(!menu2.isVisible()); - QVERIFY(!win.menuBar()->activeAction()); } void tst_QMenuBar::menubarSizeHint() @@ -1583,6 +1583,8 @@ void tst_QMenuBar::menubarSizeHint() } style; QMenuBar mb; + mb.setNativeMenuBar(false); //we can't check the geometry of native menubars + mb.setStyle(&style); //this is a list of arbitrary strings so that we check the geometry QStringList list = QStringList() << "trer" << "ezrfgtgvqd" << "sdgzgzerzerzer" << "eerzertz" << "er"; diff --git a/tests/auto/qpluginloader/tst/tst.pro b/tests/auto/qpluginloader/tst/tst.pro index 5331f09..28f74d4 100644 --- a/tests/auto/qpluginloader/tst/tst.pro +++ b/tests/auto/qpluginloader/tst/tst.pro @@ -13,7 +13,7 @@ win32 { wince*: { - addFiles.sources = ../bin/*.dll + addFiles.sources = $$OUT_PWD/../bin/*.dll addFiles.path = bin DEPLOYMENT += addFiles } diff --git a/tests/auto/qpluginloader/tst_qpluginloader.cpp b/tests/auto/qpluginloader/tst_qpluginloader.cpp index 8221325..0b8ae45 100644 --- a/tests/auto/qpluginloader/tst_qpluginloader.cpp +++ b/tests/auto/qpluginloader/tst_qpluginloader.cpp @@ -264,6 +264,7 @@ void tst_QPluginLoader::deleteinstanceOnUnload() if (pass == 0) loader1.load(); // not recommended, instance() should do the job. PluginInterface *instance1 = qobject_cast<PluginInterface*>(loader1.instance()); + QVERIFY(instance1); QCOMPARE(instance1->pluginName(), QLatin1String("Plugin ok")); QPluginLoader loader2; diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp index d235dff..1ffa360 100644 --- a/tests/auto/qprocess/tst_qprocess.cpp +++ b/tests/auto/qprocess/tst_qprocess.cpp @@ -1224,7 +1224,7 @@ private: //----------------------------------------------------------------------------- void tst_QProcess::processInAThread() { - for (int i = 0; i < 3; ++i) { + for (int i = 0; i < 10; ++i) { TestThread thread; thread.start(); QVERIFY(thread.wait(10000)); diff --git a/tests/auto/qpushbutton/tst_qpushbutton.cpp b/tests/auto/qpushbutton/tst_qpushbutton.cpp index 7a81dbf..528f3bb 100644 --- a/tests/auto/qpushbutton/tst_qpushbutton.cpp +++ b/tests/auto/qpushbutton/tst_qpushbutton.cpp @@ -661,6 +661,7 @@ void tst_QPushButton::sizeHint() tabWidget->setCurrentWidget(tab2); tabWidget->setCurrentWidget(tab1); QTest::qWait(100); + QApplication::processEvents(); QCOMPARE(button1_2->size(), button2_2->size()); } diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index 5214edb..1101a08 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -1407,7 +1407,11 @@ void tst_QSharedPointer::threadStressTest() base.clear(); +#ifdef Q_OS_WINCE + srand(QDateTime::currentDateTime().toTime_t()); +#else srand(time(NULL)); +#endif // start threads for (int i = 0; i < allThreads.count(); ++i) if (allThreads[i]) allThreads[i]->start(); diff --git a/tests/auto/qstyle/tst_qstyle.cpp b/tests/auto/qstyle/tst_qstyle.cpp index 2cb5080..3c63a50 100644 --- a/tests/auto/qstyle/tst_qstyle.cpp +++ b/tests/auto/qstyle/tst_qstyle.cpp @@ -351,7 +351,7 @@ void tst_QStyle::testAllFunctions(QStyle *style) testScrollBarSubControls(style); } -void tst_QStyle::testScrollBarSubControls(QStyle *) +void tst_QStyle::testScrollBarSubControls(QStyle* style) { #ifdef Q_OS_WINCE_WM if (qobject_cast<QWindowsMobileStyle*>(style) && qt_wince_is_smartphone()) diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index 6fa57f0..eb39dd7 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -2542,7 +2542,7 @@ void tst_QTableView::span_data() << 2 << 1 << false; - /* This makes no sens. + /* This makes no sens. QTest::newRow("top left 2x0") << 10 << 10 << -1 << -1 @@ -2631,7 +2631,7 @@ void tst_QTableView::span() view.hideRow(hiddenRow); view.hideColumn(hiddenColumn); view.show(); - + QCOMPARE(view.rowSpan(row, column), expectedRowSpan); QCOMPARE(view.columnSpan(row, column), expectedColumnSpan); @@ -3110,14 +3110,14 @@ void tst_QTableView::task227953_setRootIndex() } tableView.setModel(&model); - + //show the first 10 rows of the first table QModelIndex root = model.indexFromItem(&item1); tableView.setRootIndex(root); for (int i = 10; i != 40; ++i) { tableView.setRowHidden(i, true); } - + QCOMPARE(tableView.verticalHeader()->count(), 40); QCOMPARE(tableView.verticalHeader()->hiddenSectionCount(), 30); @@ -3139,16 +3139,13 @@ void tst_QTableView::task240266_veryBigColumn() table.setColumnWidth(1, 100); //normal column table.setColumnWidth(2, 9000); //very big column table.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif QTest::qWait(100); QScrollBar *scroll = table.horizontalScrollBar(); QCOMPARE(scroll->minimum(), 0); QCOMPARE(scroll->maximum(), model.columnCount() - 1); QCOMPARE(scroll->singleStep(), 1); - + //1 is not always a very correct value for pageStep. Ideally this should be dynamic. //Maybe something for Qt 5 ;-) QCOMPARE(scroll->pageStep(), 1); diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index b21a973..6b42821 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -2917,8 +2917,7 @@ void tst_QTreeView::styleOptionViewItem() delegate.count = 0; view.showMaximized(); - QTest::qWait(30); - QVERIFY(delegate.count >= 13); + QTRY_VERIFY(delegate.count >= 13); } class task174627_TreeView : public QTreeView diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp index 7d79d56..fd0fdb1 100644 --- a/tests/auto/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp @@ -238,6 +238,9 @@ void tst_QTreeWidget::initTestCase() testWidget = new CustomTreeWidget(); testWidget->show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(testWidget); +#endif } void tst_QTreeWidget::cleanupTestCase() @@ -2017,7 +2020,7 @@ void tst_QTreeWidget::setHeaderItem() headerItem->setText(0, "0"); headerItem->setText(1, "1"); testWidget->setHeaderItem(headerItem); - qApp->processEvents(); + QTest::qWait(100); QCOMPARE(testWidget->headerItem(), headerItem); QCOMPARE(headerItem->treeWidget(), static_cast<QTreeWidget *>(testWidget)); @@ -2762,16 +2765,18 @@ void tst_QTreeWidget::defaultRowSizes() for (int j=0; j<tw->columnCount() - 1; ++j) { it->setText(j, "This is a test"); } + QPixmap icon = tw->style()->standardPixmap((QStyle::StandardPixmap)(i + QStyle::SP_TitleBarMenuButton)); + if (icon.isNull()) + QSKIP("No pixmap found on current style, skipping this test.", SkipSingle); it->setIcon(tw->columnCount() - 1, - tw->style()->standardPixmap((QStyle::StandardPixmap)(i + QStyle::SP_TitleBarMenuButton)). - scaled(tw->iconSize())); + icon.scaled(tw->iconSize())); } tw->resize(100,100); tw->show(); QApplication::processEvents(); QRect visualRect = tw->visualItemRect(tw->topLevelItem(0)); - QVERIFY(visualRect.height() >=50); + QVERIFY(visualRect.height() >= 50); } void tst_QTreeWidget::task191552_rtl() diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp index ddd1930..b03cd05 100644 --- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp +++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp @@ -48,6 +48,7 @@ #include <private/qwindowsurface_p.h> #include <QDesktopWidget> +#include <QX11Info> class tst_QWindowSurface : public QObject { @@ -138,6 +139,11 @@ void tst_QWindowSurface::getSetWindowSurface() void tst_QWindowSurface::flushOutsidePaintEvent() { +#ifdef Q_WS_X11 + if (QX11Info::isCompositingManagerRunning()) + QSKIP("Test is unreliable with composition manager", SkipAll); +#endif + #ifdef Q_WS_WIN if (QSysInfo::WindowsVersion & QSysInfo::WV_VISTA) { QTest::qWait(1000); diff --git a/tests/auto/qxmlquery/qxmlquery.pro b/tests/auto/qxmlquery/qxmlquery.pro index e8ab641..3db3734 100644 --- a/tests/auto/qxmlquery/qxmlquery.pro +++ b/tests/auto/qxmlquery/qxmlquery.pro @@ -10,6 +10,12 @@ RESOURCES = input.qrc QT += network +!wince* { +DEFINES += SRCDIR=\\\"$$PWD/\\\" +} else { +DEFINES += SRCDIR=\\\"./\\\" +} + include (../xmlpatterns.pri) wince*: { diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp index 5c14329..6563240 100644 --- a/tests/auto/qxmlquery/tst_qxmlquery.cpp +++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp @@ -259,7 +259,7 @@ void tst_QXmlQuery::checkBaseURI(const QUrl &baseURI, const QString &candidate) QVERIFY(QDir(baseURI.toLocalFile()).relativeFilePath(QFileInfo(candidate).canonicalFilePath()).startsWith("../")); } -const char *const tst_QXmlQuery::queriesDirectory = "../xmlpatterns/queries/"; +const char *const tst_QXmlQuery::queriesDirectory = SRCDIR "../xmlpatterns/queries/"; QStringList tst_QXmlQuery::queries() { @@ -738,7 +738,7 @@ void tst_QXmlQuery::bindVariableQStringQIODeviceWithString() const void tst_QXmlQuery::bindVariableQStringQIODeviceWithQFile() const { QXmlQuery query; - QFile inDevice(QLatin1String("input.xml")); + QFile inDevice(QLatin1String(SRCDIR "input.xml")); QVERIFY(inDevice.open(QIODevice::ReadOnly)); @@ -852,7 +852,7 @@ void tst_QXmlQuery::bindVariableXSLTSuccess() const stylesheet.bindVariable(QLatin1String("paramSelectWithTypeIntBoundWithBindVariableRequired"), QVariant(QLatin1String("param5"))); - stylesheet.setQuery(QUrl(inputFile(QLatin1String("../xmlpatterns/stylesheets/parameters.xsl")))); + stylesheet.setQuery(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/parameters.xsl")))); QVERIFY(stylesheet.isValid()); @@ -960,7 +960,7 @@ void tst_QXmlQuery::evaluateToReceiver() PushBaseliner push(stream, query.namePool()); query.evaluateTo(&push); - const QString baselineName(inputFile(QLatin1String("pushBaselines/") + inputQuery.left(inputQuery.length() - 2) + QString::fromLatin1("ref"))); + const QString baselineName(inputFile(QLatin1String(SRCDIR "pushBaselines/") + inputQuery.left(inputQuery.length() - 2) + QString::fromLatin1("ref"))); QFile baseline(baselineName); if(baseline.exists()) @@ -1300,7 +1300,7 @@ void tst_QXmlQuery::basicQtToXQueryTypeCheck() const // TODO Do with different QDateTime time specs query.bindVariable(QLatin1String("fromQDateTime"), QXmlItem(QDateTime(QDate(2001, 9, 10), QTime(1, 2, 3)))); query.bindVariable(QLatin1String("fromDouble"), QXmlItem(double(3))); - query.bindVariable(QLatin1String("fromFloat"), QXmlItem(float(4))); +// query.bindVariable(QLatin1String("fromFloat"), QXmlItem(float(4))); query.bindVariable(QLatin1String("integer"), QXmlItem(5)); query.bindVariable(QLatin1String("fromQString"), QXmlItem(QString::fromLatin1("A QString"))); query.bindVariable(QLatin1String("fromQChar"), QXmlItem(QChar::fromLatin1('C'))); @@ -1793,11 +1793,11 @@ void tst_QXmlQuery::setFocusQUrl() const { QXmlQuery query(QXmlQuery::XSLT20); - const TestURIResolver resolver(QUrl(inputFile(QLatin1String("../xmlpatterns/stylesheets/documentElement.xml")))); + const TestURIResolver resolver(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml")))); query.setUriResolver(&resolver); QVERIFY(query.setFocus(QUrl(QLatin1String("arbitraryURI")))); - query.setQuery(QUrl(inputFile(QLatin1String("../xmlpatterns/stylesheets/copyWholeDocument.xsl")))); + query.setQuery(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/copyWholeDocument.xsl")))); QVERIFY(query.isValid()); QBuffer result; @@ -2011,7 +2011,7 @@ void tst_QXmlQuery::fnDocNetworkAccessSuccess_data() const QTest::addColumn<QByteArray>("expectedOutput"); QTest::newRow("file scheme") - << inputFileAsURI(QLatin1String("input.xml")) + << inputFileAsURI(QLatin1String(SRCDIR "input.xml")) << QByteArray("<!-- This is just a file for testing. --><input/>"); QTest::newRow("data scheme with ASCII") @@ -2992,7 +2992,7 @@ void tst_QXmlQuery::setInitialTemplateNameQXmlName() const QCOMPARE(query.initialTemplateName(), name); - query.setQuery(QUrl(inputFile(QLatin1String("../xmlpatterns/stylesheets/namedTemplate.xsl")))); + query.setQuery(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/namedTemplate.xsl")))); QVERIFY(query.isValid()); QBuffer result; @@ -3054,7 +3054,7 @@ void tst_QXmlQuery::setNetworkAccessManager() const /* Ensure fn:doc() picks up the right QNetworkAccessManager. */ { NetworkOverrider networkOverrider(QUrl(QLatin1String("tag:example.com:DOESNOTEXIST")), - QUrl(inputFile(QLatin1String("../xmlpatterns/queries/simpleDocument.xml")))); + QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/queries/simpleDocument.xml")))); QXmlQuery query; query.setNetworkAccessManager(&networkOverrider); @@ -3070,7 +3070,7 @@ void tst_QXmlQuery::setNetworkAccessManager() const /* Ensure setQuery() is using the right network manager. */ { NetworkOverrider networkOverrider(QUrl(QLatin1String("tag:example.com:DOESNOTEXIST")), - QUrl(inputFile(QLatin1String("../xmlpatterns/queries/concat.xq")))); + QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/queries/concat.xq")))); QXmlQuery query; query.setNetworkAccessManager(&networkOverrider); @@ -3128,9 +3128,9 @@ void tst_QXmlQuery::multipleDocsAndFocus() const /* We use string concatenation, since variable bindings might disturb what * we're testing. */ query.setQuery(QLatin1String("string(doc('") + - inputFile(QLatin1String("../xmlpatterns/queries/simpleDocument.xml")) + + inputFile(QLatin1String(SRCDIR "../xmlpatterns/queries/simpleDocument.xml")) + QLatin1String("'))")); - query.setFocus(QUrl(inputFile(QLatin1String("../xmlpatterns/stylesheets/documentElement.xml")))); + query.setFocus(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml")))); query.setQuery(QLatin1String("string(.)")); QStringList result; @@ -3154,11 +3154,11 @@ void tst_QXmlQuery::multipleEvaluationsWithDifferentFocus() const QXmlQuery query; QStringList result; - query.setFocus(QUrl(inputFile(QLatin1String("../xmlpatterns/stylesheets/documentElement.xml")))); + query.setFocus(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml")))); query.setQuery(QLatin1String("string(.)")); QVERIFY(query.evaluateTo(&result)); - query.setFocus(QUrl(inputFile(QLatin1String("../xmlpatterns/stylesheets/documentElement.xml")))); + query.setFocus(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml")))); QVERIFY(query.evaluateTo(&result)); } diff --git a/tests/auto/uic/baseline/Dialog_with_Buttons_Bottom.ui.h b/tests/auto/uic/baseline/Dialog_with_Buttons_Bottom.ui.h index 6ce3579..166dc60 100644 --- a/tests/auto/uic/baseline/Dialog_with_Buttons_Bottom.ui.h +++ b/tests/auto/uic/baseline/Dialog_with_Buttons_Bottom.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'Dialog_with_Buttons_Bottom.ui' +** Form generated from reading UI file 'Dialog_with_Buttons_Bottom.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef DIALOG_WITH_BUTTONS_BOTTOM_H diff --git a/tests/auto/uic/baseline/Dialog_with_Buttons_Right.ui.h b/tests/auto/uic/baseline/Dialog_with_Buttons_Right.ui.h index a2a9078..cbb3cc4 100644 --- a/tests/auto/uic/baseline/Dialog_with_Buttons_Right.ui.h +++ b/tests/auto/uic/baseline/Dialog_with_Buttons_Right.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'Dialog_with_Buttons_Right.ui' +** Form generated from reading UI file 'Dialog_with_Buttons_Right.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef DIALOG_WITH_BUTTONS_RIGHT_H diff --git a/tests/auto/uic/baseline/Dialog_without_Buttons.ui.h b/tests/auto/uic/baseline/Dialog_without_Buttons.ui.h index d89bbef..bb06a54 100644 --- a/tests/auto/uic/baseline/Dialog_without_Buttons.ui.h +++ b/tests/auto/uic/baseline/Dialog_without_Buttons.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'Dialog_without_Buttons.ui' +** Form generated from reading UI file 'Dialog_without_Buttons.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef DIALOG_WITHOUT_BUTTONS_H diff --git a/tests/auto/uic/baseline/Main_Window.ui.h b/tests/auto/uic/baseline/Main_Window.ui.h index 7404eca..07a8389 100644 --- a/tests/auto/uic/baseline/Main_Window.ui.h +++ b/tests/auto/uic/baseline/Main_Window.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'Main_Window.ui' +** Form generated from reading UI file 'Main_Window.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef MAIN_WINDOW_H diff --git a/tests/auto/uic/baseline/Widget.ui.h b/tests/auto/uic/baseline/Widget.ui.h index a7a3198..bba9fd9 100644 --- a/tests/auto/uic/baseline/Widget.ui.h +++ b/tests/auto/uic/baseline/Widget.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'Widget.ui' +** Form generated from reading UI file 'Widget.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef WIDGET_H diff --git a/tests/auto/uic/baseline/addlinkdialog.ui.h b/tests/auto/uic/baseline/addlinkdialog.ui.h index 34caca9..920a8f7 100644 --- a/tests/auto/uic/baseline/addlinkdialog.ui.h +++ b/tests/auto/uic/baseline/addlinkdialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'addlinkdialog.ui' +** Form generated from reading UI file 'addlinkdialog.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef ADDLINKDIALOG_H diff --git a/tests/auto/uic/baseline/addtorrentform.ui.h b/tests/auto/uic/baseline/addtorrentform.ui.h index fafcb16..185ce2e 100644 --- a/tests/auto/uic/baseline/addtorrentform.ui.h +++ b/tests/auto/uic/baseline/addtorrentform.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'addtorrentform.ui' +** Form generated from reading UI file 'addtorrentform.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef ADDTORRENTFORM_H diff --git a/tests/auto/uic/baseline/authenticationdialog.ui.h b/tests/auto/uic/baseline/authenticationdialog.ui.h index 33acd91..b46c05d 100644 --- a/tests/auto/uic/baseline/authenticationdialog.ui.h +++ b/tests/auto/uic/baseline/authenticationdialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'authenticationdialog.ui' +** Form generated from reading UI file 'authenticationdialog.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef AUTHENTICATIONDIALOG_H diff --git a/tests/auto/uic/baseline/backside.ui.h b/tests/auto/uic/baseline/backside.ui.h index 7cc5ee9..6fdab4b 100644 --- a/tests/auto/uic/baseline/backside.ui.h +++ b/tests/auto/uic/baseline/backside.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'backside.ui' +** Form generated from reading UI file 'backside.ui' ** ** Created: Tue Jun 17 09:18:47 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef BACKSIDE_H diff --git a/tests/auto/uic/baseline/batchtranslation.ui.h b/tests/auto/uic/baseline/batchtranslation.ui.h index 4cdad44..2567fd9 100644 --- a/tests/auto/uic/baseline/batchtranslation.ui.h +++ b/tests/auto/uic/baseline/batchtranslation.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'batchtranslation.ui' +** Form generated from reading UI file 'batchtranslation.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef BATCHTRANSLATION_H diff --git a/tests/auto/uic/baseline/bookmarkdialog.ui.h b/tests/auto/uic/baseline/bookmarkdialog.ui.h index b5af0cf..1db7dca 100644 --- a/tests/auto/uic/baseline/bookmarkdialog.ui.h +++ b/tests/auto/uic/baseline/bookmarkdialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'bookmarkdialog.ui' +** Form generated from reading UI file 'bookmarkdialog.ui' ** ** Created: Mon Jun 16 18:01:55 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef BOOKMARKDIALOG_H diff --git a/tests/auto/uic/baseline/bookwindow.ui.h b/tests/auto/uic/baseline/bookwindow.ui.h index eae06d9..776f9e9 100644 --- a/tests/auto/uic/baseline/bookwindow.ui.h +++ b/tests/auto/uic/baseline/bookwindow.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'bookwindow.ui' +** Form generated from reading UI file 'bookwindow.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef BOOKWINDOW_H diff --git a/tests/auto/uic/baseline/browserwidget.ui.h b/tests/auto/uic/baseline/browserwidget.ui.h index 67f637f..c1ca60f 100644 --- a/tests/auto/uic/baseline/browserwidget.ui.h +++ b/tests/auto/uic/baseline/browserwidget.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'browserwidget.ui' +** Form generated from reading UI file 'browserwidget.ui' ** ** Created: Mon Jun 16 18:01:09 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef BROWSERWIDGET_H diff --git a/tests/auto/uic/baseline/calculator.ui.h b/tests/auto/uic/baseline/calculator.ui.h index aa70aff..f476d9b 100644 --- a/tests/auto/uic/baseline/calculator.ui.h +++ b/tests/auto/uic/baseline/calculator.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'calculator.ui' +** Form generated from reading UI file 'calculator.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef CALCULATOR_H diff --git a/tests/auto/uic/baseline/calculatorform.ui.h b/tests/auto/uic/baseline/calculatorform.ui.h index 8e9e620..1c575e8 100644 --- a/tests/auto/uic/baseline/calculatorform.ui.h +++ b/tests/auto/uic/baseline/calculatorform.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'calculatorform.ui' +** Form generated from reading UI file 'calculatorform.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef CALCULATORFORM_H diff --git a/tests/auto/uic/baseline/certificateinfo.ui.h b/tests/auto/uic/baseline/certificateinfo.ui.h index bbb5d5f..548bec5 100644 --- a/tests/auto/uic/baseline/certificateinfo.ui.h +++ b/tests/auto/uic/baseline/certificateinfo.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'certificateinfo.ui' +** Form generated from reading UI file 'certificateinfo.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef CERTIFICATEINFO_H diff --git a/tests/auto/uic/baseline/chatdialog.ui.h b/tests/auto/uic/baseline/chatdialog.ui.h index 7d19376..c9f2693 100644 --- a/tests/auto/uic/baseline/chatdialog.ui.h +++ b/tests/auto/uic/baseline/chatdialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'chatdialog.ui' +** Form generated from reading UI file 'chatdialog.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef CHATDIALOG_H diff --git a/tests/auto/uic/baseline/chatmainwindow.ui.h b/tests/auto/uic/baseline/chatmainwindow.ui.h index 93ce435..87ac882 100644 --- a/tests/auto/uic/baseline/chatmainwindow.ui.h +++ b/tests/auto/uic/baseline/chatmainwindow.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'chatmainwindow.ui' +** Form generated from reading UI file 'chatmainwindow.ui' ** ** Created: Mon Sep 1 09:31:02 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef CHATMAINWINDOW_H diff --git a/tests/auto/uic/baseline/chatsetnickname.ui.h b/tests/auto/uic/baseline/chatsetnickname.ui.h index c1fd62b..54f48e7 100644 --- a/tests/auto/uic/baseline/chatsetnickname.ui.h +++ b/tests/auto/uic/baseline/chatsetnickname.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'chatsetnickname.ui' +** Form generated from reading UI file 'chatsetnickname.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef CHATSETNICKNAME_H diff --git a/tests/auto/uic/baseline/config.ui.h b/tests/auto/uic/baseline/config.ui.h index 20de66f..7933178 100644 --- a/tests/auto/uic/baseline/config.ui.h +++ b/tests/auto/uic/baseline/config.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'config.ui' +** Form generated from reading UI file 'config.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef CONFIG_H diff --git a/tests/auto/uic/baseline/connectdialog.ui.h b/tests/auto/uic/baseline/connectdialog.ui.h index b90de56..d7e0eaf 100644 --- a/tests/auto/uic/baseline/connectdialog.ui.h +++ b/tests/auto/uic/baseline/connectdialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'connectdialog.ui' +** Form generated from reading UI file 'connectdialog.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef CONNECTDIALOG_H diff --git a/tests/auto/uic/baseline/controller.ui.h b/tests/auto/uic/baseline/controller.ui.h index 29985c1..c5cd1fe 100644 --- a/tests/auto/uic/baseline/controller.ui.h +++ b/tests/auto/uic/baseline/controller.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'controller.ui' +** Form generated from reading UI file 'controller.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef CONTROLLER_H diff --git a/tests/auto/uic/baseline/cookies.ui.h b/tests/auto/uic/baseline/cookies.ui.h index e4c70ec..0b4d88a 100644 --- a/tests/auto/uic/baseline/cookies.ui.h +++ b/tests/auto/uic/baseline/cookies.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'cookies.ui' +** Form generated from reading UI file 'cookies.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef COOKIES_H diff --git a/tests/auto/uic/baseline/cookiesexceptions.ui.h b/tests/auto/uic/baseline/cookiesexceptions.ui.h index 5a436eb..12e80d8 100644 --- a/tests/auto/uic/baseline/cookiesexceptions.ui.h +++ b/tests/auto/uic/baseline/cookiesexceptions.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'cookiesexceptions.ui' +** Form generated from reading UI file 'cookiesexceptions.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef COOKIESEXCEPTIONS_H diff --git a/tests/auto/uic/baseline/default.ui.h b/tests/auto/uic/baseline/default.ui.h index 7717694..f68a93e 100644 --- a/tests/auto/uic/baseline/default.ui.h +++ b/tests/auto/uic/baseline/default.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'default.ui' +** Form generated from reading UI file 'default.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef DEFAULT_H diff --git a/tests/auto/uic/baseline/dialog.ui.h b/tests/auto/uic/baseline/dialog.ui.h index 307f2fc..d65c10a 100644 --- a/tests/auto/uic/baseline/dialog.ui.h +++ b/tests/auto/uic/baseline/dialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'dialog.ui' +** Form generated from reading UI file 'dialog.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef DIALOG_H diff --git a/tests/auto/uic/baseline/downloaditem.ui.h b/tests/auto/uic/baseline/downloaditem.ui.h index 7df99df..341fdd2 100644 --- a/tests/auto/uic/baseline/downloaditem.ui.h +++ b/tests/auto/uic/baseline/downloaditem.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'downloaditem.ui' +** Form generated from reading UI file 'downloaditem.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef DOWNLOADITEM_H diff --git a/tests/auto/uic/baseline/downloads.ui.h b/tests/auto/uic/baseline/downloads.ui.h index b4739f6..70a038a 100644 --- a/tests/auto/uic/baseline/downloads.ui.h +++ b/tests/auto/uic/baseline/downloads.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'downloads.ui' +** Form generated from reading UI file 'downloads.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef DOWNLOADS_H diff --git a/tests/auto/uic/baseline/embeddeddialog.ui.h b/tests/auto/uic/baseline/embeddeddialog.ui.h index 7df8ab8..3dd36a6 100644 --- a/tests/auto/uic/baseline/embeddeddialog.ui.h +++ b/tests/auto/uic/baseline/embeddeddialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'embeddeddialog.ui' +** Form generated from reading UI file 'embeddeddialog.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef EMBEDDEDDIALOG_H diff --git a/tests/auto/uic/baseline/filespage.ui.h b/tests/auto/uic/baseline/filespage.ui.h index f946002..15a0f5b 100644 --- a/tests/auto/uic/baseline/filespage.ui.h +++ b/tests/auto/uic/baseline/filespage.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'filespage.ui' +** Form generated from reading UI file 'filespage.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef FILESPAGE_H diff --git a/tests/auto/uic/baseline/filternamedialog.ui.h b/tests/auto/uic/baseline/filternamedialog.ui.h index f4306ea..ad435c1 100644 --- a/tests/auto/uic/baseline/filternamedialog.ui.h +++ b/tests/auto/uic/baseline/filternamedialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'filternamedialog.ui' +** Form generated from reading UI file 'filternamedialog.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef FILTERNAMEDIALOG_H diff --git a/tests/auto/uic/baseline/filterpage.ui.h b/tests/auto/uic/baseline/filterpage.ui.h index ebac375..e7fb7fb 100644 --- a/tests/auto/uic/baseline/filterpage.ui.h +++ b/tests/auto/uic/baseline/filterpage.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'filterpage.ui' +** Form generated from reading UI file 'filterpage.ui' ** ** Created: Mon Jun 16 17:58:59 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef FILTERPAGE_H diff --git a/tests/auto/uic/baseline/finddialog.ui.h b/tests/auto/uic/baseline/finddialog.ui.h index 091c54a..7a3620a 100644 --- a/tests/auto/uic/baseline/finddialog.ui.h +++ b/tests/auto/uic/baseline/finddialog.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'finddialog.ui' +** Form generated from reading UI file 'finddialog.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef FINDDIALOG_H diff --git a/tests/auto/uic/baseline/form.ui.h b/tests/auto/uic/baseline/form.ui.h index 3f85b03..60f5a14 100644 --- a/tests/auto/uic/baseline/form.ui.h +++ b/tests/auto/uic/baseline/form.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'form.ui' +** Form generated from reading UI file 'form.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef FORM_H diff --git a/tests/auto/uic/baseline/formwindowsettings.ui.h b/tests/auto/uic/baseline/formwindowsettings.ui.h index 9e97b48..2e29290 100644 --- a/tests/auto/uic/baseline/formwindowsettings.ui.h +++ b/tests/auto/uic/baseline/formwindowsettings.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'formwindowsettings.ui' +** Form generated from reading UI file 'formwindowsettings.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef FORMWINDOWSETTINGS_H diff --git a/tests/auto/uic/baseline/generalpage.ui.h b/tests/auto/uic/baseline/generalpage.ui.h index 0289f50..0dcc6ec 100644 --- a/tests/auto/uic/baseline/generalpage.ui.h +++ b/tests/auto/uic/baseline/generalpage.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'generalpage.ui' +** Form generated from reading UI file 'generalpage.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef GENERALPAGE_H diff --git a/tests/auto/uic/baseline/gridpanel.ui.h b/tests/auto/uic/baseline/gridpanel.ui.h index f79ffa9..1bc2f04 100644 --- a/tests/auto/uic/baseline/gridpanel.ui.h +++ b/tests/auto/uic/baseline/gridpanel.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'gridpanel.ui' +** Form generated from reading UI file 'gridpanel.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef GRIDPANEL_H diff --git a/tests/auto/uic/baseline/helpdialog.ui.h b/tests/auto/uic/baseline/helpdialog.ui.h index 608dba3..b003e7d 100644 --- a/tests/auto/uic/baseline/helpdialog.ui.h +++ b/tests/auto/uic/baseline/helpdialog.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'helpdialog.ui' +** Form generated from reading UI file 'helpdialog.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef HELPDIALOG_H diff --git a/tests/auto/uic/baseline/history.ui.h b/tests/auto/uic/baseline/history.ui.h index 4b84e68..16553df 100644 --- a/tests/auto/uic/baseline/history.ui.h +++ b/tests/auto/uic/baseline/history.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'history.ui' +** Form generated from reading UI file 'history.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef HISTORY_H diff --git a/tests/auto/uic/baseline/identifierpage.ui.h b/tests/auto/uic/baseline/identifierpage.ui.h index 7839600..24aecf8 100644 --- a/tests/auto/uic/baseline/identifierpage.ui.h +++ b/tests/auto/uic/baseline/identifierpage.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'identifierpage.ui' +** Form generated from reading UI file 'identifierpage.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef IDENTIFIERPAGE_H diff --git a/tests/auto/uic/baseline/imagedialog.ui.h b/tests/auto/uic/baseline/imagedialog.ui.h index 001532e..2f51b65 100644 --- a/tests/auto/uic/baseline/imagedialog.ui.h +++ b/tests/auto/uic/baseline/imagedialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'imagedialog.ui' +** Form generated from reading UI file 'imagedialog.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef IMAGEDIALOG_H diff --git a/tests/auto/uic/baseline/inputpage.ui.h b/tests/auto/uic/baseline/inputpage.ui.h index 917f91b..23f2a0b 100644 --- a/tests/auto/uic/baseline/inputpage.ui.h +++ b/tests/auto/uic/baseline/inputpage.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'inputpage.ui' +** Form generated from reading UI file 'inputpage.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef INPUTPAGE_H diff --git a/tests/auto/uic/baseline/installdialog.ui.h b/tests/auto/uic/baseline/installdialog.ui.h index d61377d..e6180f7 100644 --- a/tests/auto/uic/baseline/installdialog.ui.h +++ b/tests/auto/uic/baseline/installdialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'installdialog.ui' +** Form generated from reading UI file 'installdialog.ui' ** ** Created: Thu Jul 10 09:47:34 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef INSTALLDIALOG_H diff --git a/tests/auto/uic/baseline/languagesdialog.ui.h b/tests/auto/uic/baseline/languagesdialog.ui.h index fbe57ca..ff837c1 100644 --- a/tests/auto/uic/baseline/languagesdialog.ui.h +++ b/tests/auto/uic/baseline/languagesdialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'languagesdialog.ui' +** Form generated from reading UI file 'languagesdialog.ui' ** ** Created: Fri May 15 16:58:03 2009 ** by: Qt User Interface Compiler version 4.5.2 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef LANGUAGESDIALOG_H diff --git a/tests/auto/uic/baseline/listwidgeteditor.ui.h b/tests/auto/uic/baseline/listwidgeteditor.ui.h index 127228c..50adea0 100644 --- a/tests/auto/uic/baseline/listwidgeteditor.ui.h +++ b/tests/auto/uic/baseline/listwidgeteditor.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'listwidgeteditor.ui' +** Form generated from reading UI file 'listwidgeteditor.ui' ** ** Created: Mon Jun 16 17:54:30 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef LISTWIDGETEDITOR_H diff --git a/tests/auto/uic/baseline/mainwindow.ui.h b/tests/auto/uic/baseline/mainwindow.ui.h index 73a9de2..11b0196 100644 --- a/tests/auto/uic/baseline/mainwindow.ui.h +++ b/tests/auto/uic/baseline/mainwindow.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'mainwindow.ui' +** Form generated from reading UI file 'mainwindow.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef MAINWINDOW_H diff --git a/tests/auto/uic/baseline/mainwindowbase.ui.h b/tests/auto/uic/baseline/mainwindowbase.ui.h index 4a49f95..aef2f3a 100644 --- a/tests/auto/uic/baseline/mainwindowbase.ui.h +++ b/tests/auto/uic/baseline/mainwindowbase.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'mainwindowbase.ui' +** Form generated from reading UI file 'mainwindowbase.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef MAINWINDOWBASE_H diff --git a/tests/auto/uic/baseline/mydialog.ui.h b/tests/auto/uic/baseline/mydialog.ui.h index 17cf6c5..ac7b458 100644 --- a/tests/auto/uic/baseline/mydialog.ui.h +++ b/tests/auto/uic/baseline/mydialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'mydialog.ui' +** Form generated from reading UI file 'mydialog.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef MYDIALOG_H diff --git a/tests/auto/uic/baseline/myform.ui.h b/tests/auto/uic/baseline/myform.ui.h index 07e1663..74c83f5 100644 --- a/tests/auto/uic/baseline/myform.ui.h +++ b/tests/auto/uic/baseline/myform.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'myform.ui' +** Form generated from reading UI file 'myform.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef MYFORM_H diff --git a/tests/auto/uic/baseline/newactiondialog.ui.h b/tests/auto/uic/baseline/newactiondialog.ui.h index 69f13fd..9c78f7b 100644 --- a/tests/auto/uic/baseline/newactiondialog.ui.h +++ b/tests/auto/uic/baseline/newactiondialog.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'newactiondialog.ui' +** Form generated from reading UI file 'newactiondialog.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef NEWACTIONDIALOG_H diff --git a/tests/auto/uic/baseline/newdynamicpropertydialog.ui.h b/tests/auto/uic/baseline/newdynamicpropertydialog.ui.h index 69f1ed5..f8e5b51 100644 --- a/tests/auto/uic/baseline/newdynamicpropertydialog.ui.h +++ b/tests/auto/uic/baseline/newdynamicpropertydialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'newdynamicpropertydialog.ui' +** Form generated from reading UI file 'newdynamicpropertydialog.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef NEWDYNAMICPROPERTYDIALOG_H diff --git a/tests/auto/uic/baseline/newform.ui.h b/tests/auto/uic/baseline/newform.ui.h index 37eb709..a011e9b 100644 --- a/tests/auto/uic/baseline/newform.ui.h +++ b/tests/auto/uic/baseline/newform.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'newform.ui' +** Form generated from reading UI file 'newform.ui' ** ** Created: Mon Jun 16 17:56:52 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef NEWFORM_H diff --git a/tests/auto/uic/baseline/orderdialog.ui.h b/tests/auto/uic/baseline/orderdialog.ui.h index 7460475..304a3df 100644 --- a/tests/auto/uic/baseline/orderdialog.ui.h +++ b/tests/auto/uic/baseline/orderdialog.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'orderdialog.ui' +** Form generated from reading UI file 'orderdialog.ui' ** ** Created: Mon Jun 16 17:55:54 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef ORDERDIALOG_H diff --git a/tests/auto/uic/baseline/outputpage.ui.h b/tests/auto/uic/baseline/outputpage.ui.h index 8199c57..0b68cb9 100644 --- a/tests/auto/uic/baseline/outputpage.ui.h +++ b/tests/auto/uic/baseline/outputpage.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'outputpage.ui' +** Form generated from reading UI file 'outputpage.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef OUTPUTPAGE_H diff --git a/tests/auto/uic/baseline/pagefold.ui.h b/tests/auto/uic/baseline/pagefold.ui.h index 9c2a453..5cc5836 100644 --- a/tests/auto/uic/baseline/pagefold.ui.h +++ b/tests/auto/uic/baseline/pagefold.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'pagefold.ui' +** Form generated from reading UI file 'pagefold.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef PAGEFOLD_H diff --git a/tests/auto/uic/baseline/paletteeditor.ui.h b/tests/auto/uic/baseline/paletteeditor.ui.h index 0dcefb3..9ef3920 100644 --- a/tests/auto/uic/baseline/paletteeditor.ui.h +++ b/tests/auto/uic/baseline/paletteeditor.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'paletteeditor.ui' +** Form generated from reading UI file 'paletteeditor.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef PALETTEEDITOR_H diff --git a/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h b/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h index bb2a959..419bc0f 100644 --- a/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h +++ b/tests/auto/uic/baseline/paletteeditoradvancedbase.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'paletteeditoradvancedbase.ui' +** Form generated from reading UI file 'paletteeditoradvancedbase.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef PALETTEEDITORADVANCEDBASE_H diff --git a/tests/auto/uic/baseline/passworddialog.ui.h b/tests/auto/uic/baseline/passworddialog.ui.h index 267b5f2..be80298 100644 --- a/tests/auto/uic/baseline/passworddialog.ui.h +++ b/tests/auto/uic/baseline/passworddialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'passworddialog.ui' +** Form generated from reading UI file 'passworddialog.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef PASSWORDDIALOG_H diff --git a/tests/auto/uic/baseline/pathpage.ui.h b/tests/auto/uic/baseline/pathpage.ui.h index 528fed8..257c191 100644 --- a/tests/auto/uic/baseline/pathpage.ui.h +++ b/tests/auto/uic/baseline/pathpage.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'pathpage.ui' +** Form generated from reading UI file 'pathpage.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef PATHPAGE_H diff --git a/tests/auto/uic/baseline/phrasebookbox.ui.h b/tests/auto/uic/baseline/phrasebookbox.ui.h index f4abb1b..8c53463 100644 --- a/tests/auto/uic/baseline/phrasebookbox.ui.h +++ b/tests/auto/uic/baseline/phrasebookbox.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'phrasebookbox.ui' +** Form generated from reading UI file 'phrasebookbox.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef PHRASEBOOKBOX_H diff --git a/tests/auto/uic/baseline/plugindialog.ui.h b/tests/auto/uic/baseline/plugindialog.ui.h index bb51f4a..961155b 100644 --- a/tests/auto/uic/baseline/plugindialog.ui.h +++ b/tests/auto/uic/baseline/plugindialog.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'plugindialog.ui' +** Form generated from reading UI file 'plugindialog.ui' ** ** Created: Mon Jun 16 17:52:32 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef PLUGINDIALOG_H diff --git a/tests/auto/uic/baseline/preferencesdialog.ui.h b/tests/auto/uic/baseline/preferencesdialog.ui.h index 5412fe1..a1f5ac2 100644 --- a/tests/auto/uic/baseline/preferencesdialog.ui.h +++ b/tests/auto/uic/baseline/preferencesdialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'preferencesdialog.ui' +** Form generated from reading UI file 'preferencesdialog.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef PREFERENCESDIALOG_H diff --git a/tests/auto/uic/baseline/previewconfigurationwidget.ui.h b/tests/auto/uic/baseline/previewconfigurationwidget.ui.h index 6d5247d..4a7b694 100644 --- a/tests/auto/uic/baseline/previewconfigurationwidget.ui.h +++ b/tests/auto/uic/baseline/previewconfigurationwidget.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'previewconfigurationwidget.ui' +** Form generated from reading UI file 'previewconfigurationwidget.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef PREVIEWCONFIGURATIONWIDGET_H diff --git a/tests/auto/uic/baseline/previewdialogbase.ui.h b/tests/auto/uic/baseline/previewdialogbase.ui.h index 93bfb69..822990c 100644 --- a/tests/auto/uic/baseline/previewdialogbase.ui.h +++ b/tests/auto/uic/baseline/previewdialogbase.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'previewdialogbase.ui' +** Form generated from reading UI file 'previewdialogbase.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef PREVIEWDIALOGBASE_H diff --git a/tests/auto/uic/baseline/previewwidget.ui.h b/tests/auto/uic/baseline/previewwidget.ui.h index b76aa56..d8a596e 100644 --- a/tests/auto/uic/baseline/previewwidget.ui.h +++ b/tests/auto/uic/baseline/previewwidget.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'previewwidget.ui' +** Form generated from reading UI file 'previewwidget.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef PREVIEWWIDGET_H diff --git a/tests/auto/uic/baseline/previewwidgetbase.ui.h b/tests/auto/uic/baseline/previewwidgetbase.ui.h index 82899b7..e131cd5 100644 --- a/tests/auto/uic/baseline/previewwidgetbase.ui.h +++ b/tests/auto/uic/baseline/previewwidgetbase.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'previewwidgetbase.ui' +** Form generated from reading UI file 'previewwidgetbase.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef PREVIEWWIDGETBASE_H diff --git a/tests/auto/uic/baseline/proxy.ui.h b/tests/auto/uic/baseline/proxy.ui.h index 2ec63fa..d22edef 100644 --- a/tests/auto/uic/baseline/proxy.ui.h +++ b/tests/auto/uic/baseline/proxy.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'proxy.ui' +** Form generated from reading UI file 'proxy.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef PROXY_H diff --git a/tests/auto/uic/baseline/qfiledialog.ui.h b/tests/auto/uic/baseline/qfiledialog.ui.h index 3b3a626..ea5814f 100644 --- a/tests/auto/uic/baseline/qfiledialog.ui.h +++ b/tests/auto/uic/baseline/qfiledialog.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'qfiledialog.ui' +** Form generated from reading UI file 'qfiledialog.ui' ** ** Created: Mon Jun 16 17:51:48 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef QFILEDIALOG_H diff --git a/tests/auto/uic/baseline/qpagesetupwidget.ui.h b/tests/auto/uic/baseline/qpagesetupwidget.ui.h index f2a68bd..4694409 100644 --- a/tests/auto/uic/baseline/qpagesetupwidget.ui.h +++ b/tests/auto/uic/baseline/qpagesetupwidget.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'qpagesetupwidget.ui' +** Form generated from reading UI file 'qpagesetupwidget.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef QPAGESETUPWIDGET_H diff --git a/tests/auto/uic/baseline/qprintpropertieswidget.ui.h b/tests/auto/uic/baseline/qprintpropertieswidget.ui.h index 16148ef..626fee7 100644 --- a/tests/auto/uic/baseline/qprintpropertieswidget.ui.h +++ b/tests/auto/uic/baseline/qprintpropertieswidget.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'qprintpropertieswidget.ui' +** Form generated from reading UI file 'qprintpropertieswidget.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef QPRINTPROPERTIESWIDGET_H diff --git a/tests/auto/uic/baseline/qprintsettingsoutput.ui.h b/tests/auto/uic/baseline/qprintsettingsoutput.ui.h index 307582a..a6360ee 100644 --- a/tests/auto/uic/baseline/qprintsettingsoutput.ui.h +++ b/tests/auto/uic/baseline/qprintsettingsoutput.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'qprintsettingsoutput.ui' +** Form generated from reading UI file 'qprintsettingsoutput.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef QPRINTSETTINGSOUTPUT_H diff --git a/tests/auto/uic/baseline/qprintwidget.ui.h b/tests/auto/uic/baseline/qprintwidget.ui.h index 7fa0b4f..99d6486 100644 --- a/tests/auto/uic/baseline/qprintwidget.ui.h +++ b/tests/auto/uic/baseline/qprintwidget.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'qprintwidget.ui' +** Form generated from reading UI file 'qprintwidget.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef QPRINTWIDGET_H diff --git a/tests/auto/uic/baseline/qsqlconnectiondialog.ui.h b/tests/auto/uic/baseline/qsqlconnectiondialog.ui.h index 846f34d..165c7d7 100644 --- a/tests/auto/uic/baseline/qsqlconnectiondialog.ui.h +++ b/tests/auto/uic/baseline/qsqlconnectiondialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'qsqlconnectiondialog.ui' +** Form generated from reading UI file 'qsqlconnectiondialog.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef QSQLCONNECTIONDIALOG_H diff --git a/tests/auto/uic/baseline/qtgradientdialog.ui.h b/tests/auto/uic/baseline/qtgradientdialog.ui.h index 8a5d18c..0f2f581 100644 --- a/tests/auto/uic/baseline/qtgradientdialog.ui.h +++ b/tests/auto/uic/baseline/qtgradientdialog.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'qtgradientdialog.ui' +** Form generated from reading UI file 'qtgradientdialog.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef QTGRADIENTDIALOG_H diff --git a/tests/auto/uic/baseline/qtgradienteditor.ui.h b/tests/auto/uic/baseline/qtgradienteditor.ui.h index 5eab3a8..4468552 100644 --- a/tests/auto/uic/baseline/qtgradienteditor.ui.h +++ b/tests/auto/uic/baseline/qtgradienteditor.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'qtgradienteditor.ui' +** Form generated from reading UI file 'qtgradienteditor.ui' ** ** Created: Mon Jun 16 17:50:21 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef QTGRADIENTEDITOR_H diff --git a/tests/auto/uic/baseline/qtgradientview.ui.h b/tests/auto/uic/baseline/qtgradientview.ui.h index 6be5ed5..809cf5b 100644 --- a/tests/auto/uic/baseline/qtgradientview.ui.h +++ b/tests/auto/uic/baseline/qtgradientview.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'qtgradientview.ui' +** Form generated from reading UI file 'qtgradientview.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef QTGRADIENTVIEW_H diff --git a/tests/auto/uic/baseline/qtgradientviewdialog.ui.h b/tests/auto/uic/baseline/qtgradientviewdialog.ui.h index 8836301..fd57bc6 100644 --- a/tests/auto/uic/baseline/qtgradientviewdialog.ui.h +++ b/tests/auto/uic/baseline/qtgradientviewdialog.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'qtgradientviewdialog.ui' +** Form generated from reading UI file 'qtgradientviewdialog.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef QTGRADIENTVIEWDIALOG_H diff --git a/tests/auto/uic/baseline/qtresourceeditordialog.ui.h b/tests/auto/uic/baseline/qtresourceeditordialog.ui.h index 03e7362..a08a16c 100644 --- a/tests/auto/uic/baseline/qtresourceeditordialog.ui.h +++ b/tests/auto/uic/baseline/qtresourceeditordialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'qtresourceeditordialog.ui' +** Form generated from reading UI file 'qtresourceeditordialog.ui' ** ** Created: Mon Jun 16 17:45:38 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef QTRESOURCEEDITORDIALOG_H diff --git a/tests/auto/uic/baseline/qttoolbardialog.ui.h b/tests/auto/uic/baseline/qttoolbardialog.ui.h index 7225eda..9099553 100644 --- a/tests/auto/uic/baseline/qttoolbardialog.ui.h +++ b/tests/auto/uic/baseline/qttoolbardialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'qttoolbardialog.ui' +** Form generated from reading UI file 'qttoolbardialog.ui' ** ** Created: Mon Jun 16 17:42:37 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef QTTOOLBARDIALOG_H diff --git a/tests/auto/uic/baseline/querywidget.ui.h b/tests/auto/uic/baseline/querywidget.ui.h index 7697328..8afcf54 100644 --- a/tests/auto/uic/baseline/querywidget.ui.h +++ b/tests/auto/uic/baseline/querywidget.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'querywidget.ui' +** Form generated from reading UI file 'querywidget.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef QUERYWIDGET_H diff --git a/tests/auto/uic/baseline/remotecontrol.ui.h b/tests/auto/uic/baseline/remotecontrol.ui.h index 854a994..3d183f7 100644 --- a/tests/auto/uic/baseline/remotecontrol.ui.h +++ b/tests/auto/uic/baseline/remotecontrol.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'remotecontrol.ui' +** Form generated from reading UI file 'remotecontrol.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef REMOTECONTROL_H diff --git a/tests/auto/uic/baseline/saveformastemplate.ui.h b/tests/auto/uic/baseline/saveformastemplate.ui.h index 1bad01e..483239d 100644 --- a/tests/auto/uic/baseline/saveformastemplate.ui.h +++ b/tests/auto/uic/baseline/saveformastemplate.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'saveformastemplate.ui' +** Form generated from reading UI file 'saveformastemplate.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef SAVEFORMASTEMPLATE_H diff --git a/tests/auto/uic/baseline/settings.ui.h b/tests/auto/uic/baseline/settings.ui.h index 8fb0ef2..98cb6ee 100644 --- a/tests/auto/uic/baseline/settings.ui.h +++ b/tests/auto/uic/baseline/settings.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'settings.ui' +** Form generated from reading UI file 'settings.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef SETTINGS_H diff --git a/tests/auto/uic/baseline/signalslotdialog.ui.h b/tests/auto/uic/baseline/signalslotdialog.ui.h index 6adcf21..f3ce8bc 100644 --- a/tests/auto/uic/baseline/signalslotdialog.ui.h +++ b/tests/auto/uic/baseline/signalslotdialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'signalslotdialog.ui' +** Form generated from reading UI file 'signalslotdialog.ui' ** ** Created: Mon Jun 16 16:18:52 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef SIGNALSLOTDIALOG_H diff --git a/tests/auto/uic/baseline/sslclient.ui.h b/tests/auto/uic/baseline/sslclient.ui.h index 1ca1c3f..aee0224 100644 --- a/tests/auto/uic/baseline/sslclient.ui.h +++ b/tests/auto/uic/baseline/sslclient.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'sslclient.ui' +** Form generated from reading UI file 'sslclient.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef SSLCLIENT_H diff --git a/tests/auto/uic/baseline/sslerrors.ui.h b/tests/auto/uic/baseline/sslerrors.ui.h index a1a46a1..f999be0 100644 --- a/tests/auto/uic/baseline/sslerrors.ui.h +++ b/tests/auto/uic/baseline/sslerrors.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'sslerrors.ui' +** Form generated from reading UI file 'sslerrors.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef SSLERRORS_H diff --git a/tests/auto/uic/baseline/statistics.ui.h b/tests/auto/uic/baseline/statistics.ui.h index b8257c4..713c1c2 100644 --- a/tests/auto/uic/baseline/statistics.ui.h +++ b/tests/auto/uic/baseline/statistics.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'statistics.ui' +** Form generated from reading UI file 'statistics.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef STATISTICS_H diff --git a/tests/auto/uic/baseline/stringlisteditor.ui.h b/tests/auto/uic/baseline/stringlisteditor.ui.h index e6daa52..23655d9 100644 --- a/tests/auto/uic/baseline/stringlisteditor.ui.h +++ b/tests/auto/uic/baseline/stringlisteditor.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'stringlisteditor.ui' +** Form generated from reading UI file 'stringlisteditor.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef STRINGLISTEDITOR_H diff --git a/tests/auto/uic/baseline/stylesheeteditor.ui.h b/tests/auto/uic/baseline/stylesheeteditor.ui.h index 7633d5b..a99f274 100644 --- a/tests/auto/uic/baseline/stylesheeteditor.ui.h +++ b/tests/auto/uic/baseline/stylesheeteditor.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'stylesheeteditor.ui' +** Form generated from reading UI file 'stylesheeteditor.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef STYLESHEETEDITOR_H diff --git a/tests/auto/uic/baseline/tabbedbrowser.ui.h b/tests/auto/uic/baseline/tabbedbrowser.ui.h index 1106f13..c234f64 100644 --- a/tests/auto/uic/baseline/tabbedbrowser.ui.h +++ b/tests/auto/uic/baseline/tabbedbrowser.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'tabbedbrowser.ui' +** Form generated from reading UI file 'tabbedbrowser.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef TABBEDBROWSER_H diff --git a/tests/auto/uic/baseline/tablewidgeteditor.ui.h b/tests/auto/uic/baseline/tablewidgeteditor.ui.h index 4769c42..38fb832 100644 --- a/tests/auto/uic/baseline/tablewidgeteditor.ui.h +++ b/tests/auto/uic/baseline/tablewidgeteditor.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'tablewidgeteditor.ui' +** Form generated from reading UI file 'tablewidgeteditor.ui' ** ** Created: Mon Jun 16 17:48:45 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef TABLEWIDGETEDITOR_H diff --git a/tests/auto/uic/baseline/tetrixwindow.ui.h b/tests/auto/uic/baseline/tetrixwindow.ui.h index a848545..50ed416 100644 --- a/tests/auto/uic/baseline/tetrixwindow.ui.h +++ b/tests/auto/uic/baseline/tetrixwindow.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'tetrixwindow.ui' +** Form generated from reading UI file 'tetrixwindow.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef TETRIXWINDOW_H diff --git a/tests/auto/uic/baseline/textfinder.ui.h b/tests/auto/uic/baseline/textfinder.ui.h index f1d51f9..546ff17 100644 --- a/tests/auto/uic/baseline/textfinder.ui.h +++ b/tests/auto/uic/baseline/textfinder.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'textfinder.ui' +** Form generated from reading UI file 'textfinder.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef TEXTFINDER_H diff --git a/tests/auto/uic/baseline/topicchooser.ui.h b/tests/auto/uic/baseline/topicchooser.ui.h index 8404d0c..65cf205 100644 --- a/tests/auto/uic/baseline/topicchooser.ui.h +++ b/tests/auto/uic/baseline/topicchooser.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'topicchooser.ui' +** Form generated from reading UI file 'topicchooser.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef TOPICCHOOSER_H diff --git a/tests/auto/uic/baseline/translatedialog.ui.h b/tests/auto/uic/baseline/translatedialog.ui.h index b0df4b5..a85f5ed 100644 --- a/tests/auto/uic/baseline/translatedialog.ui.h +++ b/tests/auto/uic/baseline/translatedialog.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'translatedialog.ui' +** Form generated from reading UI file 'translatedialog.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef TRANSLATEDIALOG_H diff --git a/tests/auto/uic/baseline/translationsettings.ui.h b/tests/auto/uic/baseline/translationsettings.ui.h index 7ce0485..e36545e 100644 --- a/tests/auto/uic/baseline/translationsettings.ui.h +++ b/tests/auto/uic/baseline/translationsettings.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'translationsettings.ui' +** Form generated from reading UI file 'translationsettings.ui' ** ** Created: Mon Sep 1 09:31:03 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef TRANSLATIONSETTINGS_H diff --git a/tests/auto/uic/baseline/treewidgeteditor.ui.h b/tests/auto/uic/baseline/treewidgeteditor.ui.h index eb4875d..2fe6344 100644 --- a/tests/auto/uic/baseline/treewidgeteditor.ui.h +++ b/tests/auto/uic/baseline/treewidgeteditor.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'treewidgeteditor.ui' +** Form generated from reading UI file 'treewidgeteditor.ui' ** ** Created: Mon Jun 16 17:47:26 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef TREEWIDGETEDITOR_H diff --git a/tests/auto/uic/baseline/trpreviewtool.ui.h b/tests/auto/uic/baseline/trpreviewtool.ui.h index 2575cda..5f92583 100644 --- a/tests/auto/uic/baseline/trpreviewtool.ui.h +++ b/tests/auto/uic/baseline/trpreviewtool.ui.h @@ -41,12 +41,12 @@ */ /******************************************************************************** -** Form generated from reading ui file 'trpreviewtool.ui' +** Form generated from reading UI file 'trpreviewtool.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef TRPREVIEWTOOL_H diff --git a/tests/auto/uic/baseline/validators.ui.h b/tests/auto/uic/baseline/validators.ui.h index 03bc898..07e114a 100644 --- a/tests/auto/uic/baseline/validators.ui.h +++ b/tests/auto/uic/baseline/validators.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'validators.ui' +** Form generated from reading UI file 'validators.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef VALIDATORS_H diff --git a/tests/auto/uic/baseline/wateringconfigdialog.ui.h b/tests/auto/uic/baseline/wateringconfigdialog.ui.h index 02de59b..43120a5 100644 --- a/tests/auto/uic/baseline/wateringconfigdialog.ui.h +++ b/tests/auto/uic/baseline/wateringconfigdialog.ui.h @@ -1,10 +1,10 @@ /******************************************************************************** -** Form generated from reading ui file 'wateringconfigdialog.ui' +** Form generated from reading UI file 'wateringconfigdialog.ui' ** ** Created: Thu Jul 10 09:47:35 2008 ** by: Qt User Interface Compiler version 4.5.0 ** -** WARNING! All changes made in this file will be lost when recompiling ui file! +** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef WATERINGCONFIGDIALOG_H diff --git a/tests/auto/windowsmobile/test/test.pro b/tests/auto/windowsmobile/test/test.pro index 2420bf1..b7f65a9 100644 --- a/tests/auto/windowsmobile/test/test.pro +++ b/tests/auto/windowsmobile/test/test.pro @@ -8,8 +8,7 @@ RESOURCES += windowsmobile.qrc TARGET = tst_windowsmobile wincewm*: { - addFiles.sources = \ - ../testQMenuBar/*.exe + addFiles.sources = $$OUT_PWD/../testQMenuBar/*.exe addFiles.path = "\Program Files\tst_windowsmobile" diff --git a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp index 2069d03..26dc280 100644 --- a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp +++ b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp @@ -154,7 +154,7 @@ void tst_XmlPatterns::xquerySupport() const QByteArray rawProducedStderr((process.readAllStandardError())); const QString fixedStderr(QString::fromLocal8Bit(rawProducedStderr).remove(m_filenameInStderr)); - const QString errorFileName(inputFile(QLatin1String("stderrBaselines/") + + const QString errorFileName(inputFile(QLatin1String(SRCDIR "stderrBaselines/") + QString::fromUtf8(QTest::currentDataTag()).remove(m_normalizeTestName) + QLatin1String(".txt"))); @@ -221,7 +221,7 @@ void tst_XmlPatterns::xquerySupport_data() const #endif /* Check one file for existence, to avoid possible false positives. */ - QVERIFY(QFile::exists(inputFile(QLatin1String("queries/onePlusOne.xq")))); + QVERIFY(QFile::exists(inputFile(QLatin1String(SRCDIR "queries/onePlusOne.xq")))); QTest::addColumn<int>("expectedExitCode"); QTest::addColumn<QByteArray>("expectedQueryOutput"); @@ -232,21 +232,21 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("A simple math query") << 0 << QByteArray("2\n") - << QStringList((QLatin1String("queries/onePlusOne.xq"))) + << QStringList((QLatin1String(SRCDIR "queries/onePlusOne.xq"))) << QString() << QString(); QTest::newRow("An unbound external variable") << 2 << QByteArray() - << QStringList(QLatin1String("queries/externalVariable.xq")) + << QStringList(QLatin1String(SRCDIR "queries/externalVariable.xq")) << QString() << QString(); QTest::newRow("Bind an external variable") << 0 << QByteArray("1 4<e>1</e>true\n") - << (QStringList() << QLatin1String("queries/externalVariable.xq") + << (QStringList() << QLatin1String(SRCDIR "queries/externalVariable.xq") << QLatin1String("-param") << QLatin1String("externalVariable=1")) << QString() @@ -257,21 +257,21 @@ void tst_XmlPatterns::xquerySupport_data() const << QByteArray("1 4<e>1</e>true\n") << (QStringList() << QLatin1String("-param") << QLatin1String("externalVariable=1") - << QLatin1String("queries/externalVariable.xq")) + << QLatin1String(SRCDIR "queries/externalVariable.xq")) << QString() << QString(); QTest::newRow("Use fn:doc") << 0 << QByteArray("<e xmlns=\"http://example.com\" xmlns:p=\"http://example.com/P\" attr=\"1\" p:attr=\"\">\n <?target data?>\n <!-- a comment -->\n <e/>text <f/>text node</e>\n") - << QStringList(QLatin1String("queries/openDocument.xq")) + << QStringList(QLatin1String(SRCDIR "queries/openDocument.xq")) << QString() << QString(); QTest::newRow("Use fn:doc, together with -no-format, last") << 0 << QByteArray("<e xmlns=\"http://example.com\" xmlns:p=\"http://example.com/P\" attr=\"1\" p:attr=\"\"><?target data?><!-- a comment --><e/>text <f/>text node</e>") - << (QStringList() << QLatin1String("queries/openDocument.xq") + << (QStringList() << QLatin1String(SRCDIR "queries/openDocument.xq") << QLatin1String("-no-format")) << QString() << QString(); @@ -280,7 +280,7 @@ void tst_XmlPatterns::xquerySupport_data() const << 0 << QByteArray("<e xmlns=\"http://example.com\" xmlns:p=\"http://example.com/P\" attr=\"1\" p:attr=\"\"><?target data?><!-- a comment --><e/>text <f/>text node</e>") << (QStringList() << QLatin1String("-no-format") - << QLatin1String("queries/openDocument.xq")) + << QLatin1String(SRCDIR "queries/openDocument.xq")) << QString() << QString(); @@ -288,28 +288,28 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Make sure query paths are resolved against CWD, not the location of the executable.") << 0 << QByteArray("2\n") - << QStringList(QLatin1String("onePlusOne.xq")) + << QStringList(QLatin1String(SRCDIR "queries/onePlusOne.xq")) << QString::fromLatin1("queries") << QString(); QTest::newRow("Call fn:error()") << 2 << QByteArray() - << QStringList(QLatin1String("queries/errorFunction.xq")) + << QStringList(QLatin1String(SRCDIR "queries/errorFunction.xq")) << QString() << QString(); QTest::newRow("Evaluate a library module") << 2 << QByteArray() - << QStringList(QLatin1String("queries/simpleLibraryModule.xq")) + << QStringList(QLatin1String(SRCDIR "queries/simpleLibraryModule.xq")) << QString() << QString(); QTest::newRow("Trigger a static error.") << 2 << QByteArray() - << QStringList(QLatin1String("queries/staticError.xq")) + << QStringList(QLatin1String(SRCDIR "queries/staticError.xq")) << QString() << QString(); @@ -323,7 +323,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Open an nonexistent file") << 2 << QByteArray() - << QStringList(QLatin1String("queries/ThisFileDoesNotExist.xq")) + << QStringList(QLatin1String(SRCDIR "queries/ThisFileDoesNotExist.xq")) << QString() << QString(); @@ -332,63 +332,63 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("XQuery-function message markups") << 2 << QByteArray() - << QStringList(QLatin1String("queries/wrongArity.xq")) + << QStringList(QLatin1String(SRCDIR "queries/wrongArity.xq")) << QString() << QString(); QTest::newRow("XQuery-type message markups") << 2 << QByteArray() - << QStringList(QLatin1String("queries/typeError.xq")) + << QStringList(QLatin1String(SRCDIR "queries/typeError.xq")) << QString() << QString(); QTest::newRow("XQuery-data & XQuery-keyword message markups") << 2 << QByteArray() - << QStringList(QLatin1String("queries/zeroDivision.xq")) + << QStringList(QLatin1String(SRCDIR "queries/zeroDivision.xq")) << QString() << QString(); QTest::newRow("XQuery-uri message markups") << 2 << QByteArray() - << QStringList(QLatin1String("queries/unsupportedCollation.xq")) + << QStringList(QLatin1String(SRCDIR "queries/unsupportedCollation.xq")) << QString() << QString(); QTest::newRow("XQuery-expression message markups") << 2 << QByteArray() - << QStringList(QLatin1String("queries/invalidRegexp.xq")) + << QStringList(QLatin1String(SRCDIR "queries/invalidRegexp.xq")) << QString() << QString(); QTest::newRow("Print a list of available regexp flags(The available flags are formatted in a complex way.)") << 2 << QByteArray() - << QStringList(QLatin1String("queries/invalidRegexpFlag.xq")) + << QStringList(QLatin1String(SRCDIR "queries/invalidRegexpFlag.xq")) << QString() << QString(); QTest::newRow("Trigger an assert in QPatternist::ColorOutput. The query naturally contains an error; XPTY0004.") << 2 << QByteArray() - << QStringList(QLatin1String("queries/flwor.xq")) + << QStringList(QLatin1String(SRCDIR "queries/flwor.xq")) << QString() << QString(); QTest::newRow("Trigger a second assert in QPatternist::ColorOutput. The query naturally contains XPST0003.") << 2 << QByteArray() - << QStringList(QLatin1String("queries/syntaxError.xq")) + << QStringList(QLatin1String(SRCDIR "queries/syntaxError.xq")) << QString() << QString(); QTest::newRow("-param is missing so multiple queries appear") << 2 << QByteArray() - << (QStringList() << QLatin1String("queries/reportGlobals.xq") + << (QStringList() << QLatin1String(SRCDIR "queries/reportGlobals.xq") << QLatin1String("fileToOpen=globals.gccxml")) << QString() << QString(); @@ -403,7 +403,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Basic use of -output, query first") << 0 << QByteArray("2\n") - << (QStringList() << QLatin1String("queries/onePlusOne.xq") + << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq") << QLatin1String("-output") << QLatin1String("basicOutput.out")) << QString() @@ -414,22 +414,22 @@ void tst_XmlPatterns::xquerySupport_data() const << QByteArray("<e/>\n") << (QStringList() << QLatin1String("-output") << QLatin1String("basicOutput2.out") - << QLatin1String("queries/oneElement.xq")) + << QLatin1String(SRCDIR "queries/oneElement.xq")) << QString() << QString::fromLatin1("basicOutput2.out"); QTest::newRow("A single query, that does not exist") << 2 << QByteArray() - << (QStringList() << QLatin1String("doesNotExist.xq")) + << (QStringList() << QLatin1String(SRCDIR "doesNotExist.xq")) << QString() << QString(); QTest::newRow("Specify two identical query names") << 2 << QByteArray() - << (QStringList() << QLatin1String("query.xq") - << QLatin1String("query.xq")) + << (QStringList() << QLatin1String(SRCDIR "query.xq") + << QLatin1String(SRCDIR "query.xq")) << QString() << QString(); @@ -459,7 +459,7 @@ void tst_XmlPatterns::xquerySupport_data() const << QByteArray() << (QStringList() << QLatin1String("-output") << filename - << QLatin1String("queries/onePlusOne.xq")) + << QLatin1String(SRCDIR "queries/onePlusOne.xq")) << QString() << filename; } @@ -476,7 +476,7 @@ void tst_XmlPatterns::xquerySupport_data() const << QByteArray("2\n") << (QStringList() << QLatin1String("-output") << outName - << QLatin1String("queries/onePlusOne.xq")) + << QLatin1String(SRCDIR "queries/onePlusOne.xq")) << QString() << outName; } @@ -484,7 +484,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("one query, and a terminating dash at the end") << 0 << QByteArray("2\n") - << (QStringList() << QLatin1String("queries/onePlusOne.xq") + << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq") << QLatin1String("-")) << QString() << QString(); @@ -493,7 +493,7 @@ void tst_XmlPatterns::xquerySupport_data() const << 0 << QByteArray("2\n") << (QStringList() << QLatin1String("-") - << QLatin1String("queries/onePlusOne.xq")) + << QLatin1String(SRCDIR "queries/onePlusOne.xq")) << QString() << QString(); @@ -580,21 +580,21 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Run a query which evaluates to the empty sequence.") << 0 << QByteArray("\n") - << (QStringList() << QLatin1String("queries/emptySequence.xq")) + << (QStringList() << QLatin1String(SRCDIR "queries/emptySequence.xq")) << QString() << QString(); QTest::newRow("Run a query which evaluates to a single document node with no children.") << 0 << QByteArray("\n") - << (QStringList() << QLatin1String("queries/onlyDocumentNode.xq")) + << (QStringList() << QLatin1String(SRCDIR "queries/onlyDocumentNode.xq")) << QString() << QString(); QTest::newRow("Invoke with invalid -param value.") << 1 << QByteArray() - << (QStringList() << QLatin1String("queries/externalVariable.xq") + << (QStringList() << QLatin1String(SRCDIR "queries/externalVariable.xq") << QLatin1String("-param") << QLatin1String("EqualSignIsMissing")) << QString() @@ -603,7 +603,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Invoke with colon in variable name.") << 1 << QByteArray() - << (QStringList() << QLatin1String("queries/externalVariable.xq") + << (QStringList() << QLatin1String(SRCDIR "queries/externalVariable.xq") << QLatin1String("-param") << QLatin1String("xs:name=value")) << QString() @@ -612,7 +612,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Invoke with missing name in -param arg.") << 1 << QByteArray() - << (QStringList() << QLatin1String("queries/externalVariable.xq") + << (QStringList() << QLatin1String(SRCDIR "queries/externalVariable.xq") << QLatin1String("-param") << QLatin1String("=value")) << QString() @@ -621,7 +621,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Invoke with -param that has two adjacent equal signs.") << 0 << QByteArray("START =text END\n") - << (QStringList() << QLatin1String("queries/externalStringVariable.xq") + << (QStringList() << QLatin1String(SRCDIR "queries/externalStringVariable.xq") << QLatin1String("-param") << QLatin1String("externalString==text")) << QString() @@ -630,7 +630,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Pass in an external variable, but the query doesn't use it.") << 0 << QByteArray("2\n") - << (QStringList() << QLatin1String("queries/onePlusOne.xq") + << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq") << QLatin1String("-param") << QLatin1String("externalString==text")) << QString() @@ -640,7 +640,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Invoke with -param that has no value.") << 0 << QByteArray("START END\n") - << (QStringList() << QLatin1String("queries/externalStringVariable.xq") + << (QStringList() << QLatin1String(SRCDIR "queries/externalStringVariable.xq") << QLatin1String("-param") << QLatin1String("externalString=")) << QString() @@ -656,7 +656,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Use a native path") << 0 << QByteArray("2\n") - << (QStringList() << QDir::toNativeSeparators(QLatin1String("queries/onePlusOne.xq"))) + << (QStringList() << QDir::toNativeSeparators(QLatin1String(SRCDIR "queries/onePlusOne.xq"))) << QString() << QString(); @@ -671,8 +671,8 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("A valid, existing query, followed by a bogus one") << 1 << QByteArray() - << (QStringList() << QLatin1String("queries/onePlusOne.xq") - << QLatin1String("doesNotExist.xq")) + << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq") + << QLatin1String(SRCDIR "doesNotExist.xq")) << QString() << QString(); */ @@ -681,8 +681,8 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Specify two different query names") << 1 << QByteArray() - << (QStringList() << QLatin1String("query1.xq") - << QLatin1String("query2.xq")) + << (QStringList() << QLatin1String(SRCDIR "query1.xq") + << QLatin1String(SRCDIR "query2.xq")) << QString() << QString(); */ @@ -696,7 +696,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Use -param twice") << 0 << QByteArray("param1 param2\n") - << (QStringList() << QLatin1String("queries/twoVariables.xq") + << (QStringList() << QLatin1String(SRCDIR "queries/twoVariables.xq") << QLatin1String("-param") << QLatin1String("var1=param1") << QLatin1String("-param") @@ -707,7 +707,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Use -param thrice") << 0 << QByteArray("param1 param2 third\n") - << (QStringList() << QLatin1String("queries/threeVariables.xq") + << (QStringList() << QLatin1String(SRCDIR "queries/threeVariables.xq") << QLatin1String("-param") << QLatin1String("var1=param1") << QLatin1String("-param") @@ -720,7 +720,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Specify the same parameter twice, different values") << 1 << QByteArray() - << (QStringList() << QLatin1String("queries/onePlusOne.xq") + << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq") << QLatin1String("-param") << QLatin1String("duplicated=param1") << QLatin1String("-param") @@ -731,7 +731,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Specify the same parameter twice, same values") << 1 << QByteArray() - << (QStringList() << QLatin1String("queries/onePlusOne.xq") + << (QStringList() << QLatin1String(SRCDIR "queries/onePlusOne.xq") << QLatin1String("-param") << QLatin1String("duplicated=param1") << QLatin1String("-param") @@ -742,7 +742,7 @@ void tst_XmlPatterns::xquerySupport_data() const QTest::newRow("Open a non-existing collection.") << 2 << QByteArray() - << (QStringList() << QLatin1String("queries/nonexistingCollection.xq")) + << (QStringList() << QLatin1String(SRCDIR "queries/nonexistingCollection.xq")) << QString() << QString(); @@ -804,7 +804,7 @@ void tst_XmlPatterns::stdoutFailure() const //process.setStandardOutputFile(outName); process.setWorkingDirectory(QDir::current().absoluteFilePath(QString())); - process.start(m_command, QStringList("queries/onePlusOne.xq")); + process.start(m_command, QStringList(SRCDIR "queries/onePlusOne.xq")); QCOMPARE(process.exitStatus(), QProcess::NormalExit); QVERIFY(process.waitForFinished()); @@ -865,8 +865,8 @@ void tst_XmlPatterns::xsltSupport_data() const QTest::newRow("Pass in a stylesheet file which contains an XQuery query") << 2 << QByteArray() - << (QStringList() << QLatin1String("stylesheets/queryAsStylesheet.xsl") - << QLatin1String("queries/simpleDocument.xml")) + << (QStringList() << QLatin1String(SRCDIR "stylesheets/queryAsStylesheet.xsl") + << QLatin1String(SRCDIR "queries/simpleDocument.xml")) << QString() << QString(); @@ -883,7 +883,7 @@ void tst_XmlPatterns::xsltSupport_data() const << QByteArray() << (QStringList() << QLatin1String("-initial-template") << QLatin1String("name") - << QLatin1String("queries/onePlusOne.xq")) + << QLatin1String(SRCDIR "queries/onePlusOne.xq")) << QString() << QString(); @@ -918,8 +918,8 @@ void tst_XmlPatterns::xsltSupport_data() const << (QStringList() << QLatin1String("-no-format") << QLatin1String("-initial-template") << QLatin1String("main") - << QLatin1String("stylesheets/namedAndRootTemplate.xsl") - << QLatin1String("stylesheets/documentElement.xml")) + << QLatin1String(SRCDIR "stylesheets/namedAndRootTemplate.xsl") + << QLatin1String(SRCDIR "stylesheets/documentElement.xml")) << QString() << QString(); @@ -929,8 +929,8 @@ void tst_XmlPatterns::xsltSupport_data() const << (QStringList() << QLatin1String("-no-format") << QLatin1String("-initial-template") << QLatin1String("no-template-by-this-name") - << QLatin1String("stylesheets/namedAndRootTemplate.xsl") - << QLatin1String("stylesheets/documentElement.xml")) + << QLatin1String(SRCDIR "stylesheets/namedAndRootTemplate.xsl") + << QLatin1String(SRCDIR "stylesheets/documentElement.xml")) << QString() << QString(); @@ -940,7 +940,7 @@ void tst_XmlPatterns::xsltSupport_data() const << (QStringList() << QLatin1String("-no-format") << QLatin1String("-initial-template") << QLatin1String("main") - << QLatin1String("stylesheets/namedAndRootTemplate.xsl")) + << QLatin1String(SRCDIR "stylesheets/namedAndRootTemplate.xsl")) << QString() << QString(); @@ -950,7 +950,7 @@ void tst_XmlPatterns::xsltSupport_data() const << (QStringList() << QLatin1String("-no-format") << QLatin1String("-initial-template") << QLatin1String("{http://example.com/NS}main") - << QLatin1String("stylesheets/namedAndRootTemplate.xsl")) + << QLatin1String(SRCDIR "stylesheets/namedAndRootTemplate.xsl")) << QString() << QString(); @@ -959,7 +959,7 @@ void tst_XmlPatterns::xsltSupport_data() const << QByteArray("defParam overridedDefaultedParam implicitlyRequiredValue\n") << (QStringList() << QLatin1String("-initial-template") << QLatin1String("main") - << QLatin1String("stylesheets/useParameters.xsl") + << QLatin1String(SRCDIR "stylesheets/useParameters.xsl") << QLatin1String("-param") << QLatin1String("overridedDefaultedParam=overridedDefaultedParam") << QLatin1String("-param") @@ -970,24 +970,24 @@ void tst_XmlPatterns::xsltSupport_data() const QTest::newRow("Use a simplified stylesheet module") << 0 << QByteArray("<output>some text</output>\n") - << (QStringList() << QLatin1String("stylesheets/simplifiedStylesheetModule.xsl") - << QLatin1String("stylesheets/simplifiedStylesheetModule.xml")) + << (QStringList() << QLatin1String(SRCDIR "stylesheets/simplifiedStylesheetModule.xsl") + << QLatin1String(SRCDIR "stylesheets/simplifiedStylesheetModule.xml")) << QString() << QString(); QTest::newRow("Not well-formed stylesheet, causes crash in coloring code.") << 2 << QByteArray() - << (QStringList() << QLatin1String("stylesheets/notWellformed.xsl") - << QLatin1String("queries/simpleDocument.xml")) + << (QStringList() << QLatin1String(SRCDIR "stylesheets/notWellformed.xsl") + << QLatin1String(SRCDIR "queries/simpleDocument.xml")) << QString() << QString(); QTest::newRow("Not well-formed instance document, causes crash in coloring code.") << 2 << QByteArray() - << (QStringList() << QLatin1String("stylesheets/bool070.xsl") - << QLatin1String("stylesheets/bool070.xml")) + << (QStringList() << QLatin1String(SRCDIR "stylesheets/bool070.xsl") + << QLatin1String(SRCDIR "stylesheets/bool070.xml")) << QString() << QString(); diff --git a/tests/auto/xmlpatterns/xmlpatterns.pro b/tests/auto/xmlpatterns/xmlpatterns.pro index 569e23f..01e3b2b 100644 --- a/tests/auto/xmlpatterns/xmlpatterns.pro +++ b/tests/auto/xmlpatterns/xmlpatterns.pro @@ -2,4 +2,10 @@ load(qttest_p4) SOURCES += tst_xmlpatterns.cpp \ ../qxmlquery/TestFundament.cpp +!wince* { +DEFINES += SRCDIR=\\\"$$PWD/\\\" +} else { +DEFINES += SRCDIR=\\\"./\\\" +} + include (../xmlpatterns.pri) diff --git a/tests/manual/qdesktopwidget/main.cpp b/tests/manual/qdesktopwidget/main.cpp index 2cbdfb9..653a5fc 100644 --- a/tests/manual/qdesktopwidget/main.cpp +++ b/tests/manual/qdesktopwidget/main.cpp @@ -53,8 +53,11 @@ public: QDesktopWidget *desktop = QApplication::desktop(); connect(desktop, SIGNAL(resized(int)), this, SLOT(updateScene())); + connect(desktop, SIGNAL(resized(int)), this, SLOT(desktopResized(int))); connect(desktop, SIGNAL(workAreaResized(int)), this, SLOT(updateScene())); + connect(desktop, SIGNAL(workAreaResized(int)), this, SLOT(desktopWorkAreaResized(int))); connect(desktop, SIGNAL(screenCountChanged(int)), this, SLOT(updateScene())); + connect(desktop, SIGNAL(screenCountChanged(int)), this, SLOT(desktopScreenCountChanged(int))); updateScene(); @@ -63,6 +66,7 @@ public: setTransform(transform); setBackgroundBrush(Qt::darkGray); + desktopScreenCountChanged(-1); } protected: @@ -169,6 +173,33 @@ private slots: return rect; } + void desktopResized(int screen) + { + qDebug() << "Screen was resized: " << screen + << ", new size =" << QApplication::desktop()->screenGeometry(screen); + } + void desktopWorkAreaResized(int screen) + { + qDebug() << "Screen workarea was resized: " << screen + << ", new size =" << QApplication::desktop()->availableGeometry(screen); + } + void desktopScreenCountChanged(int screenCount) + { + QDesktopWidget *desktop = QApplication::desktop(); + qDebug() << ""; + if (screenCount != -1) { + qDebug() << "Screen count was changed to " << screenCount; + } else { + screenCount = desktop->screenCount(); + qDebug() << "Screen count: " << screenCount; + } + for (int i = 0; i < screenCount; ++i) { + qDebug() << " #" << i << ": geometry =" << desktop->screenGeometry(i) + << "; available geometry =" << desktop->availableGeometry(i); + } + qDebug() << ""; + } + private: QGraphicsScene *scene; QGraphicsRectItem *that; diff --git a/tools/checksdk/main.cpp b/tools/checksdk/main.cpp index 6322eb7..b36aa32 100644 --- a/tools/checksdk/main.cpp +++ b/tools/checksdk/main.cpp @@ -161,5 +161,5 @@ int main(int argc, char **argv) } } qWarning("Could not find specified SDK: %s" , qPrintable(sdkName)); - return 0; -}
\ No newline at end of file + return -1; +} diff --git a/tools/designer/src/components/buddyeditor/buddyeditor.cpp b/tools/designer/src/components/buddyeditor/buddyeditor.cpp index 9984b0d..d5c8670 100644 --- a/tools/designer/src/components/buddyeditor/buddyeditor.cpp +++ b/tools/designer/src/components/buddyeditor/buddyeditor.cpp @@ -404,7 +404,7 @@ QWidget *BuddyEditor::findBuddy(QLabel *l, const QWidgetList &existingBuddies) c const QRect geom = l->geometry(); const int y = geom.center().y(); QWidget *neighbour = 0; - switch (QApplication::layoutDirection()) { + switch (l->layoutDirection()) { case Qt::LeftToRight: { // Walk right to find next managed neighbour const int xEnd = parent->size().width(); for (int x = geom.right() + 1; x < xEnd; x += DeltaX) diff --git a/tools/designer/src/components/formeditor/default_actionprovider.cpp b/tools/designer/src/components/formeditor/default_actionprovider.cpp index 42d1f81..41333f8 100644 --- a/tools/designer/src/components/formeditor/default_actionprovider.cpp +++ b/tools/designer/src/components/formeditor/default_actionprovider.cpp @@ -73,9 +73,8 @@ enum { indicatorSize = 2 }; // Position an indicator horizontally over the rectangle, indicating // 'Insert before' (left or right according to layout direction) -static inline QRect horizontalIndicatorRect(const QRect &rect) +static inline QRect horizontalIndicatorRect(const QRect &rect, Qt::LayoutDirection layoutDirection) { - const Qt::LayoutDirection layoutDirection = QApplication::layoutDirection(); // Position right? QRect rc = QRect(rect.x(), 0, indicatorSize, rect.height() - 1); if (layoutDirection == Qt::RightToLeft) @@ -91,13 +90,13 @@ static inline QRect verticalIndicatorRect(const QRect &rect) // Determine the geometry of the indicator by retrieving // the action under mouse and positioning the bar within its geometry. -QRect ActionProviderBase::indicatorGeometry(const QPoint &pos) const +QRect ActionProviderBase::indicatorGeometry(const QPoint &pos, Qt::LayoutDirection layoutDirection) const { QAction *action = actionAt(pos); if (!action) return QRect(); QRect rc = actionGeometry(action); - return orientation() == Qt::Horizontal ? horizontalIndicatorRect(rc) : verticalIndicatorRect(rc); + return orientation() == Qt::Horizontal ? horizontalIndicatorRect(rc, layoutDirection) : verticalIndicatorRect(rc); } // Adjust the indicator while dragging. (-1,1) is called to finish a DND operation @@ -107,7 +106,7 @@ void ActionProviderBase::adjustIndicator(const QPoint &pos) m_indicator->hide(); return; } - const QRect ig = indicatorGeometry(pos); + const QRect ig = indicatorGeometry(pos, m_indicator->layoutDirection()); if (ig.isValid()) { m_indicator->setGeometry(ig); QPalette p = m_indicator->palette(); @@ -145,9 +144,9 @@ Qt::Orientation QToolBarActionProvider::orientation() const return m_widget->orientation(); } -QRect QToolBarActionProvider::indicatorGeometry(const QPoint &pos) const +QRect QToolBarActionProvider::indicatorGeometry(const QPoint &pos, Qt::LayoutDirection layoutDirection) const { - const QRect actionRect = ActionProviderBase::indicatorGeometry(pos); + const QRect actionRect = ActionProviderBase::indicatorGeometry(pos, layoutDirection); if (actionRect.isValid()) return actionRect; // Toolbar differs in that is has no dummy placeholder to 'insert before' @@ -155,7 +154,7 @@ QRect QToolBarActionProvider::indicatorGeometry(const QPoint &pos) const const QRect freeArea = ToolBarEventFilter::freeArea(m_widget); if (!freeArea.contains(pos)) return QRect(); - return orientation() == Qt::Horizontal ? horizontalIndicatorRect(freeArea) : verticalIndicatorRect(freeArea); + return orientation() == Qt::Horizontal ? horizontalIndicatorRect(freeArea, layoutDirection) : verticalIndicatorRect(freeArea); } // ------------- QMenuBarActionProvider diff --git a/tools/designer/src/components/formeditor/default_actionprovider.h b/tools/designer/src/components/formeditor/default_actionprovider.h index 3660f11..270ea36 100644 --- a/tools/designer/src/components/formeditor/default_actionprovider.h +++ b/tools/designer/src/components/formeditor/default_actionprovider.h @@ -66,7 +66,7 @@ public: virtual Qt::Orientation orientation() const = 0; protected: - virtual QRect indicatorGeometry(const QPoint &pos) const; + virtual QRect indicatorGeometry(const QPoint &pos, Qt::LayoutDirection layoutDirection) const; private: QWidget *m_indicator; @@ -84,7 +84,7 @@ public: Qt::Orientation orientation() const; protected: - virtual QRect indicatorGeometry(const QPoint &pos) const; + virtual QRect indicatorGeometry(const QPoint &pos, Qt::LayoutDirection layoutDirection) const; private: QToolBar *m_widget; diff --git a/tools/designer/src/lib/shared/actionprovider_p.h b/tools/designer/src/lib/shared/actionprovider_p.h index b43dee9..5f9b7a0 100644 --- a/tools/designer/src/lib/shared/actionprovider_p.h +++ b/tools/designer/src/lib/shared/actionprovider_p.h @@ -86,7 +86,7 @@ template <class Widget> // actionGeometry() can be wrong sometimes; it returns a geometry that // stretches to the end of the toolbar/menu bar. So, check from the beginning // in the case of a horizontal right-to-left orientation. - const bool checkTopRight = orientation == Qt::Horizontal && QApplication::layoutDirection() == Qt::RightToLeft; + const bool checkTopRight = orientation == Qt::Horizontal && w->layoutDirection() == Qt::RightToLeft; const QPoint topRight = QPoint(w->rect().width(), 0); for (int index = 0; index < actionCount; ++index) { QRect g = w->actionGeometry(actions.at(index)); diff --git a/tools/designer/src/lib/shared/qdesigner_menu.cpp b/tools/designer/src/lib/shared/qdesigner_menu.cpp index c727d8e..6aba65b 100644 --- a/tools/designer/src/lib/shared/qdesigner_menu.cpp +++ b/tools/designer/src/lib/shared/qdesigner_menu.cpp @@ -73,6 +73,19 @@ QT_BEGIN_NAMESPACE using namespace qdesigner_internal; +// give the user a little more space to click on the sub menu rectangle +static inline void extendClickableArea(QRect *subMenuRect, Qt::LayoutDirection dir) +{ + switch (dir) { + case Qt::LeftToRight: + subMenuRect->setLeft(subMenuRect->left() - 20); + break; + case Qt::RightToLeft: + subMenuRect->setRight(subMenuRect->right() + 20); + break; + } +} + QDesignerMenu::QDesignerMenu(QWidget *parent) : QMenu(parent), m_currentIndex(0), @@ -325,8 +338,7 @@ bool QDesignerMenu::handleMouseDoubleClickEvent(QWidget *, QMouseEvent *event) QRect pm_rect; if (action->menu() || hasSubMenuPixmap(action)) { pm_rect = subMenuPixmapRect(action); - pm_rect.setLeft(pm_rect.left() - 20); // give the user a little more - // space to click + extendClickableArea(&pm_rect, layoutDirection()); } if (!pm_rect.contains(event->pos()) && m_currentIndex != -1) @@ -381,7 +393,7 @@ bool QDesignerMenu::handleMousePressEvent(QWidget * /*widget*/, QMouseEvent *eve QAction *action = safeActionAt(index); QRect pm_rect = subMenuPixmapRect(action); - pm_rect.setLeft(pm_rect.left() - 20); // give the user a little more space to click + extendClickableArea(&pm_rect, layoutDirection()); const int old_index = m_currentIndex; m_currentIndex = index; @@ -540,7 +552,7 @@ QRect QDesignerMenu::subMenuPixmapRect(QAction *action) const { static const QPixmap pm(QLatin1String(":/trolltech/formeditor/images/submenu.png")); const QRect g = actionGeometry(action); - const int x = g.right() - pm.width() - 2; + const int x = layoutDirection() == Qt::LeftToRight ? (g.right() - pm.width() - 2) : 2; const int y = g.top() + (g.height() - pm.height())/2 + 1; return QRect(x, y, pm.width(), pm.height()); } @@ -863,38 +875,52 @@ void QDesignerMenu::closeMenuChain() m_lastSubMenuIndex = -1; } -void QDesignerMenu::moveLeft() +// Close submenu using the left/right keys according to layoutDirection(). +// Return false to indicate the event must be propagated to the menu bar. +bool QDesignerMenu::hideSubMenuOnCursorKey() { if (parentMenu()) { hide(); - } else { - closeMenuChain(); - if (QDesignerMenuBar *mb = parentMenuBar()) { - if (QApplication::layoutDirection() == Qt::LeftToRight) - mb->moveLeft(); - else - mb->moveRight(); - } + return true; } + closeMenuChain(); update(); + if (parentMenuBar()) + return false; + return true; } -void QDesignerMenu::moveRight() +// Open a submenu using the left/right keys according to layoutDirection(). +// Return false to indicate the event must be propagated to the menu bar. +bool QDesignerMenu::showSubMenuOnCursorKey() { - QAction *action = currentAction(); + const QAction *action = currentAction(); - if (qobject_cast<SpecialMenuAction*>(action) || action->isSeparator()) { + if (qobject_cast<const SpecialMenuAction*>(action) || action->isSeparator()) { closeMenuChain(); - if (QDesignerMenuBar *mb = parentMenuBar()) { - if (QApplication::layoutDirection() == Qt::LeftToRight) - mb->moveRight(); - else - mb->moveLeft(); - } - } else { - m_lastSubMenuIndex = -1; // force a refresh - slotShowSubMenuNow(); + if (parentMenuBar()) + return false; + return true; } + m_lastSubMenuIndex = -1; // force a refresh + slotShowSubMenuNow(); + return true; +} + +void QDesignerMenu::moveLeft() +{ + const bool handled = layoutDirection() == Qt::LeftToRight ? + hideSubMenuOnCursorKey() : showSubMenuOnCursorKey(); + if (!handled) + parentMenuBar()->moveLeft(); +} + +void QDesignerMenu::moveRight() +{ + const bool handled = layoutDirection() == Qt::LeftToRight ? + showSubMenuOnCursorKey() : hideSubMenuOnCursorKey(); + if (!handled) + parentMenuBar()->moveRight(); } void QDesignerMenu::moveUp(bool ctrl) @@ -1053,7 +1079,15 @@ void QDesignerMenu::slotShowSubMenuNow() if ((menu->windowFlags() & Qt::Popup) != Qt::Popup) menu->setWindowFlags(Qt::Popup); const QRect g = actionGeometry(action); - menu->move(mapToGlobal(g.topRight())); + if (layoutDirection() == Qt::LeftToRight) { + menu->move(mapToGlobal(g.topRight())); + } else { + // The position is not initially correct due to the unknown width, + // causing it to overlap a bit the first time it is invoked. + const QSize menuSize = menu->size(); + QPoint point = g.topLeft() - QPoint(menu->width() + 10, 0); + menu->move(mapToGlobal(point)); + } menu->show(); menu->setFocus(); } else { diff --git a/tools/designer/src/lib/shared/qdesigner_menu_p.h b/tools/designer/src/lib/shared/qdesigner_menu_p.h index 55d8bcd..93735e6 100644 --- a/tools/designer/src/lib/shared/qdesigner_menu_p.h +++ b/tools/designer/src/lib/shared/qdesigner_menu_p.h @@ -181,6 +181,9 @@ protected: void selectCurrentAction(); private: + bool hideSubMenuOnCursorKey(); + bool showSubMenuOnCursorKey(); + QPoint m_startPosition; int m_currentIndex; QAction *m_addItem; diff --git a/tools/designer/src/lib/shared/qdesigner_menubar.cpp b/tools/designer/src/lib/shared/qdesigner_menubar.cpp index b53bb8d..2b19142 100644 --- a/tools/designer/src/lib/shared/qdesigner_menubar.cpp +++ b/tools/designer/src/lib/shared/qdesigner_menubar.cpp @@ -219,18 +219,12 @@ bool QDesignerMenuBar::handleKeyPressEvent(QWidget *, QKeyEvent *e) case Qt::Key_Left: e->accept(); - if (QApplication::layoutDirection() == Qt::LeftToRight) - moveLeft(e->modifiers() & Qt::ControlModifier); - else - moveRight(e->modifiers() & Qt::ControlModifier); + moveLeft(e->modifiers() & Qt::ControlModifier); return true; case Qt::Key_Right: e->accept(); - if (QApplication::layoutDirection() == Qt::LeftToRight) - moveRight(e->modifiers() & Qt::ControlModifier); - else - moveLeft(e->modifiers() & Qt::ControlModifier); + moveRight(e->modifiers() & Qt::ControlModifier); return true; // no update case Qt::Key_Up: @@ -741,28 +735,48 @@ int QDesignerMenuBar::realActionCount() const return actions().count() - 1; // 1 fake actions } -void QDesignerMenuBar::moveLeft(bool ctrl) +bool QDesignerMenuBar::dragging() const { - if (ctrl) - (void) swap(m_currentIndex, m_currentIndex - 1); - - m_currentIndex = qMax(0, --m_currentIndex); - // Always re-select, swapping destroys order - updateCurrentAction(true); + return m_dragging; } -bool QDesignerMenuBar::dragging() const +void QDesignerMenuBar::moveLeft(bool ctrl) { - return m_dragging; + if (layoutDirection() == Qt::LeftToRight) { + movePrevious(ctrl); + } else { + moveNext(ctrl); + } } void QDesignerMenuBar::moveRight(bool ctrl) { - if (ctrl) - (void) swap(m_currentIndex + 1, m_currentIndex); + if (layoutDirection() == Qt::LeftToRight) { + moveNext(ctrl); + } else { + movePrevious(ctrl); + } +} + +void QDesignerMenuBar::movePrevious(bool ctrl) +{ + const bool swapped = ctrl && swapActions(m_currentIndex, m_currentIndex - 1); + const int newIndex = qMax(0, m_currentIndex - 1); + // Always re-select, swapping destroys order + if (swapped || newIndex != m_currentIndex) { + m_currentIndex = newIndex; + updateCurrentAction(true); + } +} - m_currentIndex = qMin(actions().count() - 1, ++m_currentIndex); - updateCurrentAction(!ctrl); +void QDesignerMenuBar::moveNext(bool ctrl) +{ + const bool swapped = ctrl && swapActions(m_currentIndex + 1, m_currentIndex); + const int newIndex = qMin(actions().count() - 1, m_currentIndex + 1); + if (swapped || newIndex != m_currentIndex) { + m_currentIndex = newIndex; + updateCurrentAction(!ctrl); + } } void QDesignerMenuBar::moveUp() @@ -869,7 +883,7 @@ QAction *QDesignerMenuBar::safeActionAt(int index) const return actions().at(index); } -bool QDesignerMenuBar::swap(int a, int b) +bool QDesignerMenuBar::swapActions(int a, int b) { const int left = qMin(a, b); int right = qMax(a, b); diff --git a/tools/designer/src/lib/shared/qdesigner_menubar_p.h b/tools/designer/src/lib/shared/qdesigner_menubar_p.h index 97a655b..fb820e1 100644 --- a/tools/designer/src/lib/shared/qdesigner_menubar_p.h +++ b/tools/designer/src/lib/shared/qdesigner_menubar_p.h @@ -155,10 +155,12 @@ protected: QAction *safeActionAt(int index) const; - bool swap(int a, int b); + bool swapActions(int a, int b); private: void updateCurrentAction(bool selectAction); + void movePrevious(bool ctrl); + void moveNext(bool ctrl); QAction *m_addMenu; QPointer<QMenu> m_activeMenu; diff --git a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp index 2693452..8c0c61d 100644 --- a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp +++ b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp @@ -466,7 +466,7 @@ QRect ToolBarEventFilter::freeArea(const QToolBar *tb) QRect exclusionRectangle = actionList.empty() ? handleArea(tb) : tb->actionGeometry(actionList.back()); switch (tb->orientation()) { case Qt::Horizontal: - switch (QApplication::layoutDirection()) { + switch (tb->layoutDirection()) { case Qt::LeftToRight: rc.setX(exclusionRectangle.right() + 1); break; diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index 5a9095a..fe22067 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -256,10 +256,8 @@ public: ProFile *m_prevProFile; // See m_prevLineNo }; -#if (!defined(__GNUC__) || __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)) && !defined(__SUNPRO_CC) Q_DECLARE_TYPEINFO(ProFileEvaluator::Private::State, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(ProFileEvaluator::Private::ProLoop, Q_MOVABLE_TYPE); -#endif ProFileEvaluator::Private::Private(ProFileEvaluator *q_) : q(q_) diff --git a/tools/linguist/shared/profileevaluator.h b/tools/linguist/shared/profileevaluator.h index f3498c1..ba525b2 100644 --- a/tools/linguist/shared/profileevaluator.h +++ b/tools/linguist/shared/profileevaluator.h @@ -50,10 +50,21 @@ #include <QtCore/QStringList> #include <QtCore/QStack> +#if (!defined(__GNUC__) || __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)) && !defined(__SUNPRO_CC) +# define HAVE_TEMPLATE_CLASS_FRIENDS +#endif + QT_BEGIN_NAMESPACE class ProFileEvaluator { +#ifdef HAVE_TEMPLATE_CLASS_FRIENDS +private: +#else +public: +#endif + class Private; + public: enum TemplateType { TT_Unknown = 0, @@ -93,11 +104,11 @@ public: virtual void fileMessage(const QString &msg); // error() and message() from .pro file private: - class Private; Private *d; - // This doesn't help gcc 3.3 and sunpro ... +#ifdef HAVE_TEMPLATE_CLASS_FRIENDS template<typename T> friend class QTypeInfo; +#endif }; QT_END_NAMESPACE diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index df63138..26874e1 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -543,7 +543,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, QMap<QString, const Node*> nodeMap; for (int i = 0; i < values.size(); ++i) { const Node* n = values.at(i); - nodeMap.insert(n->name(),n); + if ((n->status() != Node::Internal) && (n->access() != Node::Private)) + nodeMap.insert(n->name(),n); } generateAnnotatedList(relative, marker, nodeMap); } @@ -2018,8 +2019,8 @@ void HtmlGenerator::generateCompactList(const Node *relative, assume that NumParagraphs is 37. Each paragraph is a QMap<QString, const Node *>. */ - QMap<QString, const Node *> paragraph[NumParagraphs]; - QString paragraphName[NumParagraphs]; + QMap<QString, const Node *> paragraph[NumParagraphs+1]; + QString paragraphName[NumParagraphs+1]; QMap<QString, const Node *>::ConstIterator c = classMap.begin(); while (c != classMap.end()) { @@ -2052,22 +2053,22 @@ void HtmlGenerator::generateCompactList(const Node *relative, We now want to compute the paragraph offset. Paragraphs 0 to 6 start at offsets 0, 3, 4, 8, 9, 14, 23. */ - int paragraphOffset[NumParagraphs + 1]; + int paragraphOffset[NumParagraphs + 1]; // 37 + 1 int i, j, k; paragraphOffset[0] = 0; - for (j = 0; j < NumParagraphs; j++) + for (j = 0; j < NumParagraphs; j++) // j = 0..36 paragraphOffset[j + 1] = paragraphOffset[j] + paragraph[j].count(); - int firstOffset[NumColumns + 1]; - int currentOffset[NumColumns]; - int currentParagraphNo[NumColumns]; - int currentOffsetInParagraph[NumColumns]; + int firstOffset[NumColumns + 1]; // 4 + 1 + int currentOffset[NumColumns]; // 4 + int currentParagraphNo[NumColumns]; // 4 + int currentOffsetInParagraph[NumColumns]; // 4 int numRows = (classMap.count() + NumColumns - 1) / NumColumns; int curParagNo = 0; - for (i = 0; i < NumColumns; i++) { + for (i = 0; i < NumColumns; i++) { // i = 0..3 firstOffset[i] = qMin(i * numRows, classMap.size()); currentOffset[i] = firstOffset[i]; @@ -2092,16 +2093,18 @@ void HtmlGenerator::generateCompactList(const Node *relative, out() << "<td>\n</td>\n"; } else { - while (currentOffsetInParagraph[i] == paragraph[currentParagraphNo[i]].count()) { + while ((currentParagraphNo[i] < NumParagraphs) && + (currentOffsetInParagraph[i] == paragraph[currentParagraphNo[i]].count())) { ++currentParagraphNo[i]; currentOffsetInParagraph[i] = 0; } - +#if 0 if (currentParagraphNo[i] >= NumParagraphs) { - qDebug() << "### Internal error ###" << __FILE__ << __LINE__; + qDebug() << "### Internal error ###" << __FILE__ << __LINE__ + << currentParagraphNo[i] << NumParagraphs; currentParagraphNo[i] = NumParagraphs - 1; } - +#endif out() << "<td align=\"right\">"; if (currentOffsetInParagraph[i] == 0) { // start a new paragraph @@ -2111,7 +2114,8 @@ void HtmlGenerator::generateCompactList(const Node *relative, } out() << "</td>\n"; - if (!paragraphName[currentParagraphNo[i]].isEmpty()) { + if ((currentParagraphNo[i] < NumParagraphs) && + !paragraphName[currentParagraphNo[i]].isEmpty()) { QMap<QString, const Node *>::Iterator it; it = paragraph[currentParagraphNo[i]].begin(); for (j = 0; j < currentOffsetInParagraph[i]; j++) @@ -3710,12 +3714,6 @@ QString HtmlGenerator::getLink(const Atom *atom, } inObsoleteLink = true; } -#if 0 - qDebug() << "Link to Obsolete entity" - << (*node)->name(); - qDebug() << " relative entity" - << relative->name(); -#endif } } } @@ -3731,8 +3729,6 @@ QString HtmlGenerator::getLink(const Atom *atom, else if ((*node)->status() == Node::Internal) { qDebug() << "Link to Internal entity"; } - //else - //qDebug() << "Node Status:" << (*node)->status(); #endif } @@ -4016,10 +4012,6 @@ void HtmlGenerator::generateQmlInherits(const QmlClassNode* cn, generateText(text, cn, marker); out() << "</p>"; } -// else -// qDebug() << "generateQmlInherits(): " -// << "Inherited element not documented -->" -// << linkPair.first; } } } |