mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/statistics] Remove public MultipleDataView::editableBannerView() getter
Instead use existing protected virtual bannerView() getter. The reason why both existed is that one was const but not the other. A const variant is needed only exceptionally: in bannerFrame() which is called by drawRect(). Moreover, bannerView() is virtual and is overridden in its derived classes using co-variant return types. That fact is important in the following commit.
This commit is contained in:
committed by
Émilie Feral
parent
e2be17f150
commit
07a9116147
@@ -49,7 +49,7 @@ int MultipleDataView::numberOfSubviews() const {
|
||||
|
||||
View * MultipleDataView::subviewAtIndex(int index) {
|
||||
if (index == MultipleDataView::numberOfSubviews() -1) {
|
||||
return editableBannerView();
|
||||
return bannerView();
|
||||
}
|
||||
int seriesIndex = 0;
|
||||
int nonEmptySeriesIndex = -1;
|
||||
@@ -68,7 +68,7 @@ View * MultipleDataView::subviewAtIndex(int index) {
|
||||
|
||||
void MultipleDataView::layoutSubviews() {
|
||||
// We need to set the banner width first, so its height can be computed
|
||||
editableBannerView()->setFrame(KDRect(0, 0, bounds().width(), 0));
|
||||
bannerView()->setFrame(KDRect(0, 0, bounds().width(), 0));
|
||||
layoutDataSubviews();
|
||||
layoutBanner();
|
||||
}
|
||||
@@ -76,7 +76,7 @@ void MultipleDataView::layoutSubviews() {
|
||||
void MultipleDataView::layoutDataSubviews() {
|
||||
int numberDataSubviews = m_store->numberOfNonEmptySeries();
|
||||
assert(numberDataSubviews > 0);
|
||||
KDCoordinate bannerHeight = bannerFrame().height();
|
||||
KDCoordinate bannerHeight = bannerView()->minimalSizeForOptimalDisplay().height();
|
||||
KDCoordinate subviewHeight = (bounds().height() - bannerHeight)/numberDataSubviews + 1; // +1 to make sure that all pixel rows are drawn
|
||||
int displayedSubviewIndex = 0;
|
||||
for (int i = 0; i < Store::k_numberOfSeries; i++) {
|
||||
@@ -95,18 +95,18 @@ void MultipleDataView::changeDataViewSelection(int index, bool select) {
|
||||
}
|
||||
|
||||
KDRect MultipleDataView::bannerFrame() const {
|
||||
KDCoordinate bannerHeight = bannerView()->minimalSizeForOptimalDisplay().height();
|
||||
KDCoordinate bannerHeight = const_cast<MultipleDataView *>(this)->bannerView()->minimalSizeForOptimalDisplay().height();
|
||||
KDRect frame = KDRect(0, bounds().height() - bannerHeight, bounds().width(), bannerHeight);
|
||||
return frame;
|
||||
}
|
||||
|
||||
void MultipleDataView::layoutBanner() {
|
||||
KDCoordinate bannerHeight = bannerFrame().height();
|
||||
KDCoordinate bannerHeight = bannerView()->minimalSizeForOptimalDisplay().height();
|
||||
if (m_displayBanner) {
|
||||
editableBannerView()->setFrame(bannerFrame());
|
||||
bannerView()->setFrame(bannerFrame());
|
||||
} else {
|
||||
KDRect frame = KDRect(0, bounds().height() - bannerHeight, bounds().width(), 0);
|
||||
editableBannerView()->setFrame(frame);
|
||||
bannerView()->setFrame(frame);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user