Moved call to setResizeMode in SharedFilesDialog after the call to setModel on QTreeView.

Qt shows an assertion in debug mode when column count is 0.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6152 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-02-27 00:23:56 +00:00
parent 5aa6afbfdb
commit 2ed1712580

View File

@ -36,7 +36,7 @@
#endif #endif
#include "RetroShareLink.h" #include "RetroShareLink.h"
#include "ShareManager.h" #include "ShareManager.h"
#include "RemoteDirModel.h" #include "RemoteDirModel.h"
#include "ShareDialog.h" #include "ShareDialog.h"
#include "common/PeerDefs.h" #include "common/PeerDefs.h"
@ -56,8 +56,8 @@
#define IMAGE_COPYLINK ":/images/copyrslink.png" #define IMAGE_COPYLINK ":/images/copyrslink.png"
#define IMAGE_OPENFOLDER ":/images/folderopen.png" #define IMAGE_OPENFOLDER ":/images/folderopen.png"
#define IMAGE_OPENFILE ":/images/fileopen.png" #define IMAGE_OPENFILE ":/images/fileopen.png"
#define IMAGE_COLLECTION ":/images/mimetypes/rscollection-16.png" #define IMAGE_COLLECTION ":/images/mimetypes/rscollection-16.png"
#define IMAGE_EDITSHARE ":/images/edit_16.png" #define IMAGE_EDITSHARE ":/images/edit_16.png"
// Define to avoid using the search in treeview, because it is really slow for now. // Define to avoid using the search in treeview, because it is really slow for now.
// //
@ -130,7 +130,6 @@ SharedFilesDialog::SharedFilesDialog(RetroshareDirModel *_tree_model,RetroshareD
/* Set header resize modes and initial section sizes */ /* Set header resize modes and initial section sizes */
QHeaderView * header = ui.dirTreeView->header () ; QHeaderView * header = ui.dirTreeView->header () ;
header->setResizeMode (0, QHeaderView::Interactive);
header->resizeSection ( 0, 490 ); header->resizeSection ( 0, 490 );
header->resizeSection ( 1, 70 ); header->resizeSection ( 1, 70 );
@ -327,6 +326,9 @@ void SharedFilesDialog::changeCurrentViewModel(int c)
ui.dirTreeView->setModel(proxyModel); ui.dirTreeView->setModel(proxyModel);
ui.dirTreeView->update(); ui.dirTreeView->update();
QHeaderView * header = ui.dirTreeView->header () ;
header->setResizeMode (0, QHeaderView::Interactive);
ui.dirTreeView->header()->headerDataChanged(Qt::Horizontal,0,4) ; ui.dirTreeView->header()->headerDataChanged(Qt::Horizontal,0,4) ;
#ifdef DONT_USE_SEARCH_IN_TREE_VIEW #ifdef DONT_USE_SEARCH_IN_TREE_VIEW
@ -460,7 +462,7 @@ void LocalSharedFilesDialog::createCollectionFile()
std::cerr << "Creating a collection file!" << std::endl; std::cerr << "Creating a collection file!" << std::endl;
QModelIndexList lst = getSelected(); QModelIndexList lst = getSelected();
model->createCollectionFile(this, lst); model->createCollectionFile(this, lst);
} }
void RemoteSharedFilesDialog::downloadRemoteSelected() void RemoteSharedFilesDialog::downloadRemoteSelected()
{ {
@ -472,24 +474,24 @@ void RemoteSharedFilesDialog::downloadRemoteSelected()
QModelIndexList lst = getSelected(); QModelIndexList lst = getSelected();
model -> downloadSelected(lst); model -> downloadSelected(lst);
} }
void LocalSharedFilesDialog::editSharePermissions() void LocalSharedFilesDialog::editSharePermissions()
{ {
std::list<SharedDirInfo> dirs; std::list<SharedDirInfo> dirs;
rsFiles->getSharedDirectories(dirs); rsFiles->getSharedDirectories(dirs);
std::list<SharedDirInfo>::const_iterator it; std::list<SharedDirInfo>::const_iterator it;
for (it = dirs.begin(); it != dirs.end(); it++) { for (it = dirs.begin(); it != dirs.end(); it++) {
if (currentFile == currentFile) { if (currentFile == currentFile) {
/* file name found, show dialog */ /* file name found, show dialog */
ShareDialog sharedlg (it->filename, this); ShareDialog sharedlg (it->filename, this);
sharedlg.setWindowTitle(tr("Edit Shared Folder")); sharedlg.setWindowTitle(tr("Edit Shared Folder"));
sharedlg.exec(); sharedlg.exec();
break; break;
} }
} }
} }
void SharedFilesDialog::copyLink (const QModelIndexList& lst, bool remote) void SharedFilesDialog::copyLink (const QModelIndexList& lst, bool remote)
{ {