Skip to content
Snippets Groups Projects
Commit d1b89e4b authored by Bertrand Bellenot's avatar Bertrand Bellenot
Browse files

Source code indentation + typo

git-svn-id: http://root.cern.ch/svn/root/trunk@39507 27541ba8-7e3a-0410-8455-c3a389f83636
parent c3983444
No related branches found
No related tags found
No related merge requests found
...@@ -100,14 +100,14 @@ Gui.Style: windows ...@@ -100,14 +100,14 @@ Gui.Style: windows
#include <TRint.h> #include <TRint.h>
#include <qpushbutton.h> #include <qpushbutton.h>
int main( int argc, char **argv ) { int main( int argc, char **argv ) {
<emphasis role="italic"><code>// Create an interactive ROOT application</code></emphasis> <emphasis role="italic"><code>// Create an interactive ROOT application</code></emphasis>
TRint *theApp = new TRint("Rint", &amp;argc, argv); TRint *theApp = new TRint("Rint", &amp;argc, argv);
<emphasis role="italic"><code> // Create Qt object within ROOT application</code></emphasis> <emphasis role="italic"><code> // Create Qt object within ROOT application</code></emphasis>
QPushButton hello( "Hello world!", 0 ); QPushButton hello( "Hello world!", 0 );
hello.resize( 100, 30 ); hello.resize( 100, 30 );
hello.show(); hello.show();
<emphasis role="italic"><code> // and enter the ROOT event loop...</code></emphasis> <emphasis role="italic"><code>// and enter the ROOT event loop...</code></emphasis>
theApp-&gt;Run(); theApp-&gt;Run();
} }
</programlisting> </programlisting>
...@@ -132,20 +132,20 @@ theApp-&gt;Run(); ...@@ -132,20 +132,20 @@ theApp-&gt;Run();
int main( int argc, char **argv ) { int main( int argc, char **argv ) {
QApplication *app = new QApplication(argc, argv); QApplication *app = new QApplication(argc, argv);
TQtWidget *MyWidget= new TQtWidget(0,"MyWidget"); TQtWidget *MyWidget= new TQtWidget(0,"MyWidget");
<emphasis role="italic"><code> // Create any other Qt-widget here</code></emphasis> <emphasis role="italic"><code>// Create any other Qt-widget here</code></emphasis>
MyWidget-&gt;show(); MyWidget-&gt;show();
MyWidget-&gt;GetCanvas()-&gt;cd(); MyWidget-&gt;GetCanvas()-&gt;cd();
TGraph *mygraph; TGraph *mygraph;
float x[3] = {1,2,3}; float x[3] = {1,2,3};
float y[3] = {1.5, 3.0, 4.5}; float y[3] = {1.5, 3.0, 4.5};
mygraph = new TGraph(3,x,y); mygraph = new TGraph(3,x,y);
mygraph-&gt;SetMarkerStyle(20); mygraph-&gt;SetMarkerStyle(20);
mygraph-&gt;Draw("AP"); mygraph-&gt;Draw("AP");
MyWidget-&gt;GetCanvas()-&gt;Update(); MyWidget-&gt;GetCanvas()-&gt;Update();
app-&gt;exec(); app-&gt;exec();
return 0; return 0;
} }
</programlisting> </programlisting>
...@@ -211,15 +211,15 @@ class TVirtualPad; ...@@ -211,15 +211,15 @@ class TVirtualPad;
class TMyQButton { class TMyQButton {
private: private:
QPushButton *fMyButton; QPushButton *fMyButton;
public: public:
TMyQButton(const char*name=""); TMyQButton(const char*name="");
virtual ~TMyQButton(); virtual ~TMyQButton();
void SetSize(UInt_t w, UInt_t h); void SetSize(UInt_t w, UInt_t h);
void Show(Bool_t show=kTRUE); void Show(Bool_t show=kTRUE);
void SetText(const char *text); void SetText(const char *text);
void SetOn(Bool_t on=kTRUE); void SetOn(Bool_t on=kTRUE);
void SetStyle(const char * style); void SetStyle(const char * style);
}; };
#endif #endif
</programlisting> </programlisting>
...@@ -230,32 +230,38 @@ void SetStyle(const char * style); ...@@ -230,32 +230,38 @@ void SetStyle(const char * style);
#include "TMyQButton.h" #include "TMyQButton.h"
#include &lt;qpushbutton.h&gt; #include &lt;qpushbutton.h&gt;
<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) { TMyQButton::TMyQButton(const char *name) {
<emphasis role="italic"><code> // Create Qt QPushButton interactively</code></emphasis> <emphasis role="italic"><code>// Create Qt QPushButton interactively</code></emphasis>
fMyButton = new QPushButton(name,0); fMyButton = new QPushButton(name,0);
} }
TMyQButton::~TMyQButton() { delete fMyButton; } TMyQButton::~TMyQButton() { delete fMyButton; }
void TMyQButton::SetSize(UInt_t w, UInt_t h) { <emphasis role="italic"><code>// Resize the Qt button</code></emphasis> void TMyQButton::SetSize(UInt_t w, UInt_t h) {
fMyButton-&gt;resize(w,h); <emphasis role="italic"><code>// Resize the Qt button</code></emphasis>
fMyButton-&gt;resize(w,h);
} }
void TMyQButton::Show(Bool_t show) { <emphasis role="italic"><code> // Show / hide the button</code></emphasis> void TMyQButton::Show(Bool_t show) {
if (show) fMyButton-&gt;show(); <emphasis role="italic"><code>// Show / hide the button</code></emphasis>
else fMyButton-&gt;hide(); if (show) fMyButton-&gt;show();
else fMyButton-&gt;hide();
} }
void TMyQButton::SetText(const char *text) { <emphasis role="italic"><code>// Set / </code></emphasis><emphasis role="italic"><code>change the button text</code></emphasis> void TMyQButton::SetText(const char *text) {
fMyButton-&gt;setText(text); <emphasis role="italic"><code>// Set / change the button text</code></emphasis>
fMyButton-&gt;setText(text);
} }
void TMyQButton::SetOn(Bool_t on) { void TMyQButton::SetOn(Bool_t on) {
fMyButton-&gt;setOn(on); fMyButton-&gt;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> void TMyQButton::SetStyle(const char * style) {
<emphasis role="italic"><code> // The possible styles are defined by the local Qt inmstallation.</code></emphasis> <emphasis role="italic"><code>// Set button’s look and feel</code></emphasis>
<emphasis role="italic"><code> // For example the possible style can be: "window", "motif", "cde", "sgi",</code></emphasis> <emphasis role="italic"><code>// The possible styles are defined by the local Qt installation.</code></emphasis>
<emphasis role="italic"><code> // "motifplus", "platinum", "compact","windowsxp", "aqua", "macintosh</code></emphasis> <emphasis role="italic"><code>// For example the possible style can be: "window", "motif", "cde",</code></emphasis>
fMyButton-&gt;setStyle(style); <emphasis role="italic"><code>// "sgi", "motifplus", "platinum", "compact", "windowsxp", "aqua",</code></emphasis>
<emphasis role="italic"><code>// "macintosh</code></emphasis>
fMyButton-&gt;setStyle(style);
} }
</programlisting> </programlisting>
...@@ -344,16 +350,16 @@ root[] <emphasis role="bold"><code>pnt.drawPixmap(0,0,*pix);</code></emphasis> ...@@ -344,16 +350,16 @@ root[] <emphasis role="bold"><code>pnt.drawPixmap(0,0,*pix);</code></emphasis>
# include &lt;qstring.h&gt; # include &lt;qstring.h&gt;
#endif #endif
void FileDialog() { void FileDialog() {
// This is small AClIC wrapper to use Qt 3.3 QFileDialog class // This is small AClIC wrapper to use Qt 3.3 QFileDialog class
// See: http://doc.trolltech.com/3.3/qfiledialog.html#getOpenFileNames // See: http://doc.trolltech.com/3.3/qfiledialog.html#getOpenFileNames
// To use, invoke ACLiC from the ROOT prompt: // To use, invoke ACLiC from the ROOT prompt:
// root [] .x FileDialog .C++ // root [] .x FileDialog .C++
QStringList files = QFileDialog::getOpenFileNames (); QStringList files = QFileDialog::getOpenFileNames ();
QStringList::Iterator it = files.begin(); QStringList::Iterator it = files.begin();
while ( it != files.end() ) { while ( it != files.end() ) {
printf ("Next file selected: %sn", (const char *)(*it)); printf ("Next file selected: %sn", (const char *)(*it));
++it; ++it;
} }
} }
</programlisting> </programlisting>
...@@ -429,22 +435,22 @@ this,SLOT(CanvasEvent(TObject *, unsigned int, TCanvas *))); ...@@ -429,22 +435,22 @@ this,SLOT(CanvasEvent(TObject *, unsigned int, TCanvas *)));
. . . . . .
void qtrootexample1::CanvasEvent(TObject *obj,unsigned int event,TCanvas *) void qtrootexample1::CanvasEvent(TObject *obj,unsigned int event,TCanvas *)
{ {
TQtWidget *tipped = (TQtWidget *)sender(); TQtWidget *tipped = (TQtWidget *)sender();
const char *objectInfo = obj-&gt;GetObjectInfo(tipped-&gt;GetEventX(), const char *objectInfo = obj-&gt;GetObjectInfo(tipped-&gt;GetEventX(),
tipped-&gt;GetEventY()); tipped-&gt;GetEventY());
QString tipText ="You have "; QString tipText ="You have ";
if (tipped == tQtWidget1) if (tipped == tQtWidget1)
tipText +="clicked"; tipText +="clicked";
else else
tipText +="passed"; tipText +="passed";
tipText += " the object &lt;"; tipText += " the object &lt;";
tipText += obj-&gt;GetName(); tipText += obj-&gt;GetName();
tipText += "&gt; of class "; tipText += "&gt; of class ";
tipText += obj-&gt;ClassName(); tipText += obj-&gt;ClassName();
tipText += " : "; tipText += " : ";
tipText += objectInfo; tipText += objectInfo;
QWhatsThis::display(tipText) QWhatsThis::display(tipText)
} }
</programlisting> </programlisting>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment