From 48bd1517fc3aed050c70bcda2d0ee16af86fe9d2 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 2 Nov 2017 23:16:30 +0100 Subject: [PATCH] removed useless root item in RsCollection dialog --- .../src/gui/common/RsCollectionDialog.cpp | 52 +++++++++++-------- .../src/gui/common/RsCollectionDialog.ui | 2 +- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/retroshare-gui/src/gui/common/RsCollectionDialog.cpp b/retroshare-gui/src/gui/common/RsCollectionDialog.cpp index ede8c7520..3f0d1383d 100644 --- a/retroshare-gui/src/gui/common/RsCollectionDialog.cpp +++ b/retroshare-gui/src/gui/common/RsCollectionDialog.cpp @@ -146,6 +146,7 @@ RsCollectionDialog::RsCollectionDialog(const QString& collectionFileName ui.headerFrame->setHeaderText(tr("Collection Editor")); ui.downloadFolder_LE->hide(); ui.downloadFolder_LB->hide(); + ui.destinationDir_TB->hide(); } else { @@ -401,30 +402,34 @@ void RsCollectionDialog::processSettings(bool bLoad) */ QTreeWidgetItem* RsCollectionDialog::getRootItem() { - QTreeWidgetItem* root= ui._fileEntriesTW->topLevelItem(0); - if (!root) { - root= new QTreeWidgetItem; - root->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsTristate); - root->setText(COLUMN_FILE, "/"); - root->setToolTip(COLUMN_FILE,tr("This is the root directory.")); - root->setText(COLUMN_FILEPATH, "/"); - root->setText(COLUMN_HASH, ""); - root->setData(COLUMN_HASH, ROLE_NAME, ""); - root->setData(COLUMN_HASH, ROLE_PATH, ""); - root->setData(COLUMN_HASH, ROLE_TYPE, DIR_TYPE_DIR); - root->setText(COLUMN_SIZE, misc::friendlyUnit(0)); - root->setToolTip(COLUMN_SIZE, tr("Real Size: Waiting child...")); - root->setData(COLUMN_SIZE, ROLE_SIZE, 0); - root->setData(COLUMN_SIZE, ROLE_SELSIZE, 0); - root->setText(COLUMN_FILEC, "0"); - root->setToolTip(COLUMN_FILEC, tr("Real File Count: Waiting child...")); - root->setData(COLUMN_FILEC, ROLE_FILEC, 0); - root->setData(COLUMN_FILEC, ROLE_SELFILEC, 0); - ui._fileEntriesTW->addTopLevelItem(root); - } - root->setExpanded(true); + return ui._fileEntriesTW->invisibleRootItem(); - return root; +// (csoler) I removed this code because it does the job of the invisibleRootItem() method. +// +// QTreeWidgetItem* root= ui._fileEntriesTW->topLevelItem(0); +// if (!root) { +// root= new QTreeWidgetItem; +// root->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsTristate); +// root->setText(COLUMN_FILE, "/"); +// root->setToolTip(COLUMN_FILE,tr("This is the root directory.")); +// root->setText(COLUMN_FILEPATH, "/"); +// root->setText(COLUMN_HASH, ""); +// root->setData(COLUMN_HASH, ROLE_NAME, ""); +// root->setData(COLUMN_HASH, ROLE_PATH, ""); +// root->setData(COLUMN_HASH, ROLE_TYPE, DIR_TYPE_DIR); +// root->setText(COLUMN_SIZE, misc::friendlyUnit(0)); +// root->setToolTip(COLUMN_SIZE, tr("Real Size: Waiting child...")); +// root->setData(COLUMN_SIZE, ROLE_SIZE, 0); +// root->setData(COLUMN_SIZE, ROLE_SELSIZE, 0); +// root->setText(COLUMN_FILEC, "0"); +// root->setToolTip(COLUMN_FILEC, tr("Real File Count: Waiting child...")); +// root->setData(COLUMN_FILEC, ROLE_FILEC, 0); +// root->setData(COLUMN_FILEC, ROLE_SELFILEC, 0); +// ui._fileEntriesTW->addTopLevelItem(root); +// } +// root->setExpanded(true); +// +// return root; } /** @@ -515,6 +520,7 @@ bool RsCollectionDialog::addChild(QTreeWidgetItem* parent, const std::vectorsetData(COLUMN_FILEC, ROLE_SELFILEC, 1); } item->setFont(COLUMN_FILE, font); + item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless); if (colFileInfo.filename_has_wrong_characters) { diff --git a/retroshare-gui/src/gui/common/RsCollectionDialog.ui b/retroshare-gui/src/gui/common/RsCollectionDialog.ui index ccbae3ef6..a930d2e7d 100644 --- a/retroshare-gui/src/gui/common/RsCollectionDialog.ui +++ b/retroshare-gui/src/gui/common/RsCollectionDialog.ui @@ -377,7 +377,7 @@ QAbstractItemView::ExtendedSelection - false + true true