summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets')
-rw-r--r--examples/widgets/dialogs/standarddialogs/dialog.cpp20
-rw-r--r--examples/widgets/dialogs/standarddialogs/dialog.h2
-rw-r--r--examples/widgets/doc/src/addressbook-fr.qdoc14
-rw-r--r--examples/widgets/doc/src/addressbook-tutorial.qdoc14
-rw-r--r--examples/widgets/itemviews/spreadsheet/main.cpp3
-rw-r--r--examples/widgets/itemviews/spreadsheet/spreadsheet.cpp1
-rw-r--r--examples/widgets/widgets/spinboxes/window.cpp10
7 files changed, 34 insertions, 30 deletions
diff --git a/examples/widgets/dialogs/standarddialogs/dialog.cpp b/examples/widgets/dialogs/standarddialogs/dialog.cpp
index c626b63b7d..fdd3633950 100644
--- a/examples/widgets/dialogs/standarddialogs/dialog.cpp
+++ b/examples/widgets/dialogs/standarddialogs/dialog.cpp
@@ -121,6 +121,10 @@ Dialog::Dialog(QWidget *parent)
textLabel->setFrameStyle(frameStyle);
QPushButton *textButton = new QPushButton(tr("QInputDialog::get&Text()"));
+ multiLineTextLabel = new QLabel;
+ multiLineTextLabel->setFrameStyle(frameStyle);
+ QPushButton *multiLineTextButton = new QPushButton(tr("QInputDialog::get&MultiLineText()"));
+
colorLabel = new QLabel;
colorLabel->setFrameStyle(frameStyle);
QPushButton *colorButton = new QPushButton(tr("QColorDialog::get&Color()"));
@@ -177,6 +181,7 @@ Dialog::Dialog(QWidget *parent)
connect(doubleButton, SIGNAL(clicked()), this, SLOT(setDouble()));
connect(itemButton, SIGNAL(clicked()), this, SLOT(setItem()));
connect(textButton, SIGNAL(clicked()), this, SLOT(setText()));
+ connect(multiLineTextButton, SIGNAL(clicked()), this, SLOT(setMultiLineText()));
connect(colorButton, SIGNAL(clicked()), this, SLOT(setColor()));
connect(fontButton, SIGNAL(clicked()), this, SLOT(setFont()));
connect(directoryButton, SIGNAL(clicked()),
@@ -206,7 +211,9 @@ Dialog::Dialog(QWidget *parent)
layout->addWidget(itemLabel, 2, 1);
layout->addWidget(textButton, 3, 0);
layout->addWidget(textLabel, 3, 1);
- layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 4, 0);
+ layout->addWidget(multiLineTextButton, 4, 0);
+ layout->addWidget(multiLineTextLabel, 4, 1);
+ layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 5, 0);
toolbox->addItem(page, tr("Input Dialogs"));
const QString doNotUseNativeDialog = tr("Do not use native dialog");
@@ -327,6 +334,17 @@ void Dialog::setText()
//! [3]
}
+void Dialog::setMultiLineText()
+{
+//! [4]
+ bool ok;
+ QString text = QInputDialog::getMultiLineText(this, tr("QInputDialog::getMultiLineText()"),
+ tr("Address:"), "John Doe\nFreedom Street", &ok);
+ if (ok && !text.isEmpty())
+ multiLineTextLabel->setText(text);
+//! [4]
+}
+
void Dialog::setColor()
{
const QColorDialog::ColorDialogOptions options = QFlag(colorDialogOptionsWidget->value());
diff --git a/examples/widgets/dialogs/standarddialogs/dialog.h b/examples/widgets/dialogs/standarddialogs/dialog.h
index 27b1de98cb..d6272c440e 100644
--- a/examples/widgets/dialogs/standarddialogs/dialog.h
+++ b/examples/widgets/dialogs/standarddialogs/dialog.h
@@ -63,6 +63,7 @@ private slots:
void setDouble();
void setItem();
void setText();
+ void setMultiLineText();
void setColor();
void setFont();
void setExistingDirectory();
@@ -80,6 +81,7 @@ private:
QLabel *doubleLabel;
QLabel *itemLabel;
QLabel *textLabel;
+ QLabel *multiLineTextLabel;
QLabel *colorLabel;
QLabel *fontLabel;
QLabel *directoryLabel;
diff --git a/examples/widgets/doc/src/addressbook-fr.qdoc b/examples/widgets/doc/src/addressbook-fr.qdoc
index 9a7bc3a6b7..7d15d99597 100644
--- a/examples/widgets/doc/src/addressbook-fr.qdoc
+++ b/examples/widgets/doc/src/addressbook-fr.qdoc
@@ -71,8 +71,6 @@
*/
/*!
- \page tutorials-addressbook-fr-part1.html
-
\example tutorials/addressbook-fr/part1
\title Carnet d'adresses 1 - Conception de l'interface utilisateur
@@ -229,8 +227,6 @@
*/
/*!
- \page tutorials-addressbook-fr-part2.html
-
\example tutorials/addressbook-fr/part2
\title Carnet d'adresses 2 - Ajouter des adresses
@@ -389,8 +385,6 @@
*/
/*!
- \page tutorials-addressbook-fr-part3.html
-
\example tutorials/addressbook-fr/part3
\title Carnet d'adresses 3 - Navigation entre les éléments
@@ -509,8 +503,6 @@
/*!
- \page tutorials-addressbook-fr-part4.html
-
\example tutorials/addressbook-fr/part4
\title Carnet d'Adresses 4 - éditer et supprimer des adresses
@@ -659,8 +651,6 @@
*/
/*!
- \page tutorials-addressbook-fr-part5.html
-
\example tutorials/addressbook-fr/part5
\title Carnet d'adresse 5 - Ajout d'une fonction de recherche
@@ -808,8 +798,6 @@
*/
/*!
- \page tutorials-addressbook-part6.html
-
\example tutorials/addressbook-fr/part6
\title Carnet d'Adresses 6 - Sauvegarde et chargement
@@ -945,8 +933,6 @@
*/
/*!
- \page tutorials-addressbook-fr-part7.html
-
\example tutorials/addressbook-fr/part7
\title Carnet d'adresse 7 - Fonctionnalités avancées
diff --git a/examples/widgets/doc/src/addressbook-tutorial.qdoc b/examples/widgets/doc/src/addressbook-tutorial.qdoc
index 089ab2319d..78517f80d7 100644
--- a/examples/widgets/doc/src/addressbook-tutorial.qdoc
+++ b/examples/widgets/doc/src/addressbook-tutorial.qdoc
@@ -77,8 +77,6 @@
*/
/*!
- \page tutorials-addressbook-part1.html
-
\example tutorials/addressbook/part1
\title Part 1 - Designing the User Interface
@@ -231,8 +229,6 @@
*/
/*!
- \page tutorials-addressbook-part2.html
-
\example tutorials/addressbook/part2
\title Part 2 - Adding Addresses
@@ -382,8 +378,6 @@
*/
/*!
- \page tutorials-addressbook-part3.html
-
\example tutorials/addressbook/part3
\title Part 3 - Navigating between Entries
@@ -499,8 +493,6 @@
*/
/*!
- \page tutorials-addressbook-part4.html
-
\example tutorials/addressbook/part4
\title Part 4 - Editing and Removing Addresses
@@ -633,8 +625,6 @@
*/
/*!
- \page tutorials-addressbook-part5.html
-
\example tutorials/addressbook/part5
\title Part 5 - Adding a Find Function
@@ -777,8 +767,6 @@
*/
/*!
- \page tutorials-addressbook-part6.html
-
\example tutorials/addressbook/part6
\title Part 6 - Loading and Saving
@@ -899,8 +887,6 @@
*/
/*!
- \page tutorials-addressbook-part7.html
-
\example tutorials/addressbook/part7
\title Part 7 - Additional Features
diff --git a/examples/widgets/itemviews/spreadsheet/main.cpp b/examples/widgets/itemviews/spreadsheet/main.cpp
index 1cc9205d7e..f518986bc5 100644
--- a/examples/widgets/itemviews/spreadsheet/main.cpp
+++ b/examples/widgets/itemviews/spreadsheet/main.cpp
@@ -42,14 +42,15 @@
#include "spreadsheet.h"
#include <QApplication>
+#include <QLayout>
int main(int argc, char** argv) {
Q_INIT_RESOURCE(spreadsheet);
QApplication app(argc, argv);
SpreadSheet sheet(10, 6);
sheet.setWindowIcon(QPixmap(":/images/interview.png"));
- sheet.resize(640, 420);
sheet.show();
+ sheet.layout()->setSizeConstraint(QLayout::SetFixedSize);
return app.exec();
}
diff --git a/examples/widgets/itemviews/spreadsheet/spreadsheet.cpp b/examples/widgets/itemviews/spreadsheet/spreadsheet.cpp
index 59d29f0e61..6fab0c2aae 100644
--- a/examples/widgets/itemviews/spreadsheet/spreadsheet.cpp
+++ b/examples/widgets/itemviews/spreadsheet/spreadsheet.cpp
@@ -64,6 +64,7 @@ SpreadSheet::SpreadSheet(int rows, int cols, QWidget *parent)
toolBar->addWidget(formulaInput);
table = new QTableWidget(rows, cols, this);
+ table->setSizeAdjustPolicy(QTableWidget::AdjustToContents);
for (int c = 0; c < cols; ++c) {
QString character(QChar('A' + c));
table->setHorizontalHeaderItem(c, new QTableWidgetItem(character));
diff --git a/examples/widgets/widgets/spinboxes/window.cpp b/examples/widgets/widgets/spinboxes/window.cpp
index 8c35f93c56..acce642ec6 100644
--- a/examples/widgets/widgets/spinboxes/window.cpp
+++ b/examples/widgets/widgets/spinboxes/window.cpp
@@ -94,6 +94,14 @@ void Window::createSpinBoxes()
priceSpinBox->setValue(99);
//! [4] //! [5]
+ QLabel *hexLabel = new QLabel(tr("Enter a value between "
+ "%1 and %2:").arg('-' + QString::number(31, 16)).arg(QString::number(31, 16)));
+ QSpinBox *hexSpinBox = new QSpinBox;
+ hexSpinBox->setRange(-31, 31);
+ hexSpinBox->setSingleStep(1);
+ hexSpinBox->setValue(0);
+ hexSpinBox->setDisplayIntegerBase(16);
+
QVBoxLayout *spinBoxLayout = new QVBoxLayout;
spinBoxLayout->addWidget(integerLabel);
spinBoxLayout->addWidget(integerSpinBox);
@@ -101,6 +109,8 @@ void Window::createSpinBoxes()
spinBoxLayout->addWidget(zoomSpinBox);
spinBoxLayout->addWidget(priceLabel);
spinBoxLayout->addWidget(priceSpinBox);
+ spinBoxLayout->addWidget(hexLabel);
+ spinBoxLayout->addWidget(hexSpinBox);
spinBoxesGroup->setLayout(spinBoxLayout);
}
//! [5]