本文整理汇总了C++中QAbstractItemView::setFrameStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractItemView::setFrameStyle方法的具体用法?C++ QAbstractItemView::setFrameStyle怎么用?C++ QAbstractItemView::setFrameStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractItemView
的用法示例。
在下文中一共展示了QAbstractItemView::setFrameStyle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 );
}