size option buttons to the face they carry
QPushButton derives its size hint from its text and icon and ignores a layout set on it, so the recipe options, the shipyard schematic options and the layout dialog's module buttons all measured themselves as empty and clipped the name and recipe line drawn on them. OptionButton takes the hint from its layout instead and lets the style add what the button frame needs, so the padding stays the platform's rather than a number picked here. It falls back to QPushButton's own hint when there is no layout, which is what the "(None)" option uses. The module buttons drop their fixed height with it and take what their cost line needs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ne3mejABZoLWKLh8fgpM3x
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <functional>
|
||||
|
||||
#include "DisplayName.h"
|
||||
#include "OptionButton.h"
|
||||
#include "ProductionRules.h"
|
||||
#include "RecipeLineRow.h"
|
||||
#include "SectionBox.h"
|
||||
@@ -520,7 +521,7 @@ ShipLayoutDialog::ShipLayoutDialog(const GameConfig* config,
|
||||
// The module's name and glyph over what it costs -- its materials and the
|
||||
// production time it adds (REQ-MOD-UI-DIALOG). Both children are transparent to
|
||||
// the mouse so a click anywhere on the face still reaches the button.
|
||||
QPushButton* btn = new QPushButton(this);
|
||||
OptionButton* btn = new OptionButton(this);
|
||||
btn->setCheckable(true);
|
||||
|
||||
QVBoxLayout* face = new QVBoxLayout(btn);
|
||||
|
||||
Reference in New Issue
Block a user