Disable minimization on all subwindows (#2983)
* Disable minimization on all subwindows * Change the maximize button icon * Remove redundant boolean * Make the maximize icon play better with the close icon * I removed too much maaan * Fix spaces * Change comments
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 163 B After Width: | Height: | Size: 210 B |
Binary file not shown.
|
Before Width: | Height: | Size: 150 B |
Binary file not shown.
|
Before Width: | Height: | Size: 163 B After Width: | Height: | Size: 210 B |
Binary file not shown.
|
Before Width: | Height: | Size: 150 B |
@@ -70,7 +70,6 @@ private:
|
||||
const QSize m_buttonSize;
|
||||
const int m_titleBarHeight;
|
||||
QPushButton * m_closeBtn;
|
||||
QPushButton * m_minimizeBtn;
|
||||
QPushButton * m_maximizeBtn;
|
||||
QPushButton * m_restoreBtn;
|
||||
QBrush m_activeColor;
|
||||
|
||||
@@ -49,7 +49,7 @@ SubWindow::SubWindow( QWidget *parent, Qt::WindowFlags windowFlags ) :
|
||||
m_textShadowColor = Qt::black;
|
||||
m_borderColor = Qt::black;
|
||||
|
||||
// close, minimize, maximize and restore (after minimizing) buttons
|
||||
// close, maximize and restore (after maximizing) buttons
|
||||
m_closeBtn = new QPushButton( embed::getIconPixmap( "close" ), QString::null, this );
|
||||
m_closeBtn->resize( m_buttonSize );
|
||||
m_closeBtn->setFocusPolicy( Qt::NoFocus );
|
||||
@@ -66,14 +66,6 @@ SubWindow::SubWindow( QWidget *parent, Qt::WindowFlags windowFlags ) :
|
||||
m_maximizeBtn->setToolTip( tr( "Maximize" ) );
|
||||
connect( m_maximizeBtn, SIGNAL( clicked( bool ) ), this, SLOT( showMaximized() ) );
|
||||
|
||||
m_minimizeBtn = new QPushButton( embed::getIconPixmap( "minimize" ), QString::null, this );
|
||||
m_minimizeBtn->resize( m_buttonSize );
|
||||
m_minimizeBtn->setFocusPolicy( Qt::NoFocus );
|
||||
m_minimizeBtn->setCursor( Qt::ArrowCursor );
|
||||
m_minimizeBtn->setAttribute( Qt::WA_NoMousePropagation );
|
||||
m_minimizeBtn->setToolTip( tr( "Minimize" ) );
|
||||
connect( m_minimizeBtn, SIGNAL( clicked( bool ) ), this, SLOT( showMinimized() ) );
|
||||
|
||||
m_restoreBtn = new QPushButton( embed::getIconPixmap( "restore" ), QString::null, this );
|
||||
m_restoreBtn->resize( m_buttonSize );
|
||||
m_restoreBtn->setFocusPolicy( Qt::NoFocus );
|
||||
@@ -92,6 +84,11 @@ SubWindow::SubWindow( QWidget *parent, Qt::WindowFlags windowFlags ) :
|
||||
m_windowTitle->setFocusPolicy( Qt::NoFocus );
|
||||
m_windowTitle->setAttribute( Qt::WA_TransparentForMouseEvents, true );
|
||||
m_windowTitle->setGraphicsEffect( m_shadow );
|
||||
|
||||
// disable the minimize button
|
||||
setWindowFlags( Qt::SubWindow | Qt::WindowMaximizeButtonHint |
|
||||
Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint |
|
||||
Qt::CustomizeWindowHint );
|
||||
}
|
||||
|
||||
|
||||
@@ -236,12 +233,9 @@ void SubWindow::moveEvent( QMoveEvent * event )
|
||||
void SubWindow::adjustTitleBar()
|
||||
{
|
||||
// button adjustments
|
||||
m_minimizeBtn->hide();
|
||||
m_maximizeBtn->hide();
|
||||
m_restoreBtn->hide();
|
||||
|
||||
const bool isMax = isMaximized();
|
||||
const bool isMin = isMinimized();
|
||||
const int rightSpace = 3;
|
||||
const int buttonGap = 1;
|
||||
const int menuButtonSpace = 24;
|
||||
@@ -258,23 +252,19 @@ void SubWindow::adjustTitleBar()
|
||||
// the close button is always needed and on the rightButtonPos
|
||||
m_closeBtn->move( rightButtonPos );
|
||||
|
||||
// here we ask: is the Subwindow maximizable and/or minimizable
|
||||
// here we ask: is the Subwindow maximizable and
|
||||
// then we set the buttons and show them if needed
|
||||
if( windowFlags() & Qt::WindowMaximizeButtonHint )
|
||||
{
|
||||
buttonBarWidth = buttonBarWidth + m_buttonSize.width() + buttonGap;
|
||||
m_maximizeBtn->move( middleButtonPos );
|
||||
m_restoreBtn->move( middleButtonPos );
|
||||
m_maximizeBtn->setHidden( isMax );
|
||||
m_maximizeBtn->setHidden( isMaximized() );
|
||||
}
|
||||
|
||||
if( windowFlags() & Qt::WindowMinimizeButtonHint )
|
||||
{
|
||||
buttonBarWidth = buttonBarWidth + m_buttonSize.width() + buttonGap;
|
||||
m_minimizeBtn->move( m_maximizeBtn->isHidden() && !isMax ? middleButtonPos : leftButtonPos );
|
||||
m_minimizeBtn->setHidden( isMin );
|
||||
}
|
||||
m_restoreBtn->setVisible( isMax || isMin );
|
||||
// we're keeping the restore button around if we open projects
|
||||
// from older versions that have saved minimized windows
|
||||
m_restoreBtn->setVisible( isMaximized() || isMinimized() );
|
||||
|
||||
// title QLabel adjustments
|
||||
m_windowTitle->setAlignment( Qt::AlignHCenter );
|
||||
@@ -284,9 +274,9 @@ void SubWindow::adjustTitleBar()
|
||||
|
||||
// if minimized we can't use widget()->width(). We have to hard code the width,
|
||||
// as the width of all minimized windows is the same.
|
||||
if( isMin )
|
||||
if( isMinimized() )
|
||||
{
|
||||
m_restoreBtn->move( m_maximizeBtn->isHidden() ? middleButtonPos : leftButtonPos );
|
||||
m_restoreBtn->move( m_maximizeBtn->isHidden() ? middleButtonPos : leftButtonPos );
|
||||
m_windowTitle->setFixedWidth( 120 );
|
||||
}
|
||||
|
||||
|
||||
@@ -110,13 +110,14 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
|
||||
m_controlView = effect()->controls()->createView();
|
||||
if( m_controlView )
|
||||
{
|
||||
m_subWindow = gui->mainWindow()->addWindowedWidget(
|
||||
m_controlView,
|
||||
Qt::SubWindow | Qt::CustomizeWindowHint |
|
||||
Qt::WindowTitleHint | Qt::WindowSystemMenuHint );
|
||||
m_subWindow = gui->mainWindow()->addWindowedWidget( m_controlView );
|
||||
m_subWindow->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
|
||||
m_subWindow->setFixedSize( m_subWindow->size() );
|
||||
|
||||
Qt::WindowFlags flags = m_subWindow->windowFlags();
|
||||
flags &= ~Qt::WindowMaximizeButtonHint;
|
||||
m_subWindow->setWindowFlags( flags );
|
||||
|
||||
connect( m_controlView, SIGNAL( closed() ),
|
||||
this, SLOT( closeEffects() ) );
|
||||
|
||||
@@ -291,8 +292,3 @@ void EffectView::modelChanged()
|
||||
m_autoQuit->setModel( &effect()->m_autoQuitModel );
|
||||
m_gate->setModel( &effect()->m_gateModel );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user