Skip to content

Commit

Permalink
Maximize button for resizable instruments
Browse files Browse the repository at this point in the history
Show the maximize button for resizable instruments.

Most other changes have the character of refactorings and code
reorganizations.

Remove the negation in the if condition for resizable instruments to
make the code better readable.

Only manipulate the system menu if the instrument is not resizable.

Add a TODO to the special code that sets a size.
  • Loading branch information
michaelgregorius committed Sep 20, 2024
1 parent 1d7ed16 commit 9a1eaac
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions src/gui/instrument/InstrumentTrackWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,24 +285,30 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :

QMdiSubWindow* subWin = getGUI()->mainWindow()->addWindowedWidget( this );
Qt::WindowFlags flags = subWin->windowFlags();
if (!m_instrumentView->isResizable()) {
flags |= Qt::MSWindowsFixedSizeDialogHint;
// any better way than this?
} else {
subWin->setMaximumSize(m_instrumentView->maximumHeight() + 12, m_instrumentView->maximumWidth() + 208);
subWin->setMinimumSize( m_instrumentView->minimumWidth() + 12, m_instrumentView->minimumHeight() + 208);

if (m_instrumentView->isResizable())
{
// TODO As of writing SlicerT is the only resizable instrument. Is this code specific to SlicerT?
const auto extraSpace = QSize(12, 208);
subWin->setMaximumSize(m_instrumentView->maximumSize() + extraSpace);
subWin->setMinimumSize(m_instrumentView->minimumSize() + extraSpace);

flags |= Qt::WindowMaximizeButtonHint;
}
flags &= ~Qt::WindowMaximizeButtonHint;
subWin->setWindowFlags( flags );
else
{
flags |= Qt::MSWindowsFixedSizeDialogHint;
flags &= ~Qt::WindowMaximizeButtonHint;

// Hide the Size and Maximize options from the system menu since the dialog size is fixed.
QMenu * systemMenu = subWin->systemMenu();
systemMenu->actions().at(2)->setVisible(false); // Size
systemMenu->actions().at(4)->setVisible(false); // Maximize
}

// Hide the Size and Maximize options from the system menu
// since the dialog size is fixed.
QMenu * systemMenu = subWin->systemMenu();
systemMenu->actions().at( 2 )->setVisible( false ); // Size
systemMenu->actions().at( 4 )->setVisible( false ); // Maximize
subWin->setWindowFlags(flags);

subWin->setWindowIcon( embed::getIconPixmap( "instrument_track" ) );
subWin->setWindowIcon(embed::getIconPixmap("instrument_track"));
subWin->hide();
}

Expand Down

0 comments on commit 9a1eaac

Please sign in to comment.