本文整理汇总了C++中QRadioButton::setProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ QRadioButton::setProperty方法的具体用法?C++ QRadioButton::setProperty怎么用?C++ QRadioButton::setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRadioButton
的用法示例。
在下文中一共展示了QRadioButton::setProperty方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddCommon
bool HandlerChoiceDialog::AddCommon (const IInfo *ii, const QString& addedAs)
{
QString name;
QString tooltip;
QIcon icon;
try
{
name = ii->GetName ();
tooltip = ii->GetInfo ();
icon = ii->GetIcon ();
}
catch (const std::exception& e)
{
qWarning () << Q_FUNC_INFO
<< "could not query"
<< e.what ()
<< ii;
return false;
}
catch (...)
{
qWarning () << Q_FUNC_INFO
<< "could not query"
<< ii;
return false;
}
QRadioButton *but = new QRadioButton (name, this);
but->setToolTip (tooltip);
but->setIconSize (QSize (32, 32));
but->setIcon (icon);
but->setProperty ("AddedAs", "IDownload");
but->setProperty ("PluginID", ii->GetUniqueID ());
if (Buttons_->buttons ().isEmpty ())
but->setChecked (true);
Buttons_->addButton (but);
Ui_.DownloadersLayout_->addWidget (but);
Infos_ [name] = ii;
Ui_.DownloadersLabel_->show ();
if (Downloaders_.size () + Handlers_.size () == 1)
populateLocationsBox ();
return true;
}
示例2: 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);
}
}
示例3: QuetzalRequestDialog
QuetzalChoiceDialog::QuetzalChoiceDialog(const char *title, const char *primary,
const char *secondary, int default_value,
const char *ok_text, GCallback ok_cb,
const char *cancel_text, GCallback cancel_cb,
void *user_data, va_list choices,
QWidget *parent)
: QuetzalRequestDialog(title, primary, secondary, PURPLE_REQUEST_CHOICE, user_data, parent)
{
m_ok_cb = (PurpleRequestChoiceCb) ok_cb;
m_cancel_cb = (PurpleRequestChoiceCb) cancel_cb;
QPushButton *ok_button = buttonBox()->addButton(ok_text, QDialogButtonBox::AcceptRole);
QPushButton *cancel_button = buttonBox()->addButton(cancel_text, QDialogButtonBox::RejectRole);
connect(ok_button, SIGNAL(clicked()), this, SLOT(onOkClicked()));
connect(cancel_button, SIGNAL(clicked()), this, SLOT(onCancelClicked()));
const char *text;
int id;
int i = 1; // Label with description is situated at index 0
while (!!(text = va_arg(choices, gchararray))) {
id = va_arg(choices, int);
QRadioButton *button = new QRadioButton(text, this);
m_radios << button;
button->setProperty("choiceId", id);
boxLayout()->insertWidget(i++, button);
if (id == default_value)
button->setChecked(true);
}
}
示例4: initialize
void PreferencesDialog::initialize(PreferencesTab initialTab, const persistence::Settings *settings, const QMap<QString, QString> &jamRecorders)
{
Q_UNUSED(initialTab);
this->settings = settings;
this->jamRecorders = jamRecorders;
this->jamRecorderCheckBoxes = QMap<QCheckBox *, QString>();
this->jamDateFormatRadioButtons = QMap<const QRadioButton *, QString>();
for (const auto &jamRecorder : jamRecorders.keys()) {
QCheckBox *myCheckBox = new QCheckBox(this);
myCheckBox->setObjectName(jamRecorder);
myCheckBox->setText(jamRecorders.value(jamRecorder));
ui->layoutRecorders->addWidget(myCheckBox);
jamRecorderCheckBoxes[myCheckBox] = jamRecorder;
}
QDateTime now = QDateTime::currentDateTime();
Qt::DateFormat dateFormat;
QString nowString;
QRadioButton *myRadioButton;
dateFormat = Qt::TextDate;
nowString = "Jam-" + now.toString(dateFormat).replace(QRegExp("[/:]"), "-").replace(QRegExp("[ ]"), "_");
myRadioButton = new QRadioButton(this);
myRadioButton->setObjectName("rbdfTextDate");
myRadioButton->setText(nowString);
myRadioButton->setProperty("buttonGroup", "rbDateFormat");
ui->layoutDateFormats->addWidget(myRadioButton);
jamDateFormatRadioButtons[myRadioButton] = "Qt::TextDate";
dateFormat = Qt::ISODate;
nowString = "Jam-" + now.toString(dateFormat).replace(QRegExp("[/:]"), "-").replace(QRegExp("[ ]"), "_");
myRadioButton = new QRadioButton(this);
myRadioButton->setObjectName("rbdfISODate");
myRadioButton->setText(nowString);
myRadioButton->setProperty("buttonGroup", "rbDateFormat");
ui->layoutDateFormats->addWidget(myRadioButton);
jamDateFormatRadioButtons[myRadioButton] = "Qt::ISODate";
setupSignals();
populateAllTabs();
}
示例5: buildRadioButton
static inline
QRadioButton* buildRadioButton(QString text,
QString icon,
int mode,
QGroupBox *groupBox,
QHBoxLayout *hbox,
LogWidgetModel *m_viewmodel)
{
QRadioButton *build = new QRadioButton(text, groupBox);
build->setIcon(QIcon(QString(":/in/%0").arg(icon)));
build->setProperty("mode", mode);
build->setToolTip(build->text());
hbox->addWidget(build);
QObject::connect(build, SIGNAL(toggled(bool)), m_viewmodel, SLOT(changeMode(bool)));
return build;
}
示例6: QFrame
QWidget * PEUtils::makeConnectorForm(const QDomElement & connector, int index, QObject * slotHolder, bool alternating)
{
QFrame * frame = new QFrame();
if (alternating) {
frame->setObjectName(index % 2 == 0 ? "NewPartsEditorConnector0Frame" : "NewPartsEditorConnector1Frame");
}
else {
frame->setObjectName("NewPartsEditorConnectorFrame");
}
QVBoxLayout * mainLayout = new QVBoxLayout();
mainLayout->setMargin(0);
mainLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->setSpacing(0);
QFrame * nameFrame = new QFrame();
QHBoxLayout * nameLayout = new QHBoxLayout();
QLabel * justLabel = new QLabel(QObject::tr("<b>Name:</b>"));
justLabel->setObjectName("NewPartsEditorLabel");
nameLayout->addWidget(justLabel);
QLineEdit * nameEdit = new QLineEdit();
nameEdit->setText(connector.attribute("name"));
QObject::connect(nameEdit, SIGNAL(editingFinished()), slotHolder, SLOT(nameEntry()));
nameEdit->setObjectName("NewPartsEditorLineEdit");
nameEdit->setStatusTip(QObject::tr("Set the connectors's title"));
nameEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
nameEdit->setProperty("index", index);
nameEdit->setProperty("type", "name");
nameEdit->setProperty("id", connector.attribute("id"));
nameLayout->addWidget(nameEdit);
nameLayout->addSpacing(Spacing);
HashRemoveButton * hashRemoveButton = new HashRemoveButton(NULL, NULL, NULL);
hashRemoveButton->setProperty("index", index);
QObject::connect(hashRemoveButton, SIGNAL(clicked(HashRemoveButton *)), slotHolder, SLOT(removeConnector()));
nameLayout->addWidget(hashRemoveButton);
nameFrame->setLayout(nameLayout);
mainLayout->addWidget(nameFrame);
QFrame * descriptionFrame = new QFrame();
QHBoxLayout * descriptionLayout = new QHBoxLayout();
justLabel = new QLabel(QObject::tr("<b>Description:</b>"));
justLabel->setObjectName("NewPartsEditorLabel");
descriptionLayout->addWidget(justLabel);
QLineEdit * descriptionEdit = new QLineEdit();
QDomElement description = connector.firstChildElement("description");
descriptionEdit->setText(description.text());
QObject::connect(descriptionEdit, SIGNAL(editingFinished()), slotHolder, SLOT(descriptionEntry()));
descriptionEdit->setObjectName("NewPartsEditorLineEdit");
descriptionEdit->setStatusTip(QObject::tr("Set the connectors's description"));
descriptionEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
descriptionEdit->setProperty("index", index);
descriptionEdit->setProperty("type", "description");
descriptionLayout->addWidget(descriptionEdit);
descriptionFrame->setLayout(descriptionLayout);
mainLayout->addWidget(descriptionFrame);
QFrame * idFrame = new QFrame();
QHBoxLayout * idLayout = new QHBoxLayout();
justLabel = new QLabel(QObject::tr("<b>id:</b>"));
justLabel->setObjectName("NewPartsEditorLabel");
idLayout->addWidget(justLabel);
justLabel = new QLabel(connector.attribute("id"));
justLabel->setObjectName("NewPartsEditorLabel");
idLayout->addWidget(justLabel);
idLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Expanding));
Connector::ConnectorType ctype = Connector::connectorTypeFromName(connector.attribute("type"));
justLabel = new QLabel(QObject::tr("<b>type:</b>"));
justLabel->setObjectName("NewPartsEditorLabel");
idLayout->addWidget(justLabel);
QRadioButton * radioButton = new QRadioButton(MaleSymbolString);
QObject::connect(radioButton, SIGNAL(clicked()), slotHolder, SLOT(typeEntry()));
radioButton->setObjectName("NewPartsEditorRadio");
if (ctype == Connector::Male) radioButton->setChecked(true);
radioButton->setProperty("value", Connector::Male);
radioButton->setProperty("index", index);
radioButton->setProperty("type", "radio");
idLayout->addWidget(radioButton);
radioButton = new QRadioButton(FemaleSymbolString);
QObject::connect(radioButton, SIGNAL(clicked()), slotHolder, SLOT(typeEntry()));
radioButton->setObjectName("NewPartsEditorRadio");
if (ctype == Connector::Female) radioButton->setChecked(true);
radioButton->setProperty("value", Connector::Female);
radioButton->setProperty("index", index);
radioButton->setProperty("type", "radio");
//.........这里部分代码省略.........
示例7: QWidget
AirportsWidget::AirportsWidget(MainObject *mOb, QWidget *parent) :
QWidget(parent)
{
mainObject = mOb;
//* Main Layout
QGridLayout *mainLayout = new QGridLayout();
setLayout(mainLayout);
mainLayout->setSpacing(10);
int m = 10;
mainLayout->setContentsMargins(m,m,m,m);
//=====================================
//** Top Startup Option Buttons
QHBoxLayout *layoutTop = new QHBoxLayout();
mainLayout->addLayout(layoutTop,0,0,1,2);
buttonGroupUse = new QButtonGroup(this);
buttonGroupUse->setExclusive(true);
connect(buttonGroupUse, SIGNAL(buttonClicked(int)), this, SLOT(on_buttonGroupUse()));
QRadioButton *radioButtonUseDefault = new QRadioButton(tr("Default (KSFO)"));
radioButtonUseDefault->setChecked(true);
layoutTop->addWidget(radioButtonUseDefault);
buttonGroupUse->addButton(radioButtonUseDefault, USE_DEFAULT);
QRadioButton *radioButtonUseAirport = new QRadioButton(tr("Start at Airport"));
layoutTop->addWidget(radioButtonUseAirport);
buttonGroupUse->addButton(radioButtonUseAirport, USE_AIRPORT);
QRadioButton *radioButtonUseCoordinates = new QRadioButton(tr("Start at Coordinates"));
layoutTop->addWidget(radioButtonUseCoordinates);
buttonGroupUse->addButton(radioButtonUseCoordinates, USE_COORDINATES);
layoutTop->addStretch(10);
//=================================================================================
//* Airport Details
groupBoxAirport = new QGroupBox(this);
groupBoxAirport->setTitle("Airport Details");
mainLayout->addWidget(groupBoxAirport, 1, 0);
QVBoxLayout *airportsContainerLayout = new QVBoxLayout();
groupBoxAirport->setLayout(airportsContainerLayout);
airportsContainerLayout->setContentsMargins(10,10,10,10);
airportsContainerLayout->setSpacing(0);
//==================================================================
//** Airports Filter and Actions Top Bar
QHBoxLayout *layoutAptTopBar = new QHBoxLayout();
layoutAptTopBar->setContentsMargins(0,0,0,0);
layoutAptTopBar->setSpacing(10);
airportsContainerLayout->addLayout(layoutAptTopBar);
//** Filter Code
layoutAptTopBar->addWidget(new QLabel(tr("Filter").append(":")));
//** Filter Buttons - TODO
buttonGroupFilter = new QButtonGroup(this);
buttonGroupFilter->setExclusive(true);
//** Aiport Code Filter
QRadioButton *buttCode = new QRadioButton();
buttCode->setText("Code");
buttCode->setProperty("filter_column_idx", QVariant(CA_CODE));
buttCode->setChecked(true);
layoutAptTopBar->addWidget(buttCode);
buttonGroupFilter->addButton(buttCode, 0);
//** Airport Name Filter
QRadioButton *buttName = new QRadioButton();
buttName->setText("Name");
buttName->setProperty("filter_column_idx", QVariant(CA_NAME));
layoutAptTopBar->addWidget(buttName);
buttonGroupFilter->addButton(buttName, 1);
//** Find Airport Text
txtAirportsFilter = new QLineEdit();
layoutAptTopBar->addWidget(txtAirportsFilter);
txtAirportsFilter->setFixedWidth(100);
connect( txtAirportsFilter, SIGNAL(textChanged(QString)),
this, SLOT(on_update_airports_filter())
);
layoutAptTopBar->addStretch(20);
/* DEAD for now
QPushButton *buttonImportAirports = new QPushButton(this);
layoutAptTopBar->addWidget(buttonImportAirports);
buttonImportAirports->setText("Reload");
buttonImportAirports->setToolTip("Scan directories and reload cache");
buttonImportAirports->setIcon(QIcon(":/icon/import"));
buttonImportAirports->setFlat(true);
connect(buttonImportAirports, SIGNAL(clicked()), this, SLOT(on_import_aptdat_clicked()) );
*/
//.........这里部分代码省略.........
示例8: QWidget
TimeWeatherWidget::TimeWeatherWidget(MainObject *mOb, QWidget *parent) :
QWidget(parent)
{
mainObject = mOb;
QHBoxLayout *mainLayout = new QHBoxLayout();
setLayout(mainLayout);
//===============================================================
// Left Column with Time / Season
//===============================================================
QVBoxLayout *layTimeSeason = new QVBoxLayout();
mainLayout->addLayout(layTimeSeason, 1);
//===============================================================
// Time group
QStringList time_vals; //= are the values
time_vals << "real" << "dawn" << "morning" << "noon" << "afternoon" << "dusk" << "evening" << "midnight";
QStringList time_labels; //= are the labels
time_labels << tr("Real time") << tr("Dawn") << tr("Morning") << tr("Noon") << tr("Afternoon") << tr("Dusk") << tr("Evening") << tr("Midnight");
XGroupVBox *grpBoxTime = new XGroupVBox(tr("Time"));
layTimeSeason->addWidget(grpBoxTime);
buttonGroupTime = new QButtonGroup(this);
buttonGroupTime->setExclusive(true);
connect(buttonGroupTime, SIGNAL(buttonClicked(int)),
this, SLOT(on_time_clicked())
);
for(int i=0; i < time_vals.size(); i++){
QRadioButton *butt = new QRadioButton();
butt->setText(time_labels.at(i));
butt->setProperty("value", QVariant(time_vals.at(i)));
grpBoxTime->addWidget(butt);
buttonGroupTime->addButton(butt, i);
}
buttonGroupTime->button(0)->setChecked(true);
//===============================================================
// Season group
QStringList season_vals; //= values
season_vals << "winter" << "summer";
QStringList season_labels; // = labels
season_labels << tr("Winter") << tr("Summer");
XGroupVBox *grpBoxSeason = new XGroupVBox(tr("Season"));
layTimeSeason->addWidget(grpBoxSeason);
buttonGroupSeason = new QButtonGroup(this);
buttonGroupSeason->setExclusive(true);
connect(buttonGroupSeason, SIGNAL(buttonClicked(int)),
this, SLOT(on_season_clicked(int))
);
for(int i=0; i < season_vals.size(); i++){
QRadioButton *buttS = new QRadioButton();
buttS->setText(season_labels.at(i));
buttS->setProperty("value", QVariant(season_vals.at(i).toLower()));
grpBoxSeason->addWidget(buttS);
buttonGroupSeason->addButton(buttS, i);
}
buttonGroupSeason->button(0)->setChecked(true);
//= Add some stretch to column bottom
layTimeSeason->addStretch(100);
//= Add A Spacer in Middle Column
mainLayout->addStretch(1);
//===============================================================
// Right Column with Metar
//===============================================================
QVBoxLayout *laymetar = new QVBoxLayout();
mainLayout->addLayout(laymetar, 2);
//===============================================================
// Metar group
QStringList metar_vals; //= values
metar_vals << "none" << "live" << "custom";
QStringList metar_labels; //= labels
metar_labels << tr("None (default weather)") << tr("Fetch METAR data live") << tr("Set static METAR below");
XGroupVBox *grpBoxMetar = new XGroupVBox(tr("METAR"));
laymetar->setAlignment(Qt::AlignTop);
laymetar->addWidget(grpBoxMetar);
buttonGroupMetar = new QButtonGroup(this);
buttonGroupMetar->setExclusive(true);
connect(buttonGroupMetar, SIGNAL(buttonClicked(int)), this, SLOT(on_weather()));
for(int i=0; i < metar_vals.size(); i++){
QRadioButton *buttM = new QRadioButton();
buttM->setText(metar_labels.at(i));
buttM->setProperty("value", QVariant(metar_vals.at(i)));
grpBoxMetar->addWidget(buttM);
buttonGroupMetar->addButton(buttM, i);
}
//.........这里部分代码省略.........
示例9: size
EmoticonsWidget::EmoticonsWidget(QWidget *parent) :
QMenu(parent)
{
setStyleSheet(Style::getStylesheet(":/ui/emoticonWidget/emoticonWidget.css"));
setLayout(&layout);
layout.addWidget(&stack);
QWidget* pageButtonsContainer = new QWidget;
QHBoxLayout* buttonLayout = new QHBoxLayout;
pageButtonsContainer->setLayout(buttonLayout);
layout.addWidget(pageButtonsContainer);
const int maxCols = 8;
const int maxRows = 8;
const int itemsPerPage = maxRows * maxCols;
const QList<QStringList>& emoticons = SmileyPack::getInstance().getEmoticons();
int itemCount = emoticons.size();
int pageCount = ceil(float(itemCount) / float(itemsPerPage));
int currPage = 0;
int currItem = 0;
int row = 0;
int col = 0;
// respect configured emoticon size
const int px = Settings::getInstance().getEmojiFontPointSize();
const QSize size(px, px);
// create pages
buttonLayout->addStretch();
for (int i = 0; i < pageCount; i++)
{
QGridLayout* pageLayout = new QGridLayout;
pageLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), maxRows, 0);
pageLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, maxCols);
QWidget* page = new QWidget;
page->setLayout(pageLayout);
stack.addWidget(page);
// page buttons are only needed if there is more than 1 page
if (pageCount > 1)
{
QRadioButton* pageButton = new QRadioButton;
pageButton->setProperty("pageIndex", i);
pageButton->setCursor(Qt::PointingHandCursor);
pageButton->setChecked(i == 0);
buttonLayout->addWidget(pageButton);
connect(pageButton, &QRadioButton::clicked, this, &EmoticonsWidget::onPageButtonClicked);
}
}
buttonLayout->addStretch();
for (const QStringList& set : emoticons)
{
QPushButton* button = new QPushButton;
button->setIcon(SmileyPack::getInstance().getAsIcon(set[0]).pixmap(size));
button->setToolTip(set.join(" "));
button->setProperty("sequence", set[0]);
button->setCursor(Qt::PointingHandCursor);
button->setFlat(true);
button->setIconSize(size);
button->setFixedSize(size);
connect(button, &QPushButton::clicked, this, &EmoticonsWidget::onSmileyClicked);
qobject_cast<QGridLayout*>(stack.widget(currPage)->layout())->addWidget(button, row, col);
col++;
currItem++;
// next row
if (col >= maxCols)
{
col = 0;
row++;
}
// next page
if (currItem >= itemsPerPage)
{
row = 0;
currItem = 0;
currPage++;
}
}
// calculates sizeHint
layout.activate();
}