diff options
author | Arno <am@disconnect.de> | 2013-10-12 08:18:41 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2013-10-12 08:18:41 +0200 |
commit | f4d47b31976bf0b95c8ee3e4c1f010ffe1d2fd21 (patch) | |
tree | ff5f353b15457dfa2688e625700d8294c85dc999 | |
parent | 346b844eea4d5b19d51740b9b29d4f00d54fa373 (diff) | |
download | SheMov-f4d47b31976bf0b95c8ee3e4c1f010ffe1d2fd21.tar.gz SheMov-f4d47b31976bf0b95c8ee3e4c1f010ffe1d2fd21.tar.bz2 SheMov-f4d47b31976bf0b95c8ee3e4c1f010ffe1d2fd21.zip |
Fix resizing of columns in FileView
Don't emit needResize after every model SmDirModel-change. It freezes
the GUI. Let the user decide -> add a QAction to the toolBar.
-rw-r--r-- | shemov.cpp | 6 | ||||
-rw-r--r-- | shemov.h | 1 | ||||
-rw-r--r-- | smdirmodel.cpp | 8 |
3 files changed, 7 insertions, 8 deletions
@@ -431,13 +431,14 @@ void SheMov::createActions(){ connect(mMoveToArchiveA, SIGNAL(triggered()), mFSWidget, SLOT(moveToArchive())); //View menu (FS) - mRefreshA = new QAction(QIcon(":/refresh.png"), tr("Refresh"), this); connect(mRefreshA, SIGNAL(triggered()), mFSWidget->fileModel(), SLOT(refresh())); mFSViewPropertiesA = new QAction(QIcon(":/bizarre_amputee.png"), tr("Properties..."), this); connect(mFSViewPropertiesA, SIGNAL(triggered()), mFSWidget->fileView(), SLOT(properties())); mFSPreviewA = new QAction(QIcon(":/male_chastity_belt.png"), tr("Preview..."), this); connect(mFSPreviewA, SIGNAL(triggered()), mFSWidget, SLOT(preview())); + mFSResizeA = new QAction(QIcon(":/analstretcher.png"), tr("Resize"), this); + connect(mFSResizeA, SIGNAL(triggered()), mFSWidget, SLOT(resizeFileView())); //Help menu QString aboutLabel = QString(tr("About %1...")).arg(qApp->applicationName()); @@ -705,6 +706,8 @@ void SheMov::createMenus(){ fsHeaderMenu->addActions(mFileSysHeaderGroup->actions()); mFSViewMenu->addMenu(fsHeaderMenu); mFSViewMenu->addSeparator(); + mFSViewMenu->addAction(mFSResizeA); + mFSViewMenu->addSeparator(); mFSViewMenu->addAction(mRefreshA); mViewFSMenuA = menuBar()->addMenu(mFSViewMenu); @@ -857,6 +860,7 @@ void SheMov::createToolBar(){ mFSWidget->toolBar()->addSeparator(); mFSWidget->toolBar()->addAction(mFSPreviewA); mFSWidget->toolBar()->addAction(mFSViewPropertiesA); + mFSWidget->toolBar()->addAction(mFSResizeA); mFSWidget->toolBar()->addSeparator(); mFSWidget->toolBar()->addAction(mConfigA); @@ -106,6 +106,7 @@ class SheMov : public QMainWindow { QAction *mMoveToArchiveA; QAction *mFSViewPropertiesA; QAction *mFSPreviewA; + QAction *mFSResizeA; //Filesystem View Actions QActionGroup *mOpenWithGroupFS; diff --git a/smdirmodel.cpp b/smdirmodel.cpp index 2b1e7dc..2cdfb8d 100644 --- a/smdirmodel.cpp +++ b/smdirmodel.cpp @@ -102,7 +102,6 @@ bool SmDirModel::setData(const QModelIndex &index, const QVariant &value, int ro QString dir = fileInfo(index).absolutePath(); QString newPath = QString("%1/%2").arg(dir).arg(newName); QFile::rename(old, newPath); - emit needResize(); return true; } return SmTreeModel::setData(index, value, role); @@ -160,7 +159,6 @@ void SmDirModel::dirEvent(const QList<QVariant> &data, int e){ } } } - emit needResize(); } void SmDirModel::readSettings(){ @@ -198,7 +196,7 @@ void SmDirModel::setMd5Sum(QString path, QString md5){ }else if(mimeType.startsWith("image")){ presentQ.prepare("SELECT COUNT(*) FROM pics WHERE cmd5sum = :md5"); }else{ - goto out; + return; } presentQ.bindValue(":md5", md5); presentQ.exec(); @@ -210,8 +208,6 @@ void SmDirModel::setMd5Sum(QString path, QString md5){ setData(presentIdx, present, Qt::EditRole); } } - out: - emit needResize(); } void SmDirModel::setFfmpeg(QString path, QVariantMap data){ @@ -222,7 +218,6 @@ void SmDirModel::setFfmpeg(QString path, QVariantMap data){ QModelIndex bitrateIdx = createIndex(idx.column(), Bitrate, idx.internalPointer()); setData(bitrateIdx, data["bit_rate"], Qt::EditRole); } - emit needResize(); } void SmDirModel::setPicSize(QString path, QVariant data){ @@ -231,7 +226,6 @@ void SmDirModel::setPicSize(QString path, QVariant data){ QModelIndex psIdx = createIndex(idx.column(), DurSize, idx.internalPointer()); setData(psIdx, data, Qt::EditRole); } - emit needResize(); } void SmDirModel::populate(SmTreeItem *root){ |