125541 【云桌面】【备份还原】拖放文件夹区域,文件路径不显示

This commit is contained in:
zhaominyong 2022-06-28 14:21:01 +08:00
parent 45950d417f
commit 55b3959546
3 changed files with 11 additions and 8 deletions

View File

@ -140,17 +140,23 @@ BackupListWidget::BackupListWidget(QWidget *parent /*= nullptr*/, QHBoxLayout *p
setLayout(vlayout);
connect(this, &BackupListWidget::currentItemChanged, this, [=](QListWidgetItem *current, QListWidgetItem *previous) {
int row = this->currentRow();
if (current) {
MyItemWidget *widget = qobject_cast<MyItemWidget *>(this->itemWidget(current));
if (widget)
if (widget) {
if (-1 == row)
emit widget->selected(false);
else
emit widget->selected(true);
}
}
if (previous) {
MyItemWidget *widget = qobject_cast<MyItemWidget *>(this->itemWidget(previous));
if (widget)
if (widget) {
emit widget->selected(false);
}
}
});
}
@ -180,7 +186,6 @@ bool BackupListWidget::appendItem(const QString &text)
item->setSizeHint(QSize(this->width() - 5, WIDTH_ITEM));
MyItemWidget *widget = new MyItemWidget;
this->setItemWidget(item, widget);
this->setCurrentRow(-1);
// 必须将scrollToBottom等这种滚动条操作放到判断滚动条是否显示isVisible之前
this->scrollToBottom();
@ -204,7 +209,6 @@ bool BackupListWidget::appendItem(const QString &text)
this->removeItemWidget(item);
this->takeItem(this->row(item));
delete item;
this->setCurrentRow(-1);
this->scrollToBottom();
if (this->count() == 0) {
this->m_plusLogo->setVisible(true);
@ -223,7 +227,6 @@ bool BackupListWidget::appendItem(const QString &text)
m_plusLogo->setVisible(false);
m_plusText->setVisible(false);
emit this->addedItem();
return true;
}

View File

@ -6,7 +6,7 @@ BackupPositionSelectDialog::BackupPositionSelectDialog(QWidget* parent) :
QFileDialog(parent)
{
setWindowTitle(tr("Please select a path"));
setViewMode(QFileDialog::List);
setViewMode(QFileDialog::Detail);
setFileMode(QFileDialog::DirectoryOnly);
setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
QList<QUrl> siderUrls;

View File

@ -6,7 +6,7 @@
MyFileSelect::MyFileSelect(QWidget* parent) :
QFileDialog(parent)
{
this->setViewMode(QFileDialog::List);
this->setViewMode(QFileDialog::Detail);
this->setFileMode(QFileDialog::ExistingFiles);
this->setFilter(QDir::System | QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);