summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/embedded/styleexample/stylewidget.cpp2
-rw-r--r--examples/ipc/sharedmemory/dialog.cpp6
-rw-r--r--examples/network/bearermonitor/bearermonitor.cpp8
-rw-r--r--examples/network/bearermonitor/bearermonitor.h4
-rw-r--r--examples/network/dnslookup/dnslookup.cpp13
-rw-r--r--examples/network/loopback/dialog.cpp4
-rw-r--r--examples/network/network.pro2
-rw-r--r--examples/network/securesocketclient/main.cpp4
-rw-r--r--examples/network/torrent/peerwireclient.cpp2
-rw-r--r--examples/network/torrent/torrentserver.cpp2
-rw-r--r--examples/opengl/framebufferobject2/glwidget.cpp30
-rw-r--r--examples/opengl/framebufferobject2/main.cpp4
-rw-r--r--examples/opengl/pbuffers/main.cpp4
-rw-r--r--examples/opengl/pbuffers2/main.cpp4
-rw-r--r--examples/opengl/samplebuffers/main.cpp8
-rw-r--r--examples/touch/fingerpaint/mainwindow.cpp2
-rw-r--r--examples/widgets/doc/src/treemodelcompleter.qdoc2
-rw-r--r--examples/widgets/graphicsview/boxes/glbuffers.h6
-rw-r--r--examples/widgets/graphicsview/boxes/glextensions.cpp70
-rw-r--r--examples/widgets/graphicsview/boxes/glextensions.h46
-rw-r--r--examples/widgets/graphicsview/boxes/scene.cpp16
-rw-r--r--examples/widgets/graphicsview/elasticnodes/graphwidget.cpp4
-rw-r--r--examples/widgets/itemviews/pixelator/mainwindow.cpp10
-rw-r--r--examples/widgets/layouts/basiclayouts/dialog.cpp2
-rw-r--r--examples/widgets/layouts/borderlayout/borderlayout.h12
-rw-r--r--examples/widgets/mainwindows/mdi/mdichild.cpp4
-rw-r--r--examples/widgets/mainwindows/sdi/mainwindow.cpp4
-rw-r--r--examples/widgets/richtext/textedit/textedit.cpp2
-rw-r--r--examples/widgets/tools/codecs/mainwindow.cpp2
-rw-r--r--examples/widgets/tutorials/modelview/5_edit/mymodel.cpp12
-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.cpp29
-rw-r--r--examples/widgets/widgets/spinboxes/window.h3
-rw-r--r--examples/widgets/widgets/tetrix/tetrixboard.cpp54
-rw-r--r--examples/widgets/widgets/wiggly/wigglywidget.cpp4
37 files changed, 225 insertions, 186 deletions
diff --git a/examples/embedded/styleexample/stylewidget.cpp b/examples/embedded/styleexample/stylewidget.cpp
index 411df77293..c45949e0f0 100644
--- a/examples/embedded/styleexample/stylewidget.cpp
+++ b/examples/embedded/styleexample/stylewidget.cpp
@@ -49,7 +49,7 @@
StyleWidget::StyleWidget(QWidget *parent)
: QFrame(parent)
{
- m_ui.setupUi(this);
+ m_ui.setupUi(this);
}
diff --git a/examples/ipc/sharedmemory/dialog.cpp b/examples/ipc/sharedmemory/dialog.cpp
index 2be62b1b47..c504f3a202 100644
--- a/examples/ipc/sharedmemory/dialog.cpp
+++ b/examples/ipc/sharedmemory/dialog.cpp
@@ -73,8 +73,8 @@ Dialog::Dialog(QWidget *parent)
ui.setupUi(this);
connect(ui.loadFromFileButton, SIGNAL(clicked()), SLOT(loadFromFile()));
connect(ui.loadFromSharedMemoryButton,
- SIGNAL(clicked()),
- SLOT(loadFromMemory()));
+ SIGNAL(clicked()),
+ SLOT(loadFromMemory()));
setWindowTitle(tr("SharedMemory Example"));
}
//! [0]
@@ -155,7 +155,7 @@ void Dialog::loadFromMemory()
{
if (!sharedMemory.attach()) {
ui.label->setText(tr("Unable to attach to shared memory segment.\n" \
- "Load an image first."));
+ "Load an image first."));
return;
}
diff --git a/examples/network/bearermonitor/bearermonitor.cpp b/examples/network/bearermonitor/bearermonitor.cpp
index 58421e52b1..4590a91f4f 100644
--- a/examples/network/bearermonitor/bearermonitor.cpp
+++ b/examples/network/bearermonitor/bearermonitor.cpp
@@ -84,10 +84,10 @@ BearerMonitor::BearerMonitor(QWidget *parent)
this, SLOT(configurationChanged(const QNetworkConfiguration)));
connect(&manager, SIGNAL(updateCompleted()), this, SLOT(updateConfigurations()));
-#if defined(Q_OS_WIN)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
connect(registerButton, SIGNAL(clicked()), this, SLOT(registerNetwork()));
connect(unregisterButton, SIGNAL(clicked()), this, SLOT(unregisterNetwork()));
-#else
+#else // Q_OS_WIN && !Q_OS_WINRT
nlaGroup->hide();
#endif
@@ -257,7 +257,7 @@ void BearerMonitor::onlineStateChanged(bool isOnline)
onlineState->setText(tr("Offline"));
}
-#if defined(Q_OS_WIN)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void BearerMonitor::registerNetwork()
{
QTreeWidgetItem *item = treeWidget->currentItem();
@@ -301,7 +301,7 @@ void BearerMonitor::unregisterNetwork()
if (WSASetService(&networkInfo, RNRSERVICE_DELETE, 0) == SOCKET_ERROR)
qDebug() << "WSASetService(RNRSERVICE_DELETE) returned" << WSAGetLastError();
}
-#endif
+#endif // Q_OS_WIN && !Q_OS_WINRT
void BearerMonitor::showConfigurationFor(QTreeWidgetItem *item)
{
diff --git a/examples/network/bearermonitor/bearermonitor.h b/examples/network/bearermonitor/bearermonitor.h
index aaa2c18424..307262c2b4 100644
--- a/examples/network/bearermonitor/bearermonitor.h
+++ b/examples/network/bearermonitor/bearermonitor.h
@@ -66,10 +66,10 @@ private slots:
void onlineStateChanged(bool isOnline);
-#if defined(Q_OS_WIN)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void registerNetwork();
void unregisterNetwork();
-#endif
+#endif // Q_OS_WIN && !Q_OS_WINRT
void showConfigurationFor(QTreeWidgetItem *item);
diff --git a/examples/network/dnslookup/dnslookup.cpp b/examples/network/dnslookup/dnslookup.cpp
index 77e8abc927..202a5f9580 100644
--- a/examples/network/dnslookup/dnslookup.cpp
+++ b/examples/network/dnslookup/dnslookup.cpp
@@ -50,7 +50,7 @@
static void usage() {
printf("Qt DNS example - performs DNS lookups\n"
- "Usage: dnslookup [-t <type>] name\n\n");
+ "Usage: dnslookup [-t <type>] [-s nameserver] name\n\n");
}
DnsManager::DnsManager()
@@ -93,6 +93,17 @@ void DnsManager::execute()
return;
}
}
+ if (args.size() > 1 && args.first() == "-s") {
+ args.takeFirst();
+ const QString ns = args.takeFirst();
+ QHostAddress nameserver(ns);
+ if (nameserver.isNull() || nameserver.protocol() == QAbstractSocket::UnknownNetworkLayerProtocol) {
+ printf("Bad nameserver address: %s\n", qPrintable(ns));
+ QCoreApplication::instance()->quit();
+ return;
+ }
+ dns->setNameserver(nameserver);
+ }
if (args.isEmpty()) {
usage();
QCoreApplication::instance()->quit();
diff --git a/examples/network/loopback/dialog.cpp b/examples/network/loopback/dialog.cpp
index a378ccabaa..da5dbce854 100644
--- a/examples/network/loopback/dialog.cpp
+++ b/examples/network/loopback/dialog.cpp
@@ -99,9 +99,9 @@ void Dialog::start()
QMessageBox::StandardButton ret = QMessageBox::critical(this,
tr("Loopback"),
tr("Unable to start the test: %1.")
- .arg(tcpServer.errorString()),
+ .arg(tcpServer.errorString()),
QMessageBox::Retry
- | QMessageBox::Cancel);
+ | QMessageBox::Cancel);
if (ret == QMessageBox::Cancel)
return;
}
diff --git a/examples/network/network.pro b/examples/network/network.pro
index be4ccdbddf..8ed72315e2 100644
--- a/examples/network/network.pro
+++ b/examples/network/network.pro
@@ -23,7 +23,7 @@ qtHaveModule(widgets) {
multicastsender
# no QProcess
- !vxworks:!qnx:SUBDIRS += network-chat
+ !vxworks:!qnx:!winrt:SUBDIRS += network-chat
contains(QT_CONFIG, openssl):SUBDIRS += securesocketclient
contains(QT_CONFIG, openssl-linked):SUBDIRS += securesocketclient
diff --git a/examples/network/securesocketclient/main.cpp b/examples/network/securesocketclient/main.cpp
index de89fafa32..46beaf0d4f 100644
--- a/examples/network/securesocketclient/main.cpp
+++ b/examples/network/securesocketclient/main.cpp
@@ -50,8 +50,8 @@ int main(int argc, char **argv)
QApplication app(argc, argv);
if (!QSslSocket::supportsSsl()) {
- QMessageBox::information(0, "Secure Socket Client",
- "This system does not support OpenSSL.");
+ QMessageBox::information(0, "Secure Socket Client",
+ "This system does not support OpenSSL.");
return -1;
}
diff --git a/examples/network/torrent/peerwireclient.cpp b/examples/network/torrent/peerwireclient.cpp
index a0be01d363..2b5fe3ada1 100644
--- a/examples/network/torrent/peerwireclient.cpp
+++ b/examples/network/torrent/peerwireclient.cpp
@@ -215,7 +215,7 @@ void PeerWireClient::sendPieceList(const QBitArray &bitField)
// Don't send the bitfield if it's all zeros.
if (bitField.count(true) == 0)
- return;
+ return;
int bitFieldSize = bitField.size();
int size = (bitFieldSize + 7) / 8;
diff --git a/examples/network/torrent/torrentserver.cpp b/examples/network/torrent/torrentserver.cpp
index 2196863ca0..0a9d836098 100644
--- a/examples/network/torrent/torrentserver.cpp
+++ b/examples/network/torrent/torrentserver.cpp
@@ -64,7 +64,7 @@ void TorrentServer::removeClient(TorrentClient *client)
void TorrentServer::incomingConnection(qintptr socketDescriptor)
{
PeerWireClient *client =
- new PeerWireClient(ConnectionManager::instance()->clientId(), this);
+ new PeerWireClient(ConnectionManager::instance()->clientId(), this);
if (client->setSocketDescriptor(socketDescriptor)) {
if (ConnectionManager::instance()->canAddConnection() && !clients.isEmpty()) {
diff --git a/examples/opengl/framebufferobject2/glwidget.cpp b/examples/opengl/framebufferobject2/glwidget.cpp
index 27dc603f3c..32b9799a4a 100644
--- a/examples/opengl/framebufferobject2/glwidget.cpp
+++ b/examples/opengl/framebufferobject2/glwidget.cpp
@@ -112,20 +112,20 @@ void GLWidget::initializeGL()
{
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- // draw cube background
+ // draw cube background
glPushMatrix();
glLoadIdentity();
glTranslatef(0.5f, 0.5f, -2.0f);
- glDisable(GL_TEXTURE_2D);
- glEnableClientState(GL_COLOR_ARRAY);
- glVertexPointer(2, GL_INT, 0, faceArray);
- glDrawArrays(GL_QUADS, 0, 4);
- glVertexPointer(3, GL_INT, 0, cubeArray);
- glDisableClientState(GL_COLOR_ARRAY);
- glEnable(GL_TEXTURE_2D);
+ glDisable(GL_TEXTURE_2D);
+ glEnableClientState(GL_COLOR_ARRAY);
+ glVertexPointer(2, GL_INT, 0, faceArray);
+ glDrawArrays(GL_QUADS, 0, 4);
+ glVertexPointer(3, GL_INT, 0, cubeArray);
+ glDisableClientState(GL_COLOR_ARRAY);
+ glEnable(GL_TEXTURE_2D);
glPopMatrix();
- // draw cube
+ // draw cube
glTranslatef(0.5f, 0.5f, 0.5f);
glRotatef(3.0f, 1.0f, 1.0f, 1.0f);
glTranslatef(-0.5f, -0.5f, -0.5f);
@@ -205,12 +205,12 @@ void GLWidget::paintGL()
glTranslatef(-1.2f, -0.8f, 0.0f);
glScalef(0.2f, 0.2f, 0.2f);
for (int y = 0; y < 5; ++y) {
- for (int x = 0; x < 5; ++x) {
- glTranslatef(2.0f, 0, 0);
- glColor4f(0.8f, 0.8f, 0.8f, 1.0f);
- glDrawArrays(GL_QUADS, 0, 4);
- }
- glTranslatef(-10.0f, 2.0f, 0);
+ for (int x = 0; x < 5; ++x) {
+ glTranslatef(2.0f, 0, 0);
+ glColor4f(0.8f, 0.8f, 0.8f, 1.0f);
+ glDrawArrays(GL_QUADS, 0, 4);
+ }
+ glTranslatef(-10.0f, 2.0f, 0);
}
glVertexPointer(3, GL_INT, 0, cubeArray);
diff --git a/examples/opengl/framebufferobject2/main.cpp b/examples/opengl/framebufferobject2/main.cpp
index ab7359bef3..4c9aa9840f 100644
--- a/examples/opengl/framebufferobject2/main.cpp
+++ b/examples/opengl/framebufferobject2/main.cpp
@@ -48,8 +48,8 @@ int main(int argc, char **argv)
QApplication a(argc, argv);
if (!QGLFormat::hasOpenGL() || !QGLFramebufferObject::hasOpenGLFramebufferObjects()) {
- QMessageBox::information(0, "OpenGL framebuffer objects 2",
- "This system does not support OpenGL/framebuffer objects.");
+ QMessageBox::information(0, "OpenGL framebuffer objects 2",
+ "This system does not support OpenGL/framebuffer objects.");
return -1;
}
diff --git a/examples/opengl/pbuffers/main.cpp b/examples/opengl/pbuffers/main.cpp
index e6b1fc5f48..8be6640e92 100644
--- a/examples/opengl/pbuffers/main.cpp
+++ b/examples/opengl/pbuffers/main.cpp
@@ -54,8 +54,8 @@ int main(int argc, char **argv)
widget.makeCurrent();
if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) {
- QMessageBox::information(0, "OpenGL pbuffers",
- "This system does not support OpenGL/pbuffers.");
+ QMessageBox::information(0, "OpenGL pbuffers",
+ "This system does not support OpenGL/pbuffers.");
return -1;
}
diff --git a/examples/opengl/pbuffers2/main.cpp b/examples/opengl/pbuffers2/main.cpp
index 60d8787c58..79fd88a3c8 100644
--- a/examples/opengl/pbuffers2/main.cpp
+++ b/examples/opengl/pbuffers2/main.cpp
@@ -51,8 +51,8 @@ int main(int argc, char **argv)
widget.resize(640, 480);
widget.makeCurrent();
if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) {
- QMessageBox::information(0, "OpenGL pbuffers 2",
- "This system does not support OpenGL/pbuffers.");
+ QMessageBox::information(0, "OpenGL pbuffers 2",
+ "This system does not support OpenGL/pbuffers.");
return -1;
}
widget.show();
diff --git a/examples/opengl/samplebuffers/main.cpp b/examples/opengl/samplebuffers/main.cpp
index cb25ffb3ec..a1272af4db 100644
--- a/examples/opengl/samplebuffers/main.cpp
+++ b/examples/opengl/samplebuffers/main.cpp
@@ -50,16 +50,16 @@ int main(int argc, char **argv)
f.setSampleBuffers(true);
QGLFormat::setDefaultFormat(f);
if (!QGLFormat::hasOpenGL()) {
- QMessageBox::information(0, "OpenGL samplebuffers",
- "This system does not support OpenGL.");
+ QMessageBox::information(0, "OpenGL samplebuffers",
+ "This system does not support OpenGL.");
return 0;
}
GLWidget widget(0);
if (!widget.format().sampleBuffers()) {
- QMessageBox::information(0, "OpenGL samplebuffers",
- "This system does not have sample buffer support.");
+ QMessageBox::information(0, "OpenGL samplebuffers",
+ "This system does not have sample buffer support.");
return 0;
}
diff --git a/examples/touch/fingerpaint/mainwindow.cpp b/examples/touch/fingerpaint/mainwindow.cpp
index 9481f888b5..f0477011d3 100644
--- a/examples/touch/fingerpaint/mainwindow.cpp
+++ b/examples/touch/fingerpaint/mainwindow.cpp
@@ -186,7 +186,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/doc/src/treemodelcompleter.qdoc b/examples/widgets/doc/src/treemodelcompleter.qdoc
index f18db0db65..9411371d12 100644
--- a/examples/widgets/doc/src/treemodelcompleter.qdoc
+++ b/examples/widgets/doc/src/treemodelcompleter.qdoc
@@ -1,4 +1,4 @@
- /****************************************************************************
+/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
diff --git a/examples/widgets/graphicsview/boxes/glbuffers.h b/examples/widgets/graphicsview/boxes/glbuffers.h
index 8b95ec2ea5..304b3da87a 100644
--- a/examples/widgets/graphicsview/boxes/glbuffers.h
+++ b/examples/widgets/graphicsview/boxes/glbuffers.h
@@ -196,9 +196,9 @@ public:
{
GLBUFFERS_ASSERT_OPENGL("GLVertexBuffer::GLVertexBuffer", glGenBuffers && glBindBuffer && glBufferData, return)
- glGenBuffers(1, &m_buffer);
- glBindBuffer(GL_ARRAY_BUFFER, m_buffer);
- glBufferData(GL_ARRAY_BUFFER, (m_length = length) * sizeof(T), data, mode);
+ glGenBuffers(1, &m_buffer);
+ glBindBuffer(GL_ARRAY_BUFFER, m_buffer);
+ glBufferData(GL_ARRAY_BUFFER, (m_length = length) * sizeof(T), data, mode);
}
~GLVertexBuffer()
diff --git a/examples/widgets/graphicsview/boxes/glextensions.cpp b/examples/widgets/graphicsview/boxes/glextensions.cpp
index eb0fe0ec6a..d10c0b4a62 100644
--- a/examples/widgets/graphicsview/boxes/glextensions.cpp
+++ b/examples/widgets/graphicsview/boxes/glextensions.cpp
@@ -45,54 +45,54 @@
bool GLExtensionFunctions::resolve(const QGLContext *context)
{
- bool ok = true;
+ bool ok = true;
- RESOLVE_GL_FUNC(GenFramebuffersEXT)
- RESOLVE_GL_FUNC(GenRenderbuffersEXT)
- RESOLVE_GL_FUNC(BindRenderbufferEXT)
- RESOLVE_GL_FUNC(RenderbufferStorageEXT)
- RESOLVE_GL_FUNC(DeleteFramebuffersEXT)
- RESOLVE_GL_FUNC(DeleteRenderbuffersEXT)
- RESOLVE_GL_FUNC(BindFramebufferEXT)
- RESOLVE_GL_FUNC(FramebufferTexture2DEXT)
- RESOLVE_GL_FUNC(FramebufferRenderbufferEXT)
- RESOLVE_GL_FUNC(CheckFramebufferStatusEXT)
+ RESOLVE_GL_FUNC(GenFramebuffersEXT)
+ RESOLVE_GL_FUNC(GenRenderbuffersEXT)
+ RESOLVE_GL_FUNC(BindRenderbufferEXT)
+ RESOLVE_GL_FUNC(RenderbufferStorageEXT)
+ RESOLVE_GL_FUNC(DeleteFramebuffersEXT)
+ RESOLVE_GL_FUNC(DeleteRenderbuffersEXT)
+ RESOLVE_GL_FUNC(BindFramebufferEXT)
+ RESOLVE_GL_FUNC(FramebufferTexture2DEXT)
+ RESOLVE_GL_FUNC(FramebufferRenderbufferEXT)
+ RESOLVE_GL_FUNC(CheckFramebufferStatusEXT)
- RESOLVE_GL_FUNC(ActiveTexture)
- RESOLVE_GL_FUNC(TexImage3D)
+ RESOLVE_GL_FUNC(ActiveTexture)
+ RESOLVE_GL_FUNC(TexImage3D)
- RESOLVE_GL_FUNC(GenBuffers)
- RESOLVE_GL_FUNC(BindBuffer)
- RESOLVE_GL_FUNC(BufferData)
- RESOLVE_GL_FUNC(DeleteBuffers)
- RESOLVE_GL_FUNC(MapBuffer)
- RESOLVE_GL_FUNC(UnmapBuffer)
+ RESOLVE_GL_FUNC(GenBuffers)
+ RESOLVE_GL_FUNC(BindBuffer)
+ RESOLVE_GL_FUNC(BufferData)
+ RESOLVE_GL_FUNC(DeleteBuffers)
+ RESOLVE_GL_FUNC(MapBuffer)
+ RESOLVE_GL_FUNC(UnmapBuffer)
- return ok;
+ return ok;
}
bool GLExtensionFunctions::fboSupported() {
return GenFramebuffersEXT
- && GenRenderbuffersEXT
- && BindRenderbufferEXT
- && RenderbufferStorageEXT
- && DeleteFramebuffersEXT
- && DeleteRenderbuffersEXT
- && BindFramebufferEXT
- && FramebufferTexture2DEXT
- && FramebufferRenderbufferEXT
- && CheckFramebufferStatusEXT;
+ && GenRenderbuffersEXT
+ && BindRenderbufferEXT
+ && RenderbufferStorageEXT
+ && DeleteFramebuffersEXT
+ && DeleteRenderbuffersEXT
+ && BindFramebufferEXT
+ && FramebufferTexture2DEXT
+ && FramebufferRenderbufferEXT
+ && CheckFramebufferStatusEXT;
}
bool GLExtensionFunctions::openGL15Supported() {
return ActiveTexture
- && TexImage3D
+ && TexImage3D
&& GenBuffers
- && BindBuffer
- && BufferData
- && DeleteBuffers
- && MapBuffer
- && UnmapBuffer;
+ && BindBuffer
+ && BufferData
+ && DeleteBuffers
+ && MapBuffer
+ && UnmapBuffer;
}
#undef RESOLVE_GL_FUNC
diff --git a/examples/widgets/graphicsview/boxes/glextensions.h b/examples/widgets/graphicsview/boxes/glextensions.h
index 46f2c11967..d92d5c304f 100644
--- a/examples/widgets/graphicsview/boxes/glextensions.h
+++ b/examples/widgets/graphicsview/boxes/glextensions.h
@@ -145,37 +145,37 @@ typedef GLboolean (APIENTRY *_glUnmapBuffer) (GLenum);
struct GLExtensionFunctions
{
- bool resolve(const QGLContext *context);
+ bool resolve(const QGLContext *context);
bool fboSupported();
bool openGL15Supported(); // the rest: multi-texture, 3D-texture, vertex buffer objects
- _glGenFramebuffersEXT GenFramebuffersEXT;
- _glGenRenderbuffersEXT GenRenderbuffersEXT;
- _glBindRenderbufferEXT BindRenderbufferEXT;
- _glRenderbufferStorageEXT RenderbufferStorageEXT;
- _glDeleteFramebuffersEXT DeleteFramebuffersEXT;
- _glDeleteRenderbuffersEXT DeleteRenderbuffersEXT;
- _glBindFramebufferEXT BindFramebufferEXT;
- _glFramebufferTexture2DEXT FramebufferTexture2DEXT;
- _glFramebufferRenderbufferEXT FramebufferRenderbufferEXT;
- _glCheckFramebufferStatusEXT CheckFramebufferStatusEXT;
-
- _glActiveTexture ActiveTexture;
- _glTexImage3D TexImage3D;
-
- _glGenBuffers GenBuffers;
- _glBindBuffer BindBuffer;
- _glBufferData BufferData;
- _glDeleteBuffers DeleteBuffers;
- _glMapBuffer MapBuffer;
- _glUnmapBuffer UnmapBuffer;
+ _glGenFramebuffersEXT GenFramebuffersEXT;
+ _glGenRenderbuffersEXT GenRenderbuffersEXT;
+ _glBindRenderbufferEXT BindRenderbufferEXT;
+ _glRenderbufferStorageEXT RenderbufferStorageEXT;
+ _glDeleteFramebuffersEXT DeleteFramebuffersEXT;
+ _glDeleteRenderbuffersEXT DeleteRenderbuffersEXT;
+ _glBindFramebufferEXT BindFramebufferEXT;
+ _glFramebufferTexture2DEXT FramebufferTexture2DEXT;
+ _glFramebufferRenderbufferEXT FramebufferRenderbufferEXT;
+ _glCheckFramebufferStatusEXT CheckFramebufferStatusEXT;
+
+ _glActiveTexture ActiveTexture;
+ _glTexImage3D TexImage3D;
+
+ _glGenBuffers GenBuffers;
+ _glBindBuffer BindBuffer;
+ _glBufferData BufferData;
+ _glDeleteBuffers DeleteBuffers;
+ _glMapBuffer MapBuffer;
+ _glUnmapBuffer UnmapBuffer;
};
inline GLExtensionFunctions &getGLExtensionFunctions()
{
- static GLExtensionFunctions funcs;
- return funcs;
+ static GLExtensionFunctions funcs;
+ return funcs;
}
#define glGenFramebuffersEXT getGLExtensionFunctions().GenFramebuffersEXT
diff --git a/examples/widgets/graphicsview/boxes/scene.cpp b/examples/widgets/graphicsview/boxes/scene.cpp
index 11e9f4ea5a..621068ab0b 100644
--- a/examples/widgets/graphicsview/boxes/scene.cpp
+++ b/examples/widgets/graphicsview/boxes/scene.cpp
@@ -186,10 +186,10 @@ TwoSidedGraphicsWidget::TwoSidedGraphicsWidget(QGraphicsScene *scene)
void TwoSidedGraphicsWidget::setWidget(int index, QWidget *widget)
{
if (index < 0 || index >= 2)
- {
- qWarning("TwoSidedGraphicsWidget::setWidget: Index out of bounds, index == %d", index);
- return;
- }
+ {
+ qWarning("TwoSidedGraphicsWidget::setWidget: Index out of bounds, index == %d", index);
+ return;
+ }
GraphicsWidget *proxy = new GraphicsWidget;
proxy->setWidget(widget);
@@ -210,10 +210,10 @@ void TwoSidedGraphicsWidget::setWidget(int index, QWidget *widget)
QWidget *TwoSidedGraphicsWidget::widget(int index)
{
if (index < 0 || index >= 2)
- {
- qWarning("TwoSidedGraphicsWidget::widget: Index out of bounds, index == %d", index);
- return 0;
- }
+ {
+ qWarning("TwoSidedGraphicsWidget::widget: Index out of bounds, index == %d", index);
+ return 0;
+ }
return m_proxyWidgets[index]->widget();
}
diff --git a/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp b/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
index 8ae8749091..973b630235 100644
--- a/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
+++ b/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
@@ -193,9 +193,9 @@ void GraphWidget::drawBackground(QPainter *painter, const QRectF &rect)
QRectF rightShadow(sceneRect.right(), sceneRect.top() + 5, 5, sceneRect.height());
QRectF bottomShadow(sceneRect.left() + 5, sceneRect.bottom(), sceneRect.width(), 5);
if (rightShadow.intersects(rect) || rightShadow.contains(rect))
- painter->fillRect(rightShadow, Qt::darkGray);
+ painter->fillRect(rightShadow, Qt::darkGray);
if (bottomShadow.intersects(rect) || bottomShadow.contains(rect))
- painter->fillRect(bottomShadow, Qt::darkGray);
+ painter->fillRect(bottomShadow, Qt::darkGray);
// Fill
QLinearGradient gradient(sceneRect.topLeft(), sceneRect.bottomRight());
diff --git a/examples/widgets/itemviews/pixelator/mainwindow.cpp b/examples/widgets/itemviews/pixelator/mainwindow.cpp
index 1f6a403efc..aca5545af0 100644
--- a/examples/widgets/itemviews/pixelator/mainwindow.cpp
+++ b/examples/widgets/itemviews/pixelator/mainwindow.cpp
@@ -156,11 +156,11 @@ void MainWindow::printImage()
{
#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
if (model->rowCount(QModelIndex())*model->columnCount(QModelIndex()) > 90000) {
- QMessageBox::StandardButton answer;
- answer = QMessageBox::question(this, tr("Large Image Size"),
- tr("The printed image may be very large. Are you sure that "
- "you want to print it?"),
- QMessageBox::Yes | QMessageBox::No);
+ QMessageBox::StandardButton answer;
+ answer = QMessageBox::question(this, tr("Large Image Size"),
+ tr("The printed image may be very large. Are you sure that "
+ "you want to print it?"),
+ QMessageBox::Yes | QMessageBox::No);
if (answer == QMessageBox::No)
return;
}
diff --git a/examples/widgets/layouts/basiclayouts/dialog.cpp b/examples/widgets/layouts/basiclayouts/dialog.cpp
index d162cd8541..f8b8d68d4f 100644
--- a/examples/widgets/layouts/basiclayouts/dialog.cpp
+++ b/examples/widgets/layouts/basiclayouts/dialog.cpp
@@ -101,7 +101,7 @@ void Dialog::createHorizontalGroupBox()
for (int i = 0; i < NumButtons; ++i) {
buttons[i] = new QPushButton(tr("Button %1").arg(i + 1));
- layout->addWidget(buttons[i]);
+ layout->addWidget(buttons[i]);
}
horizontalGroupBox->setLayout(layout);
}
diff --git a/examples/widgets/layouts/borderlayout/borderlayout.h b/examples/widgets/layouts/borderlayout/borderlayout.h
index d818462035..eae425d5e6 100644
--- a/examples/widgets/layouts/borderlayout/borderlayout.h
+++ b/examples/widgets/layouts/borderlayout/borderlayout.h
@@ -69,13 +69,13 @@ public:
private:
struct ItemWrapper
{
- ItemWrapper(QLayoutItem *i, Position p) {
- item = i;
- position = p;
- }
+ ItemWrapper(QLayoutItem *i, Position p) {
+ item = i;
+ position = p;
+ }
- QLayoutItem *item;
- Position position;
+ QLayoutItem *item;
+ Position position;
};
enum SizeType { MinimumSize, SizeHint };
diff --git a/examples/widgets/mainwindows/mdi/mdichild.cpp b/examples/widgets/mainwindows/mdi/mdichild.cpp
index f55e08a249..95c95e45e0 100644
--- a/examples/widgets/mainwindows/mdi/mdichild.cpp
+++ b/examples/widgets/mainwindows/mdi/mdichild.cpp
@@ -145,13 +145,13 @@ void MdiChild::documentWasModified()
bool MdiChild::maybeSave()
{
if (document()->isModified()) {
- QMessageBox::StandardButton ret;
+ QMessageBox::StandardButton ret;
ret = QMessageBox::warning(this, tr("MDI"),
tr("'%1' has been modified.\n"
"Do you want to save your changes?")
.arg(userFriendlyCurrentFile()),
QMessageBox::Save | QMessageBox::Discard
- | QMessageBox::Cancel);
+ | QMessageBox::Cancel);
if (ret == QMessageBox::Save)
return save();
else if (ret == QMessageBox::Cancel)
diff --git a/examples/widgets/mainwindows/sdi/mainwindow.cpp b/examples/widgets/mainwindows/sdi/mainwindow.cpp
index b7af4ffd9d..6db9bd6261 100644
--- a/examples/widgets/mainwindows/sdi/mainwindow.cpp
+++ b/examples/widgets/mainwindows/sdi/mainwindow.cpp
@@ -282,12 +282,12 @@ void MainWindow::writeSettings()
bool MainWindow::maybeSave()
{
if (textEdit->document()->isModified()) {
- QMessageBox::StandardButton ret;
+ QMessageBox::StandardButton ret;
ret = QMessageBox::warning(this, tr("SDI"),
tr("The document has been modified.\n"
"Do you want to save your changes?"),
QMessageBox::Save | QMessageBox::Discard
- | QMessageBox::Cancel);
+ | QMessageBox::Cancel);
if (ret == QMessageBox::Save)
return save();
else if (ret == QMessageBox::Cancel)
diff --git a/examples/widgets/richtext/textedit/textedit.cpp b/examples/widgets/richtext/textedit/textedit.cpp
index 873a29eb0e..128924ef4e 100644
--- a/examples/widgets/richtext/textedit/textedit.cpp
+++ b/examples/widgets/richtext/textedit/textedit.cpp
@@ -283,7 +283,7 @@ void TextEdit::setupTextActions()
tr("&Bold"), this);
actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B);
actionTextBold->setPriority(QAction::LowPriority);
- QFont bold;
+ QFont bold;
bold.setBold(true);
actionTextBold->setFont(bold);
connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold()));
diff --git a/examples/widgets/tools/codecs/mainwindow.cpp b/examples/widgets/tools/codecs/mainwindow.cpp
index e8f08bea6c..1e722ac6df 100644
--- a/examples/widgets/tools/codecs/mainwindow.cpp
+++ b/examples/widgets/tools/codecs/mainwindow.cpp
@@ -162,7 +162,7 @@ void MainWindow::createActions()
QString text = tr("%1...").arg(QString(codec->name()));
QAction *action = new QAction(text, this);
- action->setData(codec->name());
+ action->setData(codec->name());
connect(action, SIGNAL(triggered()), this, SLOT(save()));
saveAsActs.append(action);
}
diff --git a/examples/widgets/tutorials/modelview/5_edit/mymodel.cpp b/examples/widgets/tutorials/modelview/5_edit/mymodel.cpp
index 317c4760fb..0a2c301f9c 100644
--- a/examples/widgets/tutorials/modelview/5_edit/mymodel.cpp
+++ b/examples/widgets/tutorials/modelview/5_edit/mymodel.cpp
@@ -77,14 +77,14 @@ bool MyModel::setData(const QModelIndex & index, const QVariant & value, int rol
{
//save value from editor to member m_gridData
m_gridData[index.row()][index.column()] = value.toString();
- //for presentation purposes only: build and emit a joined string
+ //for presentation purposes only: build and emit a joined string
QString result;
- for(int row= 0; row < ROWS; row++)
- {
+ for (int row= 0; row < ROWS; row++)
+ {
for(int col= 0; col < COLS; col++)
- {
- result += m_gridData[row][col] + " ";
- }
+ {
+ result += m_gridData[row][col] + " ";
+ }
}
emit editCompleted( result );
}
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 acce642ec6..6503d60f22 100644
--- a/examples/widgets/widgets/spinboxes/window.cpp
+++ b/examples/widgets/widgets/spinboxes/window.cpp
@@ -94,6 +94,16 @@ void Window::createSpinBoxes()
priceSpinBox->setValue(99);
//! [4] //! [5]
+ groupSeparatorSpinBox = new QSpinBox;
+ groupSeparatorSpinBox->setRange(-99999999, 99999999);
+ groupSeparatorSpinBox->setValue(1000);
+ groupSeparatorSpinBox->setGroupSeparatorShown(true);
+ QCheckBox *groupSeparatorChkBox = new QCheckBox;
+ groupSeparatorChkBox->setText(tr("Show group separator"));
+ groupSeparatorChkBox->setChecked(true);
+ connect(groupSeparatorChkBox, &QCheckBox::toggled, groupSeparatorSpinBox,
+ &QSpinBox::setGroupSeparatorShown);
+
QLabel *hexLabel = new QLabel(tr("Enter a value between "
"%1 and %2:").arg('-' + QString::number(31, 16)).arg(QString::number(31, 16)));
QSpinBox *hexSpinBox = new QSpinBox;
@@ -111,6 +121,8 @@ void Window::createSpinBoxes()
spinBoxLayout->addWidget(priceSpinBox);
spinBoxLayout->addWidget(hexLabel);
spinBoxLayout->addWidget(hexSpinBox);
+ spinBoxLayout->addWidget(groupSeparatorChkBox);
+ spinBoxLayout->addWidget(groupSeparatorSpinBox);
spinBoxesGroup->setLayout(spinBoxLayout);
}
//! [5]
@@ -182,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]
@@ -237,6 +249,17 @@ void Window::createDoubleSpinBoxes()
//! [17]
this, SLOT(changePrecision(int)));
+ groupSeparatorSpinBox_d = new QDoubleSpinBox;
+ groupSeparatorSpinBox_d->setRange(-99999999, 99999999);
+ groupSeparatorSpinBox_d->setDecimals(2);
+ groupSeparatorSpinBox_d->setValue(1000.00);
+ groupSeparatorSpinBox_d->setGroupSeparatorShown(true);
+ QCheckBox *groupSeparatorChkBox = new QCheckBox;
+ groupSeparatorChkBox->setText(tr("Show group separator"));
+ groupSeparatorChkBox->setChecked(true);
+ connect(groupSeparatorChkBox, &QCheckBox::toggled, groupSeparatorSpinBox_d,
+ &QDoubleSpinBox::setGroupSeparatorShown);
+
//! [18]
QVBoxLayout *spinBoxLayout = new QVBoxLayout;
spinBoxLayout->addWidget(precisionLabel);
@@ -247,6 +270,8 @@ void Window::createDoubleSpinBoxes()
spinBoxLayout->addWidget(scaleSpinBox);
spinBoxLayout->addWidget(priceLabel);
spinBoxLayout->addWidget(priceSpinBox);
+ spinBoxLayout->addWidget(groupSeparatorChkBox);
+ spinBoxLayout->addWidget(groupSeparatorSpinBox_d);
doubleSpinBoxesGroup->setLayout(spinBoxLayout);
}
//! [18]
diff --git a/examples/widgets/widgets/spinboxes/window.h b/examples/widgets/widgets/spinboxes/window.h
index ef7af04f59..32622c2c24 100644
--- a/examples/widgets/widgets/spinboxes/window.h
+++ b/examples/widgets/widgets/spinboxes/window.h
@@ -45,6 +45,7 @@
QT_BEGIN_NAMESPACE
class QDateTimeEdit;
+class QSpinBox;
class QDoubleSpinBox;
class QGroupBox;
class QLabel;
@@ -75,6 +76,8 @@ private:
QGroupBox *editsGroup;
QGroupBox *doubleSpinBoxesGroup;
QLabel *meetingLabel;
+ QSpinBox *groupSeparatorSpinBox;
+ QDoubleSpinBox *groupSeparatorSpinBox_d;
};
//! [0]
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]
}