Qt: Better initial shortcut editor column sizes
Vicki Pfau vi@endrift.com
Wed, 27 Jan 2021 21:23:45 -0800
4 files changed,
15 insertions(+),
0 deletions(-)
M
CHANGES
→
CHANGES
@@ -124,6 +124,7 @@ - Qt: Discard additional frame draws if waiting fails
- Qt: Unify monospace font usage - Qt: Add button to jump to log settings - Qt: Use relative paths in portable mode when applicable (fixes mgba.io/i/838) + - Qt: Better initial shortcut editor column sizes - SDL: Fall back to sw blit if OpenGL init fails - Util: Reset vector size on deinit - VFS: Change semantics of VFile.sync on mapped files (fixes mgba.io/i/1730)
M
src/platform/qt/ShortcutView.cpp
→
src/platform/qt/ShortcutView.cpp
@@ -10,6 +10,7 @@ #include "InputController.h"
#include "ShortcutController.h" #include "ShortcutModel.h" +#include <QFontMetrics> #include <QKeyEvent> using namespace QGBA;@@ -132,6 +133,15 @@ void ShortcutView::closeEvent(QCloseEvent*) {
if (m_input) { m_input->releaseFocus(this); } +} + +void ShortcutView::showEvent(QShowEvent*) { + QString longString("Ctrl+Alt+Shift+Tab"); + int width = QFontMetrics(QFont()).width(longString); + QHeaderView* header = m_ui.shortcutTable->header(); + header->resizeSection(0, header->length() - width * 2); + header->resizeSection(1, width); + header->resizeSection(2, width); } bool ShortcutView::event(QEvent* event) {
M
src/platform/qt/ShortcutView.h
→
src/platform/qt/ShortcutView.h
@@ -30,6 +30,7 @@
protected: virtual bool event(QEvent*) override; virtual void closeEvent(QCloseEvent*) override; + virtual void showEvent(QShowEvent*) override; private slots: void load(const QModelIndex&);
M
src/platform/qt/ShortcutView.ui
→
src/platform/qt/ShortcutView.ui
@@ -16,6 +16,9 @@ </property>
<layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QTreeView" name="shortcutTable"> + <property name="verticalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOn</enum> + </property> <attribute name="headerDefaultSectionSize"> <number>120</number> </attribute>