all repos — mgba @ 5b8d64b0b5e5b3aa1edac7a98be6cbf471869dd0

mGBA Game Boy Advance Emulator

Qt: Better initial shortcut editor column sizes
Vicki Pfau vi@endrift.com
Wed, 27 Jan 2021 21:23:45 -0800
commit

5b8d64b0b5e5b3aa1edac7a98be6cbf471869dd0

parent

b1a06ed52bd8f9db00dcd722198deedd8a184f69

M CHANGESCHANGES

@@ -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.cppsrc/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.hsrc/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.uisrc/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>