当前位置: 首页>>代码示例>>C++>>正文


C++ QSplitter::setResizeMode方法代码示例

本文整理汇总了C++中QSplitter::setResizeMode方法的典型用法代码示例。如果您正苦于以下问题:C++ QSplitter::setResizeMode方法的具体用法?C++ QSplitter::setResizeMode怎么用?C++ QSplitter::setResizeMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QSplitter的用法示例。


在下文中一共展示了QSplitter::setResizeMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QSplitter

ListViews::ListViews( QWidget *parent, const char *name )
    : QSplitter( Qt::Horizontal, parent, name )
{
    lstFolders.setAutoDelete( TRUE );

    folders = new QListView( this );
    folders->header()->setClickEnabled( FALSE );
    folders->addColumn( "Folder" );

    initFolders();
    setupFolders();

    folders->setRootIsDecorated( TRUE );
    setResizeMode( folders, QSplitter::KeepSize );

    QSplitter *vsplitter = new QSplitter( Qt::Vertical, this );

    messages = new QListView( vsplitter );
    messages->addColumn( "Sender" );
    messages->addColumn( "Subject" );
    messages->addColumn( "Date" );
    messages->setColumnAlignment( 1, Qt::AlignRight );
    messages->setAllColumnsShowFocus( TRUE );
    messages->setShowSortIndicator( TRUE );
    menu = new QPopupMenu( messages );
    for( int i = 1; i <= 10; i++ )
	menu->insertItem( QString( "Context Item %1" ).arg( i ) );
    connect(messages, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint& , int ) ),
	    this, SLOT( slotRMB( QListViewItem *, const QPoint &, int ) ) );
    vsplitter->setResizeMode( messages, QSplitter::KeepSize );

    message = new QLabel( vsplitter );
    message->setAlignment( Qt::AlignTop );
    message->setBackgroundMode( PaletteBase );

    connect( folders, SIGNAL( selectionChanged( QListViewItem* ) ),
	     this, SLOT( slotFolderChanged( QListViewItem* ) ) );
    connect( messages, SIGNAL( selectionChanged() ),
	     this, SLOT( slotMessageChanged() ) );
    connect( messages, SIGNAL( currentChanged( QListViewItem * ) ),
	     this, SLOT( slotMessageChanged() ) );

    messages->setSelectionMode( QListView::Extended );
    // some preparations
    folders->firstChild()->setOpen( TRUE );
    folders->firstChild()->firstChild()->setOpen( TRUE );
    folders->setCurrentItem( folders->firstChild()->firstChild()->firstChild() );
    folders->setSelected( folders->firstChild()->firstChild()->firstChild(), TRUE );

    messages->setSelected( messages->firstChild(), TRUE );
    messages->setCurrentItem( messages->firstChild() );
    message->setMargin( 5 );

    QValueList<int> lst;
    lst.append( 170 );
    setSizes( lst );
}
开发者ID:kthxbyte,项目名称:QT2-Linaro,代码行数:57,代码来源:listviews.cpp

示例2: KCModule

