diff options
Diffstat (limited to 'examples/tutorials/widgets')
-rw-r--r-- | examples/tutorials/widgets/childwidget/main.cpp | 11 | ||||
-rw-r--r-- | examples/tutorials/widgets/nestedlayouts/main.cpp | 16 | ||||
-rw-r--r-- | examples/tutorials/widgets/toplevel/main.cpp | 9 | ||||
-rw-r--r-- | examples/tutorials/widgets/windowlayout/main.cpp | 11 |
4 files changed, 27 insertions, 20 deletions
diff --git a/examples/tutorials/widgets/childwidget/main.cpp b/examples/tutorials/widgets/childwidget/main.cpp index 99235bd..fd50b1d 100644 --- a/examples/tutorials/widgets/childwidget/main.cpp +++ b/examples/tutorials/widgets/childwidget/main.cpp @@ -45,13 +45,14 @@ 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(QApplication::translate("childwidget", "Child widget")); + window.show(); //! [create, position and show] - QPushButton *button = new QPushButton(tr("Press me"), window); + QPushButton *button = new QPushButton( + QApplication::translate("childwidget", "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..226d0f9 100644 --- a/examples/tutorials/widgets/nestedlayouts/main.cpp +++ b/examples/tutorials/widgets/nestedlayouts/main.cpp @@ -46,9 +46,10 @@ 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( + QApplication::translate("nestedlayouts", "Query:")); QLineEdit *queryEdit = new QLineEdit(); QTableView *resultView = new QTableView(); @@ -59,14 +60,16 @@ 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() << QApplication::translate("nestedlayouts", "Name") + << QApplication::translate("nestedlayouts", "Office")); QList<QStringList> rows = QList<QStringList>() << (QStringList() << "Verne Nilsen" << "123") @@ -92,8 +95,9 @@ 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( + QApplication::translate("nestedlayouts", "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..f18fa6b 100644 --- a/examples/tutorials/widgets/toplevel/main.cpp +++ b/examples/tutorials/widgets/toplevel/main.cpp @@ -46,11 +46,12 @@ 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( + QApplication::translate("toplevel", "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..c30d669 100644 --- a/examples/tutorials/widgets/windowlayout/main.cpp +++ b/examples/tutorials/widgets/windowlayout/main.cpp @@ -45,18 +45,19 @@ 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(QApplication::translate("windowlayout", "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( + QApplication::translate("windowlayout", "Window layout")); + window.show(); return app.exec(); } //! [main program] |