本文整理汇总了C++中QMdiSubWindow::layout方法的典型用法代码示例。如果您正苦于以下问题:C++ QMdiSubWindow::layout方法的具体用法?C++ QMdiSubWindow::layout怎么用?C++ QMdiSubWindow::layout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMdiSubWindow
的用法示例。
在下文中一共展示了QMdiSubWindow::layout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keyPressEvent
//.........这里部分代码省略.........
setWindowTitle( tr( "FX-Mixer" ) );
setWindowIcon( embed::getIconPixmap( "fx_mixer" ) );
// main-layout
QHBoxLayout * ml = new QHBoxLayout;
// Set margins
ml->setContentsMargins( 0, 4, 0, 0 );
// Channel area
m_channelAreaWidget = new QWidget;
chLayout = new QHBoxLayout( m_channelAreaWidget );
chLayout->setSizeConstraint( QLayout::SetMinimumSize );
chLayout->setSpacing( 0 );
chLayout->setMargin( 0 );
m_channelAreaWidget->setLayout(chLayout);
// create rack layout before creating the first channel
m_racksWidget = new QWidget;
m_racksLayout = new QStackedLayout( m_racksWidget );
m_racksLayout->setContentsMargins( 0, 0, 0, 0 );
m_racksWidget->setLayout( m_racksLayout );
// add master channel
m_fxChannelViews.resize( m->numChannels() );
m_fxChannelViews[0] = new FxChannelView( this, this, 0 );
m_racksLayout->addWidget( m_fxChannelViews[0]->m_rackView );
FxChannelView * masterView = m_fxChannelViews[0];
ml->addWidget( masterView->m_fxLine, 0, Qt::AlignTop );
QSize fxLineSize = masterView->m_fxLine->size();
// add mixer channels
for( int i = 1; i < m_fxChannelViews.size(); ++i )
{
m_fxChannelViews[i] = new FxChannelView(m_channelAreaWidget, this, i);
chLayout->addWidget( m_fxChannelViews[i]->m_fxLine );
}
// add the scrolling section to the main layout
// class solely for scroll area to pass key presses down
class ChannelArea : public QScrollArea
{
public:
ChannelArea( QWidget * parent, FxMixerView * mv ) :
QScrollArea( parent ), m_mv( mv ) {}
~ChannelArea() {}
virtual void keyPressEvent( QKeyEvent * e )
{
m_mv->keyPressEvent( e );
}
private:
FxMixerView * m_mv;
};
channelArea = new ChannelArea( this, this );
channelArea->setWidget( m_channelAreaWidget );
channelArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
channelArea->setFrameStyle( QFrame::NoFrame );
channelArea->setMinimumWidth( fxLineSize.width() * 6 );
channelArea->setFixedHeight( fxLineSize.height() +
style()->pixelMetric( QStyle::PM_ScrollBarExtent ) );
ml->addWidget( channelArea, 1, Qt::AlignTop );
// show the add new effect channel button
QPushButton * newChannelBtn = new QPushButton( embed::getIconPixmap( "new_channel" ), QString::null, this );
newChannelBtn->setObjectName( "newChannelBtn" );
newChannelBtn->setFixedSize( fxLineSize );
connect( newChannelBtn, SIGNAL( clicked() ), this, SLOT( addNewChannel() ) );
ml->addWidget( newChannelBtn, 0, Qt::AlignTop );
// add the stacked layout for the effect racks of fx channels
ml->addWidget( m_racksWidget, 0, Qt::AlignTop | Qt::AlignRight );
setCurrentFxLine( m_fxChannelViews[0]->m_fxLine );
setLayout( ml );
updateGeometry();
// timer for updating faders
connect( gui->mainWindow(), SIGNAL( periodicUpdate() ),
this, SLOT( updateFaders() ) );
// add ourself to workspace
QMdiSubWindow * subWin = gui->mainWindow()->addWindowedWidget( this );
Qt::WindowFlags flags = subWin->windowFlags();
flags &= ~Qt::WindowMaximizeButtonHint;
subWin->setWindowFlags( flags );
layout()->setSizeConstraint( QLayout::SetMinimumSize );
subWin->layout()->setSizeConstraint( QLayout::SetMinAndMaxSize );
parentWidget()->setAttribute( Qt::WA_DeleteOnClose, false );
parentWidget()->move( 5, 310 );
// we want to receive dataChanged-signals in order to update
setModel( m );
}