本文整理汇总了C++中QRadioButton::setSizePolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QRadioButton::setSizePolicy方法的具体用法?C++ QRadioButton::setSizePolicy怎么用?C++ QRadioButton::setSizePolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRadioButton
的用法示例。
在下文中一共展示了QRadioButton::setSizePolicy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateLayersPanel
void QMwMaterialLayersWidget::UpdateLayersPanel()
{
QGridLayout *layersLayout = (QGridLayout*)this->layersWidget->layout();
QLayoutItem *child;
while ((child = layersLayout->takeAt(0)) != 0)
{
delete child->widget();
delete child;
}
if (this->material == 0)
return;
for (int layerIndex = 0; layerIndex < this->material->shaderSlots.count; layerIndex++)
{
QRadioButton *layerSelectRadioButton = new QRadioButton(this->layersWidget);
layerSelectRadioButton->setChecked(layerIndex == this->selectedLayerIndex);
layerSelectRadioButton->setProperty("layerIndex", QVariant(layerIndex));
layerSelectRadioButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
QObject::connect(layerSelectRadioButton, SIGNAL(clicked()), this, SLOT(LayerSelected()));
layersLayout->addWidget(layerSelectRadioButton, layerIndex, 0);
QComboBox *shaderOpComboBox = new QComboBox(this->layersWidget);
this->SetShaderOpComboBox(shaderOpComboBox, layerIndex);
QObject::connect(shaderOpComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(LayerShaderOperationChanged(int)));
layersLayout->addWidget(shaderOpComboBox, layerIndex, 1);
QComboBox *colorOpComboBox = new QComboBox(this->layersWidget);
this->SetColorOpComboBox(colorOpComboBox, layerIndex);
QObject::connect(colorOpComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(LayerColorOperationChanged(int)));
layersLayout->addWidget(colorOpComboBox, layerIndex, 2);
}
}
示例2: addRadioButton
// Create new radio button
QtWidgetObject* AtenTreeGuiDialog::addRadioButton(TreeGuiWidget* widget, TreeGuiWidget* groupWidget, QString name, QString label, int id)
{
// Cast QObject in groupWidget into QButtonGroup
QtWidgetObject* wo = groupWidget->qtWidgetObject();
if (wo == NULL)
{
printf("Internal Error: Can't add button to radiogroup widget since supplied widget doesn't have an associated QtWidgetObject.\n");
return NULL;
}
QButtonGroup *group = static_cast<QButtonGroup*>(wo->qObject());
if (!group)
{
printf("Internal Error: Couldn't cast QObject into QButtonGroup.\n");
return NULL;
}
// Create new QtWidgetObject for page
QRadioButton *radio = new QRadioButton(label, this);
group->addButton(radio, id);
QtWidgetObject* qtwo = widgetObjects_.add();
qtwo->set(widget, radio);
radio->setEnabled(widget->enabled());
radio->setVisible(widget->visible());
radio->setChecked(widget->valueI() == 1);
radio->setMinimumHeight(WIDGETHEIGHT);
radio->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
// Connect signal to master slot
QObject::connect(radio, SIGNAL(clicked(bool)), this, SLOT(radioButtonWidget_clicked(bool)));
return qtwo;
}
示例3: createCommonControls
void PathStrokeControls::createCommonControls(QWidget* parent)
{
m_capGroup = new QGroupBox(parent);
m_capGroup->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
QRadioButton *flatCap = new QRadioButton(m_capGroup);
QRadioButton *squareCap = new QRadioButton(m_capGroup);
QRadioButton *roundCap = new QRadioButton(m_capGroup);
m_capGroup->setTitle(tr("Cap Style"));
flatCap->setText(tr("Flat"));
squareCap->setText(tr("Square"));
roundCap->setText(tr("Round"));
flatCap->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
squareCap->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
roundCap->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_joinGroup = new QGroupBox(parent);
m_joinGroup->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
QRadioButton *bevelJoin = new QRadioButton(m_joinGroup);
QRadioButton *miterJoin = new QRadioButton(m_joinGroup);
QRadioButton *roundJoin = new QRadioButton(m_joinGroup);
m_joinGroup->setTitle(tr("Join Style"));
bevelJoin->setText(tr("Bevel"));
miterJoin->setText(tr("Miter"));
roundJoin->setText(tr("Round"));
m_styleGroup = new QGroupBox(parent);
m_styleGroup->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
QRadioButton *solidLine = new QRadioButton(m_styleGroup);
QRadioButton *dashLine = new QRadioButton(m_styleGroup);
QRadioButton *dotLine = new QRadioButton(m_styleGroup);
QRadioButton *dashDotLine = new QRadioButton(m_styleGroup);
QRadioButton *dashDotDotLine = new QRadioButton(m_styleGroup);
QRadioButton *customDashLine = new QRadioButton(m_styleGroup);
m_styleGroup->setTitle(tr("Pen Style"));
QPixmap line_solid(":res/images/line_solid.png");
solidLine->setIcon(line_solid);
solidLine->setIconSize(line_solid.size());
QPixmap line_dashed(":res/images/line_dashed.png");
dashLine->setIcon(line_dashed);
dashLine->setIconSize(line_dashed.size());
QPixmap line_dotted(":res/images/line_dotted.png");
dotLine->setIcon(line_dotted);
dotLine->setIconSize(line_dotted.size());
QPixmap line_dash_dot(":res/images/line_dash_dot.png");
dashDotLine->setIcon(line_dash_dot);
dashDotLine->setIconSize(line_dash_dot.size());
QPixmap line_dash_dot_dot(":res/images/line_dash_dot_dot.png");
dashDotDotLine->setIcon(line_dash_dot_dot);
dashDotDotLine->setIconSize(line_dash_dot_dot.size());
customDashLine->setText(tr("Custom"));
int fixedHeight = bevelJoin->sizeHint().height();
solidLine->setFixedHeight(fixedHeight);
dashLine->setFixedHeight(fixedHeight);
dotLine->setFixedHeight(fixedHeight);
dashDotLine->setFixedHeight(fixedHeight);
dashDotDotLine->setFixedHeight(fixedHeight);
m_pathModeGroup = new QGroupBox(parent);
m_pathModeGroup->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
QRadioButton *curveMode = new QRadioButton(m_pathModeGroup);
QRadioButton *lineMode = new QRadioButton(m_pathModeGroup);
m_pathModeGroup->setTitle(tr("Line Style"));
curveMode->setText(tr("Curves"));
lineMode->setText(tr("Lines"));
// Layouts
QVBoxLayout *capGroupLayout = new QVBoxLayout(m_capGroup);
capGroupLayout->addWidget(flatCap);
capGroupLayout->addWidget(squareCap);
capGroupLayout->addWidget(roundCap);
QVBoxLayout *joinGroupLayout = new QVBoxLayout(m_joinGroup);
joinGroupLayout->addWidget(bevelJoin);
joinGroupLayout->addWidget(miterJoin);
joinGroupLayout->addWidget(roundJoin);
QVBoxLayout *styleGroupLayout = new QVBoxLayout(m_styleGroup);
styleGroupLayout->addWidget(solidLine);
styleGroupLayout->addWidget(dashLine);
styleGroupLayout->addWidget(dotLine);
styleGroupLayout->addWidget(dashDotLine);
styleGroupLayout->addWidget(dashDotDotLine);
styleGroupLayout->addWidget(customDashLine);
QVBoxLayout *pathModeGroupLayout = new QVBoxLayout(m_pathModeGroup);
pathModeGroupLayout->addWidget(curveMode);
pathModeGroupLayout->addWidget(lineMode);
// Connections
connect(flatCap, SIGNAL(clicked()), m_renderer, SLOT(setFlatCap()));
connect(squareCap, SIGNAL(clicked()), m_renderer, SLOT(setSquareCap()));
connect(roundCap, SIGNAL(clicked()), m_renderer, SLOT(setRoundCap()));
connect(bevelJoin, SIGNAL(clicked()), m_renderer, SLOT(setBevelJoin()));
connect(miterJoin, SIGNAL(clicked()), m_renderer, SLOT(setMiterJoin()));
connect(roundJoin, SIGNAL(clicked()), m_renderer, SLOT(setRoundJoin()));
//.........这里部分代码省略.........
示例4: grBtoY
scannerwindow::scannerwindow(QList<int> parameters, QMainWindow *parent, bool load, QTextStream* stream):
QObject(parent)
{
this->parameters=parameters;
widget = new QWidget();
widget->setAttribute(Qt::WA_DeleteOnClose);
graph = new Q3DSurface();
container = QWidget::createWindowContainer(graph, widget);
container->setAttribute(Qt::WA_AcceptTouchEvents);
widget->setGeometry(
QStyle::alignedRect(
Qt::LeftToRight,
Qt::AlignTop,
widget->size(),
qApp->desktop()->availableGeometry()
)
);
bitmapForward=new QCustomPlot(widget);
bitmapBackward=new QCustomPlot(widget);
bitmapCombined=new QCustomPlot(widget);
bitmapForward->setContextMenuPolicy(Qt::CustomContextMenu);
bitmapBackward->setContextMenuPolicy(Qt::CustomContextMenu);
bitmapCombined->setContextMenuPolicy(Qt::CustomContextMenu);
bitmapBackward->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
bitmapForward->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
bitmapCombined->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
initializeBitmapForward(bitmapForward);
initializeBitmapBackward(bitmapBackward);
initializeBitmapCombined(bitmapCombined);
if (!graph->hasContext()) {
QMessageBox msgBox;
msgBox.setText("Couldn't initialize the OpenGL context.");
msgBox.exec();
}
QSize screenSize = graph->screen()->size();
container->setMinimumSize(QSize(screenSize.width() / 3, screenSize.height()/4));
container->setMaximumSize(screenSize);
container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
container->setFocusPolicy(Qt::StrongFocus);
bitmapBackward->setMinimumSize(screenSize.width()/4, screenSize.height()/4);
bitmapForward->setMinimumSize(screenSize.width()/4, screenSize.height()/4);
bitmapCombined->setMinimumSize(screenSize.width()/4, screenSize.height()/4);
QHBoxLayout *hLayout = new QHBoxLayout(widget);
QVBoxLayout *vLayout = new QVBoxLayout();
QSplitter *hSplitterMain = new QSplitter();
QSplitter *vSplitterRight = new QSplitter();
hLayout->setSizeConstraint(QBoxLayout::SizeConstraint::SetMinimumSize);
vSplitterRight->addWidget(bitmapForward);
vSplitterRight->addWidget(bitmapBackward);
vSplitterRight->addWidget(bitmapCombined);
vSplitterRight->setOrientation(Qt::Orientation::Vertical);
vSplitterRight->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
hSplitterMain->setOrientation(Qt::Orientation::Horizontal);
hSplitterMain->addWidget(container);
hSplitterMain->addWidget(vSplitterRight);
hSplitterMain->setStyleSheet("QSplitter::handle {background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,stop:0 rgba(255, 255, 255, 0),stop:0.407273 rgba(200, 200, 200, 255),stop:0.4825 rgba(101, 104, 113, 235), stop:0.6 rgba(255, 255, 255, 0));}");
vSplitterRight->setStyleSheet("QSplitter::handle {background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,stop:0 rgba(255, 255, 255, 0),stop:0.407273 rgba(200, 200, 200, 255),stop:0.4825 rgba(101, 104, 113, 235), stop:0.6 rgba(255, 255, 255, 0));}");
hLayout->addWidget(hSplitterMain);
hLayout->addLayout(vLayout);
vLayout->setAlignment(Qt::AlignTop);
widget->setWindowTitle(QStringLiteral("AFM Scan"));
QGroupBox *modelGroupBox = new QGroupBox(QStringLiteral("Scan"));
if(!load){
AFM_Scan_3D_RB = new QPushButton(widget);
AFM_Scan_3D_RB->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
AFM_Scan_3D_RB->setText(QStringLiteral("Start Scan"));
AFM_Scan_3D_RB->setCheckable(true);
AFM_Scan_3D_RB->setChecked(false);
}
SaveSurface = new QPushButton(widget);
SaveSurface->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
SaveSurface->setText(QStringLiteral("Save Data"));
BitmapView = new QPushButton(widget);
BitmapView->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
//.........这里部分代码省略.........