Better workaround for "ResizeToContents not updating" bug.

This commit is contained in:
LoRd_MuldeR 2011-08-23 17:01:11 +02:00
parent 8300d58c46
commit 10ae6c8451
5 changed files with 27 additions and 9 deletions

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 3
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 15
#define VER_LAMEXP_BUILD 660
#define VER_LAMEXP_BUILD 662
///////////////////////////////////////////////////////////////////////////////
// Tools versions

View File

@ -132,6 +132,8 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
connect(m_fileListModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(sourceModelChanged()));
connect(m_fileListModel, SIGNAL(modelReset()), this, SLOT(sourceModelChanged()));
connect(sourceFileView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(sourceFilesContextMenu(QPoint)));
connect(sourceFileView->verticalScrollBar(), SIGNAL(sliderMoved(int)), this, SLOT(sourceFilesScrollbarMoved(int)));
connect(sourceFileView->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(sourceFilesScrollbarMoved(int)));
connect(m_showDetailsContextAction, SIGNAL(triggered(bool)), this, SLOT(showDetailsButtonClicked()));
connect(m_previewContextAction, SIGNAL(triggered(bool)), this, SLOT(previewContextActionTriggered()));
connect(m_findFileContextAction, SIGNAL(triggered(bool)), this, SLOT(findFileContextActionTriggered()));
@ -862,10 +864,6 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event)
break;
}
}
else if(obj == sourceFileView->viewport())
{
sourceFileView ->resizeColumnToContents(0);
}
return false;
}
@ -1863,6 +1861,15 @@ void MainWindow::sourceFilesContextMenu(const QPoint &pos)
}
}
/*
* Scrollbar of source files moved
*/
void MainWindow::sourceFilesScrollbarMoved(int)
{
qDebug("sourceFileView->resizeColumnToContents(0);");
sourceFileView->resizeColumnToContents(0);
}
/*
* Open selected file in external player
*/

View File

@ -118,6 +118,7 @@ private slots:
void showFolderContextActionTriggered(void);
void showRenameMacros(const QString &text);
void sourceFilesContextMenu(const QPoint &pos);
void sourceFilesScrollbarMoved(int);
void sourceModelChanged(void);
void styleActionActivated(QAction *action);
void tabActionActivated(QAction *action);

View File

@ -135,6 +135,7 @@ ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, AudioFileModel
connect(m_progressModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(progressModelChanged()));
connect(m_progressModel, SIGNAL(modelReset()), this, SLOT(progressModelChanged()));
connect(view_log, SIGNAL(activated(QModelIndex)), this, SLOT(logViewDoubleClicked(QModelIndex)));
connect(view_log->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(logViewSectionSizeChanged(int,int,int)));
//Create context menu
m_contextMenu = new QMenu();
@ -264,10 +265,6 @@ bool ProcessingDialog::eventFilter(QObject *obj, QEvent *event)
QDesktopServices::openUrl(url);
}
}
else if(obj == view_log->viewport())
{
view_log->resizeColumnToContents(1);
}
return false;
}
@ -482,6 +479,18 @@ void ProcessingDialog::logViewDoubleClicked(const QModelIndex &index)
}
}
void ProcessingDialog::logViewSectionSizeChanged(int logicalIndex, int oldSize, int newSize)
{
qDebug("sectionResized");
if(logicalIndex == 1)
{
if(QHeaderView *hdr = view_log->horizontalHeader())
{
hdr->setMinimumSectionSize(max(hdr->minimumSectionSize(), hdr->sectionSize(1)));
}
}
}
void ProcessingDialog::contextMenuTriggered(const QPoint &pos)
{
QAbstractScrollArea *scrollArea = dynamic_cast<QAbstractScrollArea*>(QObject::sender());

View File

@ -52,6 +52,7 @@ private slots:
void processFinished(const QUuid &jobId, const QString &outFileName, bool success);
void progressModelChanged(void);
void logViewDoubleClicked(const QModelIndex &index);
void logViewSectionSizeChanged(int, int, int);
void contextMenuTriggered(const QPoint &pos);
void contextMenuDetailsActionTriggered(void);
void contextMenuShowFileActionTriggered(void);