本文整理汇总了C++中QCheckBox::setSizePolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QCheckBox::setSizePolicy方法的具体用法?C++ QCheckBox::setSizePolicy怎么用?C++ QCheckBox::setSizePolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCheckBox
的用法示例。
在下文中一共展示了QCheckBox::setSizePolicy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createIconButton
QAbstractButton* MainWindow::createIconButton(const QString &iconPath, const QString &text, QWidget *parent) const
{
QCheckBox *button = new QCheckBox(text, parent);
//button->setIcon(QIcon(iconPath));
button->setStyleSheet("QCheckBox::indicator { image: url(" + iconPath.arg("") + "); }"
"QCheckBox::indicator:hover { image: url(" + iconPath.arg("_hovered") + "); }"
"QCheckBox::indicator:pressed { image: url(" + iconPath.arg("_pressed") + "); }");
button->setIconSize(QImage(iconPath).size());
button->setContentsMargins(0, 0, 0, 0);
button->setCursor(Qt::PointingHandCursor);
button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
return button;
}
示例2: addCheck
// Create new checkbox widget
QtWidgetObject* AtenTreeGuiDialog::addCheck(TreeGuiWidget* widget, QString label)
{
QtWidgetObject* qtwo = widgetObjects_.add();
QCheckBox *check = new QCheckBox(this);
qtwo->set(widget, check);
check->setText(label);
check->setChecked(widget->valueI());
check->setEnabled(widget->enabled());
check->setVisible(widget->visible());
check->setMinimumHeight(WIDGETHEIGHT);
check->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
// Connect signal to master slot
QObject::connect(check, SIGNAL(clicked(bool)), this, SLOT(checkBoxWidget_clicked(bool)));
return qtwo;
}
示例3: QSpinBox
void busConnection::on_spinBox_5_valueChanged(int arg1)
{
Q_UNUSED(arg1);
if(!(ui->checkBox->isChecked())){
QHBoxLayout *bla = new QHBoxLayout;
ui->verticalLayout->addLayout(bla);
QCheckBox *intento = new QCheckBox;
intento->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
QSpinBox *left = new QSpinBox(0);
left->setMaximum(ventana->ultimo->getCantidadBits()-1);
QSpinBox *right = new QSpinBox(0);
right->setMaximum(last->getCantidadBits()-1);
checkboxOneOne.append(intento);
QSpinBoxOneOneLeft.append(left);
QSpinBoxOneOneRight.append(right);
connect(left,SIGNAL(valueChanged(int)),this,SLOT(newOneOneLine(int)));
connect(right,SIGNAL(valueChanged(int)),this,SLOT(newOneOneLine(int)));
++oneOneCounter;
bla->addWidget(intento);
bla->addWidget(left);
bla->addWidget(right);
}
示例4: createNewCheckboxesBasedOnData
void ClipperWidget::createNewCheckboxesBasedOnData()
{
std::map<QString, DataPtr> datas = this->getDatas();
std::map<QString, DataPtr>::iterator iter = datas.begin();
int row = 0;
for(; iter != datas.end(); ++iter)
{
DataPtr data = iter->second;
QCheckBox *checkbox = new QCheckBox();
checkbox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
mDataTableWidget->setCellWidget(row, 0, checkbox);
QTableWidgetItem *descriptionItem = new QTableWidgetItem(data->getName());
mDataTableWidget->setItem(row++, 1, descriptionItem);
boost::function<void()> func = boost::bind(&ClipperWidget::dataSelectorClicked, this, checkbox, data);
connect(checkbox, &QCheckBox::clicked, this, func);
this->updateCheckBoxFromClipper(checkbox, data);
}
}
示例5: 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));
//.........这里部分代码省略.........