From 0badec6124f8485a5ce2e2d1aad5d0ef4e2fd8ef Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Wed, 5 Jan 2022 20:17:17 -0500 Subject: [PATCH] Added a custom window splitter for Qt Tas editor to better control sizing of right panel. --- src/drivers/Qt/TasEditor/TasEditorWindow.cpp | 49 +++++++++++++++++++- src/drivers/Qt/TasEditor/TasEditorWindow.h | 16 ++++++- 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/src/drivers/Qt/TasEditor/TasEditorWindow.cpp b/src/drivers/Qt/TasEditor/TasEditorWindow.cpp index 2c82854d..31172bae 100644 --- a/src/drivers/Qt/TasEditor/TasEditorWindow.cpp +++ b/src/drivers/Qt/TasEditor/TasEditorWindow.cpp @@ -193,7 +193,7 @@ TasEditorWindow::TasEditorWindow(QWidget *parent) resize(512, 512); mainLayout = new QVBoxLayout(); - mainHBox = new QSplitter( Qt::Horizontal ); + mainHBox = new TasEditorSplitter(); initPatterns(); buildPianoRollDisplay(); @@ -7348,3 +7348,50 @@ bool markerDragPopup::eventFilter( QObject *obj, QEvent *event) return false; } //---------------------------------------------------------------------------- +//---- TAS Window Main Horizontal Splitter +//---------------------------------------------------------------------------- +TasEditorSplitter::TasEditorSplitter( QWidget *parent ) + : QSplitter( Qt::Horizontal, parent ) +{ + panelInitDone = false; +} +//---------------------------------------------------------------------------- +TasEditorSplitter::~TasEditorSplitter(void) +{ + +} +//---------------------------------------------------------------------------- +void TasEditorSplitter::resizeEvent(QResizeEvent *event) +{ + int minWidth; + //int widthDelta; + QList panelWidth; + + //printf("Panel Resize\n"); + if ( !panelInitDone ) + { + QSplitter::resizeEvent(event); + panelInitDone = true; + return; + } + //widthDelta = event->size().width() - event->oldSize().width(); + + panelWidth = sizes(); + + + //for (int i=0; isize().width() - panelWidth[1] - handleWidth(); + //panelWidth[0] += widthDelta; + + minWidth = widget(0)->minimumWidth(); + + if ( panelWidth[0] < minWidth ) + { + panelWidth[0] = minWidth; + } + setSizes( panelWidth ); +} +//---------------------------------------------------------------------------- diff --git a/src/drivers/Qt/TasEditor/TasEditorWindow.h b/src/drivers/Qt/TasEditor/TasEditorWindow.h index b1e67097..f212cca2 100644 --- a/src/drivers/Qt/TasEditor/TasEditorWindow.h +++ b/src/drivers/Qt/TasEditor/TasEditorWindow.h @@ -373,6 +373,20 @@ class TasFindNoteWindow : public QDialog void searchPatternChanged(const QString &); }; +class TasEditorSplitter : public QSplitter +{ + Q_OBJECT + + public: + TasEditorSplitter(QWidget *parent = 0); + ~TasEditorSplitter(void); + + protected: + void resizeEvent(QResizeEvent *event); + + bool panelInitDone; +}; + class TasEditorWindow : public QDialog { Q_OBJECT @@ -445,7 +459,7 @@ class TasEditorWindow : public QDialog QAction *showToolTipsAct; QAction *autoLuaAct; - QSplitter *mainHBox; + TasEditorSplitter *mainHBox; QFrame *pianoRollFrame; QWidget *pianoRollContainerWidget; QWidget *controlPanelContainerWidget;