mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-09-03 22:55:28 +00:00
Compare commits
2 Commits
30dd1e79df
...
597c1d56b0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
597c1d56b0 | ||
![]() |
c13d7dfd2d |
@ -334,6 +334,8 @@ add_executable(dolphin-emu
|
|||||||
QtUtils/SignalBlocking.h
|
QtUtils/SignalBlocking.h
|
||||||
QtUtils/UTF8CodePointCountValidator.cpp
|
QtUtils/UTF8CodePointCountValidator.cpp
|
||||||
QtUtils/UTF8CodePointCountValidator.h
|
QtUtils/UTF8CodePointCountValidator.h
|
||||||
|
QtUtils/VerticalTabsTabWidget.cpp
|
||||||
|
QtUtils/VerticalTabsTabWidget.h
|
||||||
QtUtils/WindowActivationEventFilter.cpp
|
QtUtils/WindowActivationEventFilter.cpp
|
||||||
QtUtils/WindowActivationEventFilter.h
|
QtUtils/WindowActivationEventFilter.h
|
||||||
QtUtils/WrapInScrollArea.cpp
|
QtUtils/WrapInScrollArea.cpp
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||||
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
|
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
|
||||||
#include "DolphinQt/QtUtils/QtUtils.h"
|
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||||
|
#include "DolphinQt/QtUtils/VerticalTabsTabWidget.h"
|
||||||
#include "DolphinQt/QtUtils/WindowActivationEventFilter.h"
|
#include "DolphinQt/QtUtils/WindowActivationEventFilter.h"
|
||||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||||
#include "DolphinQt/Settings.h"
|
#include "DolphinQt/Settings.h"
|
||||||
@ -61,7 +62,7 @@
|
|||||||
#include "InputCommon/InputConfig.h"
|
#include "InputCommon/InputConfig.h"
|
||||||
|
|
||||||
MappingWindow::MappingWindow(QWidget* parent, Type type, int port_num)
|
MappingWindow::MappingWindow(QWidget* parent, Type type, int port_num)
|
||||||
: QDialog(parent), m_port(port_num)
|
: QDialog(parent), m_mapping_type(type), m_port(port_num)
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Port %1").arg(port_num + 1));
|
setWindowTitle(tr("Port %1").arg(port_num + 1));
|
||||||
|
|
||||||
@ -179,7 +180,14 @@ void MappingWindow::CreateMainLayout()
|
|||||||
{
|
{
|
||||||
m_main_layout = new QVBoxLayout();
|
m_main_layout = new QVBoxLayout();
|
||||||
m_config_layout = new QHBoxLayout();
|
m_config_layout = new QHBoxLayout();
|
||||||
m_tab_widget = new QTabWidget();
|
if (m_mapping_type == MappingWindow::Type::MAPPING_HOTKEYS)
|
||||||
|
{
|
||||||
|
m_tab_widget = new QtUtils::VerticalTabsTabWidget;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_tab_widget = new QTabWidget;
|
||||||
|
}
|
||||||
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
|
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
|
||||||
|
|
||||||
m_tab_widget->setTabBarAutoHide(true);
|
m_tab_widget->setTabBarAutoHide(true);
|
||||||
|
@ -204,6 +204,7 @@
|
|||||||
<ClCompile Include="QtUtils\QtUtils.cpp" />
|
<ClCompile Include="QtUtils\QtUtils.cpp" />
|
||||||
<ClCompile Include="QtUtils\SetWindowDecorations.cpp" />
|
<ClCompile Include="QtUtils\SetWindowDecorations.cpp" />
|
||||||
<ClCompile Include="QtUtils\UTF8CodePointCountValidator.cpp" />
|
<ClCompile Include="QtUtils\UTF8CodePointCountValidator.cpp" />
|
||||||
|
<ClCompile Include="QtUtils\VerticalTabsTabWidget.cpp" />
|
||||||
<ClCompile Include="QtUtils\WindowActivationEventFilter.cpp" />
|
<ClCompile Include="QtUtils\WindowActivationEventFilter.cpp" />
|
||||||
<ClCompile Include="QtUtils\WrapInScrollArea.cpp" />
|
<ClCompile Include="QtUtils\WrapInScrollArea.cpp" />
|
||||||
<ClCompile Include="RenderWidget.cpp" />
|
<ClCompile Include="RenderWidget.cpp" />
|
||||||
@ -265,6 +266,7 @@
|
|||||||
<ClInclude Include="QtUtils\QueueOnObject.h" />
|
<ClInclude Include="QtUtils\QueueOnObject.h" />
|
||||||
<ClInclude Include="QtUtils\RunOnObject.h" />
|
<ClInclude Include="QtUtils\RunOnObject.h" />
|
||||||
<ClInclude Include="QtUtils\SignalBlocking.h" />
|
<ClInclude Include="QtUtils\SignalBlocking.h" />
|
||||||
|
<ClInclude Include="QtUtils\VerticalTabsTabWidget.h" />
|
||||||
<ClInclude Include="QtUtils\WrapInScrollArea.h" />
|
<ClInclude Include="QtUtils\WrapInScrollArea.h" />
|
||||||
<ClInclude Include="ResourcePackManager.h" />
|
<ClInclude Include="ResourcePackManager.h" />
|
||||||
<ClInclude Include="Resources.h" />
|
<ClInclude Include="Resources.h" />
|
||||||
|
64
Source/Core/DolphinQt/QtUtils/VerticalTabsTabWidget.cpp
Normal file
64
Source/Core/DolphinQt/QtUtils/VerticalTabsTabWidget.cpp
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// Copyright 2025 Dolphin Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "DolphinQt/QtUtils/VerticalTabsTabWidget.h"
|
||||||
|
|
||||||
|
#include <QStyleOptionTab>
|
||||||
|
#include <QStylePainter>
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
class HorizontalTabBar : public QTabBar
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit HorizontalTabBar(QWidget* const parent = nullptr) : QTabBar(parent)
|
||||||
|
{
|
||||||
|
setUsesScrollButtons(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QSize tabSizeHint(const int index) const override
|
||||||
|
{
|
||||||
|
return QTabBar::tabSizeHint(index).transposed();
|
||||||
|
}
|
||||||
|
|
||||||
|
void paintEvent(QPaintEvent* const event) override
|
||||||
|
{
|
||||||
|
QStylePainter painter(this);
|
||||||
|
QStyleOptionTab option;
|
||||||
|
|
||||||
|
const int tab_count{count()};
|
||||||
|
for (int i{0}; i < tab_count; ++i)
|
||||||
|
{
|
||||||
|
painter.save();
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
namespace QtUtils
|
||||||
|
{
|
||||||
|
|
||||||
|
VerticalTabsTabWidget::VerticalTabsTabWidget(QWidget* const parent) : QTabWidget(parent)
|
||||||
|
{
|
||||||
|
setTabBar(new HorizontalTabBar);
|
||||||
|
setTabPosition(QTabWidget::TabPosition::West);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace QtUtils
|
19
Source/Core/DolphinQt/QtUtils/VerticalTabsTabWidget.h
Normal file
19
Source/Core/DolphinQt/QtUtils/VerticalTabsTabWidget.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// Copyright 2025 Dolphin Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QTabWidget>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace QtUtils
|
||||||
|
{
|
||||||
|
|
||||||
|
// A tab widget where tabs are drawn to the left of the pages with horizontal text.
|
||||||
|
class VerticalTabsTabWidget : public QTabWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit VerticalTabsTabWidget(QWidget* parent = nullptr);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace QtUtils
|
Loading…
Reference in New Issue
Block a user