[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/examples/regexptester/regexptester.doc:1 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>A Small Application for Testing Regular Expressions</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>A Small Application for Testing Regular Expressions</h1>
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 |
|
---|
| 36 | <p>
|
---|
| 37 | <p> Regular expressions can sometimes be tricky to get right,
|
---|
| 38 | especially those that use the * quantifier. This application lets
|
---|
| 39 | you type in a regexp (without doubling the backslashes) and some
|
---|
| 40 | test text, and to execute the regexp and see the results. If you
|
---|
| 41 | click the Copy button the regexp will be copied to the clipboard
|
---|
| 42 | (with the backslashes doubled, ready for you to paste into your
|
---|
| 43 | program). Previous regexps and test texts are remembered
|
---|
| 44 | throughout the session and can be accessed by dropping down the
|
---|
| 45 | comboboxes.
|
---|
| 46 | <p> <hr>
|
---|
| 47 | <p> Header file:
|
---|
| 48 | <p> <pre>#ifndef REGEXPTESTER_H
|
---|
| 49 | #define REGEXPTESTER_H
|
---|
| 50 |
|
---|
| 51 | #include <<a href="qdialog-h.html">qdialog.h</a>>
|
---|
| 52 |
|
---|
| 53 | class QCheckBox;
|
---|
| 54 | class QComboBox;
|
---|
| 55 | class QLabel;
|
---|
| 56 | class QPushButton;
|
---|
| 57 | class QStatusBar;
|
---|
| 58 | class QTable;
|
---|
| 59 |
|
---|
| 60 | class RegexpTester : public <a href="qdialog.html">QDialog</a>
|
---|
| 61 | {
|
---|
| 62 | <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a>
|
---|
| 63 |
|
---|
| 64 | public:
|
---|
| 65 | RegexpTester(QWidget* parent=0, const char* name=0, bool modal=false,
|
---|
| 66 | WFlags f=0);
|
---|
| 67 |
|
---|
| 68 | <a href="qlabel.html">QLabel</a> *regexLabel;
|
---|
| 69 | <a href="qcombobox.html">QComboBox</a> *regexComboBox;
|
---|
| 70 | <a href="qlabel.html">QLabel</a> *textLabel;
|
---|
| 71 | <a href="qcombobox.html">QComboBox</a> *textComboBox;
|
---|
| 72 | <a href="qcheckbox.html">QCheckBox</a> *caseSensitiveCheckBox;
|
---|
| 73 | <a href="qcheckbox.html">QCheckBox</a> *minimalCheckBox;
|
---|
| 74 | <a href="qcheckbox.html">QCheckBox</a> *wildcardCheckBox;
|
---|
| 75 | <a href="qtable.html">QTable</a> *resultTable;
|
---|
| 76 | <a href="qpushbutton.html">QPushButton</a> *executePushButton;
|
---|
| 77 | <a href="qpushbutton.html">QPushButton</a> *copyPushButton;
|
---|
| 78 | <a href="qpushbutton.html">QPushButton</a> *quitPushButton;
|
---|
| 79 | <a href="qstatusbar.html">QStatusBar</a> *statusBar;
|
---|
| 80 |
|
---|
| 81 | public slots:
|
---|
| 82 | void copy();
|
---|
| 83 | void execute();
|
---|
| 84 |
|
---|
| 85 | private:
|
---|
| 86 | void languageChange();
|
---|
| 87 | };
|
---|
| 88 |
|
---|
| 89 | #endif // REGEXPTESTER_H
|
---|
| 90 | </pre>
|
---|
| 91 |
|
---|
| 92 | <p> <hr>
|
---|
| 93 | <p> Implementation:
|
---|
| 94 | <p> <pre>#include <<a href="qapplication-h.html">qapplication.h</a>>
|
---|
| 95 | #include <<a href="qcheckbox-h.html">qcheckbox.h</a>>
|
---|
| 96 | #include <<a href="qclipboard-h.html">qclipboard.h</a>>
|
---|
| 97 | #include <<a href="qcombobox-h.html">qcombobox.h</a>>
|
---|
| 98 | #include <<a href="qlabel-h.html">qlabel.h</a>>
|
---|
| 99 | #include <<a href="qlayout-h.html">qlayout.h</a>>
|
---|
| 100 | #include <<a href="qpushbutton-h.html">qpushbutton.h</a>>
|
---|
| 101 | #include <<a href="qregexp-h.html">qregexp.h</a>>
|
---|
| 102 | #include <<a href="qstatusbar-h.html">qstatusbar.h</a>>
|
---|
| 103 | #include <<a href="qtable-h.html">qtable.h</a>>
|
---|
| 104 |
|
---|
| 105 | #include "regexptester.h"
|
---|
| 106 |
|
---|
| 107 |
|
---|
| 108 | <a name="f556"></a>RegexpTester::RegexpTester(QWidget* parent, const char* name, bool modal,
|
---|
| 109 | WFlags f)
|
---|
| 110 | : <a href="qdialog.html">QDialog</a>(parent, name, modal, f)
|
---|
| 111 | {
|
---|
| 112 | regexLabel = new <a href="qlabel.html">QLabel</a>(this);
|
---|
| 113 | regexComboBox = new <a href="qcombobox.html">QComboBox</a>(this);
|
---|
| 114 | <a name="x2480"></a> regexComboBox-><a href="qcombobox.html#setEditable">setEditable</a>(true);
|
---|
| 115 | <a name="x2507"></a> regexComboBox-><a href="qwidget.html#setSizePolicy">setSizePolicy</a>(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
---|
| 116 | <a name="x2482"></a> regexLabel-><a href="qlabel.html#setBuddy">setBuddy</a>(regexComboBox);
|
---|
| 117 | textLabel = new <a href="qlabel.html">QLabel</a>(this);
|
---|
| 118 | textComboBox = new <a href="qcombobox.html">QComboBox</a>(this);
|
---|
| 119 | textComboBox-><a href="qcombobox.html#setEditable">setEditable</a>(true);
|
---|
| 120 | textComboBox-><a href="qwidget.html#setSizePolicy">setSizePolicy</a>(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
---|
| 121 | textLabel-><a href="qlabel.html#setBuddy">setBuddy</a>(textComboBox);
|
---|
| 122 | caseSensitiveCheckBox = new <a href="qcheckbox.html">QCheckBox</a>(this);
|
---|
| 123 | <a name="x2475"></a> caseSensitiveCheckBox-><a href="qcheckbox.html#setChecked">setChecked</a>(true);
|
---|
| 124 | minimalCheckBox = new <a href="qcheckbox.html">QCheckBox</a>(this);
|
---|
| 125 | wildcardCheckBox = new <a href="qcheckbox.html">QCheckBox</a>(this);
|
---|
| 126 | resultTable = new <a href="qtable.html">QTable</a>(3, 3, this);
|
---|
| 127 | <a name="x2506"></a> resultTable-><a href="qtable.html#verticalHeader">verticalHeader</a>()->hide();
|
---|
| 128 | <a name="x2501"></a> resultTable-><a href="qtable.html#setLeftMargin">setLeftMargin</a>(0);
|
---|
| 129 | <a name="x2499"></a> resultTable-><a href="qtable.html#horizontalHeader">horizontalHeader</a>()->hide();
|
---|
| 130 | <a name="x2505"></a> resultTable-><a href="qtable.html#setTopMargin">setTopMargin</a>(0);
|
---|
| 131 | <a name="x2503"></a> resultTable-><a href="qtable.html#setReadOnly">setReadOnly</a>(true);
|
---|
| 132 | executePushButton = new <a href="qpushbutton.html">QPushButton</a>(this);
|
---|
| 133 | <a name="x2484"></a> executePushButton-><a href="qpushbutton.html#setDefault">setDefault</a>(true);
|
---|
| 134 | copyPushButton = new <a href="qpushbutton.html">QPushButton</a>(this);
|
---|
| 135 | quitPushButton = new <a href="qpushbutton.html">QPushButton</a>(this);
|
---|
| 136 | statusBar = new <a href="qstatusbar.html">QStatusBar</a>(this);
|
---|
| 137 |
|
---|
| 138 | <a href="qgridlayout.html">QGridLayout</a> *gridLayout = new <a href="qgridlayout.html">QGridLayout</a>(2, 2, 6);
|
---|
| 139 | gridLayout-><a href="qgridlayout.html#addWidget">addWidget</a>(regexLabel, 0, 0);
|
---|
| 140 | gridLayout-><a href="qgridlayout.html#addWidget">addWidget</a>(regexComboBox, 0, 1);
|
---|
| 141 | gridLayout-><a href="qgridlayout.html#addWidget">addWidget</a>(textLabel, 1, 0);
|
---|
| 142 | gridLayout-><a href="qgridlayout.html#addWidget">addWidget</a>(textComboBox, 1, 1);
|
---|
| 143 | <a href="qhboxlayout.html">QHBoxLayout</a> *checkboxLayout = new <a href="qhboxlayout.html">QHBoxLayout</a>(0, 6, 6);
|
---|
| 144 | checkboxLayout-><a href="qboxlayout.html#addWidget">addWidget</a>(caseSensitiveCheckBox);
|
---|
| 145 | checkboxLayout-><a href="qboxlayout.html#addWidget">addWidget</a>(minimalCheckBox);
|
---|
| 146 | checkboxLayout-><a href="qboxlayout.html#addWidget">addWidget</a>(wildcardCheckBox);
|
---|
| 147 | <a name="x2470"></a> checkboxLayout-><a href="qboxlayout.html#addStretch">addStretch</a>(1);
|
---|
| 148 | <a href="qvboxlayout.html">QVBoxLayout</a> *buttonLayout = new <a href="qvboxlayout.html">QVBoxLayout</a>(0, 6, 6);
|
---|
| 149 | buttonLayout-><a href="qboxlayout.html#addWidget">addWidget</a>(executePushButton);
|
---|
| 150 | buttonLayout-><a href="qboxlayout.html#addWidget">addWidget</a>(copyPushButton);
|
---|
| 151 | buttonLayout-><a href="qboxlayout.html#addWidget">addWidget</a>(quitPushButton);
|
---|
| 152 | buttonLayout-><a href="qboxlayout.html#addStretch">addStretch</a>(1);
|
---|
| 153 | <a href="qhboxlayout.html">QHBoxLayout</a> *middleLayout = new <a href="qhboxlayout.html">QHBoxLayout</a>(0, 6, 6);
|
---|
| 154 | middleLayout-><a href="qboxlayout.html#addWidget">addWidget</a>(resultTable);
|
---|
| 155 | <a name="x2469"></a> middleLayout-><a href="qboxlayout.html#addLayout">addLayout</a>(buttonLayout);
|
---|
| 156 | <a href="qvboxlayout.html">QVBoxLayout</a> *mainLayout = new <a href="qvboxlayout.html">QVBoxLayout</a>(this, 6, 6);
|
---|
| 157 | mainLayout-><a href="qboxlayout.html#addLayout">addLayout</a>(gridLayout);
|
---|
| 158 | mainLayout-><a href="qboxlayout.html#addLayout">addLayout</a>(checkboxLayout);
|
---|
| 159 | mainLayout-><a href="qboxlayout.html#addLayout">addLayout</a>(middleLayout);
|
---|
| 160 | mainLayout-><a href="qboxlayout.html#addWidget">addWidget</a>(statusBar);
|
---|
| 161 |
|
---|
| 162 | <a href="qwidget.html#resize">resize</a>(QSize(500, 350).expandedTo(<a href="qwidget.html#minimumSizeHint">minimumSizeHint</a>()));
|
---|
| 163 |
|
---|
| 164 | languageChange();
|
---|
| 165 |
|
---|
| 166 | <a href="qobject.html#connect">connect</a>(copyPushButton, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), this, SLOT(copy()));
|
---|
| 167 | <a href="qobject.html#connect">connect</a>(executePushButton, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), this, SLOT(execute()));
|
---|
| 168 | <a href="qobject.html#connect">connect</a>(quitPushButton, SIGNAL(<a href="qbutton.html#clicked">clicked</a>()), this, SLOT(<a href="qdialog.html#accept">accept</a>()));
|
---|
| 169 |
|
---|
| 170 | execute();
|
---|
| 171 | }
|
---|
| 172 |
|
---|
| 173 | void <a name="f557"></a>RegexpTester::execute()
|
---|
| 174 | {
|
---|
| 175 | <a name="x2478"></a> <a href="qstring.html">QString</a> regex = regexComboBox-><a href="qcombobox.html#currentText">currentText</a>();
|
---|
| 176 | <a href="qstring.html">QString</a> text = textComboBox-><a href="qcombobox.html#currentText">currentText</a>();
|
---|
| 177 | if (!regex.<a href="qstring.html#isEmpty">isEmpty</a>() && !text.<a href="qstring.html#isEmpty">isEmpty</a>()) {
|
---|
| 178 | <a href="qregexp.html">QRegExp</a> re(regex);
|
---|
| 179 | <a name="x2491"></a><a name="x2474"></a> re.<a href="qregexp.html#setCaseSensitive">setCaseSensitive</a>(caseSensitiveCheckBox-><a href="qcheckbox.html#isChecked">isChecked</a>());
|
---|
| 180 | <a name="x2492"></a> re.<a href="qregexp.html#setMinimal">setMinimal</a>(minimalCheckBox-><a href="qcheckbox.html#isChecked">isChecked</a>());
|
---|
| 181 | bool wildcard = wildcardCheckBox-><a href="qcheckbox.html#isChecked">isChecked</a>();
|
---|
| 182 | <a name="x2493"></a> re.<a href="qregexp.html#setWildcard">setWildcard</a>(wildcard);
|
---|
| 183 | <a name="x2487"></a> if (!re.<a href="qregexp.html#isValid">isValid</a>()) {
|
---|
| 184 | <a name="x2494"></a> statusBar-><a href="qstatusbar.html#message">message</a>(<a href="qobject.html#tr">tr</a>("Invalid <a href="qregexp.html#regular-expression">regular expression</a>: %1")
|
---|
| 185 | <a name="x2486"></a> .arg(re.<a href="qregexp.html#errorString">errorString</a>()));
|
---|
| 186 | return;
|
---|
| 187 | }
|
---|
| 188 | <a name="x2490"></a> int offset = re.<a href="qregexp.html#search">search</a>(text);
|
---|
| 189 | <a name="x2489"></a> int captures = re.<a href="qregexp.html#numCaptures">numCaptures</a>();
|
---|
| 190 | int row = 0;
|
---|
| 191 | const int OFFSET = 5;
|
---|
| 192 | <a name="x2502"></a> resultTable-><a href="qtable.html#setNumRows">setNumRows</a>(0);
|
---|
| 193 | resultTable-><a href="qtable.html#setNumRows">setNumRows</a>(captures + OFFSET);
|
---|
| 194 | <a name="x2504"></a> resultTable-><a href="qtable.html#setText">setText</a>(row, 0, tr("Regex"));
|
---|
| 195 | <a href="qstring.html">QString</a> escaped = regex;
|
---|
| 196 | <a name="x2497"></a> escaped = escaped.<a href="qstring.html#replace">replace</a>("\\", "\\\\");
|
---|
| 197 | resultTable-><a href="qtable.html#setText">setText</a>(row, 1, escaped);
|
---|
| 198 | <a name="x2500"></a> resultTable-><a href="qtable.html#item">item</a>(row, 1)->setSpan(1, 2);
|
---|
| 199 | if (offset != -1) {
|
---|
| 200 | ++row;
|
---|
| 201 | resultTable-><a href="qtable.html#setText">setText</a>(row, 0, tr("Offset"));
|
---|
| 202 | resultTable-><a href="qtable.html#setText">setText</a>(row, 1, QString::number(offset));
|
---|
| 203 | resultTable-><a href="qtable.html#item">item</a>(row, 1)->setSpan(1, 2);
|
---|
| 204 | if (!wildcard) {
|
---|
| 205 | ++row;
|
---|
| 206 | resultTable-><a href="qtable.html#setText">setText</a>(row, 0, tr("Captures"));
|
---|
| 207 | resultTable-><a href="qtable.html#setText">setText</a>(row, 1, QString::number(captures));
|
---|
| 208 | resultTable-><a href="qtable.html#item">item</a>(row, 1)->setSpan(1, 2);
|
---|
| 209 | ++row;
|
---|
| 210 | resultTable-><a href="qtable.html#setText">setText</a>(row, 1, tr("Text"));
|
---|
| 211 | resultTable-><a href="qtable.html#setText">setText</a>(row, 2, tr("Characters"));
|
---|
| 212 | }
|
---|
| 213 | ++row;
|
---|
| 214 | resultTable-><a href="qtable.html#setText">setText</a>(row, 0, tr("Match"));
|
---|
| 215 | <a name="x2485"></a> resultTable-><a href="qtable.html#setText">setText</a>(row, 1, re.<a href="qregexp.html#cap">cap</a>(0));
|
---|
| 216 | <a name="x2488"></a> resultTable-><a href="qtable.html#setText">setText</a>(row, 2, QString::number(re.<a href="qregexp.html#matchedLength">matchedLength</a>()));
|
---|
| 217 | if (!wildcard) {
|
---|
| 218 | for (int i = 1; i <= captures; ++i) {
|
---|
| 219 | resultTable-><a href="qtable.html#setText">setText</a>(row + i, 0, tr("Capture #%1").arg(i));
|
---|
| 220 | resultTable-><a href="qtable.html#setText">setText</a>(row + i, 1, re.<a href="qregexp.html#cap">cap</a>(i));
|
---|
| 221 | resultTable-><a href="qtable.html#setText">setText</a>(row + i, 2,
|
---|
| 222 | <a name="x2496"></a> QString::<a href="qstring.html#number">number</a>(re.<a href="qregexp.html#cap">cap</a>(i).length()));
|
---|
| 223 | }
|
---|
| 224 | }
|
---|
| 225 | else
|
---|
| 226 | resultTable-><a href="qtable.html#setNumRows">setNumRows</a>(3);
|
---|
| 227 | }
|
---|
| 228 | else {
|
---|
| 229 | resultTable-><a href="qtable.html#setNumRows">setNumRows</a>(2);
|
---|
| 230 | ++row;
|
---|
| 231 | resultTable-><a href="qtable.html#setText">setText</a>(row, 0, tr("No matches"));
|
---|
| 232 | resultTable-><a href="qtable.html#item">item</a>(row, 0)->setSpan(1, 3);
|
---|
| 233 | }
|
---|
| 234 | <a name="x2498"></a> resultTable-><a href="qtable.html#adjustColumn">adjustColumn</a>(0);
|
---|
| 235 | resultTable-><a href="qtable.html#adjustColumn">adjustColumn</a>(1);
|
---|
| 236 | resultTable-><a href="qtable.html#adjustColumn">adjustColumn</a>(2);
|
---|
| 237 | statusBar-><a href="qstatusbar.html#message">message</a>(<a href="qobject.html#tr">tr</a>("Executed \"%1\" on \"%2\"")
|
---|
| 238 | .arg(escaped).arg(text));
|
---|
| 239 | }
|
---|
| 240 | else
|
---|
| 241 | statusBar-><a href="qstatusbar.html#message">message</a>(<a href="qobject.html#tr">tr</a>("A regular expression and a text must be given"));
|
---|
| 242 | }
|
---|
| 243 |
|
---|
| 244 | void <a name="f558"></a>RegexpTester::copy()
|
---|
| 245 | {
|
---|
| 246 | <a href="qstring.html">QString</a> escaped = regexComboBox-><a href="qcombobox.html#currentText">currentText</a>();
|
---|
| 247 | if (!escaped.<a href="qstring.html#isEmpty">isEmpty</a>()) {
|
---|
| 248 | escaped = escaped.<a href="qstring.html#replace">replace</a>("\\", "\\\\");
|
---|
| 249 | <a name="x2468"></a> <a href="qclipboard.html">QClipboard</a> *cb = QApplication::<a href="qapplication.html#clipboard">clipboard</a>();
|
---|
| 250 | <a name="x2476"></a> cb-><a href="qclipboard.html#setText">setText</a>(escaped, QClipboard::Clipboard);
|
---|
| 251 | <a name="x2477"></a> if (cb-><a href="qclipboard.html#supportsSelection">supportsSelection</a>())
|
---|
| 252 | cb-><a href="qclipboard.html#setText">setText</a>(escaped, QClipboard::Selection);
|
---|
| 253 | statusBar-><a href="qstatusbar.html#message">message</a>(<a href="qobject.html#tr">tr</a>("Copied \"%1\" to the clipboard")
|
---|
| 254 | .arg(escaped));
|
---|
| 255 | }
|
---|
| 256 | }
|
---|
| 257 |
|
---|
| 258 | void <a name="f559"></a>RegexpTester::languageChange()
|
---|
| 259 | {
|
---|
| 260 | <a href="qwidget.html#setCaption">setCaption</a>(<a href="qobject.html#tr">tr</a>("Regex Tester"));
|
---|
| 261 | regexLabel-><a href="qlabel.html#setText">setText</a>(<a href="qobject.html#tr">tr</a>("&Regex:"));
|
---|
| 262 | <a name="x2479"></a> regexComboBox-><a href="qcombobox.html#insertItem">insertItem</a>(<a href="qobject.html#tr">tr</a>("[A-Z]+=(\\d+):(\\d*)"));
|
---|
| 263 | textLabel-><a href="qlabel.html#setText">setText</a>(<a href="qobject.html#tr">tr</a>("&Text:"));
|
---|
| 264 | textComboBox-><a href="qcombobox.html#insertItem">insertItem</a>(<a href="qobject.html#tr">tr</a>("ABC=12:3456"));
|
---|
| 265 | <a name="x2473"></a> caseSensitiveCheckBox-><a href="qbutton.html#setText">setText</a>(<a href="qobject.html#tr">tr</a>("Case &Sensitive"));
|
---|
| 266 | minimalCheckBox-><a href="qbutton.html#setText">setText</a>(<a href="qobject.html#tr">tr</a>("&Minimal"));
|
---|
| 267 | wildcardCheckBox-><a href="qbutton.html#setText">setText</a>(<a href="qobject.html#tr">tr</a>("&Wildcard"));
|
---|
| 268 | copyPushButton-><a href="qbutton.html#setText">setText</a>(<a href="qobject.html#tr">tr</a>("&Copy"));
|
---|
| 269 | executePushButton-><a href="qbutton.html#setText">setText</a>(<a href="qobject.html#tr">tr</a>("&Execute"));
|
---|
| 270 | quitPushButton-><a href="qbutton.html#setText">setText</a>(<a href="qobject.html#tr">tr</a>("&Quit"));
|
---|
| 271 | }
|
---|
| 272 |
|
---|
| 273 | </pre>
|
---|
| 274 |
|
---|
| 275 | <p> <hr>
|
---|
| 276 | <p> Main:
|
---|
| 277 | <p> <pre>#include <<a href="qapplication-h.html">qapplication.h</a>>
|
---|
| 278 | #include "regexptester.h"
|
---|
| 279 |
|
---|
| 280 | int main(int argc, char **argv)
|
---|
| 281 | {
|
---|
| 282 | <a href="qapplication.html">QApplication</a> app(argc, argv);
|
---|
| 283 | RegexpTester form;
|
---|
| 284 | <a name="x2511"></a> form.<a href="qdialog.html#show">show</a>();
|
---|
| 285 | <a name="x2512"></a><a name="x2510"></a><a name="x2509"></a> app.<a href="qobject.html#connect">connect</a>(&app, SIGNAL(<a href="qapplication.html#lastWindowClosed">lastWindowClosed</a>()), &app, SLOT(<a href="qapplication.html#quit">quit</a>()));
|
---|
| 286 | return app.<a href="qapplication.html#exec">exec</a>();
|
---|
| 287 | }
|
---|
| 288 | </pre>
|
---|
| 289 |
|
---|
| 290 | <p>See also <a href="examples.html">Examples</a>.
|
---|
| 291 |
|
---|
| 292 | <!-- eof -->
|
---|
| 293 | <p><address><hr><div align=center>
|
---|
| 294 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 295 | <td>Copyright © 2007
|
---|
| 296 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 297 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 298 | </table></div></address></body>
|
---|
| 299 | </html>
|
---|