Added a custom window splitter for Qt Tas editor to better control sizing of right panel.

This commit is contained in:
mjbudd77 2022-01-05 20:17:17 -05:00
parent ede8c5fc7e
commit 0badec6124
2 changed files with 63 additions and 2 deletions

View File

@ -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<int> 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; i<panelWidth.count(); i++)
//{
// printf("Panel %i: %i\n", i, panelWidth[i] );
//}
panelWidth[0] = event->size().width() - panelWidth[1] - handleWidth();
//panelWidth[0] += widthDelta;
minWidth = widget(0)->minimumWidth();
if ( panelWidth[0] < minWidth )
{
panelWidth[0] = minWidth;
}
setSizes( panelWidth );
}
//----------------------------------------------------------------------------

View File

@ -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;