From b11317a64339f5a4bcffc8234ecaf15c7fb416f2 Mon Sep 17 00:00:00 2001 From: Axel Waggershauser Date: Fri, 15 Mar 2013 00:42:15 +0100 Subject: Whitespace cleanup: remove trailing whitespace Remove all trailing whitespace from the following list of files: *.cpp *.h *.conf *.qdoc *.pro *.pri *.mm *.rc *.pl *.qps *.xpm *.txt *README excluding 3rdparty, test-data and auto generated code. Note A): the only non 3rdparty c++-files that still have trailing whitespace after this change are: * src/corelib/codecs/cp949codetbl_p.h * src/corelib/codecs/qjpunicode.cpp * src/corelib/codecs/qbig5codec.cpp * src/corelib/xml/qxmlstream_p.h * src/tools/qdoc/qmlparser/qqmljsgrammar.cpp * src/tools/uic/ui4.cpp * tests/auto/other/qtokenautomaton/tokenizers/* * tests/benchmarks/corelib/tools/qstring/data.cpp * util/lexgen/tokenizer.cpp Note B): in about 30 files some overlapping 'leading tab' and 'TAB character in non-leading whitespace' issues have been fixed to make the sanity bot happy. Plus some general ws-fixes here and there as asked for during review. Change-Id: Ia713113c34d82442d6ce4d93d8b1cf545075d11d Reviewed-by: Oswald Buddenhagen --- examples/widgets/animation/appchooser/main.cpp | 2 +- examples/widgets/animation/easing/window.h | 4 +- examples/widgets/animation/stickman/animation.cpp | 18 +- examples/widgets/animation/stickman/lifecycle.cpp | 20 +- examples/widgets/animation/stickman/node.cpp | 4 +- examples/widgets/animation/stickman/stickman.h | 4 +- examples/widgets/dialogs/classwizard/classwizard.h | 2 +- examples/widgets/dialogs/classwizard/main.cpp | 2 +- examples/widgets/dialogs/sipdialog/dialog.cpp | 2 +- examples/widgets/doc/src/addressbook-fr.qdoc | 48 ++--- examples/widgets/doc/src/addressbook-tutorial.qdoc | 6 +- examples/widgets/doc/src/addressbook.qdoc | 2 +- examples/widgets/doc/src/codeeditor.qdoc | 12 +- examples/widgets/doc/src/coloreditorfactory.qdoc | 20 +- examples/widgets/doc/src/diagramscene.qdoc | 232 ++++++++++----------- examples/widgets/doc/src/dockwidgets.qdoc | 4 +- examples/widgets/doc/src/easing.qdoc | 2 +- examples/widgets/doc/src/echoplugin.qdoc | 18 +- examples/widgets/doc/src/fetchmore.qdoc | 2 +- examples/widgets/doc/src/flowlayout.qdoc | 90 ++++---- examples/widgets/doc/src/fontsampler.qdoc | 2 +- examples/widgets/doc/src/fridgemagnets.qdoc | 2 +- examples/widgets/doc/src/mdi.qdoc | 2 +- examples/widgets/doc/src/moveblocks.qdoc | 4 +- examples/widgets/doc/src/pixelator.qdoc | 2 +- examples/widgets/doc/src/recentfiles.qdoc | 2 +- examples/widgets/doc/src/regexp.qdoc | 2 +- examples/widgets/doc/src/rogue.qdoc | 4 +- examples/widgets/doc/src/sdi.qdoc | 2 +- examples/widgets/doc/src/settingseditor.qdoc | 2 +- examples/widgets/doc/src/simplewidgetmapper.qdoc | 2 +- examples/widgets/doc/src/spinboxes.qdoc | 2 +- examples/widgets/doc/src/standarddialogs.qdoc | 2 +- examples/widgets/doc/src/stardelegate.qdoc | 2 +- examples/widgets/doc/src/styleplugin.qdoc | 4 +- examples/widgets/doc/src/stylesheet.qdoc | 2 +- examples/widgets/doc/src/sub-attaq.qdoc | 2 +- examples/widgets/doc/src/tablet.qdoc | 46 ++-- examples/widgets/doc/src/tetrix.qdoc | 2 +- examples/widgets/doc/src/undo.qdoc | 2 +- examples/widgets/doc/src/undoframework.qdoc | 46 ++-- .../draganddrop/draggableicons/dragwidget.cpp | 4 +- examples/widgets/draganddrop/dropsite/droparea.cpp | 4 +- .../draganddrop/dropsite/dropsitewindow.cpp | 8 +- examples/widgets/graphicsview/boxes/scene.cpp | 2 +- examples/widgets/graphicsview/chip/main.cpp | 2 +- examples/widgets/graphicsview/chip/mainwindow.cpp | 2 +- examples/widgets/graphicsview/chip/mainwindow.h | 4 +- .../widgets/graphicsview/collidingmice/mouse.cpp | 2 +- .../widgets/graphicsview/dragdroprobot/robot.cpp | 2 +- .../widgets/graphicsview/dragdroprobot/robot.h | 2 +- .../widgets/graphicsview/elasticnodes/edge.cpp | 2 +- examples/widgets/graphicsview/elasticnodes/edge.h | 4 +- examples/widgets/graphicsview/elasticnodes/node.h | 2 +- .../graphicsview/embeddeddialogs/customproxy.cpp | 6 +- .../graphicsview/embeddeddialogs/customproxy.h | 2 +- .../widgets/itemviews/addressbook/adddialog.cpp | 16 +- examples/widgets/itemviews/addressbook/adddialog.h | 2 +- .../itemviews/addressbook/addresswidget.cpp | 20 +- .../widgets/itemviews/addressbook/mainwindow.cpp | 6 +- .../itemviews/addressbook/newaddresstab.cpp | 12 +- .../widgets/itemviews/addressbook/newaddresstab.h | 4 +- .../widgets/itemviews/addressbook/tablemodel.h | 2 +- .../widgets/itemviews/combowidgetmapper/window.cpp | 4 +- .../widgets/itemviews/fetchmore/filelistmodel.cpp | 6 +- examples/widgets/itemviews/fetchmore/window.cpp | 2 +- .../widgets/itemviews/pixelator/mainwindow.cpp | 2 +- .../itemviews/simplewidgetmapper/window.cpp | 2 +- .../widgets/itemviews/spreadsheet/spreadsheet.h | 2 +- examples/widgets/painting/deform/pathdeform.cpp | 4 +- examples/widgets/painting/gradients/gradients.cpp | 2 +- .../widgets/painting/pathstroke/pathstroke.cpp | 4 +- examples/widgets/richtext/textedit/textedit.cpp | 2 +- examples/widgets/richtext/textedit/textedit.qdoc | 4 +- examples/widgets/statemachine/factorial/main.cpp | 2 +- examples/widgets/statemachine/rogue/window.cpp | 8 +- examples/widgets/tools/completer/mainwindow.cpp | 2 +- .../widgets/tools/customcompleter/mainwindow.cpp | 2 +- .../widgets/tools/customcompleter/textedit.cpp | 6 +- examples/widgets/tools/plugandpaint/mainwindow.cpp | 2 +- .../widgets/tools/plugandpaint/plugindialog.cpp | 2 +- .../widgets/tools/undoframework/diagramscene.cpp | 4 +- .../tutorials/addressbook-fr/part1/addressbook.cpp | 2 +- .../tutorials/addressbook-fr/part2/addressbook.cpp | 10 +- .../tutorials/addressbook-fr/part3/addressbook.cpp | 16 +- .../tutorials/addressbook-fr/part3/addressbook.h | 6 +- .../tutorials/addressbook-fr/part4/addressbook.cpp | 24 +-- .../tutorials/addressbook-fr/part4/addressbook.h | 8 +- .../tutorials/addressbook-fr/part5/addressbook.cpp | 22 +- .../tutorials/addressbook-fr/part5/addressbook.h | 12 +- .../tutorials/addressbook-fr/part6/addressbook.cpp | 24 +-- .../tutorials/addressbook-fr/part6/addressbook.h | 8 +- .../tutorials/addressbook-fr/part7/addressbook.cpp | 24 +-- .../tutorials/addressbook-fr/part7/addressbook.h | 6 +- .../tutorials/addressbook/part1/addressbook.cpp | 2 +- .../tutorials/addressbook/part2/addressbook.cpp | 10 +- .../tutorials/addressbook/part3/addressbook.cpp | 16 +- .../tutorials/addressbook/part3/addressbook.h | 6 +- .../tutorials/addressbook/part4/addressbook.cpp | 24 +-- .../tutorials/addressbook/part4/addressbook.h | 8 +- .../tutorials/addressbook/part5/addressbook.cpp | 22 +- .../tutorials/addressbook/part5/addressbook.h | 12 +- .../tutorials/addressbook/part6/addressbook.cpp | 24 +-- .../tutorials/addressbook/part6/addressbook.h | 8 +- .../tutorials/addressbook/part7/addressbook.cpp | 24 +-- .../tutorials/addressbook/part7/addressbook.h | 6 +- .../tutorials/gettingStarted/gsQt/part3/main.cpp | 4 +- .../widgets/tutorials/modelview/5_edit/mymodel.cpp | 2 +- .../modelview/7_selections/mainwindow.cpp | 2 +- examples/widgets/widgets/calculator/button.cpp | 2 +- examples/widgets/widgets/codeeditor/codeeditor.cpp | 4 +- examples/widgets/widgets/scribble/scribblearea.cpp | 2 +- examples/widgets/widgets/styles/widgetgallery.cpp | 2 +- examples/widgets/widgets/styles/widgetgallery.h | 2 +- 114 files changed, 573 insertions(+), 573 deletions(-) (limited to 'examples/widgets') diff --git a/examples/widgets/animation/appchooser/main.cpp b/examples/widgets/animation/appchooser/main.cpp index 2184d1bcdf..a65e998b32 100644 --- a/examples/widgets/animation/appchooser/main.cpp +++ b/examples/widgets/animation/appchooser/main.cpp @@ -108,7 +108,7 @@ void createStates(const QObjectList &objects, void createAnimations(const QObjectList &objects, QStateMachine *machine) { for (int i=0; iaddDefaultAnimation(new QPropertyAnimation(objects.at(i), "geometry")); + machine->addDefaultAnimation(new QPropertyAnimation(objects.at(i), "geometry")); } int main(int argc, char **argv) diff --git a/examples/widgets/animation/easing/window.h b/examples/widgets/animation/easing/window.h index b47f236d95..d7fa927b49 100644 --- a/examples/widgets/animation/easing/window.h +++ b/examples/widgets/animation/easing/window.h @@ -63,11 +63,11 @@ private slots: void periodChanged(double); void amplitudeChanged(double); void overshootChanged(double); - + private: void createCurveIcons(); void startAnimation(); - + Ui::Form m_ui; QGraphicsScene m_scene; PixmapItem *m_item; diff --git a/examples/widgets/animation/stickman/animation.cpp b/examples/widgets/animation/stickman/animation.cpp index ebfbd1b5b8..730ee236e4 100644 --- a/examples/widgets/animation/stickman/animation.cpp +++ b/examples/widgets/animation/stickman/animation.cpp @@ -45,13 +45,13 @@ #include #include -class Frame +class Frame { public: Frame() { } - int nodeCount() const + int nodeCount() const { return m_nodePositions.size(); } @@ -70,7 +70,7 @@ public: { m_nodePositions[idx] = pos; } - + private: QVector m_nodePositions; }; @@ -81,7 +81,7 @@ Animation::Animation() m_frames.append(new Frame); } -Animation::~Animation() +Animation::~Animation() { qDeleteAll(m_frames); } @@ -89,10 +89,10 @@ Animation::~Animation() void Animation::setTotalFrames(int totalFrames) { while (m_frames.size() < totalFrames) - m_frames.append(new Frame); + m_frames.append(new Frame); while (totalFrames < m_frames.size()) - delete m_frames.takeLast(); + delete m_frames.takeLast(); } int Animation::totalFrames() const @@ -165,15 +165,15 @@ void Animation::load(QIODevice *device) QDataStream stream(device); stream >> m_name; - + int frameCount; stream >> frameCount; for (int i=0; i> nodeCount; - + Frame *frame = new Frame; frame->setNodeCount(nodeCount); diff --git a/examples/widgets/animation/stickman/lifecycle.cpp b/examples/widgets/animation/stickman/lifecycle.cpp index c49fac7905..09ca45e55b 100644 --- a/examples/widgets/animation/stickman/lifecycle.cpp +++ b/examples/widgets/animation/stickman/lifecycle.cpp @@ -65,7 +65,7 @@ public: if (QSignalTransition::eventTest(e)) { QVariant key = static_cast(e)->arguments().at(0); return (key.toInt() == int(m_key)); - } + } return false; } @@ -100,7 +100,7 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver) const int stickManNodeCount = m_stickMan->nodeCount(); for (int i=0; inode(i), "pos"); - m_animationGroup->addAnimation(pa); + m_animationGroup->addAnimation(pa); } // Set up initial state graph @@ -111,14 +111,14 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver) m_alive = new QState(m_machine); m_alive->setObjectName("alive"); - + // Make it blink when lightning strikes before entering dead animation - QState *lightningBlink = new QState(m_machine); + QState *lightningBlink = new QState(m_machine); lightningBlink->assignProperty(m_stickMan->scene(), "backgroundBrush", QColor(Qt::white)); lightningBlink->assignProperty(m_stickMan, "penColor", QColor(Qt::black)); lightningBlink->assignProperty(m_stickMan, "fillColor", QColor(Qt::white)); lightningBlink->assignProperty(m_stickMan, "isDead", true); - + //! [5] QTimer *timer = new QTimer(lightningBlink); timer->setSingleShot(true); @@ -126,13 +126,13 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver) QObject::connect(lightningBlink, SIGNAL(entered()), timer, SLOT(start())); QObject::connect(lightningBlink, SIGNAL(exited()), timer, SLOT(stop())); //! [5] - + m_dead = new QState(m_machine); m_dead->assignProperty(m_stickMan->scene(), "backgroundBrush", QColor(Qt::black)); m_dead->assignProperty(m_stickMan, "penColor", QColor(Qt::white)); m_dead->assignProperty(m_stickMan, "fillColor", QColor(Qt::black)); m_dead->setObjectName("dead"); - + // Idle state (sets no properties) m_idle = new QState(m_alive); m_idle->setObjectName("idle"); @@ -172,7 +172,7 @@ void LifeCycle::addActivity(const QString &fileName, Qt::Key key, QObject *sende QState *LifeCycle::makeState(QState *parentState, const QString &animationFileName) { QState *topLevel = new QState(parentState); - + Animation animation; { QFile file(animationFileName); @@ -186,7 +186,7 @@ QState *LifeCycle::makeState(QState *parentState, const QString &animationFileNa animation.setCurrentFrame(i); //! [1] - QState *frameState = new QState(topLevel); + QState *frameState = new QState(topLevel); const int nodeCount = animation.nodeCount(); for (int j=0; jassignProperty(m_stickMan->node(j), "pos", animation.nodePos(j)); @@ -199,7 +199,7 @@ QState *LifeCycle::makeState(QState *parentState, const QString &animationFileNa //! [2] previousState->addTransition(previousState, SIGNAL(propertiesAssigned()), frameState); //! [2] - + previousState = frameState; } diff --git a/examples/widgets/animation/stickman/node.cpp b/examples/widgets/animation/stickman/node.cpp index b47a1e8433..0694ee3a2f 100644 --- a/examples/widgets/animation/stickman/node.cpp +++ b/examples/widgets/animation/stickman/node.cpp @@ -62,7 +62,7 @@ QRectF Node::boundingRect() const } void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) -{ +{ painter->setPen(Qt::white); painter->drawEllipse(QPointF(0.0, 0.0), 5.0, 5.0); } @@ -83,7 +83,7 @@ void Node::mousePressEvent(QGraphicsSceneMouseEvent *) void Node::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { if (m_dragging) - setPos(mapToParent(event->pos())); + setPos(mapToParent(event->pos())); } void Node::mouseReleaseEvent(QGraphicsSceneMouseEvent *) diff --git a/examples/widgets/animation/stickman/stickman.h b/examples/widgets/animation/stickman/stickman.h index 337fe4a794..08928a48a6 100644 --- a/examples/widgets/animation/stickman/stickman.h +++ b/examples/widgets/animation/stickman/stickman.h @@ -62,7 +62,7 @@ public: virtual QRectF boundingRect() const; virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - int nodeCount() const; + int nodeCount() const; Node *node(int idx) const; void setDrawSticks(bool on); @@ -90,7 +90,7 @@ private: Node *m_nodes[NodeCount]; qreal m_perfectBoneLengths[BoneCount]; - + uint m_sticks : 1; uint m_isDead : 1; uint m_reserved : 30; diff --git a/examples/widgets/dialogs/classwizard/classwizard.h b/examples/widgets/dialogs/classwizard/classwizard.h index 751179f81b..34a35a2ce9 100644 --- a/examples/widgets/dialogs/classwizard/classwizard.h +++ b/examples/widgets/dialogs/classwizard/classwizard.h @@ -124,7 +124,7 @@ class OutputFilesPage : public QWizardPage { Q_OBJECT -public: +public: OutputFilesPage(QWidget *parent = 0); protected: diff --git a/examples/widgets/dialogs/classwizard/main.cpp b/examples/widgets/dialogs/classwizard/main.cpp index 110ada0ed3..4a22dbb212 100644 --- a/examples/widgets/dialogs/classwizard/main.cpp +++ b/examples/widgets/dialogs/classwizard/main.cpp @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) { Q_INIT_RESOURCE(classwizard); - + QApplication app(argc, argv); #ifndef QT_NO_TRANSLATION diff --git a/examples/widgets/dialogs/sipdialog/dialog.cpp b/examples/widgets/dialogs/sipdialog/dialog.cpp index b3592f3308..c51feac0a5 100644 --- a/examples/widgets/dialogs/sipdialog/dialog.cpp +++ b/examples/widgets/dialogs/sipdialog/dialog.cpp @@ -91,7 +91,7 @@ Dialog::Dialog() //! [Dialog constructor part5] connect(button, SIGNAL(clicked()), qApp, SLOT(closeAllWindows())); - connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), + connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(desktopResized(int))); } //! [Dialog constructor part5] diff --git a/examples/widgets/doc/src/addressbook-fr.qdoc b/examples/widgets/doc/src/addressbook-fr.qdoc index 0d6ff16b57..9a7bc3a6b7 100644 --- a/examples/widgets/doc/src/addressbook-fr.qdoc +++ b/examples/widgets/doc/src/addressbook-fr.qdoc @@ -36,7 +36,7 @@ \image addressbook-tutorial-screenshot.png - Ce tutoriel va nous amener à découvrir quelques technologies fondamentales fournies + Ce tutoriel va nous amener à découvrir quelques technologies fondamentales fournies par Qt, tel que: \list @@ -124,7 +124,7 @@ réutilisé dans d'autres projets \endlist - Comme Qt ne fournit pas de widget standard pour un carnet d'adresses, nous + Comme Qt ne fournit pas de widget standard pour un carnet d'adresses, nous partirons d'une classe de widget Qt standard et y ajouterons des fonctionnalités. La classe \c AddressBook crée dans ce tutoriel peut être réutilisée si on a besoin d'un widget carnet d'adresses basique. @@ -148,12 +148,12 @@ dans \c nameLine et \c addressText sont nécessaires à de nombreuses méthodes du carnet d'adresses. - Il n'est pas nécessaire de déclarer les objets QLabel que nous allons utiliser + Il n'est pas nécessaire de déclarer les objets QLabel que nous allons utiliser puisque nous n'aurons pas besoin d'y faire référence après leur création. La façon dont Qt gère la parenté des objets est traitée dans la section suivante. La macro Q_OBJECT implémente des fonctionnalités parmi les plus avancées de Qt. - Pour le moment, il est bon de voir la macro Q_OBJECT comme un raccourci nous + Pour le moment, il est bon de voir la macro Q_OBJECT comme un raccourci nous permettant d'utiliser les méthodes \l{QObject::}{tr()} et \l{QObject::}{connect()}. Nous en avons maintenant terminé avec le fichier \c addressbook.h et allons @@ -295,13 +295,13 @@ Le bouton \c addButton est affiché en invoquant la méthode \l{QPushButton::show()} {show()}, tandis que \c submitButton et \c cancelButton sont cachés en invoquant - \l{QPushButton::hide()}{hide()}. Ces deux boutons ne seront affichés que lorsque + \l{QPushButton::hide()}{hide()}. Ces deux boutons ne seront affichés que lorsque l'utilisateur cliquera sur "Add", et ceci est géré par la méthode \c addContact() décrite plus loin. \snippet tutorials/addressbook/part2/addressbook.cpp connecting signals and slots - Nous connectons le signal \l{QPushButton::clicked()}{clicked()} de chaque bouton + Nous connectons le signal \l{QPushButton::clicked()}{clicked()} de chaque bouton au slot qui gèrera l'action. L'image ci-dessous illustre ceci: @@ -379,8 +379,8 @@ \snippet tutorials/addressbook/part2/addressbook.cpp cancel - L'idée générale pour augmenter la flexibilité lors de l'ajout d'un - contact est de donner la possiblité de cliquer sur "Add" + L'idée générale pour augmenter la flexibilité lors de l'ajout d'un + contact est de donner la possiblité de cliquer sur "Add" ou "Cancel" à n'importe quel moment. L'organigramme ci-dessous reprend l'ensemble des interactions dévelopées jusqu'ici: @@ -458,15 +458,15 @@ \c mainLayout. \image addressbook-tutorial-part3-labeled-layout.png - Dans notre méthode \c addContact(), nous avons desactivé ces boutons - pour être sûr que l'utilisateur n'utilise pas la navigation lors de + Dans notre méthode \c addContact(), nous avons desactivé ces boutons + pour être sûr que l'utilisateur n'utilise pas la navigation lors de l'ajout d'un contact. \snippet tutorials/addressbook/part3/addressbook.cpp disabling navigation Dans notre méthode \c submitContact(), nous activons les boutons de navigation, \c nextButton et \c previousButton, en fonction de la - taille de \c contacts. Commen mentionné plus tôt, la navigation n'est + taille de \c contacts. Commen mentionné plus tôt, la navigation n'est activée que si il y a plus d'un contact dans le carnet d'adresses. Les lignes suivantes montrent comment faire cela: @@ -475,13 +475,13 @@ Nous incluons aussi ces lignes de code dans le bouton \c cancel(). Souvenez vous que nous voulons émuler une liste-liée ciruculaire à - l'aide de l'objet QMap, \c contacts. Pour faire cela, nous obtenons un itérateur + l'aide de l'objet QMap, \c contacts. Pour faire cela, nous obtenons un itérateur sur \c contact dans la méthode \c next(), et ensuite: \list \li Si l'itérateur n'est pas à la fin de \c contacts, nous l'incrémentons \li Si l'itérateur est à la fin de \c contacts, nous changeons sa position - jusqu'au début de \c contacts. Cela donne l'illusion que notre QMap + jusqu'au début de \c contacts. Cela donne l'illusion que notre QMap fonctionne comme une liste circulaire. \endlist @@ -490,7 +490,7 @@ Une fois que nous avons itéré jusqu'à l'objet recherché dans \c contacts, nous affichons son contenu sur \c nameLine et \c addressText. - De la même façon, pour la méthode \c previous(), nous obtenons un + De la même façon, pour la méthode \c previous(), nous obtenons un itérateur sur \c contacts et ensuite: \list @@ -522,7 +522,7 @@ \image addressbook-tutorial-screenshot.png Nous avons maintenant un carnet d'adresses qui ne se contente pas de - lister des contacts de façon ordonnée, mais permet également la + lister des contacts de façon ordonnée, mais permet également la navigation. Il serait pratique d'inclure des fonctions telles qu'éditer et supprimer, afin que les détails associés à un contact puissent être modifiés lorsque c'est nécessaire. Cependant, cela requiert une légère @@ -563,7 +563,7 @@ \dots \snippet tutorials/addressbook/part4/addressbook.h mode declaration - Enfin, on déclare \c currentMode pour garder une trace du mode + Enfin, on déclare \c currentMode pour garder une trace du mode actuellement utilisé. \section1 Implémentation de la classe AddressBook @@ -637,7 +637,7 @@ avant de tester sa valeur. Chacun des boutons est ensuite activé ou désactivé, en fonction du mode. - Le code source pour les cas \c AddingMode et \c EditingMode est visible + Le code source pour les cas \c AddingMode et \c EditingMode est visible ci-dessous: \snippet tutorials/addressbook/part4/addressbook.cpp update interface() part 1 @@ -840,7 +840,7 @@ \section1 Définition de la classe AddressBook - On déclare deux slots publics, \c saveToFile() et \c loadFromFile(), + On déclare deux slots publics, \c saveToFile() et \c loadFromFile(), ainsi que deux objets QPushButton, \c loadButton et \c saveButton. \snippet tutorials/addressbook/part6/addressbook.h save and load functions declaration @@ -863,11 +863,11 @@ \snippet tutorials/addressbook/part6/addressbook.cpp tooltip 2 Bien qu'on ne cite pas le code correspondant ici, nous ajoutons ces deux boutons au - layout de droite, \c button1Layout, comme pour les fonctionnalités précédentes, et + layout de droite, \c button1Layout, comme pour les fonctionnalités précédentes, et nous connectons leurs signaux \l{QPushButton::clicked()}{clicked()} à leurs slots respectifs. - Pour la sauvegarde, on commence par récupérer le nom de fichier + Pour la sauvegarde, on commence par récupérer le nom de fichier \c fileName, en utilisant QFileDialog::getSaveFileName(). C'est une méthode pratique fournie par QFileDialog, qui ouvre une boîte de dialogue modale et permet à l'utilisateur d'entrer un nom de fichier ou @@ -966,7 +966,7 @@ \section1 Définition de la classe AddressBook Nous ajoutons un objet QPushButton, \c exportButton, et un slot - public correspondant, \c exportAsVCard(), à notre classe \c AddressBook + public correspondant, \c exportAsVCard(), à notre classe \c AddressBook dans le fichier \c addressbook.h. \snippet tutorials/addressbook/part7/addressbook.h exportAsVCard() declaration @@ -1001,7 +1001,7 @@ cela échoue, nous affichons un QMessageBox pour informer l'utilisateur à propos de l'origine du problème et nous quittons la méthode. Sinon, nous passons le fichier comme paramètre pour créer un objet QTextStream, \c out. De la même façon que - QDataStream, la classe QTextStream fournit les fonctionnalités pour + QDataStream, la classe QTextStream fournit les fonctionnalités pour lire et écrire des fichiers de texte. Grâce à celà, le fichier \c{.vcf} généré pourra être ouvert et édité à l'aide d'un simple éditeur de texte. @@ -1014,7 +1014,7 @@ à un nom de famille défini ou non. Si oui, nous utilions les détails de \c nameList pour remplir le champ, dans le cas contraire on écrit uniquement le contenu de \c firstName. - + \snippet tutorials/addressbook/part7/addressbook.cpp export function part3 Nous continuons en écrivant l'adresse du contact. Les points-virgules @@ -1026,7 +1026,7 @@ \snippet tutorials/addressbook/part7/addressbook.cpp export function part4 À la fin de la méthode, un QMessageBox est affiché pour informer l'utilisateur - que la vCard a été exportée avec succès. + que la vCard a été exportée avec succès. \e{vCard est une marque déposée de \l{http://www.imc.org} {Internet Mail Consortium}}. diff --git a/examples/widgets/doc/src/addressbook-tutorial.qdoc b/examples/widgets/doc/src/addressbook-tutorial.qdoc index db3d785616..089ab2319d 100644 --- a/examples/widgets/doc/src/addressbook-tutorial.qdoc +++ b/examples/widgets/doc/src/addressbook-tutorial.qdoc @@ -73,7 +73,7 @@ have worked through this tutorial, we recommend reading the \l{mainwindows/application}{Application} example, which presents a small GUI application, with menus, toolbars, a status bar, and so - on. + on. */ /*! @@ -199,7 +199,7 @@ Notice that \c addressLabel is positioned using Qt::AlignTop as an additional argument. This is to make sure it is not vertically centered in - cell (1,0). For a basic overview on Qt Layouts, refer to the + cell (1,0). For a basic overview on Qt Layouts, refer to the \l{Layout Management} documentation. In order to install the layout object onto the widget, we have to invoke @@ -431,7 +431,7 @@ \snippet tutorials/addressbook/part3/addressbook.cpp connecting navigation signals - The image below is the expected graphical user interface. + The image below is the expected graphical user interface. \image addressbook-tutorial-part3-screenshot.png diff --git a/examples/widgets/doc/src/addressbook.qdoc b/examples/widgets/doc/src/addressbook.qdoc index ea0cb46830..becff14f3f 100644 --- a/examples/widgets/doc/src/addressbook.qdoc +++ b/examples/widgets/doc/src/addressbook.qdoc @@ -273,7 +273,7 @@ \snippet itemviews/addressbook/addresswidget.cpp 4a - Next we extract data from the row the user intends to + Next we extract data from the row the user intends to edit. This data is displayed in an instance of \c AddDialog with a different window title. The \c table is only updated if changes have been made to data in \c aDialog. diff --git a/examples/widgets/doc/src/codeeditor.qdoc b/examples/widgets/doc/src/codeeditor.qdoc index 2848908233..3db55eddc5 100644 --- a/examples/widgets/doc/src/codeeditor.qdoc +++ b/examples/widgets/doc/src/codeeditor.qdoc @@ -60,7 +60,7 @@ We will now move on to the definitions and implementations of \c CodeEditor and \c LineNumberArea. Let's start with the \c - LineNumberArea class. + LineNumberArea class. \section1 The LineNumberArea Class @@ -130,7 +130,7 @@ \snippet widgets/codeeditor/codeeditor.cpp resizeEvent When the size of the editor changes, we also need to resize the - line number area. + line number area. \snippet widgets/codeeditor/codeeditor.cpp cursorPositionChanged @@ -155,7 +155,7 @@ The \c lineNumberAreaPaintEvent() is called from \c LineNumberArea whenever it receives a paint event. We start off by painting the - widget's background. + widget's background. \snippet widgets/codeeditor/codeeditor.cpp extraAreaPaintEvent_1 @@ -163,11 +163,11 @@ numbers in the extra area for each line. Notice that in a plain text edit each line will consist of one QTextBlock; though, if line wrapping is enabled, a line may span several rows in the text - edit's viewport. + edit's viewport. We get the top and bottom y-coordinate of the first text block, and adjust these values by the height of the current text block in - each iteration in the loop. + each iteration in the loop. \snippet widgets/codeeditor/codeeditor.cpp extraAreaPaintEvent_2 @@ -183,7 +183,7 @@ In addition to line numbers, you can add more to the extra area, for instance, break points. - + QSyntaxHighlighter gives the possibility to add user data to each text block with \l{QSyntaxHighlighter::}{setCurrentBlockUserData()}. This can be diff --git a/examples/widgets/doc/src/coloreditorfactory.qdoc b/examples/widgets/doc/src/coloreditorfactory.qdoc index 6728d88252..ad4a37492e 100644 --- a/examples/widgets/doc/src/coloreditorfactory.qdoc +++ b/examples/widgets/doc/src/coloreditorfactory.qdoc @@ -78,7 +78,7 @@ After the new factory has been set, all standard item delegates will use it (i.e, also delegates that were created before the new - default factory was set). + default factory was set). The \c createGUI() function sets up the table and fills it with data. @@ -135,17 +135,17 @@ \list \li If the editor widget has no user property defined, the delegate - asks the factory for the property name, which it in turn - asks the item editor creator for. In this case, you can use - the QItemEditorCreator class, which takes the property - name to use for editing as a constructor argument. + asks the factory for the property name, which it in turn + asks the item editor creator for. In this case, you can use + the QItemEditorCreator class, which takes the property + name to use for editing as a constructor argument. \li If the editor requires other constructors or other - initialization than provided by QItemEditorCreatorBase, you - must reimplement - QItemEditorCreatorBase::createWidget(). + initialization than provided by QItemEditorCreatorBase, you + must reimplement + QItemEditorCreatorBase::createWidget(). \li You could also subclass QItemEditorFactory if you only want - to provide editors for certain kinds of data or use another - method of creating the editors than using creator bases. + to provide editors for certain kinds of data or use another + method of creating the editors than using creator bases. \endlist In this example, we use a standard QVariant data type. You can diff --git a/examples/widgets/doc/src/diagramscene.qdoc b/examples/widgets/doc/src/diagramscene.qdoc index f05ad42130..92048cdcaf 100644 --- a/examples/widgets/doc/src/diagramscene.qdoc +++ b/examples/widgets/doc/src/diagramscene.qdoc @@ -50,7 +50,7 @@ In this example we show how to create such custom graphics scenes and items by implementing classes that inherit - QGraphicsScene and QGraphicsItem. + QGraphicsScene and QGraphicsItem. In particular we show how to: @@ -65,21 +65,21 @@ The example consists of the following classes: \list \li \c MainWindow creates the widgets and display - them in a QMainWindow. It also manages the interaction - between the widgets and the graphics scene, view and - items. + them in a QMainWindow. It also manages the interaction + between the widgets and the graphics scene, view and + items. \li \c DiagramItem inherits QGraphicsPolygonItem and - represents a flowchart shape. + represents a flowchart shape. \li \c TextDiagramItem inherits QGraphicsTextItem and - represents text items in the diagram. The class adds - support for moving the item with the mouse, which is not - supported by QGraphicsTextItem. + represents text items in the diagram. The class adds + support for moving the item with the mouse, which is not + supported by QGraphicsTextItem. \li \c Arrow inherits QGraphicsLineItem and is an arrow - that connect two DiagramItems. + that connect two DiagramItems. \li \c DiagramScene inherits QGraphicsDiagramScene and - provides support for \c DiagramItem, \c Arrow and - \c DiagramTextItem (In addition to the support already - handled by QGraphicsScene). + provides support for \c DiagramItem, \c Arrow and + \c DiagramTextItem (In addition to the support already + handled by QGraphicsScene). \endlist \section1 MainWindow Class Definition @@ -88,7 +88,7 @@ The \c MainWindow class creates and lays out the widgets in a QMainWindow. The class forwards input from the widgets to the - DiagramScene. It also updates its widgets when the diagram + DiagramScene. It also updates its widgets when the diagram scene's text item changes, or a diagram item or a diagram text item is inserted into the scene. @@ -104,8 +104,8 @@ \snippet graphicsview/diagramscene/mainwindow.cpp 0 In the constructor we call methods to create the widgets and - layouts of the example before we create the diagram scene. - The toolbars must be created after the scene as they connect + layouts of the example before we create the diagram scene. + The toolbars must be created after the scene as they connect to its signals. We then lay the widgets out in the window. We connect to the \c itemInserted() and \c textInserted() slots of @@ -115,20 +115,20 @@ update the widgets that display font properties if the item selected is a \c DiagramTextItem. - The \c createToolBox() function creates and lays out the widgets + The \c createToolBox() function creates and lays out the widgets of the \c toolBox QToolBox. We will not examine it with a - high level of detail as it does not deal with graphics framework + high level of detail as it does not deal with graphics framework specific functionality. Here is its implementation: \snippet graphicsview/diagramscene/mainwindow.cpp 21 - + This part of the function sets up the tabbed widget item that - contains the flowchart shapes. An exclusive QButtonGroup always + contains the flowchart shapes. An exclusive QButtonGroup always keeps one button checked; we want the group to allow all buttons to be unchecked. We still use a button group since we can associate user - data, which we use to store the diagram type, with each button. - The \c createCellWidget() function sets up the buttons in the + data, which we use to store the diagram type, with each button. + The \c createCellWidget() function sets up the buttons in the tabbed widget item and is examined later. The buttons of the background tabbed widget item is set up in the @@ -137,7 +137,7 @@ \snippet graphicsview/diagramscene/mainwindow.cpp 22 We set the preferred size of the toolbox as its maximum. This - way, more space is given to the graphics view. + way, more space is given to the graphics view. Here is the \c createActions() function: @@ -202,7 +202,7 @@ with this function is used in the tool box. Here is the \c createColorMenu() function: - + \snippet graphicsview/diagramscene/mainwindow.cpp 30 This function creates a color menu that is used as the @@ -224,7 +224,7 @@ \snippet graphicsview/diagramscene/mainwindow.cpp 32 - This function creates an icon with a filled rectangle in the + This function creates an icon with a filled rectangle in the color of \a color. It is used for creating icons for the color menus in the \c fillColorToolButton, \c fontColorToolButton, and \c lineColorToolButton. @@ -240,8 +240,8 @@ with. When one of the buttons in the background tabbed widget item is - clicked we change the brush; we find out which button it is by - checking its text. + clicked we change the brush; we find out which button it is by + checking its text. Here is the implementation of \c buttonGroupClicked(): @@ -255,37 +255,37 @@ checked at a time. \c QButtonGroup assigns an id to each button. We have set the id - of each button to the diagram type, as given by DiagramItem::DiagramType - that will be inserted into the scene when it is clicked. We can - then use the button id when we set the diagram type with + of each button to the diagram type, as given by DiagramItem::DiagramType + that will be inserted into the scene when it is clicked. We can + then use the button id when we set the diagram type with \c setItemType(). In the case of text we assigned an id that has a value that is not in the DiagramType enum. - + Here is the implementation of \c deleteItem(): - + \snippet graphicsview/diagramscene/mainwindow.cpp 3 - + This slot deletes the selected item, if any, from the scene. It deletes the arrows first in order to avoid to delete them twice. If the item to be deleted is a \c DiagramItem, we also need to delete arrows connected to it; we don't want arrows in the scene that aren't connected to items in both ends. - + This is the implementation of pointerGroupClicked(): - + \snippet graphicsview/diagramscene/mainwindow.cpp 4 - + The \c pointerTypeGroup decides whether the scene is in ItemMove - or InsertLine mode. This button group is exclusive, i.e., only + or InsertLine mode. This button group is exclusive, i.e., only one button is checked at any time. As with the \c buttonGroup above we have assigned an id to the buttons that matches values of the DiagramScene::Mode enum, so that we can use the id to set the correct mode. - + Here is the \c bringToFront() slot: - + \snippet graphicsview/diagramscene/mainwindow.cpp 5 - + Several items may collide, i.e., overlap, with each other in the scene. This slot is called when the user requests that an item should be placed on top of the items it collides with. @@ -296,169 +296,169 @@ lower values. When we bring an item to the front we can loop through the items it collides with and set a z-value that is higher than all of them. - + Here is the \c sendToBack() slot: - + \snippet graphicsview/diagramscene/mainwindow.cpp 6 - + This slot works in the same way as \c bringToFront() described above, but sets a z-value that is lower than items the item that should be send to the back collides with. - + This is the implementation of \c itemInserted(): - + \snippet graphicsview/diagramscene/mainwindow.cpp 7 - + This slot is called from the \c DiagramScene when an item has been added to the scene. We set the mode of the scene back to the mode before the item was inserted, which is ItemMove or InsertText - depending on which button is checked in the \c pointerTypeGroup. + depending on which button is checked in the \c pointerTypeGroup. We must also uncheck the button in the in the \c buttonGroup. - + Here is the implementation of \c textInserted(): - + \snippet graphicsview/diagramscene/mainwindow.cpp 8 - + We simply set the mode of the scene back to the mode it had before the text was inserted. - + Here is the \c currentFontChanged() slot: - + \snippet graphicsview/diagramscene/mainwindow.cpp 9 - + When the user requests a font change, by using one of the widgets in the \c fontToolBar, we create a new QFont object and set its properties to match the state of the widgets. This is done in \c handleFontChange(), so we simply call that slot. - + Here is the \c fontSizeChanged() slot: - + \snippet graphicsview/diagramscene/mainwindow.cpp 10 - + When the user requests a font change, by using one of the widgets in the \c fontToolBar, we create a new QFont object and set its properties to match the state of the widgets. This is done in \c handleFontChange(), so we simply call that slot. - + Here is the implementation of \c sceneScaleChanged(): - + \snippet graphicsview/diagramscene/mainwindow.cpp 11 - + The user can increase or decrease the scale, with the \c sceneScaleCombo, the scene is drawn in. It is not the scene itself that changes its scale, but only the - view. - + view. + Here is the \c textColorChanged() slot: - + \snippet graphicsview/diagramscene/mainwindow.cpp 12 - + This slot is called when an item in the drop-down menu of the \c - fontColorToolButton is pressed. We need to change the icon on + fontColorToolButton is pressed. We need to change the icon on the button to the color of the selected QAction. We keep a pointer to the selected action in \c textAction. It is in \c textButtonTriggered() we change the text color to the color of \c textAction, so we call that slot. - + Here is the \c itemColorChanged() implementation: - + \snippet graphicsview/diagramscene/mainwindow.cpp 13 - + This slot handles requests for changing the color of \c DiagramItems in the same manner as \c textColorChanged() does for \c DiagramTextItems. - + Here is the implementation of \c lineColorChanged(): - + \snippet graphicsview/diagramscene/mainwindow.cpp 14 - + This slot handles requests for changing the color of \c Arrows in the same manner that \c textColorChanged() does it for \c DiagramTextItems. - + Here is the \c textButtonTriggered() slot: - + \snippet graphicsview/diagramscene/mainwindow.cpp 15 - + \c textAction points to the QAction of the currently selected menu item in the \c fontColorToolButton's color drop-down menu. We have set the data of the action to the QColor the action represents, so we can simply fetch this when we set the color of text with \c setTextColor(). - + Here is the \c fillButtonTriggered() slot: - + \snippet graphicsview/diagramscene/mainwindow.cpp 16 - + \c fillAction points to the selected menu item in the drop-down menu of \c fillColorToolButton(). We can therefore use the data of this action when we set the item color with \c setItemColor(). - + Here is the \c lineButtonTriggered() slot: - + \snippet graphicsview/diagramscene/mainwindow.cpp 17 - + \c lineAction point to the selected item in the drop-down menu of - \c lineColorToolButton. We use its data when we set the arrow + \c lineColorToolButton. We use its data when we set the arrow color with \c setLineColor(). - + Here is the \c handleFontChange() function: - + \snippet graphicsview/diagramscene/mainwindow.cpp 18 - + \c handleFontChange() is called when any of the widgets that show font properties changes. We create a new QFont object and set its properties based on the widgets. We then call the \c setFont() function of \c DiagramScene; it is the scene that set the font of the \c DiagramTextItems it manages. - + Here is the \c itemSelected() slot: - + \snippet graphicsview/diagramscene/mainwindow.cpp 19 - + This slot is called when an item in the \c DiagramScene is selected. In the case of this example it is only text items that emit signals when they are selected, so we do not need to check what kind of graphics \a item is. - + We set the state of the widgets to match the properties of the font of the selected text item. - + This is the \c about() slot: - + \snippet graphicsview/diagramscene/mainwindow.cpp 20 - + This slot displays an about box for the example when the user selects the about menu item from the help menu. - + \section1 DiagramScene Class Definition - + The \c DiagramScene class inherits QGraphicsScene and adds functionality to handle \c DiagramItems, \c Arrows, and \c DiagramTextItems in addition to the items handled by its super class. - - + + \snippet graphicsview/diagramscene/diagramscene.h 0 - + In the \c DiagramScene a mouse click can give three different actions: the item under the mouse can be moved, an item may be inserted, or an arrow may be connected between to diagram items. Which action a mouse click has depends on the mode, given by the Mode enum, the scene is in. The mode is set with the \c setMode() function. - + The scene also sets the color of its items and the font of its text items. The colors and font used by the scene can be set with the \c setLineColor(), \c setTextColor(), \c setItemColor() and \c setFont() functions. The type of \c DiagramItem, given by the DiagramItem::DiagramType function, to be created when an item is inserted is set with the \c setItemType() slot. - + The \c MainWindow and \c DiagramScene share responsibility for the examples functionality. \c MainWindow handles the following tasks: the deletion of items, text, and arrows; moving diagram - items to the back and front; and setting the scale of the scene. + items to the back and front; and setting the scale of the scene. \section1 DiagramScene Class Implementation @@ -492,12 +492,12 @@ \snippet graphicsview/diagramscene/diagramscene.cpp 3 - This function sets the color the scene will use when creating + This function sets the color the scene will use when creating \c DiagramItems. It also changes the color of a selected \c DiagramItem. This is the implementation of \c setFont(): - + \snippet graphicsview/diagramscene/diagramscene.cpp 4 Set the font to use for new and selected, if a text item is @@ -511,15 +511,15 @@ connected to this slot. We remove the item if it has no text. If not, we would leak memory and confuse the user as the items will be edited when pressed on by the mouse. - + The \c mousePressEvent() function handles mouse press event's different depending on which mode the \c DiagramScene is in. We examine its implementation for each mode: - + \snippet graphicsview/diagramscene/diagramscene.cpp 6 We simply create a new \c DiagramItem and add it to the scene at - the position the mouse was pressed. Note that the origin of its + the position the mouse was pressed. Note that the origin of its local coordinate system will be under the mouse pointer position. \snippet graphicsview/diagramscene/diagramscene.cpp 7 @@ -534,7 +534,7 @@ line. \snippet graphicsview/diagramscene/diagramscene.cpp 8 - + The \c DiagramTextItem is editable when the Qt::TextEditorInteraction flag is set, else it is movable by the mouse. We always want the text to be drawn on top of the other @@ -547,12 +547,12 @@ can then call the QGraphicsScene implementation, which handles movement of items with the mouse. We make this call even if we are in another mode making it possible to add an item and - then keep the mouse button pressed down and start moving + then keep the mouse button pressed down and start moving the item. In the case of text items, this is not possible as they do not propagate mouse events when they are editable. This is the \c mouseMoveEvent() function: - + \snippet graphicsview/diagramscene/diagramscene.cpp 10 We must draw the line if we are in InsertMode and the mouse button @@ -567,7 +567,7 @@ should be added to the scene: \snippet graphicsview/diagramscene/diagramscene.cpp 11 - + First we need to get the items (if any) under the line's start and end points. The line itself is the first item at these points, so we remove it from the lists. As a precaution, we check if the @@ -603,7 +603,7 @@ DiagramScene. It inherits QGraphicsPolygonItem and has a polygon for each shape. The enum DiagramType has a value for each of the flowchart shapes. - + The class has a list of the arrows that are connected to it. This is necessary because only the item knows when it is being moved (with the \c itemChanged() function) at which time the @@ -612,7 +612,7 @@ buttons in \c MainWindow, see \c createColorToolButtonIcon() in \c MainWindow. - The Type enum is a unique identifier of the class. It is used by + The Type enum is a unique identifier of the class. It is used by \c qgraphicsitem_cast(), which does dynamic casts of graphics items. The UserType constant is the minimum value a custom graphics item type can be. @@ -646,7 +646,7 @@ item. Here is the \c addArrow() function: - + \snippet graphicsview/diagramscene/diagramitem.cpp 3 This function simply adds the \a arrow to the items \c arrows list. @@ -695,7 +695,7 @@ possible to alter the mouse behavior of QGraphicsTextItem. \section1 DiagramTextItem Implementation - + We start with the constructor: \snippet graphicsview/diagramscene/diagramtextitem.cpp 0 @@ -717,7 +717,7 @@ \c DiagramScene uses the signal emitted when the text item looses focus to remove the item if it is empty, i.e., it contains no - text. + text. This is the implementation of \c mouseDoubleClickEvent(): @@ -740,7 +740,7 @@ The item's color can be set with \c setColor(). - \c boundingRect() and \c shape() are reimplemented + \c boundingRect() and \c shape() are reimplemented from QGraphicsLineItem and are used by the scene to check for collisions and selections. @@ -769,7 +769,7 @@ We need to reimplement this function because the arrow is larger than the bounding rectangle of the QGraphicsLineItem. The graphics scene uses the bounding rectangle to know which regions - of the scene to update. + of the scene to update. Here is the \c shape() function: @@ -779,14 +779,14 @@ shape of the item. The QGraphicsLineItem::shape() returns a path with a line drawn with the current pen, so we only need to add the arrow head. This function is used to check for collisions and - selections with the mouse. + selections with the mouse. Here is the \c updatePosition() slot: \snippet graphicsview/diagramscene/arrow.cpp 3 This slot updates the arrow by setting the start and end - points of its line to the center of the items it connects. + points of its line to the center of the items it connects. Here is the \c paint() function: @@ -809,7 +809,7 @@ one of the lines of the polygon. Note that the points in the polygon are relative to the local coordinate system of the item. We must therefore add the position of the end item to make the - coordinates relative to the scene. + coordinates relative to the scene. \snippet graphicsview/diagramscene/arrow.cpp 6 diff --git a/examples/widgets/doc/src/dockwidgets.qdoc b/examples/widgets/doc/src/dockwidgets.qdoc index 7f08572a30..2987ec1211 100644 --- a/examples/widgets/doc/src/dockwidgets.qdoc +++ b/examples/widgets/doc/src/dockwidgets.qdoc @@ -133,7 +133,7 @@ that the entire name and address insertion is treated as a single operation by the QTextEdit, so a single undo will revert all the insertions. - + \snippet mainwindows/dockwidgets/mainwindow.cpp 7 This function works in a similar way to \c insertCustomer(). First @@ -141,7 +141,7 @@ replace it with the standard paragraph that the user clicked. Again we use a \c beginEditBlock() ... \c endEditBlock() pair so that the insertion can be undone as a single operation. - + \snippet mainwindows/dockwidgets/mainwindow.cpp 3 Qt's QTextDocument class makes printing documents easy. We simply diff --git a/examples/widgets/doc/src/easing.qdoc b/examples/widgets/doc/src/easing.qdoc index 392cb4e826..1b5f0c8077 100644 --- a/examples/widgets/doc/src/easing.qdoc +++ b/examples/widgets/doc/src/easing.qdoc @@ -31,7 +31,7 @@ \brief The Easing Curves example shows how to use easing curves to control the speed of an animation. - + \image easing-example.png */ diff --git a/examples/widgets/doc/src/echoplugin.qdoc b/examples/widgets/doc/src/echoplugin.qdoc index eae5269d62..7b7aa9b868 100644 --- a/examples/widgets/doc/src/echoplugin.qdoc +++ b/examples/widgets/doc/src/echoplugin.qdoc @@ -46,7 +46,7 @@ System}{meta-object system}. The plugin \l{How to Create Qt Plugins}{overview document} gives a high-level introduction to plugins. - + We have implemented a plugin, the \c EchoPlugin, which implements the \c EchoInterface. The interface consists of \c echo(), which takes a QString as argument. The \c EchoPlugin returns the string @@ -68,8 +68,8 @@ \snippet tools/echoplugin/echowindow/echowindow.h 0 We load the plugin in \c loadPlugin() and cast it to \c - EchoInterface. When the user clicks the \c button we take the - text in \c lineEdit and call the interface's \c echo() with it. + EchoInterface. When the user clicks the \c button we take the + text in \c lineEdit and call the interface's \c echo() with it. \section1 EchoWindow Class Implementation @@ -136,15 +136,15 @@ System}{Qt's meta object system} aware of the interface. We do this so that it will be possible to identify plugins that implements the interface at run-time. The second argument is a - string that must identify the interface in a unique way. + string that must identify the interface in a unique way. \section1 EchoPlugin Class Definition We inherit both QObject and \c EchoInterface to make this class a plugin. The Q_INTERFACES macro tells Qt which interfaces the class - implements. In our case we only implement the \c EchoInterface. - If a class implements more than one interface, they are given as + implements. In our case we only implement the \c EchoInterface. + If a class implements more than one interface, they are given as a comma separated list. The Q_PLUGIN_METADATA macro is included next to the Q_OBJECT macro. It contains the plugins IID and a filename pointing to a json file containing the metadata for the plugin. @@ -158,7 +158,7 @@ \snippet tools/echoplugin/plugin/echoplugin.cpp 0 - We simply return the functions parameter. + We simply return the functions parameter. \section1 The \c main() function @@ -169,7 +169,7 @@ \section1 The Profiles When creating plugins the profiles need to be adjusted. - We show here what changes need to be done. + We show here what changes need to be done. The profile in the echoplugin directory uses the \c subdirs template and simply includes includes to directories in which @@ -196,7 +196,7 @@ You can find an overview of the macros needed to create plugins \l{Macros for Defining Plugins}{here}. - + We give an example of a plugin that extend Qt in the \l{Style Plugin Example}{style plugin} example. The \l{Plug & Paint Example}{plug and paint} example shows how to create static diff --git a/examples/widgets/doc/src/fetchmore.qdoc b/examples/widgets/doc/src/fetchmore.qdoc index 2f32a5d43d..1b1e87e06b 100644 --- a/examples/widgets/doc/src/fetchmore.qdoc +++ b/examples/widgets/doc/src/fetchmore.qdoc @@ -62,7 +62,7 @@ \l{QAbstractItemModel::}{fetchMore()} and \l{QAbstractItemModel::}{canFetchMore()} from QAbstractItemModel. These functions are called by the item view when it needs more - items. + items. The \c setDirPath() function sets the directory the model will work on. We emit \c numberPopulated() each time we add a batch of diff --git a/examples/widgets/doc/src/flowlayout.qdoc b/examples/widgets/doc/src/flowlayout.qdoc index f7f5496d07..b482edf946 100644 --- a/examples/widgets/doc/src/flowlayout.qdoc +++ b/examples/widgets/doc/src/flowlayout.qdoc @@ -35,27 +35,27 @@ \image flowlayout-example.png Screenshot of the Flow Layout example The items are first laid out horizontally and then vertically when each line - in the layout runs out of space. + in the layout runs out of space. - The Flowlayout class mainly uses QLayout and QWidgetItem, while the - Window uses QWidget and QLabel. We will only document the definition - and implementation of \c FlowLayout below. + The Flowlayout class mainly uses QLayout and QWidgetItem, while the + Window uses QWidget and QLabel. We will only document the definition + and implementation of \c FlowLayout below. \section1 FlowLayout Class Definition - - The \c FlowLayout class inherits QLayout. It is a custom layout class - that arranges its child widgets horizontally and vertically. + + The \c FlowLayout class inherits QLayout. It is a custom layout class + that arranges its child widgets horizontally and vertically. \snippet layouts/flowlayout/flowlayout.h 0 We reimplement functions inherited from QLayout. These functions add items to - the layout and handle their orientation and geometry. - + the layout and handle their orientation and geometry. + We also declare two private methods, \c doLayout() and \c smartSpacing(). \c doLayout() lays out the layout items, while the \c smartSpacing() function calculates the spacing between them. - \section1 FlowLayout Class Implementation + \section1 FlowLayout Class Implementation We start off by looking at the constructor: @@ -63,32 +63,32 @@ In the constructor we call \c setContentsMargins() to set the left, top, right and bottom margin. By default, QLayout uses values provided by - the current style (see QStyle::PixelMetric). + the current style (see QStyle::PixelMetric). \snippet layouts/flowlayout/flowlayout.cpp 2 - In this example we reimplement \c addItem(), which is a pure virtual - function. When using \c addItem() the ownership of the layout items is - transferred to the layout, and it is therefore the layout's - responsibility to delete them. - + In this example we reimplement \c addItem(), which is a pure virtual + function. When using \c addItem() the ownership of the layout items is + transferred to the layout, and it is therefore the layout's + responsibility to delete them. + \snippet layouts/flowlayout/flowlayout.cpp 3 - - \c addItem() is implemented to add items to the layout. + + \c addItem() is implemented to add items to the layout. \snippet layouts/flowlayout/flowlayout.cpp 4 We implement \c horizontalSpacing() and \c verticalSpacing() to get - hold of the spacing between the widgets inside the layout. If the value - is less than or equal to 0, this value will be used. If not, + hold of the spacing between the widgets inside the layout. If the value + is less than or equal to 0, this value will be used. If not, \c smartSpacing() will be called to calculate the spacing. \snippet layouts/flowlayout/flowlayout.cpp 5 - - We then implement \c count() to return the number of items in the - layout. To navigate the list of items we use \c itemAt() and - takeAt() to remove and return items from the list. If an item is - removed, the remaining items will be renumbered. All three + + We then implement \c count() to return the number of items in the + layout. To navigate the list of items we use \c itemAt() and + takeAt() to remove and return items from the list. If an item is + removed, the remaining items will be renumbered. All three functions are pure virtual functions from QLayout. \snippet layouts/flowlayout/flowlayout.cpp 6 @@ -103,7 +103,7 @@ dependency, and \c heightForWidth() passes the width on to \c doLayout() which in turn uses the width as an argument for the layout rect, i.e., the bounds in which the items are laid out. This rect does not include the layout margin(). - + \snippet layouts/flowlayout/flowlayout.cpp 8 \c setGeometry() is normally used to do the actual layout, i.e., calculate @@ -116,30 +116,30 @@ \snippet layouts/flowlayout/flowlayout.cpp 9 \c doLayout() handles the layout if \c horizontalSpacing() or \c - verticalSpacing() don't return the default value. It uses - \c getContentsMargins() to calculate the area available to the - layout items. - + verticalSpacing() don't return the default value. It uses + \c getContentsMargins() to calculate the area available to the + layout items. + \snippet layouts/flowlayout/flowlayout.cpp 10 - It then sets the proper amount of spacing for each widget in the - layout, based on the current style. - + It then sets the proper amount of spacing for each widget in the + layout, based on the current style. + \snippet layouts/flowlayout/flowlayout.cpp 11 - The position of each item in the layout is then calculated by - adding the items width and the line height to the initial x and y - coordinates. This in turn lets us find out whether the next item - will fit on the current line or if it must be moved down to the next. - We also find the height of the current line based on the widgets height. - + The position of each item in the layout is then calculated by + adding the items width and the line height to the initial x and y + coordinates. This in turn lets us find out whether the next item + will fit on the current line or if it must be moved down to the next. + We also find the height of the current line based on the widgets height. + \snippet layouts/flowlayout/flowlayout.cpp 12 - \c smartSpacing() is designed to get the default spacing for either - the top-level layouts or the sublayouts. The default spacing for - top-level layouts, when the parent is a QWidget, will be determined - by querying the style. The default spacing for sublayouts, when - the parent is a QLayout, will be determined by querying the spacing - of the parent layout. + \c smartSpacing() is designed to get the default spacing for either + the top-level layouts or the sublayouts. The default spacing for + top-level layouts, when the parent is a QWidget, will be determined + by querying the style. The default spacing for sublayouts, when + the parent is a QLayout, will be determined by querying the spacing + of the parent layout. */ diff --git a/examples/widgets/doc/src/fontsampler.qdoc b/examples/widgets/doc/src/fontsampler.qdoc index b833390def..8a2678e2f8 100644 --- a/examples/widgets/doc/src/fontsampler.qdoc +++ b/examples/widgets/doc/src/fontsampler.qdoc @@ -30,7 +30,7 @@ \title Font Sampler Example \ingroup examples-painting \brief The Font Sampler example shows how to preview and print multi-page documents. - + The Font Sampler example shows how to preview and print multi-page documents. \image fontsampler-example.png diff --git a/examples/widgets/doc/src/fridgemagnets.qdoc b/examples/widgets/doc/src/fridgemagnets.qdoc index 5db2cd586c..abaeb2c52a 100644 --- a/examples/widgets/doc/src/fridgemagnets.qdoc +++ b/examples/widgets/doc/src/fridgemagnets.qdoc @@ -230,7 +230,7 @@ top-level corner of the drag pixmap, to be the point we calculated above. This makes the process of dragging the label feel more natural because the cursor always points to the same place on the label - during the drag operation. + during the drag operation. We start the drag operation using QDrag's \l{QDrag::}{exec()} function, requesting that the magnet is copied when the drag is completed. diff --git a/examples/widgets/doc/src/mdi.qdoc b/examples/widgets/doc/src/mdi.qdoc index b35975d50c..c3f74f7a9f 100644 --- a/examples/widgets/doc/src/mdi.qdoc +++ b/examples/widgets/doc/src/mdi.qdoc @@ -25,7 +25,7 @@ ** ****************************************************************************/ -/*! +/*! \example mainwindows/mdi \title MDI Example \ingroup examples-mainwindow diff --git a/examples/widgets/doc/src/moveblocks.qdoc b/examples/widgets/doc/src/moveblocks.qdoc index c9eecc9769..b41b16519d 100644 --- a/examples/widgets/doc/src/moveblocks.qdoc +++ b/examples/widgets/doc/src/moveblocks.qdoc @@ -43,7 +43,7 @@ \li \c StateSwitcher inherits QState and can add \c {StateSwitchTransition}s to other states. When entered, it will randomly transition to one of these - states. + states. \li \c StateSwitchTransition is a custom transition that triggers on \c{StateSwitchEvent}s. \li \c StateSwitchEvent is a QEvent that triggers \c{StateSwitchTransition}s. @@ -152,7 +152,7 @@ \c StateSwitcher is a state designed for a particular purpose and will always be a top-level state. We use \c m_stateCount to keep track of how many states we are managing, and \c m_lastIndex to - remember which state was the last state to which we transitioned. + remember which state was the last state to which we transitioned. \snippet animation/moveblocks/main.cpp 11 diff --git a/examples/widgets/doc/src/pixelator.qdoc b/examples/widgets/doc/src/pixelator.qdoc index 1e9af00361..c8b04bb4bc 100644 --- a/examples/widgets/doc/src/pixelator.qdoc +++ b/examples/widgets/doc/src/pixelator.qdoc @@ -216,7 +216,7 @@ This enables the items to be drawn without any gaps between them. Removing the headers also prevents the user from adjusting the sizes of individual - rows and columns. + rows and columns. We also set the minimum section size to 1 on the headers. If we didn't, the headers would default to a larger size, preventing diff --git a/examples/widgets/doc/src/recentfiles.qdoc b/examples/widgets/doc/src/recentfiles.qdoc index 939ef8b939..58f28b2832 100644 --- a/examples/widgets/doc/src/recentfiles.qdoc +++ b/examples/widgets/doc/src/recentfiles.qdoc @@ -25,7 +25,7 @@ ** ****************************************************************************/ -/*! +/*! \example mainwindows/recentfiles \title Recent Files Example \ingroup examples-mainwindow diff --git a/examples/widgets/doc/src/regexp.qdoc b/examples/widgets/doc/src/regexp.qdoc index 9dc3878c10..0523204fce 100644 --- a/examples/widgets/doc/src/regexp.qdoc +++ b/examples/widgets/doc/src/regexp.qdoc @@ -25,7 +25,7 @@ ** ****************************************************************************/ -/*! +/*! \example tools/regexp \title Regular Expressions Example \ingroup examples-widgets-tools diff --git a/examples/widgets/doc/src/rogue.qdoc b/examples/widgets/doc/src/rogue.qdoc index 81f34edc68..1690a351fb 100644 --- a/examples/widgets/doc/src/rogue.qdoc +++ b/examples/widgets/doc/src/rogue.qdoc @@ -151,7 +151,7 @@ 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 @@ -161,7 +161,7 @@ The transition from \c inputState allows triggering the quit state when the player types \c {q}. - + \snippet statemachine/rogue/window.cpp 5 The machine is set up, so it's time to start it. diff --git a/examples/widgets/doc/src/sdi.qdoc b/examples/widgets/doc/src/sdi.qdoc index 3e703a0ba8..3e8780423a 100644 --- a/examples/widgets/doc/src/sdi.qdoc +++ b/examples/widgets/doc/src/sdi.qdoc @@ -25,7 +25,7 @@ ** ****************************************************************************/ -/*! +/*! \example mainwindows/sdi \title SDI Example \ingroup examples-mainwindow diff --git a/examples/widgets/doc/src/settingseditor.qdoc b/examples/widgets/doc/src/settingseditor.qdoc index b53b0389cc..f1e84b7eb6 100644 --- a/examples/widgets/doc/src/settingseditor.qdoc +++ b/examples/widgets/doc/src/settingseditor.qdoc @@ -25,7 +25,7 @@ ** ****************************************************************************/ -/*! +/*! \example tools/settingseditor \title Settings Editor Example \ingroup examples-widgets-tools diff --git a/examples/widgets/doc/src/simplewidgetmapper.qdoc b/examples/widgets/doc/src/simplewidgetmapper.qdoc index 0b92c3a4b4..771ac982b5 100644 --- a/examples/widgets/doc/src/simplewidgetmapper.qdoc +++ b/examples/widgets/doc/src/simplewidgetmapper.qdoc @@ -61,7 +61,7 @@ The constructor of the \c Window class can be explained in three parts. In the first part, we set up the widgets used for the user interface: - + \snippet itemviews/simplewidgetmapper/window.cpp Set up widgets We also set up the buddy relationships between various labels and the diff --git a/examples/widgets/doc/src/spinboxes.qdoc b/examples/widgets/doc/src/spinboxes.qdoc index 86cc246419..998a6d2636 100644 --- a/examples/widgets/doc/src/spinboxes.qdoc +++ b/examples/widgets/doc/src/spinboxes.qdoc @@ -25,7 +25,7 @@ ** ****************************************************************************/ -/*! +/*! \example widgets/spinboxes \title Spin Boxes Example \ingroup examples-widgets diff --git a/examples/widgets/doc/src/standarddialogs.qdoc b/examples/widgets/doc/src/standarddialogs.qdoc index 57c3281ae8..26c2548611 100644 --- a/examples/widgets/doc/src/standarddialogs.qdoc +++ b/examples/widgets/doc/src/standarddialogs.qdoc @@ -25,7 +25,7 @@ ** ****************************************************************************/ -/*! +/*! \example dialogs/standarddialogs \title Standard Dialogs Example \ingroup examples-dialogs diff --git a/examples/widgets/doc/src/stardelegate.qdoc b/examples/widgets/doc/src/stardelegate.qdoc index dae7ac9c80..4ee452d866 100644 --- a/examples/widgets/doc/src/stardelegate.qdoc +++ b/examples/widgets/doc/src/stardelegate.qdoc @@ -257,7 +257,7 @@ \l{QAbstractItemView::editTriggers()}{edit triggers}, so that the editor is opened with a single click when the star rating item is selected. - + The \c populateTableWidget() function fills the QTableWidget with data: diff --git a/examples/widgets/doc/src/styleplugin.qdoc b/examples/widgets/doc/src/styleplugin.qdoc index 51d1e5e73e..e65ded36a4 100644 --- a/examples/widgets/doc/src/styleplugin.qdoc +++ b/examples/widgets/doc/src/styleplugin.qdoc @@ -43,7 +43,7 @@ from that class, and adding a macro. In this example we extend Qt by adding a new GUI look and feel (i.e., making a new QStyle available). A high-level introduction to plugins is given in the - plugin \l{How to Create Qt Plugins}{overview document}. + plugin \l{How to Create Qt Plugins}{overview document}. Plugins that provide new styles inherit the QStylePlugin base class. Style plugins are loaded by Qt and made available through @@ -72,7 +72,7 @@ \section1 SimpleStylePlugin Class Definition \c SimpleStylePlugin inherits QStylePlugin and is the plugin - class. + class. \snippet tools/styleplugin/plugin/simplestyleplugin.h 0 diff --git a/examples/widgets/doc/src/stylesheet.qdoc b/examples/widgets/doc/src/stylesheet.qdoc index 79d9b35082..ee08b7b88a 100644 --- a/examples/widgets/doc/src/stylesheet.qdoc +++ b/examples/widgets/doc/src/stylesheet.qdoc @@ -30,7 +30,7 @@ \title Style Sheet Example \ingroup examples-widgets \brief The Style Sheet Example shows how to use style sheets. - + \image stylesheet-pagefold.png Screen Shot of the Pagefold style sheet */ diff --git a/examples/widgets/doc/src/sub-attaq.qdoc b/examples/widgets/doc/src/sub-attaq.qdoc index 1472412855..3b0070b28a 100644 --- a/examples/widgets/doc/src/sub-attaq.qdoc +++ b/examples/widgets/doc/src/sub-attaq.qdoc @@ -31,7 +31,7 @@ \brief This example shows Qt's ability to combine \l{The Animation Framework}{the animation framework} and \l{The State Machine Framework}{the state machine framework} to create a game. - + \image sub-attaq-demo.png The purpose of the game is to destroy all submarines to win the current level. diff --git a/examples/widgets/doc/src/tablet.qdoc b/examples/widgets/doc/src/tablet.qdoc index 6cb9ef5057..4fa67b85d3 100644 --- a/examples/widgets/doc/src/tablet.qdoc +++ b/examples/widgets/doc/src/tablet.qdoc @@ -41,7 +41,7 @@ it is close but not pressed down on it), when a device is pushed down and released from it, and when a device is moved on the tablet. - + The information available in QTabletEvent depends on the device used. The tablet in this example has two different devices for drawing: a stylus and an airbrush. For both devices the event @@ -61,23 +61,23 @@ The example consists of the following: \list - \li The \c MainWindow class inherits QMainWindow and creates - the examples menus and connect their slots and signals. + \li The \c MainWindow class inherits QMainWindow and creates + the examples menus and connect their slots and signals. \li The \c TabletCanvas class inherits QWidget and - receives tablet events. It uses the events to paint on a - offscreen pixmap, which it draws onto itself. + receives tablet events. It uses the events to paint on a + offscreen pixmap, which it draws onto itself. \li The \c TabletApplication class inherits QApplication. This - class handles tablet events that are not sent to \c tabletEvent(). - We will look at this later. + class handles tablet events that are not sent to \c tabletEvent(). + We will look at this later. \li The \c main() function creates a \c MainWindow and shows it - as a top level window. + as a top level window. \endlist \section1 MainWindow Class Definition - The \c MainWindow creates a \c TabletCanvas and sets it as its - center widget. + The \c MainWindow creates a \c TabletCanvas and sets it as its + center widget. \snippet widgets/tablet/mainwindow.h 0 @@ -115,10 +115,10 @@ \snippet widgets/tablet/mainwindow.cpp 2 - The \c TabletCanvas class supports two ways by which the alpha + The \c TabletCanvas class supports two ways by which the alpha channel of the drawing color can be changed: tablet pressure and tilt. We have one action for each and an action if the alpha - channel should not be changed. + channel should not be changed. Here is the implementation of \c lineWidthActionTriggered(): @@ -155,12 +155,12 @@ \snippet widgets/tablet/mainwindow.cpp 7 - We show a message box with a short description of the example. + We show a message box with a short description of the example. \c createActions() creates all actions and action groups of the example. We look at the creation of one action group and its actions. See the \l{Application Example}{application example} if - you want a high-level introduction to QActions. + you want a high-level introduction to QActions. Here is the implementation of \c createActions: @@ -189,7 +189,7 @@ \section1 TabletCanvas Class Definition The \c TabletCanvas class provides a surface on which the - user can draw with a tablet. + user can draw with a tablet. \snippet widgets/tablet/tabletcanvas.h 0 @@ -198,7 +198,7 @@ these; their values decide if it is the tablet pressure or tilt that will alter them. We keep a private variable for each, the \c alphaChannelType, \c colorSturationType, and \c penWidthType, - which we provide access functions for. + which we provide access functions for. We draw on a QPixmap with \c myPen and \c myBrush using \c myColor. The \c saveImage() and \c loadImage() saves and loads @@ -291,7 +291,7 @@ -60, 127 equals 0, and 255 equals 60 degrees. The angle measured is between the device and the perpendicular of the tablet (see QTabletEvent for an illustration). - + \snippet widgets/tablet/tabletcanvas.cpp 8 The alpha channel of QColor is given as a number between 0 @@ -301,8 +301,8 @@ taking the absolute value we get the smallest alpha values (i.e., the color is most transparent) when the pen is perpendicular to the tablet. We select the largest of the vertical and horizontal - tilt value. - + tilt value. + \snippet widgets/tablet/tabletcanvas.cpp 9 The colorsaturation is given as a number between 0 and 255. It is @@ -317,7 +317,7 @@ the angle between the device and the perpendicular of the tablet. \snippet widgets/tablet/tabletcanvas.cpp 11 - + We finally check whether the pointer is the stylus or the eraser. If it is the eraser, we set the color to the background color of the pixmap an let the pressure decide the pen width, else we set @@ -327,7 +327,7 @@ \section1 TabletApplication Class Definition We inherit QApplication in this class because we want to - reimplement the \l{QApplication::}{event()} function. + reimplement the \l{QApplication::}{event()} function. \snippet widgets/tablet/tabletapplication.h 0 @@ -336,7 +336,7 @@ and TabletLeaveProximity events are not sendt to the QApplication object, while other tablet events are sendt to the QWidget's \c event(), which sends them on to \l{QWidget::}{tabletEvent()}. - Since we want to handle these events we have implemented \c + Since we want to handle these events we have implemented \c TabletApplication. @@ -352,7 +352,7 @@ events is to do work that is dependent on what kind of device is used on the tablet. This way, you don't have to do this work when other events are generated, which is more frequently than the - leave and enter proximity events. We call \c setTabletDevice() in + leave and enter proximity events. We call \c setTabletDevice() in \c TabletCanvas. \section1 The \c main() function diff --git a/examples/widgets/doc/src/tetrix.qdoc b/examples/widgets/doc/src/tetrix.qdoc index 599323deb0..7527d6758f 100644 --- a/examples/widgets/doc/src/tetrix.qdoc +++ b/examples/widgets/doc/src/tetrix.qdoc @@ -25,7 +25,7 @@ ** ****************************************************************************/ -/*! +/*! \example widgets/tetrix \title Tetrix Example \ingroup examples-widgets diff --git a/examples/widgets/doc/src/undo.qdoc b/examples/widgets/doc/src/undo.qdoc index 07f586b8f3..fc89751e90 100644 --- a/examples/widgets/doc/src/undo.qdoc +++ b/examples/widgets/doc/src/undo.qdoc @@ -35,7 +35,7 @@ \image undodemo.png Qt's undo framework is an implementation of the Command - pattern, which provides advanced undo/redo functionality. + pattern, which provides advanced undo/redo functionality. To show the abilities of the framework, we have implemented a small diagram application in which the diagram items are geometric diff --git a/examples/widgets/doc/src/undoframework.qdoc b/examples/widgets/doc/src/undoframework.qdoc index ba146e65b9..1710ab9132 100644 --- a/examples/widgets/doc/src/undoframework.qdoc +++ b/examples/widgets/doc/src/undoframework.qdoc @@ -61,9 +61,9 @@ The example consists of the following classes: - \list + \list \li \c MainWindow is the main window and arranges the - example's widgets. It creates the commands based + example's widgets. It creates the commands based on user input and keeps them on the command stack. \li \c AddCommand adds an item to the scene. \li \c DeleteCommand deletes an item from the scene. @@ -85,23 +85,23 @@ \l{QUndoCommand}s and pushes and pops them from the stack when it receives the \c triggered() signal from \c undoAction and \c redoAction. - + \section1 MainWindow Class Implementation - We will start with a look at the constructor: + We will start with a look at the constructor: \snippet tools/undoframework/mainwindow.cpp 0 - In the constructor, we set up the DiagramScene and QGraphicsView. + In the constructor, we set up the DiagramScene and QGraphicsView. - Here is the \c createUndoView() function: + Here is the \c createUndoView() function: \snippet tools/undoframework/mainwindow.cpp 1 The QUndoView is a widget that display the text, which is set with the \l{QUndoCommand::}{setText()} function, for each QUndoCommand in the undo stack in a list. - + Here is the \c createActions() function: \snippet tools/undoframework/mainwindow.cpp 2 @@ -130,7 +130,7 @@ We have to use the QMenu \c aboutToShow() and \c aboutToHide() signals since we only want \c deleteAction to be enabled when we - have selected an item. + have selected an item. Here is the \c itemMoved() slot: @@ -155,9 +155,9 @@ \snippet tools/undoframework/mainwindow.cpp 12 We implement \c itemMenuAboutToShow() and \c itemMenuAboutToHide() - to get a dynamic item menu. These slots are connected to the + to get a dynamic item menu. These slots are connected to the \l{QMenu::}{aboutToShow()} and \l{QMenu::}{aboutToHide()} signals. - We need this to disable or enable the \c deleteAction. + We need this to disable or enable the \c deleteAction. Here is the \c addBox() slot: @@ -171,21 +171,21 @@ \snippet tools/undoframework/mainwindow.cpp 14 The \c addTriangle() function creates an AddCommand and pushes it - on the undo stack. + on the undo stack. Here is the implementation of \c about(): \snippet tools/undoframework/mainwindow.cpp 15 - + The about slot is triggered by the \c aboutAction and displays an about box for the example. \section1 AddCommand Class Definition - + \snippet tools/undoframework/commands.h 2 The \c AddCommand class adds DiagramItem graphics items to the - DiagramScene. + DiagramScene. \section1 AddCommand Class Implementation @@ -208,20 +208,20 @@ constructor. \section1 DeleteCommand Class Definition - + \snippet tools/undoframework/commands.h 1 The DeleteCommand class implements the functionality to remove an item from the scene. - + \section1 DeleteCommand Class Implementation \snippet tools/undoframework/commands.cpp 4 We know that there must be one selected item as it is not possible to create a DeleteCommand unless the item to be deleted is - selected and that only one item can be selected at any time. - The item must be unselected if it is inserted back into the + selected and that only one item can be selected at any time. + The item must be unselected if it is inserted back into the scene. \snippet tools/undoframework/commands.cpp 5 @@ -242,7 +242,7 @@ \section1 MoveCommand Class Implementation - + The constructor of MoveCommand looks like this: \snippet tools/undoframework/commands.cpp 0 @@ -252,12 +252,12 @@ \snippet tools/undoframework/commands.cpp 2 - We simply set the items old position and update the scene. + We simply set the items old position and update the scene. \snippet tools/undoframework/commands.cpp 3 We set the item to its new position. - + \snippet tools/undoframework/commands.cpp 1 Whenever a MoveCommand is created, this function is called to @@ -268,7 +268,7 @@ We first check whether it is the same item that has been moved twice, in which case we merge the commands. We update the position of the item so that it will take the last position in the move - sequence when undone. + sequence when undone. \section1 DiagramScene Class Definition @@ -281,7 +281,7 @@ as it only deals with graphics framework issues. \section1 The \c main() Function - + The \c main() function of the program looks like this: \snippet tools/undoframework/main.cpp 0 diff --git a/examples/widgets/draganddrop/draggableicons/dragwidget.cpp b/examples/widgets/draganddrop/draggableicons/dragwidget.cpp index b13d571a26..5d01ee7619 100644 --- a/examples/widgets/draganddrop/draggableicons/dragwidget.cpp +++ b/examples/widgets/draganddrop/draggableicons/dragwidget.cpp @@ -103,7 +103,7 @@ void DragWidget::dropEvent(QDropEvent *event) if (event->mimeData()->hasFormat("application/x-dnditemdata")) { QByteArray itemData = event->mimeData()->data("application/x-dnditemdata"); QDataStream dataStream(&itemData, QIODevice::ReadOnly); - + QPixmap pixmap; QPoint offset; dataStream >> pixmap >> offset; @@ -143,7 +143,7 @@ void DragWidget::mousePressEvent(QMouseEvent *event) QMimeData *mimeData = new QMimeData; mimeData->setData("application/x-dnditemdata", itemData); //! [2] - + //! [3] QDrag *drag = new QDrag(this); drag->setMimeData(mimeData); diff --git a/examples/widgets/draganddrop/dropsite/droparea.cpp b/examples/widgets/draganddrop/dropsite/droparea.cpp index 8662ec80b3..fcabeb3b62 100644 --- a/examples/widgets/draganddrop/dropsite/droparea.cpp +++ b/examples/widgets/draganddrop/dropsite/droparea.cpp @@ -87,7 +87,7 @@ void DropArea::dropEvent(QDropEvent *event) setText(mimeData->html()); setTextFormat(Qt::RichText); } else if (mimeData->hasText()) { - setText(mimeData->text()); + setText(mimeData->text()); setTextFormat(Qt::PlainText); } else if (mimeData->hasUrls()) { QList urlList = mimeData->urls(); @@ -102,7 +102,7 @@ void DropArea::dropEvent(QDropEvent *event) } //! [dropEvent() function part2] -//! [dropEvent() function part3] +//! [dropEvent() function part3] setBackgroundRole(QPalette::Dark); event->acceptProposedAction(); } diff --git a/examples/widgets/draganddrop/dropsite/dropsitewindow.cpp b/examples/widgets/draganddrop/dropsite/dropsitewindow.cpp index 9b7f0c3de9..d69f4ee2a8 100644 --- a/examples/widgets/draganddrop/dropsite/dropsitewindow.cpp +++ b/examples/widgets/draganddrop/dropsite/dropsitewindow.cpp @@ -103,7 +103,7 @@ void DropSiteWindow::updateFormatsTable(const QMimeData *mimeData) return; //! [updateFormatsTable() part1] -//! [updateFormatsTable() part2] +//! [updateFormatsTable() part2] foreach (QString format, mimeData->formats()) { QTableWidgetItem *formatItem = new QTableWidgetItem(format); formatItem->setFlags(Qt::ItemIsEnabled); @@ -129,7 +129,7 @@ void DropSiteWindow::updateFormatsTable(const QMimeData *mimeData) text.append(hex + " "); } } -//! [updateFormatsTable() part3] +//! [updateFormatsTable() part3] //! [updateFormatsTable() part4] int row = formatsTable->rowCount(); @@ -137,7 +137,7 @@ void DropSiteWindow::updateFormatsTable(const QMimeData *mimeData) formatsTable->setItem(row, 0, new QTableWidgetItem(format)); formatsTable->setItem(row, 1, new QTableWidgetItem(text)); } - + formatsTable->resizeColumnToContents(0); } -//! [updateFormatsTable() part4] +//! [updateFormatsTable() part4] diff --git a/examples/widgets/graphicsview/boxes/scene.cpp b/examples/widgets/graphicsview/boxes/scene.cpp index c907070db8..11e9f4ea5a 100644 --- a/examples/widgets/graphicsview/boxes/scene.cpp +++ b/examples/widgets/graphicsview/boxes/scene.cpp @@ -567,7 +567,7 @@ void Scene::initGL() m_environmentProgram->link(); const int NOISE_SIZE = 128; // for a different size, B and BM in fbm.c must also be changed - m_noise = new GLTexture3D(NOISE_SIZE, NOISE_SIZE, NOISE_SIZE); + m_noise = new GLTexture3D(NOISE_SIZE, NOISE_SIZE, NOISE_SIZE); QRgb *data = new QRgb[NOISE_SIZE * NOISE_SIZE * NOISE_SIZE]; memset(data, 0, NOISE_SIZE * NOISE_SIZE * NOISE_SIZE * sizeof(QRgb)); QRgb *p = data; diff --git a/examples/widgets/graphicsview/chip/main.cpp b/examples/widgets/graphicsview/chip/main.cpp index a0c1b919d1..c0f271a83c 100644 --- a/examples/widgets/graphicsview/chip/main.cpp +++ b/examples/widgets/graphicsview/chip/main.cpp @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); MainWindow window; - window.show(); + window.show(); return app.exec(); } diff --git a/examples/widgets/graphicsview/chip/mainwindow.cpp b/examples/widgets/graphicsview/chip/mainwindow.cpp index 0925e9c9cb..510dd2e5c9 100644 --- a/examples/widgets/graphicsview/chip/mainwindow.cpp +++ b/examples/widgets/graphicsview/chip/mainwindow.cpp @@ -53,7 +53,7 @@ MainWindow::MainWindow(QWidget *parent) h1Splitter = new QSplitter; h2Splitter = new QSplitter; - + QSplitter *vSplitter = new QSplitter; vSplitter->setOrientation(Qt::Vertical); vSplitter->addWidget(h1Splitter); diff --git a/examples/widgets/graphicsview/chip/mainwindow.h b/examples/widgets/graphicsview/chip/mainwindow.h index 876a9f7d77..d4a9dfda85 100644 --- a/examples/widgets/graphicsview/chip/mainwindow.h +++ b/examples/widgets/graphicsview/chip/mainwindow.h @@ -54,11 +54,11 @@ class MainWindow : public QWidget Q_OBJECT public: MainWindow(QWidget *parent = 0); - + private: void setupMatrix(); void populateScene(); - + QGraphicsScene *scene; QSplitter *h1Splitter; QSplitter *h2Splitter; diff --git a/examples/widgets/graphicsview/collidingmice/mouse.cpp b/examples/widgets/graphicsview/collidingmice/mouse.cpp index e44d5549b3..d22e935828 100644 --- a/examples/widgets/graphicsview/collidingmice/mouse.cpp +++ b/examples/widgets/graphicsview/collidingmice/mouse.cpp @@ -159,7 +159,7 @@ void Mouse::advance(int step) foreach (QGraphicsItem *item, dangerMice) { if (item == this) continue; - + QLineF lineToMouse(QPointF(0, 0), mapFromItem(item, 0, 0)); qreal angleToMouse = ::acos(lineToMouse.dx() / lineToMouse.length()); if (lineToMouse.dy() < 0) diff --git a/examples/widgets/graphicsview/dragdroprobot/robot.cpp b/examples/widgets/graphicsview/dragdroprobot/robot.cpp index 90ae4e9e22..4bfcac4800 100644 --- a/examples/widgets/graphicsview/dragdroprobot/robot.cpp +++ b/examples/widgets/graphicsview/dragdroprobot/robot.cpp @@ -162,7 +162,7 @@ void RobotTorso::paint(QPainter *painter, { Q_UNUSED(option); Q_UNUSED(widget); - + painter->setBrush(dragOver ? color.light(130) : color); painter->drawRoundedRect(-20, -20, 40, 60, 25, 25, Qt::RelativeSize); painter->drawEllipse(-25, -20, 20, 20); diff --git a/examples/widgets/graphicsview/dragdroprobot/robot.h b/examples/widgets/graphicsview/dragdroprobot/robot.h index bb61bfe54b..a0c842e72c 100644 --- a/examples/widgets/graphicsview/dragdroprobot/robot.h +++ b/examples/widgets/graphicsview/dragdroprobot/robot.h @@ -109,7 +109,7 @@ class Robot : public RobotPart { public: Robot(QGraphicsItem *parent = 0); - + QRectF boundingRect() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); }; diff --git a/examples/widgets/graphicsview/elasticnodes/edge.cpp b/examples/widgets/graphicsview/elasticnodes/edge.cpp index 8561983db9..1923550fd3 100644 --- a/examples/widgets/graphicsview/elasticnodes/edge.cpp +++ b/examples/widgets/graphicsview/elasticnodes/edge.cpp @@ -136,7 +136,7 @@ void Edge::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) QPointF sourceArrowP1 = sourcePoint + QPointF(sin(angle + Pi / 3) * arrowSize, cos(angle + Pi / 3) * arrowSize); QPointF sourceArrowP2 = sourcePoint + QPointF(sin(angle + Pi - Pi / 3) * arrowSize, - cos(angle + Pi - Pi / 3) * arrowSize); + cos(angle + Pi - Pi / 3) * arrowSize); QPointF destArrowP1 = destPoint + QPointF(sin(angle - Pi / 3) * arrowSize, cos(angle - Pi / 3) * arrowSize); QPointF destArrowP2 = destPoint + QPointF(sin(angle - Pi + Pi / 3) * arrowSize, diff --git a/examples/widgets/graphicsview/elasticnodes/edge.h b/examples/widgets/graphicsview/elasticnodes/edge.h index 5800ca0d32..6ab71e3478 100644 --- a/examples/widgets/graphicsview/elasticnodes/edge.h +++ b/examples/widgets/graphicsview/elasticnodes/edge.h @@ -58,11 +58,11 @@ public: enum { Type = UserType + 2 }; int type() const { return Type; } - + protected: QRectF boundingRect() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - + private: Node *source, *dest; diff --git a/examples/widgets/graphicsview/elasticnodes/node.h b/examples/widgets/graphicsview/elasticnodes/node.h index 703b99801a..813dbb1c54 100644 --- a/examples/widgets/graphicsview/elasticnodes/node.h +++ b/examples/widgets/graphicsview/elasticnodes/node.h @@ -74,7 +74,7 @@ protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - + private: QList edgeList; QPointF newPos; diff --git a/examples/widgets/graphicsview/embeddeddialogs/customproxy.cpp b/examples/widgets/graphicsview/embeddeddialogs/customproxy.cpp index 5e7577f28b..fa108a21b3 100644 --- a/examples/widgets/graphicsview/embeddeddialogs/customproxy.cpp +++ b/examples/widgets/graphicsview/embeddeddialogs/customproxy.cpp @@ -64,7 +64,7 @@ void CustomProxy::paintWindowFrame(QPainter *painter, const QStyleOptionGraphics QWidget *widget) { const QColor color(0, 0, 0, 64); - + QRectF r = windowFrameRect(); QRectF right(r.right(), r.top() + 10, 10, r.height() - 10); QRectF bottom(r.left() + 10, r.bottom(), r.width(), 10); @@ -159,7 +159,7 @@ void CustomProxy::zoomIn() { if (timeLine->direction() != QTimeLine::Forward) timeLine->setDirection(QTimeLine::Forward); - if (timeLine->state() == QTimeLine::NotRunning) + if (timeLine->state() == QTimeLine::NotRunning) timeLine->start(); } @@ -167,6 +167,6 @@ void CustomProxy::zoomOut() { if (timeLine->direction() != QTimeLine::Backward) timeLine->setDirection(QTimeLine::Backward); - if (timeLine->state() == QTimeLine::NotRunning) + if (timeLine->state() == QTimeLine::NotRunning) timeLine->start(); } diff --git a/examples/widgets/graphicsview/embeddeddialogs/customproxy.h b/examples/widgets/graphicsview/embeddeddialogs/customproxy.h index 3f7b540d2b..7257a90b12 100644 --- a/examples/widgets/graphicsview/embeddeddialogs/customproxy.h +++ b/examples/widgets/graphicsview/embeddeddialogs/customproxy.h @@ -54,7 +54,7 @@ public: QRectF boundingRect() const; void paintWindowFrame(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget); + QWidget *widget); protected: void hoverEnterEvent(QGraphicsSceneHoverEvent *event); diff --git a/examples/widgets/itemviews/addressbook/adddialog.cpp b/examples/widgets/itemviews/addressbook/adddialog.cpp index f68cacc2e5..bb31fd60c4 100644 --- a/examples/widgets/itemviews/addressbook/adddialog.cpp +++ b/examples/widgets/itemviews/addressbook/adddialog.cpp @@ -50,31 +50,31 @@ AddDialog::AddDialog(QWidget *parent) addressLabel = new QLabel("Address"); okButton = new QPushButton("OK"); cancelButton = new QPushButton("Cancel"); - + nameText = new QLineEdit; addressText = new QTextEdit; - + QGridLayout *gLayout = new QGridLayout; gLayout->setColumnStretch(1, 2); gLayout->addWidget(nameLabel, 0, 0); gLayout->addWidget(nameText, 0, 1); - + gLayout->addWidget(addressLabel, 1, 0, Qt::AlignLeft|Qt::AlignTop); gLayout->addWidget(addressText, 1, 1, Qt::AlignLeft); - + QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->addWidget(okButton); buttonLayout->addWidget(cancelButton); - + gLayout->addLayout(buttonLayout, 2, 1, Qt::AlignRight); - + QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(gLayout); setLayout(mainLayout); - + connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); - + setWindowTitle(tr("Add a Contact")); } //! [0] diff --git a/examples/widgets/itemviews/addressbook/adddialog.h b/examples/widgets/itemviews/addressbook/adddialog.h index 8412664287..78f56ef744 100644 --- a/examples/widgets/itemviews/addressbook/adddialog.h +++ b/examples/widgets/itemviews/addressbook/adddialog.h @@ -54,7 +54,7 @@ QT_END_NAMESPACE class AddDialog : public QDialog { Q_OBJECT - + public: AddDialog(QWidget *parent = 0); QLineEdit *nameText; diff --git a/examples/widgets/itemviews/addressbook/addresswidget.cpp b/examples/widgets/itemviews/addressbook/addresswidget.cpp index 2c05e0e059..cd6f4a5534 100644 --- a/examples/widgets/itemviews/addressbook/addresswidget.cpp +++ b/examples/widgets/itemviews/addressbook/addresswidget.cpp @@ -52,7 +52,7 @@ AddressWidget::AddressWidget(QWidget *parent) connect(newAddressTab, SIGNAL(sendDetails(QString, QString)), this, SLOT(addEntry(QString, QString))); - addTab(newAddressTab, "Address Book"); + addTab(newAddressTab, "Address Book"); setupTabs(); } @@ -60,13 +60,13 @@ AddressWidget::AddressWidget(QWidget *parent) //! [2] void AddressWidget::addEntry() -{ +{ AddDialog aDialog; if (aDialog.exec()) { QString name = aDialog.nameText->text(); QString address = aDialog.addressText->toPlainText(); - + addEntry(name, address); } } @@ -74,7 +74,7 @@ void AddressWidget::addEntry() //! [3] void AddressWidget::addEntry(QString name, QString address) -{ +{ QList >list = table->getList(); QPair pair(name, address); @@ -110,14 +110,14 @@ void AddressWidget::editEntry() QModelIndex nameIndex = table->index(row, 0, QModelIndex()); QVariant varName = table->data(nameIndex, Qt::DisplayRole); name = varName.toString(); - + QModelIndex addressIndex = table->index(row, 1, QModelIndex()); QVariant varAddr = table->data(addressIndex, Qt::DisplayRole); address = varAddr.toString(); } //! [4a] - -//! [4b] + +//! [4b] AddDialog aDialog; aDialog.setWindowTitle(tr("Edit a Contact")); @@ -141,7 +141,7 @@ void AddressWidget::removeEntry() QTableView *temp = static_cast(currentWidget()); QSortFilterProxyModel *proxy = static_cast(temp->model()); QItemSelectionModel *selectionModel = temp->selectionModel(); - + QModelIndexList indexes = selectionModel->selectedRows(); foreach (QModelIndex index, indexes) { @@ -163,7 +163,7 @@ void AddressWidget::setupTabs() for (int i = 0; i < groups.size(); ++i) { QString str = groups.at(i); - + proxyModel = new QSortFilterProxyModel(this); proxyModel->setSourceModel(table); @@ -181,7 +181,7 @@ void AddressWidget::setupTabs() proxyModel->setFilterRegExp(QRegExp(newStr, Qt::CaseInsensitive)); proxyModel->setFilterKeyColumn(0); proxyModel->sort(0, Qt::AscendingOrder); - + connect(tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SIGNAL(selectionChanged(QItemSelection))); diff --git a/examples/widgets/itemviews/addressbook/mainwindow.cpp b/examples/widgets/itemviews/addressbook/mainwindow.cpp index 8f1ea81763..8e66e9cb49 100644 --- a/examples/widgets/itemviews/addressbook/mainwindow.cpp +++ b/examples/widgets/itemviews/addressbook/mainwindow.cpp @@ -58,7 +58,7 @@ MainWindow::MainWindow() void MainWindow::createMenus() { fileMenu = menuBar()->addMenu(tr("&File")); - + openAct = new QAction(tr("&Open..."), this); fileMenu->addAction(openAct); connect(openAct, SIGNAL(triggered()), this, SLOT(openFile())); @@ -79,7 +79,7 @@ void MainWindow::createMenus() addAct = new QAction(tr("&Add Entry..."), this); toolMenu->addAction(addAct); connect(addAct, SIGNAL(triggered()), addressWidget, SLOT(addEntry())); - + //! [1b] editAct = new QAction(tr("&Edit Entry..."), this); editAct->setEnabled(false); @@ -120,7 +120,7 @@ void MainWindow::saveFile() void MainWindow::updateActions(const QItemSelection &selection) { QModelIndexList indexes = selection.indexes(); - + if (!indexes.isEmpty()) { removeAct->setEnabled(true); editAct->setEnabled(true); diff --git a/examples/widgets/itemviews/addressbook/newaddresstab.cpp b/examples/widgets/itemviews/addressbook/newaddresstab.cpp index b443d9cf96..a8e770cab8 100644 --- a/examples/widgets/itemviews/addressbook/newaddresstab.cpp +++ b/examples/widgets/itemviews/addressbook/newaddresstab.cpp @@ -50,15 +50,15 @@ NewAddressTab::NewAddressTab(QWidget *parent) descriptionLabel = new QLabel(tr("There are currently no contacts in your address book. " "\nClick Add to add new contacts.")); - + addButton = new QPushButton(tr("Add")); - + connect(addButton, SIGNAL(clicked()), this, SLOT(addEntry())); - + mainLayout = new QVBoxLayout; mainLayout->addWidget(descriptionLabel); mainLayout->addWidget(addButton, 0, Qt::AlignCenter); - + setLayout(mainLayout); } //! [0] @@ -67,11 +67,11 @@ NewAddressTab::NewAddressTab(QWidget *parent) void NewAddressTab::addEntry() { AddDialog aDialog; - + if (aDialog.exec()) { QString name = aDialog.nameText->text(); QString address = aDialog.addressText->toPlainText(); - + emit sendDetails(name, address); } } diff --git a/examples/widgets/itemviews/addressbook/newaddresstab.h b/examples/widgets/itemviews/addressbook/newaddresstab.h index 51e75aa366..2db7302e75 100644 --- a/examples/widgets/itemviews/addressbook/newaddresstab.h +++ b/examples/widgets/itemviews/addressbook/newaddresstab.h @@ -53,7 +53,7 @@ QT_END_NAMESPACE class NewAddressTab : public QWidget { Q_OBJECT - + public: NewAddressTab(QWidget *parent = 0); @@ -67,7 +67,7 @@ private: QLabel *descriptionLabel; QPushButton *addButton; QVBoxLayout *mainLayout; - + }; //! [0] diff --git a/examples/widgets/itemviews/addressbook/tablemodel.h b/examples/widgets/itemviews/addressbook/tablemodel.h index 0ef54fae6a..e282defa1b 100644 --- a/examples/widgets/itemviews/addressbook/tablemodel.h +++ b/examples/widgets/itemviews/addressbook/tablemodel.h @@ -49,7 +49,7 @@ class TableModel : public QAbstractTableModel { Q_OBJECT - + public: TableModel(QObject *parent = 0); TableModel(QList > listofPairs, QObject *parent = 0); diff --git a/examples/widgets/itemviews/combowidgetmapper/window.cpp b/examples/widgets/itemviews/combowidgetmapper/window.cpp index 39ba428ced..3dfb2834a8 100644 --- a/examples/widgets/itemviews/combowidgetmapper/window.cpp +++ b/examples/widgets/itemviews/combowidgetmapper/window.cpp @@ -101,7 +101,7 @@ void Window::setupModel() QStringList items; items << tr("Home") << tr("Work") << tr("Other"); typeModel = new QStringListModel(items, this); - + model = new QStandardItemModel(5, 3, this); QStringList names; names << "Alice" << "Bob" << "Carol" << "Donald" << "Emma"; @@ -115,7 +115,7 @@ void Window::setupModel() QStringList types; types << "0" << "1" << "2" << "0" << "2"; - + for (int row = 0; row < 5; ++row) { QStandardItem *item = new QStandardItem(names[row]); model->setItem(row, 0, item); diff --git a/examples/widgets/itemviews/fetchmore/filelistmodel.cpp b/examples/widgets/itemviews/fetchmore/filelistmodel.cpp index 5e7ba2c754..6532189b06 100644 --- a/examples/widgets/itemviews/fetchmore/filelistmodel.cpp +++ b/examples/widgets/itemviews/fetchmore/filelistmodel.cpp @@ -60,10 +60,10 @@ QVariant FileListModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); - + if (index.row() >= fileList.size() || index.row() < 0) return QVariant(); - + if (role == Qt::DisplayRole) { return fileList.at(index.row()); } else if (role == Qt::BackgroundRole) { @@ -94,7 +94,7 @@ void FileListModel::fetchMore(const QModelIndex & /* index */) int itemsToFetch = qMin(100, remainder); beginInsertRows(QModelIndex(), fileCount, fileCount+itemsToFetch-1); - + fileCount += itemsToFetch; endInsertRows(); diff --git a/examples/widgets/itemviews/fetchmore/window.cpp b/examples/widgets/itemviews/fetchmore/window.cpp index ed2d2a2260..f35593923d 100644 --- a/examples/widgets/itemviews/fetchmore/window.cpp +++ b/examples/widgets/itemviews/fetchmore/window.cpp @@ -65,7 +65,7 @@ Window::Window(QWidget *parent) logViewer, SLOT(clear())); connect(model, SIGNAL(numberPopulated(int)), this, SLOT(updateLog(int))); - + QGridLayout *layout = new QGridLayout; layout->addWidget(label, 0, 0); layout->addWidget(lineEdit, 0, 1); diff --git a/examples/widgets/itemviews/pixelator/mainwindow.cpp b/examples/widgets/itemviews/pixelator/mainwindow.cpp index 0d34dbf190..1f6a403efc 100644 --- a/examples/widgets/itemviews/pixelator/mainwindow.cpp +++ b/examples/widgets/itemviews/pixelator/mainwindow.cpp @@ -226,7 +226,7 @@ void MainWindow::printImage() tr("The printing process was canceled."), QMessageBox::Cancel); } #else - QMessageBox::information(this, tr("Printing canceled"), + QMessageBox::information(this, tr("Printing canceled"), tr("Printing is not supported on this Qt build"), QMessageBox::Cancel); #endif } diff --git a/examples/widgets/itemviews/simplewidgetmapper/window.cpp b/examples/widgets/itemviews/simplewidgetmapper/window.cpp index 7699bcc929..0e3314601a 100644 --- a/examples/widgets/itemviews/simplewidgetmapper/window.cpp +++ b/examples/widgets/itemviews/simplewidgetmapper/window.cpp @@ -109,7 +109,7 @@ void Window::setupModel() QStringList ages; ages << "20" << "31" << "32" << "19" << "26"; - + for (int row = 0; row < 5; ++row) { QStandardItem *item = new QStandardItem(names[row]); model->setItem(row, 0, item); diff --git a/examples/widgets/itemviews/spreadsheet/spreadsheet.h b/examples/widgets/itemviews/spreadsheet/spreadsheet.h index c81af6666a..279146552a 100644 --- a/examples/widgets/itemviews/spreadsheet/spreadsheet.h +++ b/examples/widgets/itemviews/spreadsheet/spreadsheet.h @@ -77,7 +77,7 @@ public slots: void actionSubtract(); void actionAdd(); void actionMultiply(); - void actionDivide(); + void actionDivide(); protected: void setupContextMenu(); diff --git a/examples/widgets/painting/deform/pathdeform.cpp b/examples/widgets/painting/deform/pathdeform.cpp index 3c0624ac76..9f9a88700c 100644 --- a/examples/widgets/painting/deform/pathdeform.cpp +++ b/examples/widgets/painting/deform/pathdeform.cpp @@ -289,7 +289,7 @@ void PathDeformWidget::setStyle( QStyle * style ) return; m_controls->setStyle(style); - + QList widgets = m_controls->findChildren(); foreach (QWidget *w, widgets) w->setStyle(style); @@ -481,7 +481,7 @@ void PathDeformRenderer::mousePressEvent(QMouseEvent *e) m_offset = m_pos - e->pos(); m_mousePress = e->pos(); - + // If we're not running in small screen mode, always assume we're dragging m_mouseDrag = !m_smallScreen; diff --git a/examples/widgets/painting/gradients/gradients.cpp b/examples/widgets/painting/gradients/gradients.cpp index f3da5f3de5..ffca9f5560 100644 --- a/examples/widgets/painting/gradients/gradients.cpp +++ b/examples/widgets/painting/gradients/gradients.cpp @@ -362,7 +362,7 @@ GradientWidget::GradientWidget(QWidget *parent) connect(showSourceButton, SIGNAL(clicked()), m_renderer, SLOT(showSource())); #ifdef QT_OPENGL_SUPPORT connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool))); -#endif +#endif connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setDescriptionEnabled(bool))); connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer->hoverPoints(), SLOT(setDisabled(bool))); diff --git a/examples/widgets/painting/pathstroke/pathstroke.cpp b/examples/widgets/painting/pathstroke/pathstroke.cpp index a8b87f51f4..6807585f57 100644 --- a/examples/widgets/painting/pathstroke/pathstroke.cpp +++ b/examples/widgets/painting/pathstroke/pathstroke.cpp @@ -380,7 +380,7 @@ void PathStrokeWidget::setStyle( QStyle * style ) if (m_controls != 0) { m_controls->setStyle(style); - + QList widgets = m_controls->findChildren(); foreach (QWidget *w, widgets) w->setStyle(style); @@ -544,7 +544,7 @@ void PathStrokeRenderer::mousePressEvent(QMouseEvent *e) setAnimation(false); mouseMoveEvent(e); } - + // If we're not running in small screen mode, always assume we're dragging m_mouseDrag = !m_smallScreen; m_mousePress = e->pos(); diff --git a/examples/widgets/richtext/textedit/textedit.cpp b/examples/widgets/richtext/textedit/textedit.cpp index c7edd1b550..ae2bdedf13 100644 --- a/examples/widgets/richtext/textedit/textedit.cpp +++ b/examples/widgets/richtext/textedit/textedit.cpp @@ -197,7 +197,7 @@ void TextEdit::setupFileActions() #ifndef QT_NO_PRINTER a = new QAction(QIcon::fromTheme("document-print", QIcon(rsrcPath + "/fileprint.png")), tr("&Print..."), this); - a->setPriority(QAction::LowPriority); + a->setPriority(QAction::LowPriority); a->setShortcut(QKeySequence::Print); connect(a, SIGNAL(triggered()), this, SLOT(filePrint())); tb->addAction(a); diff --git a/examples/widgets/richtext/textedit/textedit.qdoc b/examples/widgets/richtext/textedit/textedit.qdoc index 1695adfb2e..8e7a0bef24 100644 --- a/examples/widgets/richtext/textedit/textedit.qdoc +++ b/examples/widgets/richtext/textedit/textedit.qdoc @@ -31,8 +31,8 @@ \title Text Edit Example \brief This example displays a text editor with the user interface written - in pure C++. - + in pure C++. + A similar example which uses Qt Designer to produce the user interface is in the \l {Qt Designer Manual}. diff --git a/examples/widgets/statemachine/factorial/main.cpp b/examples/widgets/statemachine/factorial/main.cpp index 9107fea013..1ad2740563 100644 --- a/examples/widgets/statemachine/factorial/main.cpp +++ b/examples/widgets/statemachine/factorial/main.cpp @@ -78,7 +78,7 @@ public: Q_SIGNALS: void xChanged(int value); - + private: int m_x; int m_fac; diff --git a/examples/widgets/statemachine/rogue/window.cpp b/examples/widgets/statemachine/rogue/window.cpp index 1e26278051..af8390f928 100644 --- a/examples/widgets/statemachine/rogue/window.cpp +++ b/examples/widgets/statemachine/rogue/window.cpp @@ -96,7 +96,7 @@ void Window::paintEvent(QPaintEvent * /* event */) painter.setPen(Qt::white); painter.drawText(QPoint(0, yPos), status()); - + for (int y = 0; y < HEIGHT; ++y) { yPos += fontHeight; xPos = 0; @@ -184,7 +184,7 @@ void Window::buildMachine() //![3] QState *quitState = new QState(machine); - quitState->assignProperty(this, "status", "Really quit(y/n)?"); + quitState->assignProperty(this, "status", "Really quit(y/n)?"); QKeyEventTransition *yesTransition = new QKeyEventTransition(this, QEvent::KeyPress, Qt::Key_Y); @@ -218,7 +218,7 @@ void Window::movePlayer(Direction direction) switch (direction) { case Left: if (map[pX - 1][pY] != '#') - --pX; + --pX; break; case Right: if (map[pX + 1][pY] != '#') @@ -231,7 +231,7 @@ void Window::movePlayer(Direction direction) case Down: if (map[pX][pY + 1] != '#') ++pY; - break; + break; } repaint(); } diff --git a/examples/widgets/tools/completer/mainwindow.cpp b/examples/widgets/tools/completer/mainwindow.cpp index 6730193928..c299d08c17 100644 --- a/examples/widgets/tools/completer/mainwindow.cpp +++ b/examples/widgets/tools/completer/mainwindow.cpp @@ -100,7 +100,7 @@ MainWindow::MainWindow(QWidget *parent) //! [3] lineEdit = new QLineEdit; - + QGridLayout *layout = new QGridLayout; layout->addWidget(modelLabel, 0, 0); layout->addWidget(modelCombo, 0, 1); layout->addWidget(modeLabel, 1, 0); layout->addWidget(modeCombo, 1, 1); diff --git a/examples/widgets/tools/customcompleter/mainwindow.cpp b/examples/widgets/tools/customcompleter/mainwindow.cpp index 54033b5dd3..20b5d509ff 100644 --- a/examples/widgets/tools/customcompleter/mainwindow.cpp +++ b/examples/widgets/tools/customcompleter/mainwindow.cpp @@ -93,7 +93,7 @@ QAbstractItemModel *MainWindow::modelFromFile(const QString& fileName) QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); #endif QStringList words; - + while (!file.atEnd()) { QByteArray line = file.readLine(); if (!line.isEmpty()) diff --git a/examples/widgets/tools/customcompleter/textedit.cpp b/examples/widgets/tools/customcompleter/textedit.cpp index 1fafdcd04d..9b0c1b9c97 100644 --- a/examples/widgets/tools/customcompleter/textedit.cpp +++ b/examples/widgets/tools/customcompleter/textedit.cpp @@ -53,7 +53,7 @@ TextEdit::TextEdit(QWidget *parent) : QTextEdit(parent), c(0) { setPlainText(tr("This TextEdit provides autocompletions for words that have more than" - " 3 characters. You can trigger autocompletion using ") + + " 3 characters. You can trigger autocompletion using ") + QKeySequence("Ctrl+E").toString(QKeySequence::NativeText)); } //! [0] @@ -133,7 +133,7 @@ void TextEdit::keyPressEvent(QKeyEvent *e) case Qt::Key_Escape: case Qt::Key_Tab: case Qt::Key_Backtab: - e->ignore(); + e->ignore(); return; // let the completer do default behavior default: break; @@ -154,7 +154,7 @@ void TextEdit::keyPressEvent(QKeyEvent *e) bool hasModifier = (e->modifiers() != Qt::NoModifier) && !ctrlOrShift; QString completionPrefix = textUnderCursor(); - if (!isShortcut && (hasModifier || e->text().isEmpty()|| completionPrefix.length() < 3 + if (!isShortcut && (hasModifier || e->text().isEmpty()|| completionPrefix.length() < 3 || eow.contains(e->text().right(1)))) { c->popup()->hide(); return; diff --git a/examples/widgets/tools/plugandpaint/mainwindow.cpp b/examples/widgets/tools/plugandpaint/mainwindow.cpp index cc0ce48be8..fdd3689a1a 100644 --- a/examples/widgets/tools/plugandpaint/mainwindow.cpp +++ b/examples/widgets/tools/plugandpaint/mainwindow.cpp @@ -81,7 +81,7 @@ MainWindow::MainWindow() : void MainWindow::open() { const QString fileName = QFileDialog::getOpenFileName(this, - tr("Open File"), + tr("Open File"), QDir::currentPath()); if (!fileName.isEmpty()) { if (!paintArea->openImage(fileName)) { diff --git a/examples/widgets/tools/plugandpaint/plugindialog.cpp b/examples/widgets/tools/plugandpaint/plugindialog.cpp index 2c19d32584..19d2a103fa 100644 --- a/examples/widgets/tools/plugandpaint/plugindialog.cpp +++ b/examples/widgets/tools/plugandpaint/plugindialog.cpp @@ -58,7 +58,7 @@ PluginDialog::PluginDialog(const QString &path, const QStringList &fileNames, QDialog(parent), label(new QLabel), treeWidget(new QTreeWidget), - okButton(new QPushButton(tr("OK"))) + okButton(new QPushButton(tr("OK"))) { treeWidget->setAlternatingRowColors(false); treeWidget->setSelectionMode(QAbstractItemView::NoSelection); diff --git a/examples/widgets/tools/undoframework/diagramscene.cpp b/examples/widgets/tools/undoframework/diagramscene.cpp index bef3b89df0..1083cba5db 100644 --- a/examples/widgets/tools/undoframework/diagramscene.cpp +++ b/examples/widgets/tools/undoframework/diagramscene.cpp @@ -59,8 +59,8 @@ void DiagramScene::mousePressEvent(QGraphicsSceneMouseEvent *event) if (movingItem != 0 && event->button() == Qt::LeftButton) { oldPos = movingItem->pos(); } - - clearSelection(); + + clearSelection(); QGraphicsScene::mousePressEvent(event); } diff --git a/examples/widgets/tutorials/addressbook-fr/part1/addressbook.cpp b/examples/widgets/tutorials/addressbook-fr/part1/addressbook.cpp index 4e8c95635b..60acd6bb27 100644 --- a/examples/widgets/tutorials/addressbook-fr/part1/addressbook.cpp +++ b/examples/widgets/tutorials/addressbook-fr/part1/addressbook.cpp @@ -60,7 +60,7 @@ AddressBook::AddressBook(QWidget *parent) mainLayout->addWidget(addressText, 1, 1); //! [layout] -//![setting the layout] +//![setting the layout] setLayout(mainLayout); setWindowTitle(tr("Simple Address Book")); } diff --git a/examples/widgets/tutorials/addressbook-fr/part2/addressbook.cpp b/examples/widgets/tutorials/addressbook-fr/part2/addressbook.cpp index bb221d2222..d88716a8c8 100644 --- a/examples/widgets/tutorials/addressbook-fr/part2/addressbook.cpp +++ b/examples/widgets/tutorials/addressbook-fr/part2/addressbook.cpp @@ -51,10 +51,10 @@ AddressBook::AddressBook(QWidget *parent) //! [setting readonly 1] QLabel *addressLabel = new QLabel(tr("Address:")); addressText = new QTextEdit; -//! [setting readonly 2] +//! [setting readonly 2] addressText->setReadOnly(true); //! [setting readonly 2] - + //! [pushbutton declaration] addButton = new QPushButton(tr("&Add")); addButton->show(); @@ -94,7 +94,7 @@ void AddressBook::addContact() nameLine->clear(); addressText->clear(); - + nameLine->setReadOnly(false); nameLine->setFocus(Qt::OtherFocusReason); addressText->setReadOnly(false); @@ -110,7 +110,7 @@ void AddressBook::submitContact() { QString name = nameLine->text(); QString address = addressText->toPlainText(); - + if ( name.isEmpty()|| address.isEmpty()) { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); @@ -152,6 +152,6 @@ void AddressBook::cancel() addButton->setEnabled(true); submitButton->hide(); - cancelButton->hide(); + cancelButton->hide(); } //! [cancel] diff --git a/examples/widgets/tutorials/addressbook-fr/part3/addressbook.cpp b/examples/widgets/tutorials/addressbook-fr/part3/addressbook.cpp index 09b1e06bfe..86ff58d015 100644 --- a/examples/widgets/tutorials/addressbook-fr/part3/addressbook.cpp +++ b/examples/widgets/tutorials/addressbook-fr/part3/addressbook.cpp @@ -51,7 +51,7 @@ AddressBook::AddressBook(QWidget *parent) QLabel *addressLabel = new QLabel(tr("Address:")); addressText = new QTextEdit; addressText->setReadOnly(true); - + addButton = new QPushButton(tr("&Add")); addButton->show(); submitButton = new QPushButton(tr("&Submit")); @@ -68,7 +68,7 @@ AddressBook::AddressBook(QWidget *parent) connect(addButton, SIGNAL(clicked()), this, SLOT(addContact())); connect(submitButton, SIGNAL(clicked()), this, SLOT(submitContact())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); -//! [connecting navigation signals] +//! [connecting navigation signals] connect(nextButton, SIGNAL(clicked()), this, SLOT(next())); connect(previousButton, SIGNAL(clicked()), this, SLOT(previous())); //! [connecting navigation signals] @@ -107,7 +107,7 @@ void AddressBook::addContact() nameLine->setReadOnly(false); nameLine->setFocus(Qt::OtherFocusReason); addressText->setReadOnly(false); - + addButton->setEnabled(false); //! [disabling navigation] nextButton->setEnabled(false); @@ -121,7 +121,7 @@ void AddressBook::submitContact() { QString name = nameLine->text(); QString address = addressText->toPlainText(); - + if (name.isEmpty() || address.isEmpty()) { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); @@ -159,20 +159,20 @@ void AddressBook::cancel() { nameLine->setText(oldName); addressText->setText(oldAddress); - + if (contacts.isEmpty()) { nameLine->clear(); addressText->clear(); } - + nameLine->setReadOnly(true); addressText->setReadOnly(true); addButton->setEnabled(true); - + int number = contacts.size(); nextButton->setEnabled(number > 1); previousButton->setEnabled(number > 1); - + submitButton->hide(); cancelButton->hide(); } diff --git a/examples/widgets/tutorials/addressbook-fr/part3/addressbook.h b/examples/widgets/tutorials/addressbook-fr/part3/addressbook.h index 2458645ab5..3613fedb34 100644 --- a/examples/widgets/tutorials/addressbook-fr/part3/addressbook.h +++ b/examples/widgets/tutorials/addressbook-fr/part3/addressbook.h @@ -65,16 +65,16 @@ public slots: //! [navigation functions] void next(); void previous(); -//! [navigation functions] +//! [navigation functions] private: QPushButton *addButton; QPushButton *submitButton; QPushButton *cancelButton; -//! [navigation pushbuttons] +//! [navigation pushbuttons] QPushButton *nextButton; QPushButton *previousButton; -//! [navigation pushbuttons] +//! [navigation pushbuttons] QLineEdit *nameLine; QTextEdit *addressText; diff --git a/examples/widgets/tutorials/addressbook-fr/part4/addressbook.cpp b/examples/widgets/tutorials/addressbook-fr/part4/addressbook.cpp index 2d158f3f17..70f5d110db 100644 --- a/examples/widgets/tutorials/addressbook-fr/part4/addressbook.cpp +++ b/examples/widgets/tutorials/addressbook-fr/part4/addressbook.cpp @@ -53,17 +53,17 @@ AddressBook::AddressBook(QWidget *parent) addressText->setReadOnly(true); addButton = new QPushButton(tr("&Add")); -//! [edit and remove buttons] +//! [edit and remove buttons] editButton = new QPushButton(tr("&Edit")); editButton->setEnabled(false); removeButton = new QPushButton(tr("&Remove")); removeButton->setEnabled(false); -//! [edit and remove buttons] +//! [edit and remove buttons] submitButton = new QPushButton(tr("&Submit")); submitButton->hide(); cancelButton = new QPushButton(tr("&Cancel")); cancelButton->hide(); - + nextButton = new QPushButton(tr("&Next")); nextButton->setEnabled(false); previousButton = new QPushButton(tr("&Previous")); @@ -71,20 +71,20 @@ AddressBook::AddressBook(QWidget *parent) connect(addButton, SIGNAL(clicked()), this, SLOT(addContact())); connect(submitButton, SIGNAL(clicked()), this, SLOT(submitContact())); -//! [connecting edit and remove] +//! [connecting edit and remove] connect(editButton, SIGNAL(clicked()), this, SLOT(editContact())); connect(removeButton, SIGNAL(clicked()), this, SLOT(removeContact())); -//! [connecting edit and remove] +//! [connecting edit and remove] connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); connect(nextButton, SIGNAL(clicked()), this, SLOT(next())); connect(previousButton, SIGNAL(clicked()), this, SLOT(previous())); QVBoxLayout *buttonLayout1 = new QVBoxLayout; buttonLayout1->addWidget(addButton); -//! [adding edit and remove to the layout] +//! [adding edit and remove to the layout] buttonLayout1->addWidget(editButton); buttonLayout1->addWidget(removeButton); -//! [adding edit and remove to the layout] +//! [adding edit and remove to the layout] buttonLayout1->addWidget(submitButton); buttonLayout1->addWidget(cancelButton); buttonLayout1->addStretch(); @@ -138,7 +138,7 @@ void AddressBook::submitContact() } //! [submitContact() function part1] if (currentMode == AddingMode) { - + if (!contacts.contains(name)) { contacts.insert(name, address); QMessageBox::information(this, tr("Add Successful"), @@ -150,7 +150,7 @@ void AddressBook::submitContact() //! [submitContact() function part1] //! [submitContact() function part2] } else if (currentMode == EditingMode) { - + if (oldName != name) { if (!contacts.contains(name)) { QMessageBox::information(this, tr("Edit Successful"), @@ -164,7 +164,7 @@ void AddressBook::submitContact() } else if (oldAddress != address) { QMessageBox::information(this, tr("Edit Successful"), tr("\"%1\" has been edited in your address book.").arg(name)); - contacts[name] = address; + contacts[name] = address; } } @@ -192,7 +192,7 @@ void AddressBook::removeContact() QMessageBox::Yes | QMessageBox::No); if (button == QMessageBox::Yes) { - + previous(); contacts.remove(name); @@ -243,7 +243,7 @@ void AddressBook::updateInterface(Mode mode) currentMode = mode; switch (currentMode) { - + case AddingMode: case EditingMode: diff --git a/examples/widgets/tutorials/addressbook-fr/part4/addressbook.h b/examples/widgets/tutorials/addressbook-fr/part4/addressbook.h index ff8c4f0318..6430ac3413 100644 --- a/examples/widgets/tutorials/addressbook-fr/part4/addressbook.h +++ b/examples/widgets/tutorials/addressbook-fr/part4/addressbook.h @@ -77,10 +77,10 @@ private: void updateInterface(Mode mode); //! [updateInterface() declaration] QPushButton *addButton; -//! [buttons declaration] +//! [buttons declaration] QPushButton *editButton; QPushButton *removeButton; -//! [buttons declaration] +//! [buttons declaration] QPushButton *submitButton; QPushButton *cancelButton; QPushButton *nextButton; @@ -91,9 +91,9 @@ private: QMap contacts; QString oldName; QString oldAddress; -//! [mode declaration] +//! [mode declaration] Mode currentMode; -//! [mode declaration] +//! [mode declaration] }; #endif diff --git a/examples/widgets/tutorials/addressbook-fr/part5/addressbook.cpp b/examples/widgets/tutorials/addressbook-fr/part5/addressbook.cpp index 02f4788537..33af5f1e4e 100644 --- a/examples/widgets/tutorials/addressbook-fr/part5/addressbook.cpp +++ b/examples/widgets/tutorials/addressbook-fr/part5/addressbook.cpp @@ -81,19 +81,19 @@ AddressBook::AddressBook(QWidget *parent) connect(editButton, SIGNAL(clicked()), this, SLOT(editContact())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); connect(removeButton, SIGNAL(clicked()), this, SLOT(removeContact())); -//! [signals and slots for find] +//! [signals and slots for find] connect(findButton, SIGNAL(clicked()), this, SLOT(findContact())); -//! [signals and slots for find] +//! [signals and slots for find] connect(nextButton, SIGNAL(clicked()), this, SLOT(next())); connect(previousButton, SIGNAL(clicked()), this, SLOT(previous())); - + QVBoxLayout *buttonLayout1 = new QVBoxLayout; buttonLayout1->addWidget(addButton); buttonLayout1->addWidget(editButton); buttonLayout1->addWidget(removeButton); -//! [adding findButton to layout] +//! [adding findButton to layout] buttonLayout1->addWidget(findButton); -//! [adding findButton to layout] +//! [adding findButton to layout] buttonLayout1->addWidget(submitButton); buttonLayout1->addWidget(cancelButton); buttonLayout1->addStretch(); @@ -145,7 +145,7 @@ void AddressBook::submitContact() } if (currentMode == AddingMode) { - + if (!contacts.contains(name)) { contacts.insert(name, address); QMessageBox::information(this, tr("Add Successful"), @@ -155,7 +155,7 @@ void AddressBook::submitContact() tr("Sorry, \"%1\" is already in your address book.").arg(name)); } } else if (currentMode == EditingMode) { - + if (oldName != name) { if (!contacts.contains(name)) { QMessageBox::information(this, tr("Edit Successful"), @@ -196,7 +196,7 @@ void AddressBook::removeContact() QMessageBox::Yes | QMessageBox::No); if (button == QMessageBox::Yes) { - + previous(); contacts.remove(name); @@ -241,7 +241,7 @@ void AddressBook::previous() nameLine->setText(i.key()); addressText->setText(i.value()); } -//! [findContact() function] +//! [findContact() function] void AddressBook::findContact() { dialog->show(); @@ -261,7 +261,7 @@ void AddressBook::findContact() updateInterface(NavigationMode); } -//! [findContact() function] +//! [findContact() function] void AddressBook::updateInterface(Mode mode) { @@ -288,7 +288,7 @@ void AddressBook::updateInterface(Mode mode) break; case NavigationMode: - + if (contacts.isEmpty()) { nameLine->clear(); addressText->clear(); diff --git a/examples/widgets/tutorials/addressbook-fr/part5/addressbook.h b/examples/widgets/tutorials/addressbook-fr/part5/addressbook.h index 5e2c18e91a..f8a53304ee 100644 --- a/examples/widgets/tutorials/addressbook-fr/part5/addressbook.h +++ b/examples/widgets/tutorials/addressbook-fr/part5/addressbook.h @@ -68,9 +68,9 @@ public slots: void submitContact(); void cancel(); void removeContact(); -//! [findContact() declaration] +//! [findContact() declaration] void findContact(); -//! [findContact() declaration] +//! [findContact() declaration] void next(); void previous(); @@ -80,9 +80,9 @@ private: QPushButton *addButton; QPushButton *editButton; QPushButton *removeButton; -//! [findButton declaration] +//! [findButton declaration] QPushButton *findButton; -//! [findButton declaration] +//! [findButton declaration] QPushButton *submitButton; QPushButton *cancelButton; QPushButton *nextButton; @@ -91,9 +91,9 @@ private: QTextEdit *addressText; QMap contacts; -//! [FindDialog declaration] +//! [FindDialog declaration] FindDialog *dialog; -//! [FindDialog declaration] +//! [FindDialog declaration] QString oldName; QString oldAddress; Mode currentMode; diff --git a/examples/widgets/tutorials/addressbook-fr/part6/addressbook.cpp b/examples/widgets/tutorials/addressbook-fr/part6/addressbook.cpp index e8caa628a5..e81c959c2c 100644 --- a/examples/widgets/tutorials/addressbook-fr/part6/addressbook.cpp +++ b/examples/widgets/tutorials/addressbook-fr/part6/addressbook.cpp @@ -71,9 +71,9 @@ AddressBook::AddressBook(QWidget *parent) previousButton->setEnabled(false); loadButton = new QPushButton(tr("&Load...")); -//! [tooltip 1] +//! [tooltip 1] loadButton->setToolTip(tr("Load contacts from a file")); -//! [tooltip 1] +//! [tooltip 1] saveButton = new QPushButton(tr("Sa&ve...")); //! [tooltip 2] saveButton->setToolTip(tr("Save contacts to a file")); @@ -92,7 +92,7 @@ AddressBook::AddressBook(QWidget *parent) connect(previousButton, SIGNAL(clicked()), this, SLOT(previous())); connect(loadButton, SIGNAL(clicked()), this, SLOT(loadFromFile())); connect(saveButton, SIGNAL(clicked()), this, SLOT(saveToFile())); - + QVBoxLayout *buttonLayout1 = new QVBoxLayout; buttonLayout1->addWidget(addButton); buttonLayout1->addWidget(editButton); @@ -151,7 +151,7 @@ void AddressBook::submitContact() } if (currentMode == AddingMode) { - + if (!contacts.contains(name)) { contacts.insert(name, address); QMessageBox::information(this, tr("Add Successful"), @@ -161,7 +161,7 @@ void AddressBook::submitContact() tr("Sorry, \"%1\" is already in your address book.").arg(name)); } } else if (currentMode == EditingMode) { - + if (oldName != name) { if (!contacts.contains(name)) { QMessageBox::information(this, tr("Edit Successful"), @@ -202,7 +202,7 @@ void AddressBook::removeContact() QMessageBox::Yes | QMessageBox::No); if (button == QMessageBox::Yes) { - + previous(); contacts.remove(name); @@ -296,7 +296,7 @@ void AddressBook::updateInterface(Mode mode) break; case NavigationMode: - + if (contacts.isEmpty()) { nameLine->clear(); addressText->clear(); @@ -341,12 +341,12 @@ void AddressBook::saveToFile() return; } -//! [saveToFile() function part2] +//! [saveToFile() function part2] //! [saveToFile() function part3] QDataStream out(&file); out.setVersion(QDataStream::Qt_4_5); out << contacts; - } + } } //! [saveToFile() function part3] @@ -362,15 +362,15 @@ void AddressBook::loadFromFile() if (fileName.isEmpty()) return; else { - + QFile file(fileName); - + if (!file.open(QIODevice::ReadOnly)) { QMessageBox::information(this, tr("Unable to open file"), file.errorString()); return; } - + QDataStream in(&file); in.setVersion(QDataStream::Qt_4_5); contacts.empty(); // empty existing contacts diff --git a/examples/widgets/tutorials/addressbook-fr/part6/addressbook.h b/examples/widgets/tutorials/addressbook-fr/part6/addressbook.h index 99dfd1e404..ce2691ccad 100644 --- a/examples/widgets/tutorials/addressbook-fr/part6/addressbook.h +++ b/examples/widgets/tutorials/addressbook-fr/part6/addressbook.h @@ -70,10 +70,10 @@ public slots: void findContact(); void next(); void previous(); -//! [save and load functions declaration] +//! [save and load functions declaration] void saveToFile(); void loadFromFile(); -//! [save and load functions declaration] +//! [save and load functions declaration] private: void updateInterface(Mode mode); @@ -86,10 +86,10 @@ private: QPushButton *cancelButton; QPushButton *nextButton; QPushButton *previousButton; -//! [save and load buttons declaration] +//! [save and load buttons declaration] QPushButton *loadButton; QPushButton *saveButton; -//! [save and load buttons declaration] +//! [save and load buttons declaration] QLineEdit *nameLine; QTextEdit *addressText; diff --git a/examples/widgets/tutorials/addressbook-fr/part7/addressbook.cpp b/examples/widgets/tutorials/addressbook-fr/part7/addressbook.cpp index a91a3bbc12..a0780ae78a 100644 --- a/examples/widgets/tutorials/addressbook-fr/part7/addressbook.cpp +++ b/examples/widgets/tutorials/addressbook-fr/part7/addressbook.cpp @@ -93,7 +93,7 @@ AddressBook::AddressBook(QWidget *parent) connect(loadButton, SIGNAL(clicked()), this, SLOT(loadFromFile())); connect(saveButton, SIGNAL(clicked()), this, SLOT(saveToFile())); connect(exportButton, SIGNAL(clicked()), this, SLOT(exportAsVCard())); - + QVBoxLayout *buttonLayout1 = new QVBoxLayout; buttonLayout1->addWidget(addButton); buttonLayout1->addWidget(editButton); @@ -153,7 +153,7 @@ void AddressBook::submitContact() } if (currentMode == AddingMode) { - + if (!contacts.contains(name)) { contacts.insert(name, address); QMessageBox::information(this, tr("Add Successful"), @@ -163,7 +163,7 @@ void AddressBook::submitContact() tr("Sorry, \"%1\" is already in your address book.").arg(name)); } } else if (currentMode == EditingMode) { - + if (oldName != name) { if (!contacts.contains(name)) { QMessageBox::information(this, tr("Edit Successful"), @@ -204,7 +204,7 @@ void AddressBook::removeContact() QMessageBox::Yes | QMessageBox::No); if (button == QMessageBox::Yes) { - + previous(); contacts.remove(name); @@ -298,7 +298,7 @@ void AddressBook::updateInterface(Mode mode) break; case NavigationMode: - + if (contacts.isEmpty()) { nameLine->clear(); addressText->clear(); @@ -331,7 +331,7 @@ void AddressBook::saveToFile() QString fileName = QFileDialog::getSaveFileName(this, tr("Save Address Book"), "", tr("Address Book (*.abk);;All Files (*)")); - + if (fileName.isEmpty()) return; else { @@ -404,14 +404,14 @@ void AddressBook::exportAsVCard() QString fileName = QFileDialog::getSaveFileName(this, tr("Export Contact"), "", tr("vCard Files (*.vcf);;All Files (*)")); - + if (fileName.isEmpty()) return; QFile file(fileName); //! [export function part1] - -//! [export function part2] + +//! [export function part2] if (!file.open(QIODevice::WriteOnly)) { QMessageBox::information(this, tr("Unable to open file"), file.errorString()); @@ -425,12 +425,12 @@ void AddressBook::exportAsVCard() out << "BEGIN:VCARD" << "\n"; out << "VERSION:2.1" << "\n"; out << "N:" << lastName << ";" << firstName << "\n"; - - if (!nameList.isEmpty()) + + if (!nameList.isEmpty()) out << "FN:" << nameList.join(' ') << "\n"; else out << "FN:" << firstName << "\n"; -//! [export function part3] +//! [export function part3] //! [export function part4] address.replace(";", "\\;", Qt::CaseInsensitive); diff --git a/examples/widgets/tutorials/addressbook-fr/part7/addressbook.h b/examples/widgets/tutorials/addressbook-fr/part7/addressbook.h index a34cf24a23..d672c7a85b 100644 --- a/examples/widgets/tutorials/addressbook-fr/part7/addressbook.h +++ b/examples/widgets/tutorials/addressbook-fr/part7/addressbook.h @@ -74,7 +74,7 @@ public slots: void loadFromFile(); //! [exportAsVCard() declaration] void exportAsVCard(); -//! [exportAsVCard() declaration] +//! [exportAsVCard() declaration] private: void updateInterface(Mode mode); @@ -89,9 +89,9 @@ private: QPushButton *previousButton; QPushButton *loadButton; QPushButton *saveButton; -//! [exportButton declaration] +//! [exportButton declaration] QPushButton *exportButton; -//! [exportButton declaration] +//! [exportButton declaration] QLineEdit *nameLine; QTextEdit *addressText; diff --git a/examples/widgets/tutorials/addressbook/part1/addressbook.cpp b/examples/widgets/tutorials/addressbook/part1/addressbook.cpp index 4e8c95635b..60acd6bb27 100644 --- a/examples/widgets/tutorials/addressbook/part1/addressbook.cpp +++ b/examples/widgets/tutorials/addressbook/part1/addressbook.cpp @@ -60,7 +60,7 @@ AddressBook::AddressBook(QWidget *parent) mainLayout->addWidget(addressText, 1, 1); //! [layout] -//![setting the layout] +//![setting the layout] setLayout(mainLayout); setWindowTitle(tr("Simple Address Book")); } diff --git a/examples/widgets/tutorials/addressbook/part2/addressbook.cpp b/examples/widgets/tutorials/addressbook/part2/addressbook.cpp index e6f3409efc..6fd5d03fea 100644 --- a/examples/widgets/tutorials/addressbook/part2/addressbook.cpp +++ b/examples/widgets/tutorials/addressbook/part2/addressbook.cpp @@ -51,10 +51,10 @@ AddressBook::AddressBook(QWidget *parent) //! [setting readonly 1] QLabel *addressLabel = new QLabel(tr("Address:")); addressText = new QTextEdit; -//! [setting readonly 2] +//! [setting readonly 2] addressText->setReadOnly(true); //! [setting readonly 2] - + //! [pushbutton declaration] addButton = new QPushButton(tr("&Add")); addButton->show(); @@ -94,7 +94,7 @@ void AddressBook::addContact() nameLine->clear(); addressText->clear(); - + nameLine->setReadOnly(false); nameLine->setFocus(Qt::OtherFocusReason); addressText->setReadOnly(false); @@ -110,7 +110,7 @@ void AddressBook::submitContact() { QString name = nameLine->text(); QString address = addressText->toPlainText(); - + if (name.isEmpty() || address.isEmpty()) { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); @@ -152,6 +152,6 @@ void AddressBook::cancel() addButton->setEnabled(true); submitButton->hide(); - cancelButton->hide(); + cancelButton->hide(); } //! [cancel] diff --git a/examples/widgets/tutorials/addressbook/part3/addressbook.cpp b/examples/widgets/tutorials/addressbook/part3/addressbook.cpp index 61c331d1f5..bcf3f63430 100644 --- a/examples/widgets/tutorials/addressbook/part3/addressbook.cpp +++ b/examples/widgets/tutorials/addressbook/part3/addressbook.cpp @@ -51,7 +51,7 @@ AddressBook::AddressBook(QWidget *parent) QLabel *addressLabel = new QLabel(tr("Address:")); addressText = new QTextEdit; addressText->setReadOnly(true); - + addButton = new QPushButton(tr("&Add")); addButton->show(); submitButton = new QPushButton(tr("&Submit")); @@ -68,7 +68,7 @@ AddressBook::AddressBook(QWidget *parent) connect(addButton, SIGNAL(clicked()), this, SLOT(addContact())); connect(submitButton, SIGNAL(clicked()), this, SLOT(submitContact())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); -//! [connecting navigation signals] +//! [connecting navigation signals] connect(nextButton, SIGNAL(clicked()), this, SLOT(next())); connect(previousButton, SIGNAL(clicked()), this, SLOT(previous())); //! [connecting navigation signals] @@ -107,7 +107,7 @@ void AddressBook::addContact() nameLine->setReadOnly(false); nameLine->setFocus(Qt::OtherFocusReason); addressText->setReadOnly(false); - + addButton->setEnabled(false); //! [disabling navigation] nextButton->setEnabled(false); @@ -121,7 +121,7 @@ void AddressBook::submitContact() { QString name = nameLine->text(); QString address = addressText->toPlainText(); - + if (name.isEmpty() || address.isEmpty()) { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); @@ -159,20 +159,20 @@ void AddressBook::cancel() { nameLine->setText(oldName); addressText->setText(oldAddress); - + if (contacts.isEmpty()) { nameLine->clear(); addressText->clear(); } - + nameLine->setReadOnly(true); addressText->setReadOnly(true); addButton->setEnabled(true); - + int number = contacts.size(); nextButton->setEnabled(number > 1); previousButton->setEnabled(number > 1); - + submitButton->hide(); cancelButton->hide(); } diff --git a/examples/widgets/tutorials/addressbook/part3/addressbook.h b/examples/widgets/tutorials/addressbook/part3/addressbook.h index 2458645ab5..3613fedb34 100644 --- a/examples/widgets/tutorials/addressbook/part3/addressbook.h +++ b/examples/widgets/tutorials/addressbook/part3/addressbook.h @@ -65,16 +65,16 @@ public slots: //! [navigation functions] void next(); void previous(); -//! [navigation functions] +//! [navigation functions] private: QPushButton *addButton; QPushButton *submitButton; QPushButton *cancelButton; -//! [navigation pushbuttons] +//! [navigation pushbuttons] QPushButton *nextButton; QPushButton *previousButton; -//! [navigation pushbuttons] +//! [navigation pushbuttons] QLineEdit *nameLine; QTextEdit *addressText; diff --git a/examples/widgets/tutorials/addressbook/part4/addressbook.cpp b/examples/widgets/tutorials/addressbook/part4/addressbook.cpp index 6b3731b5f6..66764a2815 100644 --- a/examples/widgets/tutorials/addressbook/part4/addressbook.cpp +++ b/examples/widgets/tutorials/addressbook/part4/addressbook.cpp @@ -53,17 +53,17 @@ AddressBook::AddressBook(QWidget *parent) addressText->setReadOnly(true); addButton = new QPushButton(tr("&Add")); -//! [edit and remove buttons] +//! [edit and remove buttons] editButton = new QPushButton(tr("&Edit")); editButton->setEnabled(false); removeButton = new QPushButton(tr("&Remove")); removeButton->setEnabled(false); -//! [edit and remove buttons] +//! [edit and remove buttons] submitButton = new QPushButton(tr("&Submit")); submitButton->hide(); cancelButton = new QPushButton(tr("&Cancel")); cancelButton->hide(); - + nextButton = new QPushButton(tr("&Next")); nextButton->setEnabled(false); previousButton = new QPushButton(tr("&Previous")); @@ -71,20 +71,20 @@ AddressBook::AddressBook(QWidget *parent) connect(addButton, SIGNAL(clicked()), this, SLOT(addContact())); connect(submitButton, SIGNAL(clicked()), this, SLOT(submitContact())); -//! [connecting edit and remove] +//! [connecting edit and remove] connect(editButton, SIGNAL(clicked()), this, SLOT(editContact())); connect(removeButton, SIGNAL(clicked()), this, SLOT(removeContact())); -//! [connecting edit and remove] +//! [connecting edit and remove] connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); connect(nextButton, SIGNAL(clicked()), this, SLOT(next())); connect(previousButton, SIGNAL(clicked()), this, SLOT(previous())); QVBoxLayout *buttonLayout1 = new QVBoxLayout; buttonLayout1->addWidget(addButton); -//! [adding edit and remove to the layout] +//! [adding edit and remove to the layout] buttonLayout1->addWidget(editButton); buttonLayout1->addWidget(removeButton); -//! [adding edit and remove to the layout] +//! [adding edit and remove to the layout] buttonLayout1->addWidget(submitButton); buttonLayout1->addWidget(cancelButton); buttonLayout1->addStretch(); @@ -138,7 +138,7 @@ void AddressBook::submitContact() } //! [submitContact() function part1] if (currentMode == AddingMode) { - + if (!contacts.contains(name)) { contacts.insert(name, address); QMessageBox::information(this, tr("Add Successful"), @@ -150,7 +150,7 @@ void AddressBook::submitContact() //! [submitContact() function part1] //! [submitContact() function part2] } else if (currentMode == EditingMode) { - + if (oldName != name) { if (!contacts.contains(name)) { QMessageBox::information(this, tr("Edit Successful"), @@ -164,7 +164,7 @@ void AddressBook::submitContact() } else if (oldAddress != address) { QMessageBox::information(this, tr("Edit Successful"), tr("\"%1\" has been edited in your address book.").arg(name)); - contacts[name] = address; + contacts[name] = address; } } @@ -192,7 +192,7 @@ void AddressBook::removeContact() QMessageBox::Yes | QMessageBox::No); if (button == QMessageBox::Yes) { - + previous(); contacts.remove(name); @@ -243,7 +243,7 @@ void AddressBook::updateInterface(Mode mode) currentMode = mode; switch (currentMode) { - + case AddingMode: case EditingMode: diff --git a/examples/widgets/tutorials/addressbook/part4/addressbook.h b/examples/widgets/tutorials/addressbook/part4/addressbook.h index ff8c4f0318..6430ac3413 100644 --- a/examples/widgets/tutorials/addressbook/part4/addressbook.h +++ b/examples/widgets/tutorials/addressbook/part4/addressbook.h @@ -77,10 +77,10 @@ private: void updateInterface(Mode mode); //! [updateInterface() declaration] QPushButton *addButton; -//! [buttons declaration] +//! [buttons declaration] QPushButton *editButton; QPushButton *removeButton; -//! [buttons declaration] +//! [buttons declaration] QPushButton *submitButton; QPushButton *cancelButton; QPushButton *nextButton; @@ -91,9 +91,9 @@ private: QMap contacts; QString oldName; QString oldAddress; -//! [mode declaration] +//! [mode declaration] Mode currentMode; -//! [mode declaration] +//! [mode declaration] }; #endif diff --git a/examples/widgets/tutorials/addressbook/part5/addressbook.cpp b/examples/widgets/tutorials/addressbook/part5/addressbook.cpp index 90eb81986a..ca2f72e9e1 100644 --- a/examples/widgets/tutorials/addressbook/part5/addressbook.cpp +++ b/examples/widgets/tutorials/addressbook/part5/addressbook.cpp @@ -81,19 +81,19 @@ AddressBook::AddressBook(QWidget *parent) connect(editButton, SIGNAL(clicked()), this, SLOT(editContact())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); connect(removeButton, SIGNAL(clicked()), this, SLOT(removeContact())); -//! [signals and slots for find] +//! [signals and slots for find] connect(findButton, SIGNAL(clicked()), this, SLOT(findContact())); -//! [signals and slots for find] +//! [signals and slots for find] connect(nextButton, SIGNAL(clicked()), this, SLOT(next())); connect(previousButton, SIGNAL(clicked()), this, SLOT(previous())); - + QVBoxLayout *buttonLayout1 = new QVBoxLayout; buttonLayout1->addWidget(addButton); buttonLayout1->addWidget(editButton); buttonLayout1->addWidget(removeButton); -//! [adding findButton to layout] +//! [adding findButton to layout] buttonLayout1->addWidget(findButton); -//! [adding findButton to layout] +//! [adding findButton to layout] buttonLayout1->addWidget(submitButton); buttonLayout1->addWidget(cancelButton); buttonLayout1->addStretch(); @@ -145,7 +145,7 @@ void AddressBook::submitContact() } if (currentMode == AddingMode) { - + if (!contacts.contains(name)) { contacts.insert(name, address); QMessageBox::information(this, tr("Add Successful"), @@ -155,7 +155,7 @@ void AddressBook::submitContact() tr("Sorry, \"%1\" is already in your address book.").arg(name)); } } else if (currentMode == EditingMode) { - + if (oldName != name) { if (!contacts.contains(name)) { QMessageBox::information(this, tr("Edit Successful"), @@ -196,7 +196,7 @@ void AddressBook::removeContact() QMessageBox::Yes | QMessageBox::No); if (button == QMessageBox::Yes) { - + previous(); contacts.remove(name); @@ -241,7 +241,7 @@ void AddressBook::previous() nameLine->setText(i.key()); addressText->setText(i.value()); } -//! [findContact() function] +//! [findContact() function] void AddressBook::findContact() { dialog->show(); @@ -261,7 +261,7 @@ void AddressBook::findContact() updateInterface(NavigationMode); } -//! [findContact() function] +//! [findContact() function] void AddressBook::updateInterface(Mode mode) { @@ -288,7 +288,7 @@ void AddressBook::updateInterface(Mode mode) break; case NavigationMode: - + if (contacts.isEmpty()) { nameLine->clear(); addressText->clear(); diff --git a/examples/widgets/tutorials/addressbook/part5/addressbook.h b/examples/widgets/tutorials/addressbook/part5/addressbook.h index 5e2c18e91a..f8a53304ee 100644 --- a/examples/widgets/tutorials/addressbook/part5/addressbook.h +++ b/examples/widgets/tutorials/addressbook/part5/addressbook.h @@ -68,9 +68,9 @@ public slots: void submitContact(); void cancel(); void removeContact(); -//! [findContact() declaration] +//! [findContact() declaration] void findContact(); -//! [findContact() declaration] +//! [findContact() declaration] void next(); void previous(); @@ -80,9 +80,9 @@ private: QPushButton *addButton; QPushButton *editButton; QPushButton *removeButton; -//! [findButton declaration] +//! [findButton declaration] QPushButton *findButton; -//! [findButton declaration] +//! [findButton declaration] QPushButton *submitButton; QPushButton *cancelButton; QPushButton *nextButton; @@ -91,9 +91,9 @@ private: QTextEdit *addressText; QMap contacts; -//! [FindDialog declaration] +//! [FindDialog declaration] FindDialog *dialog; -//! [FindDialog declaration] +//! [FindDialog declaration] QString oldName; QString oldAddress; Mode currentMode; diff --git a/examples/widgets/tutorials/addressbook/part6/addressbook.cpp b/examples/widgets/tutorials/addressbook/part6/addressbook.cpp index a9bc2cc51c..2ced8e2404 100644 --- a/examples/widgets/tutorials/addressbook/part6/addressbook.cpp +++ b/examples/widgets/tutorials/addressbook/part6/addressbook.cpp @@ -71,9 +71,9 @@ AddressBook::AddressBook(QWidget *parent) previousButton->setEnabled(false); loadButton = new QPushButton(tr("&Load...")); -//! [tooltip 1] +//! [tooltip 1] loadButton->setToolTip(tr("Load contacts from a file")); -//! [tooltip 1] +//! [tooltip 1] saveButton = new QPushButton(tr("&Save...")); //! [tooltip 2] saveButton->setToolTip(tr("Save contacts to a file")); @@ -92,7 +92,7 @@ AddressBook::AddressBook(QWidget *parent) connect(previousButton, SIGNAL(clicked()), this, SLOT(previous())); connect(loadButton, SIGNAL(clicked()), this, SLOT(loadFromFile())); connect(saveButton, SIGNAL(clicked()), this, SLOT(saveToFile())); - + QVBoxLayout *buttonLayout1 = new QVBoxLayout; buttonLayout1->addWidget(addButton); buttonLayout1->addWidget(editButton); @@ -151,7 +151,7 @@ void AddressBook::submitContact() } if (currentMode == AddingMode) { - + if (!contacts.contains(name)) { contacts.insert(name, address); QMessageBox::information(this, tr("Add Successful"), @@ -161,7 +161,7 @@ void AddressBook::submitContact() tr("Sorry, \"%1\" is already in your address book.").arg(name)); } } else if (currentMode == EditingMode) { - + if (oldName != name) { if (!contacts.contains(name)) { QMessageBox::information(this, tr("Edit Successful"), @@ -202,7 +202,7 @@ void AddressBook::removeContact() QMessageBox::Yes | QMessageBox::No); if (button == QMessageBox::Yes) { - + previous(); contacts.remove(name); @@ -296,7 +296,7 @@ void AddressBook::updateInterface(Mode mode) break; case NavigationMode: - + if (contacts.isEmpty()) { nameLine->clear(); addressText->clear(); @@ -341,12 +341,12 @@ void AddressBook::saveToFile() return; } -//! [saveToFile() function part2] +//! [saveToFile() function part2] //! [saveToFile() function part3] QDataStream out(&file); out.setVersion(QDataStream::Qt_4_5); out << contacts; - } + } } //! [saveToFile() function part3] @@ -362,15 +362,15 @@ void AddressBook::loadFromFile() if (fileName.isEmpty()) return; else { - + QFile file(fileName); - + if (!file.open(QIODevice::ReadOnly)) { QMessageBox::information(this, tr("Unable to open file"), file.errorString()); return; } - + QDataStream in(&file); in.setVersion(QDataStream::Qt_4_5); contacts.clear(); // clear existing contacts diff --git a/examples/widgets/tutorials/addressbook/part6/addressbook.h b/examples/widgets/tutorials/addressbook/part6/addressbook.h index 99dfd1e404..ce2691ccad 100644 --- a/examples/widgets/tutorials/addressbook/part6/addressbook.h +++ b/examples/widgets/tutorials/addressbook/part6/addressbook.h @@ -70,10 +70,10 @@ public slots: void findContact(); void next(); void previous(); -//! [save and load functions declaration] +//! [save and load functions declaration] void saveToFile(); void loadFromFile(); -//! [save and load functions declaration] +//! [save and load functions declaration] private: void updateInterface(Mode mode); @@ -86,10 +86,10 @@ private: QPushButton *cancelButton; QPushButton *nextButton; QPushButton *previousButton; -//! [save and load buttons declaration] +//! [save and load buttons declaration] QPushButton *loadButton; QPushButton *saveButton; -//! [save and load buttons declaration] +//! [save and load buttons declaration] QLineEdit *nameLine; QTextEdit *addressText; diff --git a/examples/widgets/tutorials/addressbook/part7/addressbook.cpp b/examples/widgets/tutorials/addressbook/part7/addressbook.cpp index 6ad7630e8d..2060d97d2f 100644 --- a/examples/widgets/tutorials/addressbook/part7/addressbook.cpp +++ b/examples/widgets/tutorials/addressbook/part7/addressbook.cpp @@ -93,7 +93,7 @@ AddressBook::AddressBook(QWidget *parent) connect(loadButton, SIGNAL(clicked()), this, SLOT(loadFromFile())); connect(saveButton, SIGNAL(clicked()), this, SLOT(saveToFile())); connect(exportButton, SIGNAL(clicked()), this, SLOT(exportAsVCard())); - + QVBoxLayout *buttonLayout1 = new QVBoxLayout; buttonLayout1->addWidget(addButton); buttonLayout1->addWidget(editButton); @@ -153,7 +153,7 @@ void AddressBook::submitContact() } if (currentMode == AddingMode) { - + if (!contacts.contains(name)) { contacts.insert(name, address); QMessageBox::information(this, tr("Add Successful"), @@ -163,7 +163,7 @@ void AddressBook::submitContact() tr("Sorry, \"%1\" is already in your address book.").arg(name)); } } else if (currentMode == EditingMode) { - + if (oldName != name) { if (!contacts.contains(name)) { QMessageBox::information(this, tr("Edit Successful"), @@ -204,7 +204,7 @@ void AddressBook::removeContact() QMessageBox::Yes | QMessageBox::No); if (button == QMessageBox::Yes) { - + previous(); contacts.remove(name); @@ -298,7 +298,7 @@ void AddressBook::updateInterface(Mode mode) break; case NavigationMode: - + if (contacts.isEmpty()) { nameLine->clear(); addressText->clear(); @@ -331,7 +331,7 @@ void AddressBook::saveToFile() QString fileName = QFileDialog::getSaveFileName(this, tr("Save Address Book"), "", tr("Address Book (*.abk);;All Files (*)")); - + if (fileName.isEmpty()) return; else { @@ -404,14 +404,14 @@ void AddressBook::exportAsVCard() QString fileName = QFileDialog::getSaveFileName(this, tr("Export Contact"), "", tr("vCard Files (*.vcf);;All Files (*)")); - + if (fileName.isEmpty()) return; QFile file(fileName); //! [export function part1] - -//! [export function part2] + +//! [export function part2] if (!file.open(QIODevice::WriteOnly)) { QMessageBox::information(this, tr("Unable to open file"), file.errorString()); @@ -425,12 +425,12 @@ void AddressBook::exportAsVCard() out << "BEGIN:VCARD" << "\n"; out << "VERSION:2.1" << "\n"; out << "N:" << lastName << ";" << firstName << "\n"; - - if (!nameList.isEmpty()) + + if (!nameList.isEmpty()) out << "FN:" << nameList.join(' ') << "\n"; else out << "FN:" << firstName << "\n"; -//! [export function part3] +//! [export function part3] //! [export function part4] address.replace(";", "\\;", Qt::CaseInsensitive); diff --git a/examples/widgets/tutorials/addressbook/part7/addressbook.h b/examples/widgets/tutorials/addressbook/part7/addressbook.h index a34cf24a23..d672c7a85b 100644 --- a/examples/widgets/tutorials/addressbook/part7/addressbook.h +++ b/examples/widgets/tutorials/addressbook/part7/addressbook.h @@ -74,7 +74,7 @@ public slots: void loadFromFile(); //! [exportAsVCard() declaration] void exportAsVCard(); -//! [exportAsVCard() declaration] +//! [exportAsVCard() declaration] private: void updateInterface(Mode mode); @@ -89,9 +89,9 @@ private: QPushButton *previousButton; QPushButton *loadButton; QPushButton *saveButton; -//! [exportButton declaration] +//! [exportButton declaration] QPushButton *exportButton; -//! [exportButton declaration] +//! [exportButton declaration] QLineEdit *nameLine; QTextEdit *addressText; diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/part3/main.cpp b/examples/widgets/tutorials/gettingStarted/gsQt/part3/main.cpp index e780986a53..bd0202c967 100644 --- a/examples/widgets/tutorials/gettingStarted/gsQt/part3/main.cpp +++ b/examples/widgets/tutorials/gettingStarted/gsQt/part3/main.cpp @@ -67,7 +67,7 @@ Notepad::Notepad() layout->addWidget(textEdit); layout->addWidget(quitButton); - setLayout(layout); + setLayout(layout); setWindowTitle(tr("Notepad")); } @@ -79,7 +79,7 @@ void Notepad::quit() messageBox.setText(tr("Do you really want to quit?")); messageBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); messageBox.setDefaultButton(QMessageBox::No); - if (messageBox.exec() == QMessageBox::Yes) + if (messageBox.exec() == QMessageBox::Yes) qApp->quit(); } diff --git a/examples/widgets/tutorials/modelview/5_edit/mymodel.cpp b/examples/widgets/tutorials/modelview/5_edit/mymodel.cpp index a3567a08ab..317c4760fb 100644 --- a/examples/widgets/tutorials/modelview/5_edit/mymodel.cpp +++ b/examples/widgets/tutorials/modelview/5_edit/mymodel.cpp @@ -78,7 +78,7 @@ 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 - QString result; + QString result; for(int row= 0; row < ROWS; row++) { for(int col= 0; col < COLS; col++) diff --git a/examples/widgets/tutorials/modelview/7_selections/mainwindow.cpp b/examples/widgets/tutorials/modelview/7_selections/mainwindow.cpp index d969582928..0c1eb290fa 100644 --- a/examples/widgets/tutorials/modelview/7_selections/mainwindow.cpp +++ b/examples/widgets/tutorials/modelview/7_selections/mainwindow.cpp @@ -72,7 +72,7 @@ MainWindow::MainWindow(QWidget *parent) europeItem-> appendRow(italyItem); italyItem-> appendRow(romeItem); italyItem-> appendRow(veronaItem); - + //register the model treeView->setModel(standardModel); treeView->expandAll(); diff --git a/examples/widgets/widgets/calculator/button.cpp b/examples/widgets/widgets/calculator/button.cpp index 70dbd52fca..395f685751 100644 --- a/examples/widgets/widgets/calculator/button.cpp +++ b/examples/widgets/widgets/calculator/button.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "button.h" diff --git a/examples/widgets/widgets/codeeditor/codeeditor.cpp b/examples/widgets/widgets/codeeditor/codeeditor.cpp index 2a7865ce6e..7da0930301 100644 --- a/examples/widgets/widgets/codeeditor/codeeditor.cpp +++ b/examples/widgets/widgets/codeeditor/codeeditor.cpp @@ -79,7 +79,7 @@ int CodeEditor::lineNumberAreaWidth() //![slotUpdateExtraAreaWidth] void CodeEditor::updateLineNumberAreaWidth(int /* newBlockCount */) -{ +{ setViewportMargins(lineNumberAreaWidth(), 0, 0, 0); } @@ -120,7 +120,7 @@ void CodeEditor::highlightCurrentLine() if (!isReadOnly()) { QTextEdit::ExtraSelection selection; - + QColor lineColor = QColor(Qt::yellow).lighter(160); selection.format.setBackground(lineColor); diff --git a/examples/widgets/widgets/scribble/scribblearea.cpp b/examples/widgets/widgets/scribble/scribblearea.cpp index 24e2b2b159..4028263e69 100644 --- a/examples/widgets/widgets/scribble/scribblearea.cpp +++ b/examples/widgets/widgets/scribble/scribblearea.cpp @@ -202,7 +202,7 @@ void ScribbleArea::print() { #if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) QPrinter printer(QPrinter::HighResolution); - + QPrintDialog printDialog(&printer, this); //! [21] //! [22] if (printDialog.exec() == QDialog::Accepted) { diff --git a/examples/widgets/widgets/styles/widgetgallery.cpp b/examples/widgets/widgets/styles/widgetgallery.cpp index 604f5af40b..4421bd19c4 100644 --- a/examples/widgets/widgets/styles/widgetgallery.cpp +++ b/examples/widgets/widgets/styles/widgetgallery.cpp @@ -215,7 +215,7 @@ void WidgetGallery::createBottomLeftTabWidget() "Like a diamond in the sky.\n" "Twinkle, twinkle, little star,\n" "How I wonder what you are!\n")); - + QHBoxLayout *tab2hbox = new QHBoxLayout; tab2hbox->setMargin(5); tab2hbox->addWidget(textEdit); diff --git a/examples/widgets/widgets/styles/widgetgallery.h b/examples/widgets/widgets/styles/widgetgallery.h index 27e82c4d14..25d4c5881d 100644 --- a/examples/widgets/widgets/styles/widgetgallery.h +++ b/examples/widgets/widgets/styles/widgetgallery.h @@ -83,7 +83,7 @@ private: void createProgressBar(); QPalette originalPalette; - + QLabel *styleLabel; QComboBox *styleComboBox; QCheckBox *useStylePaletteCheckBox; -- cgit v1.2.3