mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 01:23:24 -08:00
[VisualDeckStorage] Keep databaseLoadIndicator alive when swapping in folder widget (#7651)
Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>
This commit is contained in:
parent
f3fb3331d1
commit
4ab875be48
2 changed files with 13 additions and 2 deletions
|
|
@ -184,7 +184,9 @@ void VisualDeckStorageWidget::resizeEvent(QResizeEvent *event)
|
|||
|
||||
void VisualDeckStorageWidget::retranslateUi()
|
||||
{
|
||||
databaseLoadIndicator->setText(tr("Loading database ..."));
|
||||
if (databaseLoadIndicator) {
|
||||
databaseLoadIndicator->setText(tr("Loading database ..."));
|
||||
}
|
||||
|
||||
refreshButton->setToolTip(tr("Refresh loaded files"));
|
||||
shareButton->setToolTip(tr("Select decks to share"));
|
||||
|
|
@ -279,6 +281,14 @@ void VisualDeckStorageWidget::createRootFolderWidget()
|
|||
folderWidget =
|
||||
new VisualDeckStorageFolderDisplayWidget(this, this, QString(), false, quickSettingsWidget->getShowFolders());
|
||||
|
||||
// QScrollArea::setWidget() deletes the widget it currently holds. If that is still the
|
||||
// database load indicator, take it back first so the label stays alive for retranslateUi().
|
||||
if (databaseLoadIndicator && scrollArea->widget() == databaseLoadIndicator) {
|
||||
scrollArea->takeWidget();
|
||||
databaseLoadIndicator->setParent(this);
|
||||
databaseLoadIndicator->setVisible(false);
|
||||
}
|
||||
|
||||
scrollArea->setWidget(folderWidget); // this automatically destroys the old folderWidget
|
||||
scrollArea->widget()->setMaximumWidth(scrollArea->viewport()->width());
|
||||
scrollArea->widget()->adjustSize();
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#ifndef VISUAL_DECK_STORAGE_WIDGET_H
|
||||
#define VISUAL_DECK_STORAGE_WIDGET_H
|
||||
|
||||
#include <QPointer>
|
||||
#include <QSet>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
|
@ -87,7 +88,7 @@ private:
|
|||
QVBoxLayout *layout;
|
||||
QWidget *searchAndSortContainer;
|
||||
QHBoxLayout *searchAndSortLayout;
|
||||
QLabel *databaseLoadIndicator;
|
||||
QPointer<QLabel> databaseLoadIndicator;
|
||||
VisualDeckStorageSortWidget *sortWidget;
|
||||
VisualDeckStorageSearchWidget *searchWidget;
|
||||
DeckPreviewColorIdentityFilterWidget *deckPreviewColorIdentityFilterWidget;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue