本文整理汇总了C++中QBoxLayout::insertLayout方法的典型用法代码示例。如果您正苦于以下问题:C++ QBoxLayout::insertLayout方法的具体用法?C++ QBoxLayout::insertLayout怎么用?C++ QBoxLayout::insertLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QBoxLayout
的用法示例。
在下文中一共展示了QBoxLayout::insertLayout方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QLabel
GNumericalExpressionSettingsWidget::GNumericalExpressionSettingsWidget( GNumericalExpression* numericalExpression, QObject* parent /*= NULL*/)
{
m_NumericalExpression = numericalExpression;
QGroupBox* pExpressionSettings = new QGroupBox;
QBoxLayout* pExpressionSettingsLayout = new QVBoxLayout;
QBoxLayout* pExpressionEditLayout = new QHBoxLayout;
pExpressionSettings->setFixedWidth(400);
pExpressionSettings->setTitle("Expression Settings");
pExpressionSettings->setLayout(pExpressionSettingsLayout);
pExpressionEditLayout->insertWidget(0, new QLabel("Expression:"), 0);
pExpressionEditLayout->insertWidget(1, m_NumericalExpression->m_Expression.ProvideNewParamLineEdit(pExpressionSettings), 0);
pExpressionSettingsLayout->insertLayout(0, pExpressionEditLayout);
QGroupBox* pVariableSettings = new QGroupBox;
QGroupBox* pShowVariables = new QGroupBox;
QBoxLayout* pShowVariablesLayout = new QVBoxLayout;
QBoxLayout* pVariableSettingsLayout = new QVBoxLayout;
QRadioButton* pLayoutVariablesVertically = new QRadioButton;
QRadioButton* pLayoutVariablesHorizontally = new QRadioButton;
QRadioButton* pLayoutVariablesGrid = new QRadioButton;
pVariableSettings->setFixedWidth(400);
pVariableSettings->setTitle("Variable Settings");
pVariableSettings->setLayout(pVariableSettingsLayout);
pShowVariables->setTitle("Show Variables");
pShowVariables->setCheckable(true);
pShowVariables->setLayout(pShowVariablesLayout);
pLayoutVariablesHorizontally->setText("Layout: Horizontal");
pShowVariablesLayout->insertWidget(0, pLayoutVariablesHorizontally);
pLayoutVariablesVertically->setText("Layout: Vertical");
pShowVariablesLayout->insertWidget(1, pLayoutVariablesVertically);
pLayoutVariablesGrid->setText("Layout: Grid");
pShowVariablesLayout->insertWidget(2, pLayoutVariablesGrid);
pVariableSettingsLayout->insertWidget(0, pShowVariables);
QPushButton* pAcceptButton = new QPushButton;
QPushButton* pCloseButton = new QPushButton;
QBoxLayout* pButtonLayout = new QHBoxLayout;
pAcceptButton->setText("Accept");
connect(pAcceptButton, SIGNAL(clicked(bool)), this, SLOT(Accept()));
pCloseButton->setText("Close");
connect(pCloseButton, SIGNAL(clicked(bool)), this, SLOT(close()));
pButtonLayout->insertWidget(0, pAcceptButton, 1);
pButtonLayout->insertWidget(1, pCloseButton, 1);
QBoxLayout* pMainLayout = new QVBoxLayout;
pMainLayout->setSizeConstraint(QLayout::SetFixedSize);
setLayout(pMainLayout);
pMainLayout->insertWidget(0, pExpressionSettings, 1);
pMainLayout->insertWidget(1, pVariableSettings, 1);
pMainLayout->insertLayout(2, pButtonLayout, 0);
}
示例2: insertLayoutItem
void layoutOperations::insertLayoutItem( int Index, QWidget *Widget, QLayoutItem *Item, int Stretch )
{
if ( Widget == NULL )
return;
QBoxLayout *Layout = dynamic_cast<QBoxLayout*>( Widget->layout() );
if ( Layout == NULL )
return;
do
{
QWidget *ItemWidget = Item->widget();
if ( ItemWidget != NULL )
{
Layout->insertWidget( Index, ItemWidget, Stretch );
break;
}
QLayout *ItemLayout = Item->layout();
if ( ItemLayout != NULL )
{
Layout->insertLayout( Index, ItemLayout, Stretch );
break;
}
QSpacerItem *ItemSpace = Item->spacerItem();
if ( ItemSpace != NULL )
{
Layout->insertSpacerItem( Index, ItemSpace );
break;
}
} while ( false );
}
示例3: addPage
void PropertyToolBox::addPage( QWidget* page )
{
QBoxLayout* pageLayout = qobject_cast<QBoxLayout*>( page->layout() );
if ( pageLayout && pageLayout->direction() == QBoxLayout::TopToBottom ) {
pageLayout->setContentsMargins( 5, 5, 5, 5 );
pageLayout->setSpacing( 3 );
for ( int i = 0; i < pageLayout->count(); i++ ) {
QLayoutItem* item = pageLayout->itemAt( i );
if ( item->spacerItem() )
continue;
QLabel* label = qobject_cast<QLabel*>( item->widget() );
if ( label ) {
QString style = "border: none; border-bottom: 1px solid palette(dark);";
if ( i > 0 )
style += "margin-top: 2px;";
label->setStyleSheet( style );
continue;
}
QBoxLayout* itemLayout = qobject_cast<QBoxLayout*>( item->layout() );
if ( itemLayout && itemLayout->direction() == QBoxLayout::LeftToRight ) {
itemLayout->insertSpacing( 0, 10 );
} else {
pageLayout->removeItem( item );
QHBoxLayout* wrapperLayout = new QHBoxLayout();
wrapperLayout->addSpacing( 10 );
wrapperLayout->addItem( item );
pageLayout->insertLayout( i, wrapperLayout );
}
}
}
page->setBackgroundRole( QPalette::Base );
addItem( page, page->windowTitle() );
}
示例4: addExtraLayout
void QIDialogButtonBox::addExtraLayout (QLayout* aLayout)
{
QBoxLayout *layout = boxLayout();
int index = findEmptySpace (layout);
layout->insertLayout (index + 1, aLayout);
layout->insertStretch(index + 2);
}
示例5: QFileDialog
pFileDialog::pFileDialog( QWidget* parent, const QString& caption, const QString& directory, const QString& filter, bool textCodecEnabled, bool openReadOnlyEnabled )
: QFileDialog( parent, caption, directory, filter )
{
setFileMode( QFileDialog::AnyFile );
setOption( QFileDialog::DontUseNativeDialog );
// get grid layout
glDialog = qobject_cast<QGridLayout*>( layout() );
// assert on gridlayout
Q_ASSERT( glDialog );
// relook the dialog to be more friendly
QLabel* lLookIn = findChild<QLabel*>( "lookInLabel" );
QComboBox* cbLookIn = findChild<QComboBox*>( "lookInCombo" );
QToolButton* tbNewFolder = findChild<QToolButton*>( "newFolderButton" );
QAbstractItemView* sidebar = findChild<QAbstractItemView*>( "sidebar" );
QFrame* fFrame = findChild<QFrame*>( "frame" );
QBoxLayout* hLayout = 0;
// search layout containing tbNewFolder
foreach ( QLayout* layout, findChildren<QLayout*>() ) {
if ( layout->indexOf( tbNewFolder ) != -1 ) {
hLayout = qobject_cast<QBoxLayout*>( layout );
break;
}
}
if ( lLookIn ) {
lLookIn->setVisible( false );
}
if ( hLayout ) {
hLayout->setSpacing( 3 );
hLayout->insertStretch( hLayout->indexOf( tbNewFolder ) );
}
if ( cbLookIn && fFrame ) {
QBoxLayout* vLayout = qobject_cast<QBoxLayout*>( fFrame->layout() );
if ( vLayout ) {
vLayout->setSpacing( 3 );
vLayout->insertWidget( 0, cbLookIn );
if ( hLayout ) {
glDialog->removeItem( hLayout );
hLayout->setParent( 0 );
vLayout->insertLayout( 0, hLayout );
}
}
}
if ( sidebar ) {
QWidget* viewport = sidebar->viewport();
QPalette pal = viewport->palette();
pal.setColor( viewport->backgroundRole(), QColor( Qt::transparent ) );
viewport->setPalette( pal );
sidebar->setFrameStyle( QFrame::NoFrame | QFrame::Plain );
sidebar->setIconSize( QSize( 16, 16 ) );
}
// text codec
mTextCodecEnabled = true;
lCodec = new QLabel( tr( "Codec:" ), this );
cbCodec = new QComboBox( this );
cbCodec->addItems( pCoreUtils::textCodecs() );
setTextCodec( QTextCodec::codecForLocale()->name() );
glDialog->addWidget( lCodec, 4, 0 );
glDialog->addWidget( cbCodec, 4, 1 );
// read only
mOpenReadOnlyEnabled = true;
cbOpenReadOnly = new QCheckBox( tr( "Open in read only." ), this );
glDialog->addWidget( cbOpenReadOnly, 5, 1 );
// configuration
setTextCodecEnabled( textCodecEnabled );
setOpenReadOnlyEnabled( openReadOnlyEnabled );
}
示例6: insertLayout
void QBoxLayoutProto::insertLayout(int index, QLayout *layout, int stretch)
{
QBoxLayout *item = qscriptvalue_cast<QBoxLayout*>(thisObject());
if (item)
item->insertLayout(index, layout, stretch);
}