summaryrefslogtreecommitdiffstats
path: root/examples/widgets/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/widgets')
-rw-r--r--examples/widgets/widgets/calculator/calculator.cpp24
-rw-r--r--examples/widgets/widgets/lineedits/window.cpp4
-rw-r--r--examples/widgets/widgets/scribble/mainwindow.cpp2
-rw-r--r--examples/widgets/widgets/spinboxes/window.cpp4
-rw-r--r--examples/widgets/widgets/tetrix/tetrixboard.cpp54
-rw-r--r--examples/widgets/widgets/wiggly/wigglywidget.cpp4
6 files changed, 46 insertions, 46 deletions
diff --git a/examples/widgets/widgets/calculator/calculator.cpp b/examples/widgets/widgets/calculator/calculator.cpp
index 5b6b69ba03..bb3836bd70 100644
--- a/examples/widgets/widgets/calculator/calculator.cpp
+++ b/examples/widgets/widgets/calculator/calculator.cpp
@@ -69,7 +69,7 @@ Calculator::Calculator(QWidget *parent)
//! [4]
for (int i = 0; i < NumDigitButtons; ++i) {
- digitButtons[i] = createButton(QString::number(i), SLOT(digitClicked()));
+ digitButtons[i] = createButton(QString::number(i), SLOT(digitClicked()));
}
Button *pointButton = createButton(tr("."), SLOT(pointClicked()));
@@ -144,7 +144,7 @@ void Calculator::digitClicked()
if (waitingForOperand) {
display->clear();
- waitingForOperand = false;
+ waitingForOperand = false;
}
display->setText(display->text() + QString::number(digitValue));
}
@@ -169,8 +169,8 @@ void Calculator::unaryOperatorClicked()
result = pow(operand, 2.0);
} else if (clickedOperator == tr("1/x")) {
if (operand == 0.0) {
- abortOperation();
- return;
+ abortOperation();
+ return;
}
result = 1.0 / operand;
}
@@ -192,7 +192,7 @@ void Calculator::additiveOperatorClicked()
//! [12] //! [13]
if (!calculate(operand, pendingMultiplicativeOperator)) {
abortOperation();
- return;
+ return;
}
display->setText(QString::number(factorSoFar));
operand = factorSoFar;
@@ -205,7 +205,7 @@ void Calculator::additiveOperatorClicked()
//! [14] //! [15]
if (!calculate(operand, pendingAdditiveOperator)) {
abortOperation();
- return;
+ return;
}
display->setText(QString::number(sumSoFar));
} else {
@@ -229,7 +229,7 @@ void Calculator::multiplicativeOperatorClicked()
if (!pendingMultiplicativeOperator.isEmpty()) {
if (!calculate(operand, pendingMultiplicativeOperator)) {
abortOperation();
- return;
+ return;
}
display->setText(QString::number(factorSoFar));
} else {
@@ -249,7 +249,7 @@ void Calculator::equalClicked()
if (!pendingMultiplicativeOperator.isEmpty()) {
if (!calculate(operand, pendingMultiplicativeOperator)) {
abortOperation();
- return;
+ return;
}
operand = factorSoFar;
factorSoFar = 0.0;
@@ -258,7 +258,7 @@ void Calculator::equalClicked()
if (!pendingAdditiveOperator.isEmpty()) {
if (!calculate(operand, pendingAdditiveOperator)) {
abortOperation();
- return;
+ return;
}
pendingAdditiveOperator.clear();
} else {
@@ -387,9 +387,9 @@ bool Calculator::calculate(double rightOperand, const QString &pendingOperator)
} else if (pendingOperator == tr("\303\227")) {
factorSoFar *= rightOperand;
} else if (pendingOperator == tr("\303\267")) {
- if (rightOperand == 0.0)
- return false;
- factorSoFar /= rightOperand;
+ if (rightOperand == 0.0)
+ return false;
+ factorSoFar /= rightOperand;
}
return true;
}
diff --git a/examples/widgets/widgets/lineedits/window.cpp b/examples/widgets/widgets/lineedits/window.cpp
index a0871e7c77..fe241208f6 100644
--- a/examples/widgets/widgets/lineedits/window.cpp
+++ b/examples/widgets/widgets/lineedits/window.cpp
@@ -182,7 +182,7 @@ void Window::echoChanged(int index)
echoLineEdit->setEchoMode(QLineEdit::Password);
break;
case 2:
- echoLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);
+ echoLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);
break;
case 3:
echoLineEdit->setEchoMode(QLineEdit::NoEcho);
@@ -221,7 +221,7 @@ void Window::alignmentChanged(int index)
alignmentLineEdit->setAlignment(Qt::AlignCenter);
break;
case 2:
- alignmentLineEdit->setAlignment(Qt::AlignRight);
+ alignmentLineEdit->setAlignment(Qt::AlignRight);
}
}
//! [11]
diff --git a/examples/widgets/widgets/scribble/mainwindow.cpp b/examples/widgets/widgets/scribble/mainwindow.cpp
index 65550ae606..5f175c15b5 100644
--- a/examples/widgets/widgets/scribble/mainwindow.cpp
+++ b/examples/widgets/widgets/scribble/mainwindow.cpp
@@ -219,7 +219,7 @@ bool MainWindow::maybeSave()
tr("The image has been modified.\n"
"Do you want to save your changes?"),
QMessageBox::Save | QMessageBox::Discard
- | QMessageBox::Cancel);
+ | QMessageBox::Cancel);
if (ret == QMessageBox::Save) {
return saveFile("png");
} else if (ret == QMessageBox::Cancel) {
diff --git a/examples/widgets/widgets/spinboxes/window.cpp b/examples/widgets/widgets/spinboxes/window.cpp
index 7c2f6e45bc..6503d60f22 100644
--- a/examples/widgets/widgets/spinboxes/window.cpp
+++ b/examples/widgets/widgets/spinboxes/window.cpp
@@ -194,12 +194,12 @@ void Window::setFormatString(const QString &formatString)
meetingEdit->setDateRange(QDate(2004, 11, 1), QDate(2005, 11, 30));
meetingLabel->setText(tr("Meeting date (between %0 and %1):")
.arg(meetingEdit->minimumDate().toString(Qt::ISODate))
- .arg(meetingEdit->maximumDate().toString(Qt::ISODate)));
+ .arg(meetingEdit->maximumDate().toString(Qt::ISODate)));
} else {
meetingEdit->setTimeRange(QTime(0, 7, 20, 0), QTime(21, 0, 0, 0));
meetingLabel->setText(tr("Meeting time (between %0 and %1):")
.arg(meetingEdit->minimumTime().toString(Qt::ISODate))
- .arg(meetingEdit->maximumTime().toString(Qt::ISODate)));
+ .arg(meetingEdit->maximumTime().toString(Qt::ISODate)));
}
}
//! [13]
diff --git a/examples/widgets/widgets/tetrix/tetrixboard.cpp b/examples/widgets/widgets/tetrix/tetrixboard.cpp
index 15a2e8e6dd..c286af6406 100644
--- a/examples/widgets/widgets/tetrix/tetrixboard.cpp
+++ b/examples/widgets/widgets/tetrix/tetrixboard.cpp
@@ -109,9 +109,9 @@ void TetrixBoard::pause()
isPaused = !isPaused;
if (isPaused) {
- timer.stop();
+ timer.stop();
} else {
- timer.start(timeoutTime(), this);
+ timer.start(timeoutTime(), this);
}
update();
//! [5] //! [6]
@@ -128,7 +128,7 @@ void TetrixBoard::paintEvent(QPaintEvent *event)
//! [7]
if (isPaused) {
- painter.drawText(rect, Qt::AlignCenter, tr("Pause"));
+ painter.drawText(rect, Qt::AlignCenter, tr("Pause"));
return;
}
@@ -138,7 +138,7 @@ void TetrixBoard::paintEvent(QPaintEvent *event)
for (int i = 0; i < BoardHeight; ++i) {
for (int j = 0; j < BoardWidth; ++j) {
TetrixShape shape = shapeAt(j, BoardHeight - i - 1);
- if (shape != NoShape)
+ if (shape != NoShape)
drawSquare(painter, rect.left() + j * squareWidth(),
boardTop + i * squareHeight(), shape);
}
@@ -165,7 +165,7 @@ void TetrixBoard::paintEvent(QPaintEvent *event)
void TetrixBoard::keyPressEvent(QKeyEvent *event)
{
if (!isStarted || isPaused || curPiece.shape() == NoShape) {
- QFrame::keyPressEvent(event);
+ QFrame::keyPressEvent(event);
return;
}
//! [13]
@@ -174,24 +174,24 @@ void TetrixBoard::keyPressEvent(QKeyEvent *event)
switch (event->key()) {
case Qt::Key_Left:
tryMove(curPiece, curX - 1, curY);
- break;
+ break;
case Qt::Key_Right:
tryMove(curPiece, curX + 1, curY);
- break;
+ break;
case Qt::Key_Down:
tryMove(curPiece.rotatedRight(), curX, curY);
- break;
+ break;
case Qt::Key_Up:
tryMove(curPiece.rotatedLeft(), curX, curY);
- break;
+ break;
case Qt::Key_Space:
- dropDown();
- break;
+ dropDown();
+ break;
case Qt::Key_D:
- oneLineDown();
- break;
+ oneLineDown();
+ break;
default:
- QFrame::keyPressEvent(event);
+ QFrame::keyPressEvent(event);
}
//! [14]
}
@@ -201,9 +201,9 @@ void TetrixBoard::timerEvent(QTimerEvent *event)
{
if (event->timerId() == timer.timerId()) {
if (isWaitingAfterLine) {
- isWaitingAfterLine = false;
- newPiece();
- timer.start(timeoutTime(), this);
+ isWaitingAfterLine = false;
+ newPiece();
+ timer.start(timeoutTime(), this);
} else {
oneLineDown();
}
@@ -243,7 +243,7 @@ void TetrixBoard::dropDown()
void TetrixBoard::oneLineDown()
{
if (!tryMove(curPiece, curX, curY - 1))
- pieceDropped(0);
+ pieceDropped(0);
}
//! [21]
@@ -290,24 +290,24 @@ void TetrixBoard::removeFullLines()
if (lineIsFull) {
//! [24] //! [25]
- ++numFullLines;
- for (int k = i; k < BoardHeight - 1; ++k) {
+ ++numFullLines;
+ for (int k = i; k < BoardHeight - 1; ++k) {
for (int j = 0; j < BoardWidth; ++j)
shapeAt(j, k) = shapeAt(j, k + 1);
- }
+ }
//! [25] //! [26]
- for (int j = 0; j < BoardWidth; ++j)
+ for (int j = 0; j < BoardWidth; ++j)
shapeAt(j, BoardHeight - 1) = NoShape;
- }
+ }
//! [26] //! [27]
}
//! [27]
//! [28]
if (numFullLines > 0) {
- numLinesRemoved += numFullLines;
- score += 10 * numFullLines;
- emit linesRemovedChanged(numLinesRemoved);
+ numLinesRemoved += numFullLines;
+ score += 10 * numFullLines;
+ emit linesRemovedChanged(numLinesRemoved);
emit scoreChanged(score);
timer.start(500, this);
@@ -329,7 +329,7 @@ void TetrixBoard::newPiece()
curY = BoardHeight - 1 + curPiece.minY();
if (!tryMove(curPiece, curX, curY)) {
- curPiece.setShape(NoShape);
+ curPiece.setShape(NoShape);
timer.stop();
isStarted = false;
}
diff --git a/examples/widgets/widgets/wiggly/wigglywidget.cpp b/examples/widgets/widgets/wiggly/wigglywidget.cpp
index cfd45a611a..a68bafb77d 100644
--- a/examples/widgets/widgets/wiggly/wigglywidget.cpp
+++ b/examples/widgets/widgets/wiggly/wigglywidget.cpp
@@ -63,7 +63,7 @@ void WigglyWidget::paintEvent(QPaintEvent * /* event */)
//! [1] //! [2]
{
static const int sineTable[16] = {
- 0, 38, 71, 92, 100, 92, 71, 38, 0, -38, -71, -92, -100, -92, -71, -38
+ 0, 38, 71, 92, 100, 92, 71, 38, 0, -38, -71, -92, -100, -92, -71, -38
};
QFontMetrics metrics(font());
@@ -94,7 +94,7 @@ void WigglyWidget::timerEvent(QTimerEvent *event)
++step;
update();
} else {
- QWidget::timerEvent(event);
+ QWidget::timerEvent(event);
}
//! [6]
}