Skip to content

Commit 5bfbe81

Browse files
committed
Bulk conversion of ::sizeHintEvent(const ftk::SizeHintEvent& event) to ::getSizeHint(). These are all ripe for a refactor to create a ToucanWidget class which removes the redunancy of such instance functions
1 parent 407945d commit 5bfbe81

34 files changed

Lines changed: 72 additions & 95 deletions

lib/toucanView/BackgroundTool.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,9 @@ namespace toucan
125125
_scrollWidget->setGeometry(value);
126126
}
127127

128-
void BackgroundTool::sizeHintEvent(const ftk::SizeHintEvent& event)
128+
Size2I BackgroundTool::getSizeHint() const
129129
{
130-
IToolWidget::sizeHintEvent(event);
131-
_setSizeHint(_scrollWidget->getSizeHint());
130+
return _scrollWidget->getSizeHint();
132131
}
133132

134133
void BackgroundTool::_widgetUpdate()

lib/toucanView/BackgroundTool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace toucan
3636
const std::shared_ptr<IWidget>& parent = nullptr);
3737

3838
void setGeometry(const ftk::Box2I&) override;
39-
void sizeHintEvent(const ftk::SizeHintEvent&) override;
39+
Size2I getSizeHint() const override;
4040

4141
private:
4242
void _widgetUpdate();

lib/toucanView/CompareTool.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,9 @@ namespace toucan
7878
_layout->setGeometry(value);
7979
}
8080

81-
void CompareWidget::sizeHintEvent(const ftk::SizeHintEvent& event)
81+
Size2I CompareWidget::getSizeHint() const
8282
{
83-
IWidget::sizeHintEvent(event);
84-
_setSizeHint(_layout->getSizeHint());
83+
return _layout->getSizeHint();
8584
}
8685

8786
void CompareTool::_init(
@@ -209,10 +208,9 @@ namespace toucan
209208
_layout->setGeometry(value);
210209
}
211210

212-
void CompareTool::sizeHintEvent(const ftk::SizeHintEvent& event)
211+
Size2I CompareTool::getSizeHint() const
213212
{
214-
IToolWidget::sizeHintEvent(event);
215-
_setSizeHint(_layout->getSizeHint());
213+
return _layout->getSizeHint();
216214
}
217215

218216
void CompareTool::_widgetUpdate()

lib/toucanView/CompareTool.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace toucan
4343
void setBCallback(const std::function<void(bool)>&);
4444

4545
void setGeometry(const ftk::Box2I&) override;
46-
void sizeHintEvent(const ftk::SizeHintEvent&) override;
46+
Size2I getSizeHint() const override;
4747

4848
private:
4949
bool _current = false;
@@ -73,7 +73,7 @@ namespace toucan
7373
const std::shared_ptr<IWidget>& parent = nullptr);
7474

7575
void setGeometry(const ftk::Box2I&) override;
76-
void sizeHintEvent(const ftk::SizeHintEvent&) override;
76+
Size2I CompareTool::getSizeHint() const override;
7777

7878
private:
7979
void _widgetUpdate();

lib/toucanView/DetailsTool.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,9 @@ namespace toucan
115115
_bellows->setGeometry(value);
116116
}
117117

118-
void DetailsWidget::sizeHintEvent(const ftk::SizeHintEvent& event)
118+
Size2I DetailsWidget::getSizeHint() const
119119
{
120-
IWidget::sizeHintEvent(event);
121-
_setSizeHint(_bellows->isVisible(false) ? _bellows->getSizeHint() : ftk::Size2I());
120+
return _bellows->isVisible(false) ? _bellows->getSizeHint() : ftk::Size2I();
122121
}
123122

124123
void DetailsWidget::_textUpdate()
@@ -345,9 +344,8 @@ namespace toucan
345344
_layout->setGeometry(value);
346345
}
347346

348-
void DetailsTool::sizeHintEvent(const ftk::SizeHintEvent& event)
347+
Size2I DetailsTool::getSizeHint() const
349348
{
350-
IToolWidget::sizeHintEvent(event);
351-
_setSizeHint(_layout->getSizeHint());
349+
return _layout->getSizeHint();
352350
}
353351
}

lib/toucanView/DetailsTool.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace toucan
5555
void setSearch(const std::string&);
5656

5757
void setGeometry(const ftk::Box2I&) override;
58-
void sizeHintEvent(const ftk::SizeHintEvent&) override;
58+
Size2I getSizeHint() const override;
5959

6060
private:
6161
void _textUpdate();
@@ -96,7 +96,7 @@ namespace toucan
9696
const std::shared_ptr<IWidget>& parent = nullptr);
9797

9898
void setGeometry(const ftk::Box2I&) override;
99-
void sizeHintEvent(const ftk::SizeHintEvent&) override;
99+
Size2I getSizeHint() const override;
100100

101101
private:
102102
std::shared_ptr<ftk::VerticalLayout> _layout;

lib/toucanView/ExportTool.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,9 @@ namespace toucan
9191
_layout->setGeometry(value);
9292
}
9393

94-
void ExportWidget::sizeHintEvent(const ftk::SizeHintEvent& event)
94+
Size2I ExportWidget::getSizeHint() const
9595
{
96-
IWidget::sizeHintEvent(event);
97-
_setSizeHint(_layout->getSizeHint());
96+
return _layout->getSizeHint();
9897
}
9998

10099
void ExportWidget::_initSettings(
@@ -551,9 +550,8 @@ namespace toucan
551550
_scrollWidget->setGeometry(value);
552551
}
553552

554-
void ExportTool::sizeHintEvent(const ftk::SizeHintEvent& event)
553+
Size2I ExportTool::getSizeHint() const
555554
{
556-
IToolWidget::sizeHintEvent(event);
557-
_setSizeHint(_scrollWidget->getSizeHint());
555+
return _scrollWidget->getSizeHint();
558556
}
559557
}

lib/toucanView/ExportTool.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace toucan
4646
const std::shared_ptr<IWidget>& parent = nullptr);
4747

4848
void setGeometry(const ftk::Box2I&) override;
49-
void sizeHintEvent(const ftk::SizeHintEvent&) override;
49+
Size2I getSizeHint() const override;
5050

5151
private:
5252
struct SettingsValues
@@ -134,7 +134,7 @@ namespace toucan
134134
const std::shared_ptr<IWidget>& parent = nullptr);
135135

136136
void setGeometry(const ftk::Box2I&) override;
137-
void sizeHintEvent(const ftk::SizeHintEvent&) override;
137+
Size2I getSizeHint() const override;
138138

139139
private:
140140
std::shared_ptr<ftk::ScrollWidget> _scrollWidget;

lib/toucanView/FileTab.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ namespace toucan
5151
_hudWidget->setGeometry(value);
5252
}
5353

54-
void FileTab::sizeHintEvent(const ftk::SizeHintEvent& event)
54+
Size2I FileTab::getSizeHint() const
5555
{
56-
ftk::IWidget::sizeHintEvent(event);
57-
_setSizeHint(_viewport->getSizeHint());
56+
return _viewport->getSizeHint();
5857
}
5958
}

lib/toucanView/FileTab.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace toucan
3535
const std::shared_ptr<IWidget>& parent = nullptr);
3636

3737
void setGeometry(const ftk::Box2I&) override;
38-
void sizeHintEvent(const ftk::SizeHintEvent&) override;
38+
Size2I getSizeHint() const override;
3939

4040
private:
4141
std::shared_ptr<Viewport> _viewport;

0 commit comments

Comments
 (0)