mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-18 04:51:33 -07:00
[VDD] Fix minimum size by adding a compact mode to quickSettingsButtons (#6890)
* [VDD] Fix minimum size by adding a compact mode to quickSettingsButtons Took 17 minutes Took 5 seconds * Fix and use FlowWidget/FlowLayout Took 35 minutes Took 4 seconds * Set spacings. Took 12 minutes * Make VDE tools flow Took 1 hour 23 minutes Took 5 seconds * Squeeze and flow even more. Took 11 minutes * Make pushbutton compact. Took 54 minutes Took 7 seconds --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
762e742be0
commit
7153f7d4c1
21 changed files with 666 additions and 617 deletions
|
|
@ -35,19 +35,33 @@ void SettingsButtonWidget::setButtonIcon(QPixmap iconMap)
|
|||
button->setIcon(iconMap);
|
||||
}
|
||||
|
||||
void SettingsButtonWidget::setButtonText(const QString &buttonText)
|
||||
void SettingsButtonWidget::setButtonText(const QString &text)
|
||||
{
|
||||
// 🔓 unlock size constraints
|
||||
buttonText = text;
|
||||
|
||||
button->setMinimumSize(QSize(0, 0));
|
||||
button->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
|
||||
|
||||
button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
button->setText(buttonText);
|
||||
|
||||
button->setText(text);
|
||||
button->setFixedHeight(32);
|
||||
button->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
|
||||
button->setMinimumWidth(button->sizeHint().width());
|
||||
button->setMinimumWidth(32); // icon-only fallback minimum
|
||||
}
|
||||
|
||||
void SettingsButtonWidget::setCompact(bool _compact)
|
||||
{
|
||||
compact = _compact;
|
||||
if (compact) {
|
||||
button->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
button->setFixedWidth(32);
|
||||
} else {
|
||||
button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
button->setText(buttonText);
|
||||
button->setFixedWidth(QWIDGETSIZE_MAX); // release fixed width
|
||||
button->setMinimumWidth(32);
|
||||
button->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsButtonWidget::togglePopup()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue