本文整理汇总了C++中QRadioButton::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ QRadioButton::setName方法的具体用法?C++ QRadioButton::setName怎么用?C++ QRadioButton::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRadioButton
的用法示例。
在下文中一共展示了QRadioButton::setName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupIncomingPage
void kiptablesgenerator::setupIncomingPage()
{
incomingPage = new QFrame(this);
QGridLayout *layout = new QGridLayout(incomingPage, 2, 2);
QLabel *intro = new QLabel(i18n(
"<p>Do you want to filter incoming data? (recommended)</p>"
"<p>This will allow you to control other computers access to "
"your computer.</p>"), incomingPage);
intro->show();
layout->addMultiCellWidget(intro, 0, 0, 0, 1);
QButtonGroup *optYesNo = new QButtonGroup(incomingPage);
namedWidgets["incomingYesNo"] = optYesNo;
optYesNo->hide();
QRadioButton *optYes = new QRadioButton(i18n("&Yes"), incomingPage);
optYes->setChecked(true);
optYes->setName("yes");
optYes->show();
layout->addWidget(optYes, 1, 0);
optYesNo->insert(optYes);
QRadioButton *optNo = new QRadioButton(i18n("N&o"), incomingPage);
optNo->setName("no");
optNo->show();
layout->addWidget(optNo, 1, 1);
optYesNo->insert(optNo);
incomingPage->show();
this->addPage(incomingPage, i18n("Incoming Data"));
}
示例2: setupNewServiceDialog
void kiptablesgenerator::setupNewServiceDialog()
{
newServiceDialog = new KDialogBase(this, 0, true, i18n("Add Service"), KDialogBase::Ok | KDialogBase::Cancel);
QFrame *dialogArea = new QFrame(newServiceDialog);
QGridLayout *layout = new QGridLayout(dialogArea, 7, 2);
QLabel *intro = new QLabel(i18n(
"<p><i>Advanced users only</i></p>"
"<p>Here you can allow or deny access to services through your firewall.<br />"
"You can specify a port range in the box using this format: <tt>fromPort:toPort</tt></p>"), dialogArea);
intro->show();
layout->addMultiCellWidget(intro, 0, 0, 0, 1);
QLabel *protocolLabel = new QLabel(i18n("&Protocol: "), dialogArea);
protocolLabel->show();
layout->addWidget(protocolLabel, 1, 0);
KComboBox *protocols = new KComboBox(dialogArea);
protocols->insertItem(i18n("TCP"));
protocols->insertItem(i18n("UDP"));
protocols->insertItem(i18n("TCP & UDP"));
protocols->insertItem(i18n("ICMP"));
protocols->setCurrentItem(2);
protocols->show();
layout->addWidget(protocols, 1, 1);
protocolLabel->setBuddy(protocols);
namedWidgets["newService_protocols"] = protocols;
connect(protocols, SIGNAL(activated(int )), this, SLOT(slotChangedProtocol(int )));
QLabel *selectByLabel = new QLabel(i18n("Select service by: "), dialogArea);
selectByLabel->show();
layout->addMultiCellWidget(selectByLabel, 2, 2, 0, 1);
QButtonGroup *optNamedOrNumbered = new QButtonGroup(dialogArea);
optNamedOrNumbered->hide();
namedWidgets["newService_namedOrNumbered"] = optNamedOrNumbered;
QRadioButton *optNamed = new QRadioButton(i18n("&Name: "), dialogArea);
optNamed->setChecked(true);
optNamed->setName("named");
optNamedOrNumbered->insert(optNamed);
optNamed->show();
layout->addWidget(optNamed, 3, 0);
namedWidgets["newService_named"] = optNamed;
KComboBox *names = new KComboBox(dialogArea);
names->show();
layout->addWidget(names, 3, 1);
namedWidgets["newService_names"] = names;
QRadioButton *optNumbered = new QRadioButton(i18n("&Port number(s): "), dialogArea);
optNumbered->setName("numbered");
optNamedOrNumbered->insert(optNumbered);
optNumbered->show();
layout->addWidget(optNumbered, 4, 0);
namedWidgets["newService_numbered"] = optNumbered;
KLineEdit *ports = new KLineEdit(dialogArea);
ports->show();
layout->addWidget(ports, 4, 1);
namedWidgets["newService_ports"] = ports;
QButtonGroup *optAllowDeny = new QButtonGroup(dialogArea);
optAllowDeny->hide();
namedWidgets["newService_allowDeny"] = optAllowDeny;
KSeparator *separator = new KSeparator(dialogArea);
separator->show();
layout->addMultiCellWidget(separator, 5, 5, 0, 1);
QRadioButton *optAllow = new QRadioButton(i18n("&Accept"), dialogArea);
optAllow->setName(i18n("Accept"));
optAllow->setChecked(true);
optAllow->show();
optAllowDeny->insert(optAllow);
layout->addWidget(optAllow, 6, 0);
QRadioButton *optDeny = new QRadioButton(i18n("&Drop"), dialogArea);
optDeny->setName(i18n("Drop"));
optDeny->show();
optAllowDeny->insert(optDeny);
layout->addWidget(optDeny, 6, 1);
dialogArea->show();
newServiceDialog->setMainWidget(dialogArea);
connect(newServiceDialog, SIGNAL(okClicked()), this, SLOT(slotAddService()));
slotChangedProtocol(2); // TCP+UDP
}