mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-09 19:43:26 -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()
|
void VisualDeckStorageWidget::retranslateUi()
|
||||||
{
|
{
|
||||||
databaseLoadIndicator->setText(tr("Loading database ..."));
|
if (databaseLoadIndicator) {
|
||||||
|
databaseLoadIndicator->setText(tr("Loading database ..."));
|
||||||
|
}
|
||||||
|
|
||||||
refreshButton->setToolTip(tr("Refresh loaded files"));
|
refreshButton->setToolTip(tr("Refresh loaded files"));
|
||||||
shareButton->setToolTip(tr("Select decks to share"));
|
shareButton->setToolTip(tr("Select decks to share"));
|
||||||
|
|
@ -279,6 +281,14 @@ void VisualDeckStorageWidget::createRootFolderWidget()
|
||||||
folderWidget =
|
folderWidget =
|
||||||
new VisualDeckStorageFolderDisplayWidget(this, this, QString(), false, quickSettingsWidget->getShowFolders());
|
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->setWidget(folderWidget); // this automatically destroys the old folderWidget
|
||||||
scrollArea->widget()->setMaximumWidth(scrollArea->viewport()->width());
|
scrollArea->widget()->setMaximumWidth(scrollArea->viewport()->width());
|
||||||
scrollArea->widget()->adjustSize();
|
scrollArea->widget()->adjustSize();
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#ifndef VISUAL_DECK_STORAGE_WIDGET_H
|
#ifndef VISUAL_DECK_STORAGE_WIDGET_H
|
||||||
#define VISUAL_DECK_STORAGE_WIDGET_H
|
#define VISUAL_DECK_STORAGE_WIDGET_H
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
@ -87,7 +88,7 @@ private:
|
||||||
QVBoxLayout *layout;
|
QVBoxLayout *layout;
|
||||||
QWidget *searchAndSortContainer;
|
QWidget *searchAndSortContainer;
|
||||||
QHBoxLayout *searchAndSortLayout;
|
QHBoxLayout *searchAndSortLayout;
|
||||||
QLabel *databaseLoadIndicator;
|
QPointer<QLabel> databaseLoadIndicator;
|
||||||
VisualDeckStorageSortWidget *sortWidget;
|
VisualDeckStorageSortWidget *sortWidget;
|
||||||
VisualDeckStorageSearchWidget *searchWidget;
|
VisualDeckStorageSearchWidget *searchWidget;
|
||||||
DeckPreviewColorIdentityFilterWidget *deckPreviewColorIdentityFilterWidget;
|
DeckPreviewColorIdentityFilterWidget *deckPreviewColorIdentityFilterWidget;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue