Compare commits

..

2 Commits

Author SHA1 Message Date
cristian64
30dd1e79df DolphinQt: Use vertical tabs in Hotkey Settings dialog.
At this time, only the **Hotkey Settings** dialog will use vertical
tabs. This dialog happens to feature many tabs that, when horizontal
tabs are used, require horizontal scroll. Also, with these many tabs,
it can make good use of the vertical space that the vertical tabs
require.

| Before | After |
| ------ | ----- |
| <img width="918" height="679" alt="[Dolphin Emulator] Hotkey Settings dialog" title="[Dolphin Emulator] Hotkey Settings dialog" src="https://github.com/user-attachments/assets/7c9d9964-f36b-4872-ab52-6ebbe974a8ca" /> | <img width="1041" height="653" alt="[Dolphin Emulator] Hotkey Settings dialog with vertical tabs" title="[Dolphin Emulator] Hotkey Settings dialog with vertical tabs" src="https://github.com/user-attachments/assets/c6d875f9-f52d-4564-9d68-0555521a77fa" /> |
2025-08-30 21:50:25 +01:00
cristian64
9a359fd47c DolphinQt: Add tab widget with vertical tabs. 2025-08-30 21:50:20 +01:00

View File

@ -25,14 +25,28 @@ protected:
void paintEvent(QPaintEvent* const event) override
{
QStylePainter painter(this);
QStyleOptionTab option;
const int current_tab_index{currentIndex()};
const int tab_count{count()};
for (int i{0}; i < tab_count; ++i)
{
if (i != current_tab_index)
paintTab(painter, i);
}
// 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();
initStyleOption(&option, i);
QStyleOptionTab option;
initStyleOption(&option, tab_index);
painter.drawControl(QStyle::CE_TabBarTabShape, option);
const QSize size{option.rect.size().transposed()};
@ -40,7 +54,7 @@ protected:
rect.moveCenter(option.rect.center());
option.rect = rect;
const QPoint center{tabRect(i).center()};
const QPoint center{tabRect(tab_index).center()};
painter.translate(center);
painter.rotate(90.0);
painter.translate(-center);
@ -48,7 +62,6 @@ protected:
painter.restore();
}
}
};
} // namespace