removed useless root item in RsCollection dialog

This commit is contained in:
csoler 2017-11-02 23:16:30 +01:00
parent 2d18335da4
commit 48bd1517fc
2 changed files with 30 additions and 24 deletions

View File

@ -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::vector<Col
item->setData(COLUMN_FILEC, ROLE_SELFILEC, 1);
}
item->setFont(COLUMN_FILE, font);
item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
if (colFileInfo.filename_has_wrong_characters)
{

View File

@ -377,7 +377,7 @@
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>