Skip to content

Center PianoView in resizeable plugins (SlicerT) #7731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/gui/instrument/InstrumentTrackWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,11 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
m_tabWidget->addTab(m_tuningView, tr("Tuning and transposition"), "tuning_tab", 5);

// setup piano-widget
auto pianoLayout = new QHBoxLayout();
m_pianoView = new PianoView( this );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@regulus79 wrote:

I would like to get someone's opinion on whether I am managing the layout pointer correctly. Passing this as the parent for the layout caused warnings, since that automatically tries to set the layout as the default layout for the parent. Should I leave it as is and add an explicit call to setParent(this) to make sure this is responsible for deleting the layout?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried calling setParent but that resulted in more warnings, so I'm not sure how to let qt know that it needs to be deleted. Unless it automatically deletes sub-layouts?

m_pianoView->setMinimumHeight( PIANO_HEIGHT );
m_pianoView->setMaximumHeight( PIANO_HEIGHT );
pianoLayout->addWidget(m_pianoView);

// setup sizes and policies
generalSettingsWidget->setMaximumHeight(90);
Expand All @@ -277,7 +279,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
// Use QWidgetItem explicitly to make the size hint change on instrument changes
// QLayout::addWidget() uses QWidgetItemV2 with size hint caching
vlayout->insertItem(1, new QWidgetItem(m_tabWidget));
vlayout->addWidget( m_pianoView );
vlayout->addLayout(pianoLayout);
setModel( _itv->model() );

updateInstrumentView();
Expand Down
Loading