diff options
author | Alessandro Portale <alessandro.portale@nokia.com> | 2009-11-17 15:48:12 (GMT) |
---|---|---|
committer | Alessandro Portale <alessandro.portale@nokia.com> | 2009-11-17 17:35:45 (GMT) |
commit | 2fb8eee9324dbaed07a1dbab4702f4ffa2e356b1 (patch) | |
tree | ae4cc79371de860b58cc5f11b1bcbf4c81a3a979 /examples | |
parent | d95d77d40ad6ef82b9c043307fa72969c369938b (diff) | |
download | Qt-2fb8eee9324dbaed07a1dbab4702f4ffa2e356b1.zip Qt-2fb8eee9324dbaed07a1dbab4702f4ffa2e356b1.tar.gz Qt-2fb8eee9324dbaed07a1dbab4702f4ffa2e356b1.tar.bz2 |
Fix DrillDown for moblie devices.
1) Use QFormLayout instead of QGridLayout
2) Remove Symbian specific size hack
3) Give button box a parent, so that it's buttons get
properly added as the dialog's softkeys.
4) Add submitButton with a positive button role
Task-number: QTBUG-5685
Reviewed-by: Jason Barron
Diffstat (limited to 'examples')
-rw-r--r-- | examples/sql/drilldown/informationwindow.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/examples/sql/drilldown/informationwindow.cpp b/examples/sql/drilldown/informationwindow.cpp index 08fe2ac..a440aad 100644 --- a/examples/sql/drilldown/informationwindow.cpp +++ b/examples/sql/drilldown/informationwindow.cpp @@ -83,16 +83,15 @@ InformationWindow::InformationWindow(int id, QSqlRelationalTableModel *offices, connect(imageFileEditor, SIGNAL(currentIndexChanged(int)), this, SLOT(enableButtons())); - QGridLayout *layout = new QGridLayout; - layout->addWidget(locationLabel, 0, 0, Qt::AlignLeft | Qt::AlignTop); - layout->addWidget(countryLabel, 1, 0, Qt::AlignLeft | Qt::AlignTop); - layout->addWidget(imageFileLabel, 2, 0, Qt::AlignLeft | Qt::AlignTop); - layout->addWidget(descriptionLabel, 3, 0, Qt::AlignLeft | Qt::AlignTop); - layout->addWidget(locationText, 0, 1); - layout->addWidget(countryText, 1, 1); - layout->addWidget(imageFileEditor, 2, 1); - layout->addWidget(descriptionEditor, 3, 1); - layout->addWidget(buttonBox, 4, 0, 1, 2); + QFormLayout *formLayout = new QFormLayout; + formLayout->addRow(locationLabel, locationText); + formLayout->addRow(countryLabel, countryText); + formLayout->addRow(imageFileLabel, imageFileEditor); + formLayout->addRow(descriptionLabel, descriptionEditor); + + QVBoxLayout *layout = new QVBoxLayout; + layout->addLayout(formLayout); + layout->addWidget(buttonBox); setLayout(layout); locationId = id; @@ -101,9 +100,6 @@ InformationWindow::InformationWindow(int id, QSqlRelationalTableModel *offices, setWindowFlags(Qt::Window); enableButtons(false); setWindowTitle(tr("Office: %1").arg(locationText->text())); -#ifndef Q_OS_SYMBIAN - resize(320, sizeHint().height()); -#endif } //! [4] @@ -154,8 +150,8 @@ void InformationWindow::createButtons() //! [8] //! [9] - buttonBox = new QDialogButtonBox; - buttonBox->addButton(submitButton, QDialogButtonBox::ResetRole); + buttonBox = new QDialogButtonBox(this); + buttonBox->addButton(submitButton, QDialogButtonBox::AcceptRole); buttonBox->addButton(revertButton, QDialogButtonBox::ResetRole); buttonBox->addButton(closeButton, QDialogButtonBox::RejectRole); } |