本文整理汇总了C++中QProgressBar::setSizePolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QProgressBar::setSizePolicy方法的具体用法?C++ QProgressBar::setSizePolicy怎么用?C++ QProgressBar::setSizePolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QProgressBar
的用法示例。
在下文中一共展示了QProgressBar::setSizePolicy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addRow
void MainWindow::addRow( int fileId, const QString &fileName, int progress )
{
int rowId = ui->files->rowCount();
ui->files->insertRow( rowId );
QTableWidgetItem *id = new QTableWidgetItem( QString::number(fileId) );
QTableWidgetItem *fn = new QTableWidgetItem( fileName );
QWidget *wt = new QWidget();
QSpacerItem *s1 = new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding );
QSpacerItem *s2 = new QSpacerItem(1, 7, QSizePolicy::Fixed, QSizePolicy::Expanding );
QVBoxLayout *lt = new QVBoxLayout( wt );
QProgressBar *pb = new QProgressBar( wt );
pb->setObjectName( "PROGRESS_BAR" );
pb->setParent( this );
pb->setValue( progress );
pb->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
lt->addSpacerItem( s1 );
lt->addWidget( pb );
lt->addSpacerItem( s2 );
lt->setMargin( 0 );
wt->setLayout( lt );
ui->files->setItem( rowId, 0, id );
ui->files->setItem( rowId, 1, fn );
ui->files->setCellWidget( rowId, 2, wt );
}
示例2: createWidgets
void MyFracWindow::createWidgets()
{
KDockWidget* dockMain = createDockWidget("main", NULL);
_tabWidget = new QTabWidget(dockMain);
dockMain->setWidget(_tabWidget);
_view2D = new ViewWidget(true, _tabWidget);
_tabWidget->addTab(_view2D, SmallIconSet("frtab2d"), i18n("2D View"));
_view3D = new View3DWidget(_tabWidget);
_tabWidget->addTab(_view3D, SmallIconSet("frtab3d"), i18n("3D View"));
_dockParams = createDockWidget("params", SmallIcon("frparams"), NULL,
i18n("Parameters"));
QWidget* params = createParamsDock(_dockParams);
_dockParams->setWidget(params);
_dockDisplay = createDockWidget("display", SmallIcon("frdisplay"), NULL,
i18n("Display"));
QWidget* display = createDisplayDock(_dockParams);
_dockDisplay->setWidget(display);
_dockPreview = createDockWidget("preview", SmallIcon("viewmag"), NULL, i18n("Preview"));
ViewWidget* preview = new ViewWidget(false, _dockPreview);
_dockPreview->setWidget(preview);
dockMain->setDockSite(KDockWidget::DockCorner);
dockMain->setEnableDocking(KDockWidget::DockNone);
setView(dockMain);
setMainDockWidget(dockMain);
KDockWidget* dock1 = _dockDisplay->manualDock(_dockParams, KDockWidget::DockCenter);
KDockWidget* dock2 = _dockPreview->manualDock(dock1, KDockWidget::DockBottom, 65);
dock2->manualDock(dockMain, KDockWidget::DockRight, 65);
connect(_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(tabChanged()));
connect(this, SIGNAL(view2DEnabled(bool)), _view2D, SLOT(setVisible(bool)));
connect(this, SIGNAL(view3DEnabled(bool)), _view3D, SLOT(setVisible(bool)));
connect(this, SIGNAL(previewEnabled(bool)), _view2D, SLOT(enablePreview(bool)));
connect(this, SIGNAL(positionChanged(double, double, double, double)), _view2D, SLOT(setPosition(double, double, double, double)));
connect(this, SIGNAL(positionChanged(double, double, double, double)), _view3D, SLOT(setPosition(double, double, double, double)));
connect(this, SIGNAL(positionChanged(double, double, double, double)), preview, SLOT(setPreviewPosition(double, double, double, double)));
connect(this, SIGNAL(modeChangedMandelbrot()), _view2D, SLOT(setMandelbrotMode()));
connect(this, SIGNAL(modeChangedMandelbrot()), _view3D, SLOT(setMandelbrotMode()));
connect(this, SIGNAL(modeChangedJulia(double, double)), _view2D, SLOT(setJuliaMode(double, double)));
connect(this, SIGNAL(modeChangedJulia(double, double)), _view3D, SLOT(setJuliaMode(double, double)));
connect(this, SIGNAL(precisionChanged(double, double)), _view2D, SLOT(setQuality(double, double)));
connect(this, SIGNAL(precisionChanged(double, double)), _view3D, SLOT(setQuality(double, double)));
connect(this, SIGNAL(precisionChanged(double, double)), preview, SLOT(setQuality(double, double)));
connect(this, SIGNAL(backgroundChanged(QRgb)), _view2D, SLOT(setBackground(QRgb)));
connect(this, SIGNAL(backgroundChanged(QRgb)), _view3D, SLOT(setBackground(QRgb)));
connect(this, SIGNAL(backgroundChanged(QRgb)), preview, SLOT(setBackground(QRgb)));
connect(this, SIGNAL(gradientChanged(const QRgb*, double, double)), _view2D, SLOT(setGradient(const QRgb*, double, double)));
connect(this, SIGNAL(gradientChanged(const QRgb*, double, double)), _view3D, SLOT(setGradient(const QRgb*, double, double)));
connect(this, SIGNAL(gradientChanged(const QRgb*, double, double)), preview, SLOT(setGradient(const QRgb*, double, double)));
connect(_view2D, SIGNAL(previewVisible(bool)), preview, SLOT(setVisible(bool)));
connect(_view2D, SIGNAL(previewPosition(double, double)), preview, SLOT(setJuliaMode(double, double)));
connect(_view2D, SIGNAL(positionChanged(double, double, double, double)), this, SLOT(setPosition(double, double, double, double)));
connect(_view2D, SIGNAL(previewDoubleClick(double, double)), this, SLOT(setJuliaMode(double, double)));
connect(this, SIGNAL(gridSizeChanged(int, int)), _view3D, SLOT(setGridSize(int, int)));
connect(this, SIGNAL(heightScaleChanged(double)), _view3D, SLOT(setHeightScale(double)));
_view2D->enableTransform(true);
KStatusBar* status = statusBar();
status->setSizeGripEnabled(false);
QProgressBar* progress = new QProgressBar(100, status);
progress->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
progress->setMaximumHeight(status->sizeHint().height() - 2);
progress->setMinimumWidth(120);
progress->setProgress(100);
status->addWidget(progress, 0, true);
connect(_view2D, SIGNAL(updateProgress(int)), progress, SLOT(setProgress(int)));
connect(_view3D, SIGNAL(updateProgress(int)), progress, SLOT(setProgress(int)));
}