fix: Avoid duplicate scale in settings dialog (#5069)

This commit is contained in:
nerix 2024-01-06 12:28:06 +01:00 committed by GitHub
parent 1192393039
commit e48d868e8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View file

@ -108,6 +108,7 @@
- Dev: Refactor Args to be less of a singleton. (#5041)
- Dev: Channels without any animated elements on screen will skip updates from the GIF timer. (#5042, #5043, #5045)
- Dev: Autogenerate docs/plugin-meta.lua. (#5055)
- Dev: Removed duplicate scale in settings dialog. (#5069)
- Dev: Fix `NotebookTab` emitting updates for every message. (#5068)
## 2.4.6

View file

@ -52,7 +52,6 @@ SettingsDialog::SettingsDialog(QWidget *parent)
this->initUi();
this->addTabs();
this->overrideBackgroundColor_ = QColor("#111111");
this->scaleChangedEvent(this->scale()); // execute twice to width of item
this->addShortcuts();
this->signalHolder_.managedConnect(getApp()->hotkeys->onItemsUpdated,
@ -128,6 +127,8 @@ void SettingsDialog::initUi()
.setLayoutType<QVBoxLayout>()
.withoutMargin()
.assign(&this->ui_.tabContainer);
this->ui_.tabContainerContainer->setFixedWidth(
static_cast<int>(150 * this->dpi_));
// right side (pages)
centerBox.emplace<QStackedLayout>()
@ -257,6 +258,7 @@ void SettingsDialog::addTab(std::function<SettingsPage *()> page,
SettingsTabId id, Qt::Alignment alignment)
{
auto tab = new SettingsDialogTab(this, std::move(page), name, iconPath, id);
tab->setFixedHeight(static_cast<int>(30 * this->dpi_));
this->ui_.tabContainer->addWidget(tab, 0, alignment);
this->tabs_.push_back(tab);
@ -390,7 +392,11 @@ void SettingsDialog::scaleChangedEvent(float newDpi)
this->setStyleSheet(styleSheet);
if (this->ui_.tabContainerContainer)
{
this->ui_.tabContainerContainer->setFixedWidth(int(150 * newDpi));
}
this->dpi_ = newDpi;
}
void SettingsDialog::themeChangedEvent()

View file

@ -77,6 +77,7 @@ private:
std::vector<SettingsDialogTab *> tabs_;
SettingsDialogTab *selectedTab_{};
SettingsDialogTab *lastSelectedByUser_{};
float dpi_ = 1.0F;
friend class SettingsDialogTab;
};