当前位置: 首页>>代码示例>>C++>>正文


C++ QAbstractButton::text方法代码示例

本文整理汇总了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));
    }
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:33,代码来源:WidgetDataNode.C

示例2: GetString

wxString wxRadioBox::GetString(unsigned int n) const
{
    QAbstractButton *qtButton = GetButtonAt( m_qtButtonGroup, n );
    CHECK_BUTTON( qtButton, wxEmptyString );

    return wxQtConvertString( qtButton->text() );
}
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:7,代码来源:radiobox.cpp

示例3: saveSelectedRadioButtonOrCheckBox

	void MultiDataInputInstance::saveSelectedRadioButtonOrCheckBox()
	{
		QAbstractButton *checkedButton = mButtonGroup->checkedButton();
		if(checkedButton)
            setVariable(mVariable, checkedButton->text());
		else
            setVariable(mVariable, scriptEngine()->nullValue());
	}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例4: getTime

 int Preferences::getTime()
 {
     if (!grTime->isChecked())
          return -1;
     
     QAbstractButton* button = groupTime->checkedButton();
     return button->text().toInt();
 }
开发者ID:sigidagi,项目名称:chimpanse,代码行数:8,代码来源:preferences.cpp

示例5: changedTime

 void Preferences::changedTime()
 {
     if ( grTime->isChecked())
     {
         QAbstractButton* button = groupTime->checkedButton();
         magic_->setTime( button->text().toInt() );
     }
     else
         magic_->setTime(-1);
 }
开发者ID:sigidagi,项目名称:chimpanse,代码行数:10,代码来源:preferences.cpp

示例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 "";
	}
}
开发者ID:PeterJespersen,项目名称:juffed,代码行数:11,代码来源:ColorFormatDlg.cpp

示例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 );
    }
}
开发者ID:qbikez,项目名称:booxsdk,代码行数:13,代码来源:number_widget.cpp

示例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;
}
开发者ID:emoratac,项目名称:devel,代码行数:15,代码来源:tab.cpp

示例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;
}
开发者ID:weigj,项目名称:loongide,代码行数:18,代码来源:cdrv.cpp

示例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;
}
开发者ID:AlanCal,项目名称:rstudio,代码行数:44,代码来源:DesktopGwtCallback.cpp

示例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;
}
开发者ID:emoratac,项目名称:devel,代码行数:19,代码来源:tab.cpp

示例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;
}
开发者ID:,项目名称:,代码行数:38,代码来源:

示例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);
    }
}
开发者ID:151706061,项目名称:CTK,代码行数:38,代码来源:ctkMessageBoxDontShowAgainTest.cpp

示例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);
	}
    }
};
开发者ID:jeez,项目名称:iqr,代码行数:24,代码来源:ClsQNeuronStateVariableDisplay.cpp

示例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;
    }
};
开发者ID:jeez,项目名称:iqr,代码行数:66,代码来源:ClsQNeuronStateVariableDisplay.cpp


注:本文中的QAbstractButton::text方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。