本文整理汇总了C++中QRadioButton::setFont方法的典型用法代码示例。如果您正苦于以下问题:C++ QRadioButton::setFont方法的具体用法?C++ QRadioButton::setFont怎么用?C++ QRadioButton::setFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRadioButton
的用法示例。
在下文中一共展示了QRadioButton::setFont方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createWidget
void MeasureCountFilter::createWidget()
{
QFont minMaxFont("SansSerif", 9);
QRadioButton * minButton = new QRadioButton("Minimum");
minButton->setFont(minMaxFont);
QRadioButton * maxButton = new QRadioButton("Maximum");
maxButton->setFont(minMaxFont);
minMaxGroup = new QButtonGroup;
connect(minMaxGroup, SIGNAL(buttonClicked(int)),
this, SLOT(updateMinMax(int)));
minMaxGroup->addButton(minButton, 0);
minMaxGroup->addButton(maxButton, 1);
minButton->click();
countSpinBox = new QSpinBox;
countSpinBox->setRange(0, std::numeric_limits< int >::max());
countSpinBox->setValue(count);
connect(countSpinBox, SIGNAL(valueChanged(int)),
this, SLOT(updateMeasureCount(int)));
// hide inclusive and exclusive buttons,
// and add spinbox for min measure count
getInclusiveExclusiveLayout()->itemAt(0)->widget()->setVisible(false);
getInclusiveExclusiveLayout()->itemAt(1)->widget()->setVisible(false);
getInclusiveExclusiveLayout()->addWidget(minButton);
getInclusiveExclusiveLayout()->addWidget(maxButton);
getInclusiveExclusiveLayout()->addSpacing(8);
getInclusiveExclusiveLayout()->addWidget(countSpinBox);
}
示例2: QRadioButton
ChooseDialog::ChooseDialog(const QString &title, const List &values, QWidget *parent) :
QDialog(parent),
m_layout(this),
m_buttonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Ok, Qt::Horizontal, this)
{
setWindowTitle(title);
m_values.reserve(values.size());
QFont font;
font.setBold(true);
font.setWeight(75);
m_layout.setSpacing(6);
m_layout.setMargin(6);
QRadioButton *button;
for (List::size_type i = 0, size = values.size(); i < size; ++i)
{
button = new QRadioButton(values.at(i).first, this);
button->setFont(font);
m_values.push_back(Container::value_type(values.at(i).second, button));
m_layout.addWidget(button);
}
m_layout.addWidget(&m_buttonBox);
connect(&m_buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(&m_buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
}
示例3: createWidget
void AbstractNumberFilter::createWidget()
{
QFont greaterThanLessThanFont("SansSerif", 9);
QRadioButton * lessThanButton = new QRadioButton("<=");
lessThanButton->setFont(greaterThanLessThanFont);
QRadioButton * greaterThanButton = new QRadioButton(">=");
greaterThanButton->setFont(greaterThanLessThanFont);
greaterThanLessThan = new QButtonGroup;
connect(greaterThanLessThan, SIGNAL(buttonClicked(int)),
this, SIGNAL(filterChanged()));
greaterThanLessThan->addButton(lessThanButton, 0);
greaterThanLessThan->addButton(greaterThanButton, 1);
// hide inclusive and exclusive buttons, and add greater than and less than
// in the inclusiveExclusiveLayout.
getInclusiveExclusiveLayout()->itemAt(0)->widget()->setVisible(false);
getInclusiveExclusiveLayout()->itemAt(1)->widget()->setVisible(false);
getInclusiveExclusiveLayout()->addWidget(lessThanButton);
getInclusiveExclusiveLayout()->addWidget(greaterThanButton);
lineEditText = new QString;
lineEdit = new QLineEdit;
lineEdit->setMinimumWidth(75);
connect(lineEdit, SIGNAL(textChanged(QString)),
this, SLOT(updateLineEditText(QString)));
connect(lineEdit, SIGNAL(textChanged(QString)),
this, SIGNAL(filterChanged()));
QHBoxLayout * layout = new QHBoxLayout;
QMargins margins = layout->contentsMargins();
margins.setTop(0);
margins.setBottom(0);
layout->setContentsMargins(margins);
layout->addWidget(lineEdit);
layout->addStretch();
getMainLayout()->addLayout(layout);
// FIXME: QSettings should handle this
lessThanButton->click();
}
示例4: createWidget
void AbstractFilter::createWidget() {
QRadioButton *inclusiveButton = new QRadioButton("Inclusive");
inclusiveButton->setFont(*m_smallFont);
QRadioButton *exclusiveButton = new QRadioButton("Exclusive");
exclusiveButton->setFont(*m_smallFont);
m_inclusiveExclusiveGroup = new QButtonGroup;
connect(m_inclusiveExclusiveGroup, SIGNAL(buttonClicked(int)),
this, SIGNAL(filterChanged()));
m_inclusiveExclusiveGroup->addButton(inclusiveButton, 0);
m_inclusiveExclusiveGroup->addButton(exclusiveButton, 1);
m_inclusiveExclusiveLayout = new QHBoxLayout;
QMargins margins = m_inclusiveExclusiveLayout->contentsMargins();
margins.setTop(0);
margins.setBottom(0);
m_inclusiveExclusiveLayout->setContentsMargins(margins);
m_inclusiveExclusiveLayout->addWidget(inclusiveButton);
m_inclusiveExclusiveLayout->addWidget(exclusiveButton);
QHBoxLayout *controlsLayout = new QHBoxLayout;
margins = controlsLayout->contentsMargins();
margins.setTop(0);
margins.setBottom(0);
controlsLayout->setContentsMargins(margins);
controlsLayout->addLayout(m_inclusiveExclusiveLayout);
m_effectivenessGroup = new QButtonGroup();
m_effectivenessGroup->setExclusive(false);
if (m_effectivenessFlags->testFlag(Images))
m_effectivenessGroup->addButton(
createEffectivenessCheckBox("&Images"), 0);
if (m_effectivenessFlags->testFlag(Points))
m_effectivenessGroup->addButton(
createEffectivenessCheckBox("&Points"), 1);
if (m_effectivenessFlags->testFlag(Measures))
m_effectivenessGroup->addButton(
createEffectivenessCheckBox("&Measures"), 2);
QString firstGroupEntry;
ASSERT(m_effectivenessGroup->buttons().size());
if (m_effectivenessGroup->buttons().size()) {
firstGroupEntry = m_effectivenessGroup->buttons()[0]->text();
firstGroupEntry.remove(0, 1);
}
QList<QAbstractButton *> buttons = m_effectivenessGroup->buttons();
if (m_effectivenessGroup->buttons().size() >= 2) {
QHBoxLayout *effectivenessLayout = new QHBoxLayout;
QMargins effectivenessMargins = effectivenessLayout->contentsMargins();
effectivenessMargins.setTop(0);
effectivenessMargins.setBottom(0);
effectivenessLayout->setContentsMargins(effectivenessMargins);
for (int i = 0; i < buttons.size(); i++)
effectivenessLayout->addWidget(buttons[i]);
controlsLayout->addLayout(effectivenessLayout);
}
else {
for (int i = 0; i < buttons.size(); i++)
delete buttons[i];
delete m_effectivenessGroup;
m_effectivenessGroup = NULL;
}
if (m_minForSuccess != -1) {
QLabel *label = new QLabel;
label->setText(
"<span>Min Count<br/>for " + firstGroupEntry + "</span>");
label->setFont(QFont("SansSerif", 7));
QSpinBox *spinBox = new QSpinBox;
spinBox->setRange(1, std::numeric_limits< int >::max());
spinBox->setValue(1); // FIXME: QSettings should handle this
connect(spinBox, SIGNAL(valueChanged(int)),
this, SLOT(updateMinForSuccess(int)));
QHBoxLayout *minLayout = new QHBoxLayout;
margins = minLayout->contentsMargins();
margins.setTop(0);
margins.setBottom(0);
minLayout->setContentsMargins(margins);
minLayout->addWidget(label);
minLayout->addWidget(spinBox);
m_minWidget = new QWidget;
m_minWidget->setLayout(minLayout);
controlsLayout->addWidget(m_minWidget);
controlsLayout->setAlignment(m_minWidget, Qt::AlignTop);
m_minWidget->setVisible(true); // FIXME: QSettings should handle this
}
示例5: createValueWidget
void SettingWidget::createValueWidget()
{
rsArgument* argument = task->getArgument(option->name);
switch(option->type) {
case G_OPTION_ARG_FILENAME:
case G_OPTION_ARG_STRING:
case G_OPTION_ARG_STRING_ARRAY:
case G_OPTION_ARG_CALLBACK:
case G_OPTION_ARG_INT:
case G_OPTION_ARG_INT64:
case G_OPTION_ARG_DOUBLE:
{
// Display text box if number of values is not restricted
if ( option->allowedValues == NULL ) {
if ( option->nLines < 2 ) {
QLineEdit *w = new QLineEdit();
valueWidget = w;
w->setPlaceholderText(option->cli_arg_description);
connect(w, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
if ( argument != NULL ) {
w->setText(argument->value);
} else if ( option->defaultValue != NULL ) {
w->setText(option->defaultValue);
}
} else { // create a QTextEdit field instead
QPlainTextEdit *w = new QPlainTextEdit();
valueWidget = w;
connect(w, SIGNAL(textChanged()), this, SLOT(textChanged()));
if ( argument != NULL ) {
w->setPlainText(argument->value);
} else if ( option->defaultValue != NULL ) {
w->setPlainText(option->defaultValue);
}
QFontMetrics m(w->font()) ;
int rowHeight = m.lineSpacing() ;
w->setFixedHeight(option->nLines * rowHeight) ;
w->setLineWrapMode(QPlainTextEdit::NoWrap);
}
} else { // if the allowed values are restricted display radio buttons instead
QWidget *w = new QWidget();
QBoxLayout *wLayout = new QBoxLayout(QBoxLayout::TopToBottom);
QButtonGroup *buttonGroup = new QButtonGroup();
buttonGroup->setExclusive(true);
valueWidget = w;
connect(buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(buttonClicked(int)));
// go through all options and add a radio button for them
rsUIOptionValue** values = option->allowedValues;
for (size_t i=0; values[i] != NULL; i++ ) {
// add radio button
QRadioButton *b = new QRadioButton(QString("'")+QString(values[i]->name)+QString("'"));
QFont f("Arial", 12, QFont::Bold);
b->setFont(f);
buttonGroup->addButton(b, (int)i);
wLayout->addWidget(b);
// set it to checked if it is the default or set value
b->setChecked(false);
if ( argument != NULL ) {
if ( ! strcmp(argument->value,values[i]->name) ) {
b->setChecked(true);
}
} else if ( ! strcmp(option->defaultValue,values[i]->name) ) {
b->setChecked(true);
}
// add its description
QLabel *label = new QLabel(values[i]->description);
label->setIndent(22);
label->setWordWrap(true);
label->setContentsMargins(0, 0, 0, 4);
QFont f2("Arial", 11, QFont::Normal);
label->setFont(f2);
wLayout->addWidget(label);
}
w->setLayout(wLayout);
}
}
break;
/*
case G_OPTION_ARG_INT:
case G_OPTION_ARG_INT64:
valueWidget = new QSpinBox();
break;
case G_OPTION_ARG_DOUBLE:
valueWidget = new QDoubleSpinBox();
break;
*/
case G_OPTION_ARG_NONE:
{
QCheckBox *w = new QCheckBox("Enabled"); // new SwitchWidget();
valueWidget = w;
connect(w, SIGNAL(stateChanged(int)), this, SLOT(stateChanged(int)));
if ( argument != NULL ) {
w->setCheckState(Qt::Checked);
} else {
w->setCheckState(Qt::Unchecked);
}
}
//.........这里部分代码省略.........