USBViewer::USBViewer(QWidget *parent, const char *name, const QStringList &) : KCModule(USBFactory::instance(), parent, name)
{
    setButtons(Help);

    setQuickHelp(
        i18n("<h1>USB Devices</h1> This module allows you to see"
             " the devices attached to your USB bus(es)."));

    QVBoxLayout *vbox = new QVBoxLayout(this, 0, KDialog::spacingHint());
    QGroupBox *gbox = new QGroupBox(i18n("USB Devices"), this);
    gbox->setColumnLayout(0, Qt::Horizontal);
    vbox->addWidget(gbox);

    QVBoxLayout *vvbox = new QVBoxLayout(gbox->layout(), KDialog::spacingHint());

    QSplitter *splitter = new QSplitter(gbox);
    vvbox->addWidget(splitter);

    _devices = new QListView(splitter);
    _devices->addColumn(i18n("Device"));
    _devices->setRootIsDecorated(true);
    _devices->header()->hide();
    _devices->setMinimumWidth(200);
    _devices->setColumnWidthMode(0, QListView::Maximum);

    QValueList< int > sizes;
    sizes.append(200);
    splitter->setSizes(sizes);

    _details = new QTextView(splitter);

    splitter->setResizeMode(_devices, QSplitter::KeepSize);

    QTimer *refreshTimer = new QTimer(this);
    // 1 sec seems to be a good compromise between latency and polling load.
    refreshTimer->start(1000);

    connect(refreshTimer, SIGNAL(timeout()), SLOT(refresh()));
    connect(_devices, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(selectionChanged(QListViewItem *)));

    KAboutData *about = new KAboutData(I18N_NOOP("kcmusb"), I18N_NOOP("KDE USB Viewer"), 0, 0, KAboutData::License_GPL,
                                       I18N_NOOP("(c) 2001 Matthias Hoelzer-Kluepfel"));

    about->addAuthor("Matthias Hoelzer-Kluepfel", 0, "[email protected]");
    about->addCredit("Leo Savernik", "Live Monitoring of USB Bus", "[email protected]");
    setAboutData(about);

    load();
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:49,代码来源:kcmusb.cpp

示例3: qbmEraser

ClsQGroupStateManip::ClsQGroupStateManip ( const char * _name = 0,string _strGroupID = ""):
    QFrame( 0, _name, Qt::WDestructiveClose), strGroupID(_strGroupID) {

    bApplied = false;
    clsQStateArrayView = NULL;
    iInterval = 1;
    iLoops = 1;
    iStepSize = 1;


    string strGroupName = ClsFESystemManager::Instance()->getGroupName(strGroupID).c_str();
    string strTitle = "State Manipulation Panel for \"" + strGroupName + "\"";
    this->setCaption(strTitle.c_str());


    QBitmap qbmEraser(  eraser_cursor_width,  eraser_cursor_height,  eraser_cursor_bits, TRUE );
    QBitmap qbmEraserMask(  eraser_cursor_mask_width,  eraser_cursor_mask_height,  eraser_cursor_mask_bits, TRUE );
    qcursorEraser = new QCursor( qbmEraser, qbmEraserMask,0 ,0 ); 

    QBitmap qbmPencil(  pencil_cursor_width,  pencil_cursor_height,  pencil_cursor_bits, TRUE );
    QBitmap qbmPencilMask(  pencil_cursor_mask_width,  pencil_cursor_mask_height,  pencil_cursor_mask_bits, TRUE );
    qcursorPencil = new QCursor( qbmPencil, qbmPencilMask, 0, 0 ); 

    QSplitter *qsplitter = new QSplitter(this);
    QFrame *qfmLeftPane = new QFrame(qsplitter);

    QBoxLayout * layoutMain = new QHBoxLayout( this);
    layoutMain->setResizeMode (QLayout::Fixed);
    layoutMain->addWidget(qsplitter);



    QBoxLayout * layoutLeftPane = new QVBoxLayout( qfmLeftPane, 5, -1, "mainL");

    qlblCaption = new QLabel(qfmLeftPane);
    qlblCaption->setText(strGroupName.c_str());

    layoutLeftPane->addWidget(qlblCaption);

    qfmStateArray = new QFrame(qfmLeftPane);;
    QHBoxLayout *qlayoutQfm = new QHBoxLayout( qfmStateArray);
    qlayoutQfm->setAutoAdd ( true);

    createStateArray(strGroupID);
    layoutLeftPane->addWidget(qfmStateArray, 0, Qt::AlignHCenter);
    qfmStateArray->show();
    clsQStateArrayView->show();
    clsQStateArrayView->setValue(DEFAULTVALUE);

    QHBoxLayout *qlayoutGradient = new QHBoxLayout( layoutLeftPane);

    QString qstr;

    QLabel* qlblMin = new QLabel(qfmLeftPane);
    qstr.setNum(fMinVal());

    qlblMin->setText(qstr);
    qlayoutGradient->addWidget(qlblMin, 0, Qt::AlignRight);

    qlblGradientPixmap = new QLabel(qfmLeftPane);;
    qlayoutGradient->addWidget(qlblGradientPixmap, 1, Qt::AlignHCenter);

    qstr.setNum(fMaxVal());
    QLabel* qlblMax = new QLabel(qfmLeftPane);
    qlblMax->setText(qstr);
    qlayoutGradient->addWidget(qlblMax);

    int iImgWidth = clsQStateArrayView->width() - qlblMin->minimumWidth() - qlblMax->minimumWidth() - 30;
    int iImgHeight = 13;
    qlblGradientPixmap->setFixedSize(iImgWidth,iImgHeight);
    qlblGradientPixmap->setPixmap(clsQStateArrayView->getGradientPixmap(iImgWidth, iImgHeight));

/* -------------------------------- */
    qgrpbxTools = new QGroupBox( );

    QLabel *lblValue = new QLabel();
    lblValue->setText("Value:");

    qdblspnbx = new QDoubleSpinBox( qgrpbxTools );
    qdblspnbx->setMinimum(fMinVal());
    qdblspnbx->setMaximum(fMaxVal());
    qdblspnbx->setDecimals(3);
    qdblspnbx->setSingleStep ( 0.01);
    qdblspnbx->setValue(DEFAULTVALUE);
    connect(qdblspnbx, SIGNAL(valueChanged(double)), this, SLOT(slotChangeValue(double)));

    QPushButton* qpbtnPen = new QPushButton (QIcon(QPixmap(pencil)), "");
    qpbtnPen->setToggleButton ( true);
    qpbtnPen->setFlat(true);
    qpbtnPen->setChecked(true);

    slotSelectTool(TOOL_PENCIL);


    QPushButton* qpbtnEraser = new QPushButton (QIcon(QPixmap(eraser)), "");
    qpbtnEraser->setToggleButton ( true);
    qpbtnEraser->setFlat(true);

    QHBoxLayout *qlayoutTools = new QHBoxLayout;
    qlayoutTools->addWidget(lblValue);
//.........这里部分代码省略.........
开发者ID:jeez,项目名称:iqr,代码行数:101,代码来源:ClsQGroupStateManip.cpp

示例4: setup

void FileMainWindow::setup()
{
    QSplitter *splitter = new QSplitter( this );

    dirlist = new DirectoryView( splitter, "dirlist", TRUE );
    dirlist->addColumn( "Name" );
    dirlist->addColumn( "Type" );
    Directory *root = new Directory( dirlist, "/" );
    root->setOpen( TRUE );
    splitter->setResizeMode( dirlist, QSplitter::KeepSize );

    fileview = new QtFileIconView( "/", splitter );
    fileview->setSelectionMode( QIconView::Extended );

    setCentralWidget( splitter );

    QToolBar *toolbar = new QToolBar( this, "toolbar" );
    setRightJustification( TRUE );

    (void)new QLabel( tr( " Path: " ), toolbar );

    pathCombo = new QComboBox( TRUE, toolbar );
    pathCombo->setAutoCompletion( TRUE );
    toolbar->setStretchableWidget( pathCombo );
    connect( pathCombo, SIGNAL( activated( const QString & ) ),
	     this, SLOT ( changePath( const QString & ) ) );

    toolbar->addSeparator();

    QPixmap pix;

    pix = QPixmap( cdtoparent_xpm );
    upButton = new QToolButton( pix, "One directory up", QString::null,
				this, SLOT( cdUp() ), toolbar, "cd up" );

    pix = QPixmap( newfolder_xpm );
    mkdirButton = new QToolButton( pix, "New Folder", QString::null,
				   this, SLOT( newFolder() ), toolbar, "new folder" );

    connect( dirlist, SIGNAL( folderSelected( const QString & ) ),
	     fileview, SLOT ( setDirectory( const QString & ) ) );
    connect( fileview, SIGNAL( directoryChanged( const QString & ) ),
	     this, SLOT( directoryChanged( const QString & ) ) );
    connect( fileview, SIGNAL( startReadDir( int ) ),
	     this, SLOT( slotStartReadDir( int ) ) );
    connect( fileview, SIGNAL( readNextDir() ),
	     this, SLOT( slotReadNextDir() ) );
    connect( fileview, SIGNAL( readDirDone() ),
	     this, SLOT( slotReadDirDone() ) );

    setDockEnabled( DockLeft, FALSE );
    setDockEnabled( DockRight, FALSE );

    label = new QLabel( statusBar() );
    statusBar()->addWidget( label, 2, TRUE );
    progress = new QProgressBar( statusBar() );
    statusBar()->addWidget( progress, 1, TRUE );

    connect( fileview, SIGNAL( enableUp() ),
	     this, SLOT( enableUp() ) );
    connect( fileview, SIGNAL( disableUp() ),
	     this, SLOT( disableUp() ) );
    connect( fileview, SIGNAL( enableMkdir() ),
	     this, SLOT( enableMkdir() ) );
    connect( fileview, SIGNAL( disableMkdir() ),
	     this, SLOT( disableMkdir() ) );
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:67,代码来源:mainwindow.cpp


注:本文中的QSplitter::setResizeMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。