mirror of https://github.com/mgba-emu/mgba.git
Qt: Better initial shortcut editor column sizes
This commit is contained in:
parent
b1a06ed52b
commit
5b8d64b0b5
1
CHANGES
1
CHANGES
|
@ -124,6 +124,7 @@ Misc:
|
|||
- 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)
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "ShortcutController.h"
|
||||
#include "ShortcutModel.h"
|
||||
|
||||
#include <QFontMetrics>
|
||||
#include <QKeyEvent>
|
||||
|
||||
using namespace QGBA;
|
||||
|
@ -134,6 +135,15 @@ void ShortcutView::closeEvent(QCloseEvent*) {
|
|||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
if (m_input) {
|
||||
QEvent::Type type = event->type();
|
||||
|
|
|
@ -30,6 +30,7 @@ public:
|
|||
protected:
|
||||
virtual bool event(QEvent*) override;
|
||||
virtual void closeEvent(QCloseEvent*) override;
|
||||
virtual void showEvent(QShowEvent*) override;
|
||||
|
||||
private slots:
|
||||
void load(const QModelIndex&);
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
<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>
|
||||
|
|
Loading…
Reference in New Issue