summaryrefslogtreecommitdiffstats
path: root/examples/sql/drilldown/informationwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/sql/drilldown/informationwindow.cpp')
-rw-r--r--examples/sql/drilldown/informationwindow.cpp38
1 files changed, 15 insertions, 23 deletions
diff --git a/examples/sql/drilldown/informationwindow.cpp b/examples/sql/drilldown/informationwindow.cpp
index 08c125e58a..d3930c6f0b 100644
--- a/examples/sql/drilldown/informationwindow.cpp
+++ b/examples/sql/drilldown/informationwindow.cpp
@@ -41,38 +41,35 @@
#include "informationwindow.h"
//! [0]
-InformationWindow::InformationWindow(int id, QSqlRelationalTableModel *offices,
+InformationWindow::InformationWindow(int id, QSqlRelationalTableModel *items,
QWidget *parent)
: QDialog(parent)
{
//! [0] //! [1]
- QLabel *locationLabel = new QLabel(tr("Location: "));
- QLabel *countryLabel = new QLabel(tr("Country: "));
+ QLabel *itemLabel = new QLabel(tr("Item: "));
QLabel *descriptionLabel = new QLabel(tr("Description: "));
QLabel *imageFileLabel = new QLabel(tr("Image file: "));
createButtons();
- locationText = new QLabel;
- countryText = new QLabel;
+ itemText = new QLabel;
descriptionEditor = new QTextEdit;
//! [1]
//! [2]
imageFileEditor = new QComboBox;
- imageFileEditor->setModel(offices->relationModel(1));
- imageFileEditor->setModelColumn(offices->relationModel(1)->fieldIndex("file"));
+ imageFileEditor->setModel(items->relationModel(1));
+ imageFileEditor->setModelColumn(items->relationModel(1)->fieldIndex("file"));
//! [2]
//! [3]
mapper = new QDataWidgetMapper(this);
- mapper->setModel(offices);
+ mapper->setModel(items);
mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
mapper->setItemDelegate(new QSqlRelationalDelegate(mapper));
mapper->addMapping(imageFileEditor, 1);
- mapper->addMapping(locationText, 2, "text");
- mapper->addMapping(countryText, 3, "text");
- mapper->addMapping(descriptionEditor, 4);
+ mapper->addMapping(itemText, 2, "text");
+ mapper->addMapping(descriptionEditor, 3);
mapper->setCurrentIndex(id);
//! [3]
@@ -83,8 +80,7 @@ InformationWindow::InformationWindow(int id, QSqlRelationalTableModel *offices,
this, SLOT(enableButtons()));
QFormLayout *formLayout = new QFormLayout;
- formLayout->addRow(locationLabel, locationText);
- formLayout->addRow(countryLabel, countryText);
+ formLayout->addRow(itemLabel, itemText);
formLayout->addRow(imageFileLabel, imageFileEditor);
formLayout->addRow(descriptionLabel, descriptionEditor);
@@ -93,23 +89,19 @@ InformationWindow::InformationWindow(int id, QSqlRelationalTableModel *offices,
layout->addWidget(buttonBox);
setLayout(layout);
- locationId = id;
+ itemId = id;
displayedImage = imageFileEditor->currentText();
- // Commented the following line. Now the window will look like dialog and the Qt will place the QDialogBox buttons to menu area in Symbian.
- // Too bad that the revert button is missing, Should the Qt place the buttons under Option menu in the menu area?!
- // If the Qt::Window flag was used, the background of window is white in symbian and the QLabels can't be regognized from the background.
-
- //setWindowFlags(Qt::Window);
+ setWindowFlags(Qt::Window);
enableButtons(false);
- setWindowTitle(tr("Office: %1").arg(locationText->text()));
+ setWindowTitle(itemText->text());
}
//! [4]
//! [5]
int InformationWindow::id()
{
- return locationId;
+ return itemId;
}
//! [5]
@@ -128,11 +120,11 @@ void InformationWindow::submit()
if (displayedImage != newImage) {
displayedImage = newImage;
- emit imageChanged(locationId, newImage);
+ emit imageChanged(itemId, newImage);
}
mapper->submit();
- mapper->setCurrentIndex(locationId);
+ mapper->setCurrentIndex(itemId);
enableButtons(false);
}