diff options
author | Arno <am@disconnect.de> | 2012-03-08 07:09:09 +0100 |
---|---|---|
committer | Arno <am@disconnect.de> | 2012-03-08 07:09:09 +0100 |
commit | ea30d012b7777a2aea1c5e957a7d7566eebef391 (patch) | |
tree | 88a1ebdcca7a3184781d4ed4ac29b3892df04d6c /pictureswidget.cpp | |
parent | 57f69839e3bab9ab73f15811374099576216282b (diff) | |
download | SheMov-ea30d012b7777a2aea1c5e957a7d7566eebef391.tar.gz SheMov-ea30d012b7777a2aea1c5e957a7d7566eebef391.tar.bz2 SheMov-ea30d012b7777a2aea1c5e957a7d7566eebef391.zip |
Show picture on doubleClick in PicturesWidget
Show picture in PictureViewer2 when double clicking an item in pictures
widget. Also shuffle some code around.
Diffstat (limited to 'pictureswidget.cpp')
-rw-r--r-- | pictureswidget.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/pictureswidget.cpp b/pictureswidget.cpp index 907b33f..2d56571 100644 --- a/pictureswidget.cpp +++ b/pictureswidget.cpp @@ -27,16 +27,17 @@ #include "mappingtreemodel.h" #include "smglobals.h" -PicturesWidget::PicturesWidget(QWidget *parent) : QWidget(parent), mWindowTitleBase(tr("Picture archive")) { +PicturesWidget::PicturesWidget(QWidget *parent) : QWidget(parent), mWindowTitleBase(tr("Picture archive")), mPicViewerA(0) { //setup gui QSplitter *splitter = new QSplitter; mMappingTree = new MappingTreeWidget; mPictureView = new PictureView; connect(mMappingTree, SIGNAL(mappingChanged(int)), mPictureView, SLOT(mappingChanged(int))); - //emit needWindowtitleChange(QString) when mapping selection changes + //change window title when mapping selection changes connect(mMappingTree, SIGNAL(mappingChanged(int)), this, SLOT(constructWindowTitle())); connect(mPictureView, SIGNAL(newFileMappigs()), this, SLOT(setMappingColors())); connect(mPictureView, SIGNAL(editPicsMappings()), this, SLOT(editMappings())); + connect(mPictureView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(showInPicViewer(QModelIndex))); splitter->addWidget(mMappingTree); splitter->addWidget(mPictureView); splitter->setStretchFactor(0, 1); @@ -89,6 +90,16 @@ void PicturesWidget::constructWindowTitle(){ emit needWindowTitleChange(windowTitle); } +void PicturesWidget::showInPicViewer(const QModelIndex &idx){ + if(!idx.isValid()){ + return; + } + mPicViewer->setFile(idx.data(PicFilesModel::FullPathRole).toString()); + if(mPicViewerA){ + mPicViewerA->setChecked(true); + } +} + PictureView::PictureView(QWidget *parent) : QTreeView(parent) { //setup model mModel = new PicFilesModel(QStringList() << tr("Filename") << tr("SizeNum") << tr("Format") << tr("Full Path") << tr("Id") << tr("Added") << tr("Md5Sum") << tr("Size"), this); |