diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/widgets/dialogs/standarddialogs/dialog.cpp | 20 | ||||
-rw-r--r-- | examples/widgets/dialogs/standarddialogs/dialog.h | 2 | ||||
-rw-r--r-- | examples/widgets/doc/src/addressbook-tutorial.qdoc | 14 | ||||
-rw-r--r-- | examples/widgets/itemviews/spreadsheet/main.cpp | 3 | ||||
-rw-r--r-- | examples/widgets/itemviews/spreadsheet/spreadsheet.cpp | 1 | ||||
-rw-r--r-- | examples/widgets/widgets/spinboxes/window.cpp | 10 |
6 files changed, 34 insertions, 16 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-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] |