本文整理汇总了C++中QAbstractButton::text方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractButton::text方法的具体用法?C++ QAbstractButton::text怎么用?C++ QAbstractButton::text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractButton
的用法示例。
在下文中一共展示了QAbstractButton::text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: objectName
static void
InitializeDataNodeFromQButtonGroup(QButtonGroup *co, DataNode *node)
{
std::string objectName(co->objectName().toStdString());
DataNode *currentNode = node->GetNode(objectName);
QAbstractButton *sb = co->checkedButton();
if(currentNode != 0)
{
// Use int or string, depending on what the node was initially.
NodeTypeEnum t = currentNode->GetNodeType();
node->RemoveNode(objectName);
if(t == STRING_NODE)
{
if(sb != 0)
node->AddNode(new DataNode(objectName, sb->text().toStdString()));
else
node->AddNode(new DataNode(objectName, int(0)));
}
else
{
int index = sb ? co->id(sb) : 0;
node->AddNode(new DataNode(objectName, index));
}
}
else
{
// There's no preference on which type to use so use int
int index = sb ? co->id(sb) : 0;
node->AddNode(new DataNode(objectName, index));
}
}
示例2: GetString
wxString wxRadioBox::GetString(unsigned int n) const
{
QAbstractButton *qtButton = GetButtonAt( m_qtButtonGroup, n );
CHECK_BUTTON( qtButton, wxEmptyString );
return wxQtConvertString( qtButton->text() );
}
示例3: saveSelectedRadioButtonOrCheckBox
void MultiDataInputInstance::saveSelectedRadioButtonOrCheckBox()
{
QAbstractButton *checkedButton = mButtonGroup->checkedButton();
if(checkedButton)
setVariable(mVariable, checkedButton->text());
else
setVariable(mVariable, scriptEngine()->nullValue());
}
示例4: getTime
int Preferences::getTime()
{
if (!grTime->isChecked())
return -1;
QAbstractButton* button = groupTime->checkedButton();
return button->text().toInt();
}
示例5: changedTime
void Preferences::changedTime()
{
if ( grTime->isChecked())
{
QAbstractButton* button = groupTime->checkedButton();
magic_->setTime( button->text().toInt() );
}
else
magic_->setTime(-1);
}
示例6: colorStr
QString ColorFormatDlg::colorStr() const {
QAbstractButton* checkedBtn = _ui.buttonGroup->checkedButton();
if ( checkedBtn != 0 ) {
int id = _ui.buttonGroup->checkedId();
PluginSettings::set( _plugin, "format", id );
return checkedBtn->text();
}
else {
return "";
}
}
示例7: onNumberButtonClicked
void NumberWidget::onNumberButtonClicked(bool checked)
{
// Downcast. Any other good idea?
QAbstractButton * btn = static_cast<QAbstractButton *>(sender());
bool ok = false;
int number = btn->text().toInt(&ok);
// Handle overflow.
if (ok)
{
emit numberClicked( number );
}
}
示例8: it
QAbstractButton * Tab::get_profile_button(QString profile_name){
QAbstractButton * get_profile = NULL;
QList<QAbstractButton *> buttons_list = group->buttons();
QListIterator<QAbstractButton *> it(buttons_list);
while(it.hasNext() && get_profile == NULL){
QAbstractButton * button = it.next();
if(button->text() == profile_name){
get_profile = button;
}
}
return get_profile;
}
示例9: drv_basebutton
int drv_basebutton(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
handle_head* head = (handle_head*)a0;
QAbstractButton *self = (QAbstractButton*)head->native;
switch (drvid) {
case BASEBUTTON_SETTEXT: {
self->setText(drvGetString(a1));
break;
}
case BASEBUTTON_TEXT: {
drvSetString(a1,self->text());
break;
}
default:
return 0;
}
return 1;
}
示例10: showMessageBox
int GwtCallback::showMessageBox(int type,
QString caption,
QString message,
QString buttons,
int defaultButton,
int cancelButton)
{
// cancel other message box if it's visible
QMessageBox* pMsgBox = qobject_cast<QMessageBox*>(
QApplication::activeModalWidget());
if (pMsgBox != NULL)
pMsgBox->close();
QMessageBox msgBox(safeMessageBoxIcon(static_cast<QMessageBox::Icon>(type)),
caption,
message,
QMessageBox::NoButton,
pOwner_->asWidget(),
Qt::Dialog | Qt::Sheet);
msgBox.setWindowModality(Qt::WindowModal);
msgBox.setTextFormat(Qt::PlainText);
QStringList buttonList = buttons.split(QChar::fromLatin1('|'));
for (int i = 0; i != buttonList.size(); i++)
{
QPushButton* pBtn = msgBox.addButton(buttonList.at(i),
captionToRole(buttonList.at(i)));
if (defaultButton == i)
msgBox.setDefaultButton(pBtn);
}
msgBox.exec();
QAbstractButton* button = msgBox.clickedButton();
if (!button)
return cancelButton;
for (int i = 0; i < buttonList.size(); i++)
if (buttonList.at(i) == button->text())
return i;
return cancelButton;
}
示例11: remove_profile_from_button_group
bool Tab::remove_profile_from_button_group(QString * profile_name){
bool remove_profile_from_button_group = false;
QList<QAbstractButton *> buttons_list = group->buttons();
QListIterator<QAbstractButton *> it(buttons_list);
while(it.hasNext() && remove_profile_from_button_group != true){
QAbstractButton * button = it.next();
if(button->text() == profile_name){
v_layout->removeWidget(button);
group->removeButton(button);
button->~QAbstractButton();
remove_profile_from_button_group =true;
}
}
return remove_profile_from_button_group;
}
示例12: showMessageBox
int GwtCallback::showMessageBox(int type,
QString caption,
QString message,
QString buttons,
int defaultButton,
int cancelButton)
{
QMessageBox msgBox(safeMessageBoxIcon(static_cast<QMessageBox::Icon>(type)),
caption,
message,
QMessageBox::NoButton,
pOwnerWindow_,
Qt::Dialog | Qt::Sheet);
msgBox.setWindowModality(Qt::WindowModal);
msgBox.setTextFormat(Qt::PlainText);
QStringList buttonList = buttons.split(QChar::fromAscii('|'));
for (int i = 0; i != buttonList.size(); i++)
{
QPushButton* pBtn = msgBox.addButton(buttonList.at(i),
captionToRole(buttonList.at(i)));
if (defaultButton == i)
msgBox.setDefaultButton(pBtn);
}
msgBox.exec();
QAbstractButton* button = msgBox.clickedButton();
if (!button)
return cancelButton;
for (int i = 0; i < buttonList.size(); i++)
if (buttonList.at(i) == button->text())
return i;
return cancelButton;
}
示例13: testDontShowAgainCustomText
// ----------------------------------------------------------------------------
void ctkMessageBoxDontShowAgainTester::testDontShowAgainCustomText()
{
ctkMessageBox messageBox;
messageBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
QAbstractButton *okButton = messageBox.button(QMessageBox::Ok);
okButton->setText("SaveData");
QAbstractButton *cancelButton = messageBox.button(QMessageBox::Cancel);
cancelButton->setText("Discard Data");
QFETCH(bool, visible);
messageBox.setDontShowAgainVisible(visible);
QFETCH(bool, dontShowAgain);
messageBox.setDontShowAgain(dontShowAgain);
this->testExecMessageBox(messageBox);
// check that the don't show again text has been updated
QCheckBox *checkBox = messageBox.findChild<QCheckBox*>("ctk_msgbox_dontshowcheckbox");
QString dontShowAgainText = checkBox->text();
if (visible)
{
// the custom text was set from the Ok box as it has the accept role
QString expectedString = QString("Don't show this message again and always ")
+ okButton->text();
QCOMPARE(dontShowAgainText, expectedString);
}
else
{
// the custom text was not added to the end of the standard message
QString expectedString = QString("Don't show this message again");
QCOMPARE(dontShowAgainText, expectedString);
}
}
示例14: setSelectedStates
void ClsQNeuronStateVariableDisplay::setSelectedStates(list<string> lstStates) {
#ifdef DEBUG_CLSQSTATEVARIABLEDISPLAY
cout << "ClsQNeuronStateVariableDisplay::setSelectedStates(list<string> lst)" << endl;
#endif
QList<QAbstractButton *> lst = qbtngrpStateVariables->buttons ();
QList<QAbstractButton*>::iterator it;
for (it = lst.begin(); it != lst.end(); ++it) {
string str= (string)((*it)->text().latin1());
if(std::find(lstStates.begin(), lstStates.end(), str) != lstStates.end()){
QAbstractButton *qrb = (*it);
qrb->toggle();
string strSinkID = qrb->text().latin1() + strID;
QColor qc;
qc.setHsv(clsFEDataClient->getDataSinkColor(strSinkID), 255, 210);
QPalette palette = qrb->palette();
palette.setColor ( QColorGroup::Foreground, qc );
// palette.setColor ( QColorGroup::ButtonText, qc );
qrb->setPalette(palette);
}
}
};
示例15: slotStateVariables
void ClsQNeuronStateVariableDisplay::slotStateVariables(int ii){
#ifdef DEBUG_CLSQSTATEVARIABLEDISPLAY
cout << "void ClsQNeuronStateVariableDisplay::slotStateVariables(int ii)" << endl;
#endif
/*
cout << "qbtngrpStateVariables->exclusive ( ): " << qbtngrpStateVariables->exclusive ( ) << endl;
cout << "iCurrentStateButton: " << iCurrentStateButton << endl;
cout << "ii: " << ii << endl;
*/
QAbstractButton *btn = qbtngrpStateVariables->button ( ii );
if(btn==NULL){
return;
}
if(qchkbxLiveData->isOn() && ii != iCurrentStateButton){
if(btn->isChecked()){
//cout << "send request: " << btn->text().latin1() << endl;
/* send request */
string strSinkID = btn->text().latin1() + strID;
clsFEDataClient->addDataSink(strSinkID, clsFEGroup, btn->text().latin1(), strSelectedIndices);
QColor qc;
qc.setHsv(clsFEDataClient->getDataSinkColor(strSinkID), 255, 210);
QPalette palette = (btn)->palette();
palette.setColor ( QColorGroup::Foreground, qc );
(btn)->setPalette(palette);
if(bAverage){
clsFEDataClient->setSinkMath(strSinkID, ClsFEDataSink::MATH_AVERAGE);
}
if(qbtngrpStateVariables->exclusive( ) && iCurrentStateButton >= 0){
/* cancel rewquest of the last active checkbox (iCurrentStateButton) */
QAbstractButton *btnCurrent = qbtngrpStateVariables->button (iCurrentStateButton);
if(btnCurrent!=NULL){
// cout << "cancel request: " << btnCurrent->text().latin1() << endl;
string strSinkID = btnCurrent->text().latin1() + strID;
clsFEDataClient->removeDataSink(strSinkID);
QColor qc;
qc.setRgb(0,0,0);
QPalette palette = btnCurrent->palette();
palette.setColor ( QColorGroup::Foreground, qc );
btnCurrent->setPalette(palette);
}
}
} else {
/* cancel request */
// cout << "cancel request: " << btn->text().latin1() << endl;
string strSinkID = btn->text().latin1() + strID;
clsFEDataClient->removeDataSink(strSinkID);
QColor qc;
qc.setRgb(0,0,0);
QPalette palette = (btn)->palette();
palette.setColor ( QColorGroup::Foreground, qc );
(btn)->setPalette(palette);
}
}
if(qbtngrpStateVariables->exclusive ( )){
iCurrentStateButton = ii;
}
};