From d1b89e4bdcd8c92c972c9e4de8dcaefaf60b9658 Mon Sep 17 00:00:00 2001 From: Bertrand Bellenot <Bertrand.Bellenot@cern.ch> Date: Tue, 31 May 2011 14:38:49 +0000 Subject: [PATCH] Source code indentation + typo git-svn-id: http://root.cern.ch/svn/root/trunk@39507 27541ba8-7e3a-0410-8455-c3a389f83636 --- docbook/users-guide/ROOTandQt.xml | 150 ++++++++++++++++-------------- 1 file changed, 78 insertions(+), 72 deletions(-) diff --git a/docbook/users-guide/ROOTandQt.xml b/docbook/users-guide/ROOTandQt.xml index 2b753c59a5b..1d0c77798d9 100644 --- a/docbook/users-guide/ROOTandQt.xml +++ b/docbook/users-guide/ROOTandQt.xml @@ -100,14 +100,14 @@ Gui.Style: windows #include <TRint.h> #include <qpushbutton.h> int main( int argc, char **argv ) { -<emphasis role="italic"><code>// Create an interactive ROOT application</code></emphasis> -TRint *theApp = new TRint("Rint", &argc, argv); -<emphasis role="italic"><code> // Create Qt object within ROOT application</code></emphasis> -QPushButton hello( "Hello world!", 0 ); -hello.resize( 100, 30 ); -hello.show(); -<emphasis role="italic"><code> // and enter the ROOT event loop...</code></emphasis> -theApp->Run(); + <emphasis role="italic"><code>// Create an interactive ROOT application</code></emphasis> + TRint *theApp = new TRint("Rint", &argc, argv); + <emphasis role="italic"><code> // Create Qt object within ROOT application</code></emphasis> + QPushButton hello( "Hello world!", 0 ); + hello.resize( 100, 30 ); + hello.show(); + <emphasis role="italic"><code>// and enter the ROOT event loop...</code></emphasis> + theApp->Run(); } </programlisting> @@ -132,20 +132,20 @@ theApp->Run(); int main( int argc, char **argv ) { -QApplication *app = new QApplication(argc, argv); -TQtWidget *MyWidget= new TQtWidget(0,"MyWidget"); -<emphasis role="italic"><code> // Create any other Qt-widget here</code></emphasis> -MyWidget->show(); -MyWidget->GetCanvas()->cd(); -TGraph *mygraph; -float x[3] = {1,2,3}; -float y[3] = {1.5, 3.0, 4.5}; -mygraph = new TGraph(3,x,y); -mygraph->SetMarkerStyle(20); -mygraph->Draw("AP"); -MyWidget->GetCanvas()->Update(); -app->exec(); -return 0; + QApplication *app = new QApplication(argc, argv); + TQtWidget *MyWidget= new TQtWidget(0,"MyWidget"); + <emphasis role="italic"><code>// Create any other Qt-widget here</code></emphasis> + MyWidget->show(); + MyWidget->GetCanvas()->cd(); + TGraph *mygraph; + float x[3] = {1,2,3}; + float y[3] = {1.5, 3.0, 4.5}; + mygraph = new TGraph(3,x,y); + mygraph->SetMarkerStyle(20); + mygraph->Draw("AP"); + MyWidget->GetCanvas()->Update(); + app->exec(); + return 0; } </programlisting> @@ -211,15 +211,15 @@ class TVirtualPad; class TMyQButton { private: -QPushButton *fMyButton; + QPushButton *fMyButton; public: -TMyQButton(const char*name=""); -virtual ~TMyQButton(); -void SetSize(UInt_t w, UInt_t h); -void Show(Bool_t show=kTRUE); -void SetText(const char *text); -void SetOn(Bool_t on=kTRUE); -void SetStyle(const char * style); + TMyQButton(const char*name=""); + virtual ~TMyQButton(); + void SetSize(UInt_t w, UInt_t h); + void Show(Bool_t show=kTRUE); + void SetText(const char *text); + void SetOn(Bool_t on=kTRUE); + void SetStyle(const char * style); }; #endif </programlisting> @@ -230,32 +230,38 @@ void SetStyle(const char * style); #include "TMyQButton.h" #include <qpushbutton.h> -<emphasis role="italic"><code>// This class allow you to create and manipulate the QPushButton interactively</code></emphasis> +<emphasis role="italic"><code>// This class allow you to create and manipulate the QPushButton +// interactively</code></emphasis> TMyQButton::TMyQButton(const char *name) { -<emphasis role="italic"><code> // Create Qt QPushButton interactively</code></emphasis> -fMyButton = new QPushButton(name,0); + <emphasis role="italic"><code>// Create Qt QPushButton interactively</code></emphasis> + fMyButton = new QPushButton(name,0); } TMyQButton::~TMyQButton() { delete fMyButton; } -void TMyQButton::SetSize(UInt_t w, UInt_t h) { <emphasis role="italic"><code>// Resize the Qt button</code></emphasis> -fMyButton->resize(w,h); +void TMyQButton::SetSize(UInt_t w, UInt_t h) { + <emphasis role="italic"><code>// Resize the Qt button</code></emphasis> + fMyButton->resize(w,h); } -void TMyQButton::Show(Bool_t show) { <emphasis role="italic"><code> // Show / hide the button</code></emphasis> -if (show) fMyButton->show(); -else fMyButton->hide(); +void TMyQButton::Show(Bool_t show) { + <emphasis role="italic"><code>// Show / hide the button</code></emphasis> + if (show) fMyButton->show(); + else fMyButton->hide(); } -void TMyQButton::SetText(const char *text) { <emphasis role="italic"><code>// Set / </code></emphasis><emphasis role="italic"><code>change the button text</code></emphasis> -fMyButton->setText(text); +void TMyQButton::SetText(const char *text) { + <emphasis role="italic"><code>// Set / change the button text</code></emphasis> + fMyButton->setText(text); } void TMyQButton::SetOn(Bool_t on) { -fMyButton->setOn(on); + fMyButton->setOn(on); } -void TMyQButton::SetStyle(const char * style) { <emphasis role="italic"><code>// Set </code></emphasis><emphasis role="italic"><code>button’s</code></emphasis><emphasis role="italic"><code> look and feel</code></emphasis> -<emphasis role="italic"><code> // The possible styles are defined by the local Qt inmstallation.</code></emphasis> -<emphasis role="italic"><code> // For example the possible style can be: "window", "motif", "cde", "sgi",</code></emphasis> -<emphasis role="italic"><code> // "motifplus", "platinum", "compact","windowsxp", "aqua", "macintosh</code></emphasis> -fMyButton->setStyle(style); +void TMyQButton::SetStyle(const char * style) { + <emphasis role="italic"><code>// Set button’s look and feel</code></emphasis> + <emphasis role="italic"><code>// The possible styles are defined by the local Qt installation.</code></emphasis> + <emphasis role="italic"><code>// For example the possible style can be: "window", "motif", "cde",</code></emphasis> + <emphasis role="italic"><code>// "sgi", "motifplus", "platinum", "compact", "windowsxp", "aqua",</code></emphasis> + <emphasis role="italic"><code>// "macintosh</code></emphasis> + fMyButton->setStyle(style); } </programlisting> @@ -344,16 +350,16 @@ root[] <emphasis role="bold"><code>pnt.drawPixmap(0,0,*pix);</code></emphasis> # include <qstring.h> #endif void FileDialog() { -// This is small AClIC wrapper to use Qt 3.3 QFileDialog class -// See: http://doc.trolltech.com/3.3/qfiledialog.html#getOpenFileNames -// To use, invoke ACLiC from the ROOT prompt: -// root [] .x FileDialog .C++ -QStringList files = QFileDialog::getOpenFileNames (); -QStringList::Iterator it = files.begin(); -while ( it != files.end() ) { -printf ("Next file selected: %sn", (const char *)(*it)); -++it; -} + // This is small AClIC wrapper to use Qt 3.3 QFileDialog class + // See: http://doc.trolltech.com/3.3/qfiledialog.html#getOpenFileNames + // To use, invoke ACLiC from the ROOT prompt: + // root [] .x FileDialog .C++ + QStringList files = QFileDialog::getOpenFileNames (); + QStringList::Iterator it = files.begin(); + while ( it != files.end() ) { + printf ("Next file selected: %sn", (const char *)(*it)); + ++it; + } } </programlisting> @@ -429,22 +435,22 @@ this,SLOT(CanvasEvent(TObject *, unsigned int, TCanvas *))); . . . void qtrootexample1::CanvasEvent(TObject *obj,unsigned int event,TCanvas *) { -TQtWidget *tipped = (TQtWidget *)sender(); -const char *objectInfo = obj->GetObjectInfo(tipped->GetEventX(), -tipped->GetEventY()); -QString tipText ="You have "; -if (tipped == tQtWidget1) -tipText +="clicked"; -else -tipText +="passed"; -tipText += " the object <"; -tipText += obj->GetName(); -tipText += "> of class "; -tipText += obj->ClassName(); -tipText += " : "; -tipText += objectInfo; - -QWhatsThis::display(tipText) + TQtWidget *tipped = (TQtWidget *)sender(); + const char *objectInfo = obj->GetObjectInfo(tipped->GetEventX(), + tipped->GetEventY()); + QString tipText ="You have "; + if (tipped == tQtWidget1) + tipText +="clicked"; + else + tipText +="passed"; + tipText += " the object <"; + tipText += obj->GetName(); + tipText += "> of class "; + tipText += obj->ClassName(); + tipText += " : "; + tipText += objectInfo; + + QWhatsThis::display(tipText) } </programlisting> -- GitLab