From 5d1e566d275b47fa590fb9e9879b9a1f970fc3ba Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 3 Mar 2012 06:36:22 +0100 Subject: Impement editing of picture mappings Make it possible to edit picture mappings on archived pictures. --- mappingtreewidget.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'mappingtreewidget.cpp') diff --git a/mappingtreewidget.cpp b/mappingtreewidget.cpp index 67ccd87..22a9757 100644 --- a/mappingtreewidget.cpp +++ b/mappingtreewidget.cpp @@ -297,3 +297,35 @@ void MappingEditWidget::removeMapping(){ QModelIndex firstIdx = sel.first(); mResultModel->removeRows(firstIdx.row(), 1, firstIdx.parent()); } + +void MappingEditWidget::setMappings(const QList &mappings){ + if(mappings.isEmpty()){ + return; + } + MappingTreeModel *mModel = static_cast(SmGlobals::instance()->model("MappingTree")); + mResultModel->clearData(); + foreach(int i, mappings){ + MappingData curData = mModel->mappingDataFromId(i); + if(curData.id != -1){ + mResultModel->addItem(curData); + } + } + mMappingResult->expandAll(); +} + +MappingEditDialog::MappingEditDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f){ + mEditWidget = new MappingEditWidget; + mOk = new QPushButton(tr("Ok")); + connect(mOk, SIGNAL(clicked()), this, SLOT(accept())); + mCancel = new QPushButton(tr("Cancel")); + connect(mCancel, SIGNAL(clicked()), this, SLOT(reject())); + + QHBoxLayout *buttonLayout = new QHBoxLayout; + buttonLayout->addStretch(); + buttonLayout->addWidget(mOk); + buttonLayout->addWidget(mCancel); + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addWidget(mEditWidget); + mainLayout->addLayout(buttonLayout); + setLayout(mainLayout); +} -- cgit v1.2.3-70-g09d2