Charlie Jiang pushed to branch master at FreeType / FreeType Demo Programs
Commits:
-
2186a044
by Charlie Jiang at 2023-07-26T12:29:07+00:00
8 changed files:
- src/ftinspect/maingui.cpp
- src/ftinspect/panels/abstracttab.hpp
- src/ftinspect/panels/continuous.cpp
- src/ftinspect/panels/continuous.hpp
- src/ftinspect/panels/singular.cpp
- src/ftinspect/panels/singular.hpp
- src/ftinspect/widgets/glyphindexselector.cpp
- src/ftinspect/widgets/glyphindexselector.hpp
Changes:
... | ... | @@ -198,6 +198,8 @@ MainGUI::switchTab() |
198 | 198 | else
|
199 | 199 | leftWidget_->setVisible(!isComparator);
|
200 | 200 | |
201 | + tabs_[tabWidget_->currentIndex()]->relayout();
|
|
202 | + |
|
201 | 203 | reloadCurrentTabFont();
|
202 | 204 | |
203 | 205 | if (current == continuousTab_
|
... | ... | @@ -16,6 +16,7 @@ public: |
16 | 16 | |
17 | 17 | virtual void repaintGlyph() = 0;
|
18 | 18 | virtual void reloadFont() = 0;
|
19 | + virtual void relayout() {}
|
|
19 | 20 | };
|
20 | 21 | |
21 | 22 |
... | ... | @@ -65,6 +65,13 @@ ContinuousTab::reloadFont() |
65 | 65 | }
|
66 | 66 | |
67 | 67 | |
68 | +void
|
|
69 | +ContinuousTab::relayout()
|
|
70 | +{
|
|
71 | + indexSelector_->relayoutNavigation();
|
|
72 | +}
|
|
73 | + |
|
74 | + |
|
68 | 75 | void
|
69 | 76 | ContinuousTab::applySettings()
|
70 | 77 | {
|
... | ... | @@ -46,6 +46,7 @@ public: |
46 | 46 | |
47 | 47 | void repaintGlyph() override;
|
48 | 48 | void reloadFont() override;
|
49 | + void relayout() override;
|
|
49 | 50 | void highlightGlyph(int index);
|
50 | 51 | void applySettings();
|
51 | 52 |
... | ... | @@ -459,6 +459,13 @@ SingularTab::reloadFont() |
459 | 459 | }
|
460 | 460 | |
461 | 461 | |
462 | +void
|
|
463 | +SingularTab::relayout()
|
|
464 | +{
|
|
465 | + indexSelector_->relayoutNavigation();
|
|
466 | +}
|
|
467 | + |
|
468 | + |
|
462 | 469 | void
|
463 | 470 | SingularTab::setCurrentGlyphAndSize(int glyphIndex,
|
464 | 471 | double sizePoint)
|
... | ... | @@ -46,6 +46,7 @@ public: |
46 | 46 | |
47 | 47 | void repaintGlyph() override;
|
48 | 48 | void reloadFont() override;
|
49 | + void relayout() override;
|
|
49 | 50 | // The size remains unchanged if `sizePoint` <= 0.
|
50 | 51 | void setCurrentGlyphAndSize(int glyphIndex,
|
51 | 52 | double sizePoint);
|
... | ... | @@ -20,6 +20,20 @@ GlyphIndexSelector::GlyphIndexSelector(QWidget* parent) |
20 | 20 | }
|
21 | 21 | |
22 | 22 | |
23 | +void
|
|
24 | +GlyphIndexSelector::relayoutNavigation()
|
|
25 | +{
|
|
26 | + auto minimumWidth = minimumSizeHint().width();
|
|
27 | + if (toEndButton_->isVisible())
|
|
28 | + {
|
|
29 | + if (width() < minimumWidth)
|
|
30 | + navigationWidget_->setVisible(false);
|
|
31 | + }
|
|
32 | + else if (navigationWidget_->minimumSizeHint().width() + minimumWidth <= width())
|
|
33 | + navigationWidget_->setVisible(true);
|
|
34 | +}
|
|
35 | + |
|
36 | + |
|
23 | 37 | void
|
24 | 38 | GlyphIndexSelector::setMinMax(int min,
|
25 | 39 | int max)
|
... | ... | @@ -87,15 +101,7 @@ void |
87 | 101 | GlyphIndexSelector::resizeEvent(QResizeEvent* event)
|
88 | 102 | {
|
89 | 103 | QWidget::resizeEvent(event);
|
90 | - auto minimumWidth = minimumSizeHint().width();
|
|
91 | - if (toEndButton_->isVisible())
|
|
92 | - {
|
|
93 | - if (width() < minimumWidth)
|
|
94 | - navigationWidget_->setVisible(false);
|
|
95 | - }
|
|
96 | - else if (navigationWidget_->minimumSizeHint().width() + minimumWidth
|
|
97 | - <= width())
|
|
98 | - navigationWidget_->setVisible(true);
|
|
104 | + relayoutNavigation();
|
|
99 | 105 | }
|
100 | 106 | |
101 | 107 |
... | ... | @@ -24,6 +24,8 @@ public: |
24 | 24 | GlyphIndexSelector(QWidget* parent);
|
25 | 25 | ~GlyphIndexSelector() override = default;
|
26 | 26 | |
27 | + void relayoutNavigation();
|
|
28 | + |
|
27 | 29 | // Never triggers repaint!
|
28 | 30 | void setMinMax(int min,
|
29 | 31 | int max);
|