summaryrefslogtreecommitdiffstats
path: root/propertiesdialog.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2012-09-30 04:34:22 +0200
committerArno <am@disconnect.de>2012-09-30 04:34:22 +0200
commit887c2cd696c54af0cd6fdd54950d006626afeacc (patch)
tree2ad296208a7d8e44ac249612dfcd09919e7ba07d /propertiesdialog.cpp
parent5addc8a8ec89c1e354949bcf5c3152fea4fe44b9 (diff)
downloadSheMov-887c2cd696c54af0cd6fdd54950d006626afeacc.tar.gz
SheMov-887c2cd696c54af0cd6fdd54950d006626afeacc.tar.bz2
SheMov-887c2cd696c54af0cd6fdd54950d006626afeacc.zip
Foremost a fix for SmTreeModel
Not working again, but I eventually have to commit the changes. Fixes to SmTreeModel: * Fix SmTreeModel::index(). The previous comment was quite valid. I'm surprised that it worked at all. I have no clue why to return an invalid QModelIndex if the column isn't 0. Now an index with any valid column number can be created. * Fix SmTreeModel::parent(). Again, why shouldn't we create a parent index with a column other than 0? No idea... * Fix SmTreeModel::headerData(). Add some sanity checks. * Fix SmTreeModel::findRecursive(). Well, what is there to say. It never worked for models with a depth > 1, but obviously it didn't really matter until now. To make it work I had to change SmTreeItem as well. SmTreeItem::next() returns the next valid parent/sibling, or 0 if there isn't one. There may be some fallout from these changes, but they're yet to be seen. Changes to PictureView: * fix selecting an item according to the new datasbase layout * same goes for editing items. If an update actually works has to be checked. Overall, it's an intermediate commit that should have been a sane series of commits. Can't be changed now...
Diffstat (limited to 'propertiesdialog.cpp')
-rw-r--r--propertiesdialog.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/propertiesdialog.cpp b/propertiesdialog.cpp
index 485df6b..2068cdf 100644
--- a/propertiesdialog.cpp
+++ b/propertiesdialog.cpp
@@ -66,7 +66,7 @@ void PropertiesDialog::populate(int seriesPartId){
mDisplayModel->setRoot(root);
//setup caption
- QModelIndex seriesIdx = mSeriesModel->findRecursive(seriesPartId, SeriesTreeModel::SeriesPartId, QModelIndex());
+ QModelIndex seriesIdx = mSeriesModel->findRecursive(seriesPartId, SeriesTreeModel::SeriesPartId, mSeriesModel->rootIndex());
Q_ASSERT(seriesIdx.isValid());
QString captionString = QString(tr("Properties for %1")).arg(mSeriesModel->index(seriesIdx.row(), SeriesTreeModel::Name, seriesIdx.parent()).data().toString());
mCaption->setText(captionString);
@@ -88,7 +88,7 @@ void PropertiesDialog::showPicture(QModelIndex current, QModelIndex previous){
QPixmap pic = SmGlobals::instance()->frameCache()->entry(current.data().toString());
mPictureLabel->setPixmap(pic);
}else if(nodeType == PictureFileNode){
- QModelIndex fileIdx = mFilesModel->findRecursive(fileId, FilesTreeModel::FilesId, mFilesModel->index(0, 0, QModelIndex()));
+ QModelIndex fileIdx = mFilesModel->findRecursive(fileId, FilesTreeModel::FilesId, mFilesModel->rootIndex());
if(fileIdx.isValid()){
QString fullPath = fileIdx.data(FilesTreeModel::FullPathRole).toString();
mPictureLabel->setPixmap(fullPath);