mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-09-03 22:55:28 +00:00
Compare commits
2 Commits
597c1d56b0
...
30dd1e79df
Author | SHA1 | Date | |
---|---|---|---|
![]() |
30dd1e79df | ||
![]() |
9a359fd47c |
@ -25,29 +25,42 @@ protected:
|
|||||||
void paintEvent(QPaintEvent* const event) override
|
void paintEvent(QPaintEvent* const event) override
|
||||||
{
|
{
|
||||||
QStylePainter painter(this);
|
QStylePainter painter(this);
|
||||||
QStyleOptionTab option;
|
|
||||||
|
const int current_tab_index{currentIndex()};
|
||||||
|
|
||||||
const int tab_count{count()};
|
const int tab_count{count()};
|
||||||
for (int i{0}; i < tab_count; ++i)
|
for (int i{0}; i < tab_count; ++i)
|
||||||
{
|
{
|
||||||
painter.save();
|
if (i != current_tab_index)
|
||||||
|
paintTab(painter, i);
|
||||||
initStyleOption(&option, i);
|
|
||||||
painter.drawControl(QStyle::CE_TabBarTabShape, option);
|
|
||||||
|
|
||||||
const QSize size{option.rect.size().transposed()};
|
|
||||||
QRect rect(QPoint(), size);
|
|
||||||
rect.moveCenter(option.rect.center());
|
|
||||||
option.rect = rect;
|
|
||||||
|
|
||||||
const QPoint center{tabRect(i).center()};
|
|
||||||
painter.translate(center);
|
|
||||||
painter.rotate(90.0);
|
|
||||||
painter.translate(-center);
|
|
||||||
painter.drawControl(QStyle::CE_TabBarTabLabel, option);
|
|
||||||
|
|
||||||
painter.restore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Current tab is painted last as, depending on the [system] style, it is possible that the
|
||||||
|
// decoration is required to occlude the adjacent tab underneath.
|
||||||
|
paintTab(painter, current_tab_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void paintTab(QStylePainter& painter, const int tab_index)
|
||||||
|
{
|
||||||
|
painter.save();
|
||||||
|
|
||||||
|
QStyleOptionTab option;
|
||||||
|
initStyleOption(&option, tab_index);
|
||||||
|
painter.drawControl(QStyle::CE_TabBarTabShape, option);
|
||||||
|
|
||||||
|
const QSize size{option.rect.size().transposed()};
|
||||||
|
QRect rect(QPoint(), size);
|
||||||
|
rect.moveCenter(option.rect.center());
|
||||||
|
option.rect = rect;
|
||||||
|
|
||||||
|
const QPoint center{tabRect(tab_index).center()};
|
||||||
|
painter.translate(center);
|
||||||
|
painter.rotate(90.0);
|
||||||
|
painter.translate(-center);
|
||||||
|
painter.drawControl(QStyle::CE_TabBarTabLabel, option);
|
||||||
|
|
||||||
|
painter.restore();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user