summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2009-05-20 13:37:12 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2009-05-20 13:37:12 (GMT)
commitefb14d56ef9cd327f6358f626f79e3ee88078600 (patch)
tree96cf779eb1f3fe344c9ff440f858ce184f641a07 /examples
parente28412e4c2389c1765441cec02baed58a63dd29c (diff)
downloadQt-efb14d56ef9cd327f6358f626f79e3ee88078600.zip
Qt-efb14d56ef9cd327f6358f626f79e3ee88078600.tar.gz
Qt-efb14d56ef9cd327f6358f626f79e3ee88078600.tar.bz2
Doc: Compile fixes for tutorial examples.
Reviewed-by: Trust Me
Diffstat (limited to 'examples')
-rw-r--r--examples/tutorials/widgets/childwidget/main.cpp10
-rw-r--r--examples/tutorials/widgets/nestedlayouts/main.cpp13
-rw-r--r--examples/tutorials/widgets/toplevel/main.cpp8
-rw-r--r--examples/tutorials/widgets/windowlayout/main.cpp10
4 files changed, 21 insertions, 20 deletions
diff --git a/examples/tutorials/widgets/childwidget/main.cpp b/examples/tutorials/widgets/childwidget/main.cpp
index 99235bd..8674b6e 100644
--- a/examples/tutorials/widgets/childwidget/main.cpp
+++ b/examples/tutorials/widgets/childwidget/main.cpp
@@ -45,13 +45,13 @@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- QWidget *window = new QWidget();
- window->resize(320, 240);
- window->setWindowTitle(tr("Child widget"));
- window->show();
+ QWidget window;
+ window.resize(320, 240);
+ window.setWindowTitle(QObject::tr("Child widget"));
+ window.show();
//! [create, position and show]
- QPushButton *button = new QPushButton(tr("Press me"), window);
+ QPushButton *button = new QPushButton(QObject::tr("Press me"), &window);
button->move(100, 100);
button->show();
//! [create, position and show]
diff --git a/examples/tutorials/widgets/nestedlayouts/main.cpp b/examples/tutorials/widgets/nestedlayouts/main.cpp
index 29996c6..33f9ad2 100644
--- a/examples/tutorials/widgets/nestedlayouts/main.cpp
+++ b/examples/tutorials/widgets/nestedlayouts/main.cpp
@@ -46,9 +46,9 @@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- QWidget *window = new QWidget();
+ QWidget window;
- QLabel *queryLabel = new QLabel(tr("Query:"));
+ QLabel *queryLabel = new QLabel(QObject::tr("Query:"));
QLineEdit *queryEdit = new QLineEdit();
QTableView *resultView = new QTableView();
@@ -59,14 +59,15 @@ int main(int argc, char *argv[])
QVBoxLayout *mainLayout = new QVBoxLayout();
mainLayout->addLayout(queryLayout);
mainLayout->addWidget(resultView);
- window->setLayout(mainLayout);
+ window.setLayout(mainLayout);
// Set up the model and configure the view...
//! [first part]
//! [set up the model]
QStandardItemModel model;
- model.setHorizontalHeaderLabels(QStringList() << tr("Name") << tr("Office"));
+ model.setHorizontalHeaderLabels(
+ QStringList() << QObject::tr("Name") << QObject::tr("Office"));
QList<QStringList> rows = QList<QStringList>()
<< (QStringList() << "Verne Nilsen" << "123")
@@ -92,8 +93,8 @@ int main(int argc, char *argv[])
resultView->horizontalHeader()->setStretchLastSection(true);
//! [set up the model]
//! [last part]
- window->setWindowTitle(tr("Nested layouts"));
- window->show();
+ window.setWindowTitle(QObject::tr("Nested layouts"));
+ window.show();
return app.exec();
}
//! [last part]
diff --git a/examples/tutorials/widgets/toplevel/main.cpp b/examples/tutorials/widgets/toplevel/main.cpp
index c966037..25ebd3f 100644
--- a/examples/tutorials/widgets/toplevel/main.cpp
+++ b/examples/tutorials/widgets/toplevel/main.cpp
@@ -46,11 +46,11 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
//! [create, resize and show]
- QWidget *window = new QWidget();
- window->resize(320, 240);
- window->show();
+ QWidget window;
+ window.resize(320, 240);
+ window.show();
//! [create, resize and show]
- window->setWindowTitle(tr("Top-level widget"));
+ window.setWindowTitle(QObject::tr("Top-level widget"));
return app.exec();
}
//! [main program]
diff --git a/examples/tutorials/widgets/windowlayout/main.cpp b/examples/tutorials/widgets/windowlayout/main.cpp
index d7c75a3..15a11e1 100644
--- a/examples/tutorials/widgets/windowlayout/main.cpp
+++ b/examples/tutorials/widgets/windowlayout/main.cpp
@@ -45,18 +45,18 @@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- QWidget *window = new QWidget();
+ QWidget window;
//! [create, lay out widgets and show]
- QLabel *label = new QLabel(tr("Name:"));
+ QLabel *label = new QLabel(QObject::tr("Name:"));
QLineEdit *lineEdit = new QLineEdit();
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget(label);
layout->addWidget(lineEdit);
- window->setLayout(layout);
+ window.setLayout(layout);
//! [create, lay out widgets and show]
- window->setWindowTitle(tr("Window layout"));
- window->show();
+ window.setWindowTitle(QObject::tr("Window layout"));
+ window.show();
return app.exec();
}
//! [main program]