本文整理汇总了C++中QAbstractButton::setText方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractButton::setText方法的具体用法?C++ QAbstractButton::setText怎么用?C++ QAbstractButton::setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractButton
的用法示例。
在下文中一共展示了QAbstractButton::setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateRefButton
void TaskDatumParameters::updateRefButton(int idx)
{
QAbstractButton* b;
switch(idx){
case 0: b = ui->buttonRef1; break;
case 1: b = ui->buttonRef2; break;
case 2: b = ui->buttonRef3; break;
case 3: b = ui->buttonRef4; break;
default: throw Base::Exception("button index out of range");
}
Part::Datum* pcDatum = static_cast<Part::Datum*>(DatumView->getObject());
std::vector<App::DocumentObject*> refs = pcDatum->Support.getValues();
int numrefs = refs.size();
bool enable = true;
if (idx > numrefs)
enable = false;
if (idx == numrefs && this->lastSuggestResult.nextRefTypeHint.size() == 0)
enable = false;
b->setEnabled(enable);
b->setChecked(iActiveRef == idx);
if (iActiveRef == idx) {
b->setText(tr("Selecting..."));
} else if (idx < static_cast<int>(this->lastSuggestResult.references_Types.size())){
b->setText(AttacherGui::getShapeTypeText(this->lastSuggestResult.references_Types[idx]));
} else {
b->setText(tr("Reference%1").arg(idx+1));
}
}
示例2: QDialog
XMLInfoDialog::XMLInfoDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::XMLInfoDialog)
{
ui->setupUi(this);
setWindowTitle(tr("选择订阅"));
setMinimumWidth(400);
setMinimumHeight(450);
setMaximumWidth(400);
setMaximumHeight(450);
QAbstractButton *okBtn = ui->buttonBox->button(QDialogButtonBox::Ok);
QAbstractButton *cancelBtn = ui->buttonBox->button(QDialogButtonBox::Cancel);
okBtn->setText(tr("确定"));
cancelBtn->setText(tr("取消"));
connect(cancelBtn, SIGNAL(clicked(bool)), this, SLOT(close()));
connect(okBtn, SIGNAL(clicked(bool)), this, SLOT(subscriptionSelectedFinished()));
QHeaderView *header = new QHeaderView(Qt::Horizontal, ui->treeWidget);
header->setSectionResizeMode(QHeaderView::Stretch);
header->setDefaultAlignment(Qt::AlignCenter);
ui->treeWidget->setHeader(header);
connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(treeItemChanged(QTreeWidgetItem*,int)));
}
示例3: SetString
void wxRadioBox::SetString(unsigned int n, const wxString& s)
{
QAbstractButton *qtButton = GetButtonAt( m_qtButtonGroup, n );
wxCHECK_RET( qtButton != NULL, INVALID_INDEX_MESSAGE );
qtButton->setText( wxQtConvertString( s ));
}
示例4: testButtonClicked
void EmailAccountWizardOutgoingServerPage::testButtonClicked(int which)
{
Q_D(EmailAccountWizardOutgoingServerPage);
Q_ASSERT(which == QWizard::CustomButton1);
if (which != QWizard::CustomButton1)
return;
EmailAccountWizard* w = static_cast<EmailAccountWizard*>(wizard());
Q_ASSERT(w);
if (!w)
return;
if (w->currentId() != EmailAccountWizard::PageEmailOutgoingServer)
return;
QAbstractButton* testButton = w->button(QWizard::CustomButton1);
Q_ASSERT(testButton);
if (!testButton)
return;
w->updateTestButton(EmailAccountWizard::TestButtonRed);
testButton->setText(tr("Testing..."));
d->changedDuringTest = false;
QFuture<bool> future = QtConcurrent::run(this,
&EmailAccountWizardOutgoingServerPage::test);
ForgettableWatcher<bool>* futureWatcher = new ForgettableWatcher<bool>();
connect(futureWatcher, SIGNAL(finished()), this, SLOT(testFinished()));
futureWatcher->setFuture(future);
}
示例5: switch
QAbstractButton*
FirstRunWizard::setButton( Button button, const QString& text )
{
QAbstractButton* returnButton;
switch ( button )
{
case CustomButton:
returnButton = ui->custom;
break;
case BackButton:
returnButton = ui->back;
break;
case SkipButton:
returnButton = ui->skip;
break;
case NextButton:
returnButton = ui->next;
break;
case FinishButton:
returnButton = ui->finish;
break;
}
returnButton->setText( text );
returnButton->show();
return returnButton;
}
示例6: whoWin
void Game_main::whoWin()//直接判断white_win,black_win弹出窗口
{
if(white_win)
{
QDialog *Dblack = new QDialog();
QVBoxLayout *vlayout = new QVBoxLayout;
Dblack->setFixedSize(150,140);
QLabel *label = new QLabel("白棋胜利!");
QAbstractButton *bExit = new QPushButton("再来一局");
bExit->setText("再来一局");
vlayout->addWidget(label);
vlayout->addWidget(bExit);
Dblack->setLayout(vlayout);
Dblack->show();
Dblack->connect(bExit,SIGNAL(clicked()),Dblack,SLOT(close()));
Dblack->connect(bExit,SIGNAL(clicked()),this,SLOT(start()));
is_over = true;
}
if(black_win)
{
QDialog *Dblack = new QDialog();
QVBoxLayout *vlayout = new QVBoxLayout;
Dblack->setFixedSize(150,140);
QLabel *label = new QLabel("黑棋胜利!");
QAbstractButton *bExit = new QPushButton("再来一局");
bExit->setText("再来一局");
vlayout->addWidget(label);
vlayout->addWidget(bExit);
Dblack->setLayout(vlayout);
Dblack->show();
Dblack->connect(bExit,SIGNAL(clicked()),Dblack,SLOT(close()));
Dblack->connect(bExit,SIGNAL(clicked()),this,SLOT(start()));
is_over =true;
}
}
示例7: setButtonPageNumbers
void PageNavigator::setButtonPageNumbers(int lowestPageNum)
{
OS_ASSERT(lowestPageNum > 0 && lowestPageNum <= m_numPages);
QString num;
for(int i = 0; i < m_numPagesListed; ++i) {
QAbstractButton * button = m_buttonGroup->button(i);
button->setText(num.setNum(lowestPageNum + i));
if(i == m_numPages) break;
}
}
示例8: newButton
QAbstractButton* newButton( const QString& text, QWidget* parent = 0 )
{
QAbstractButton* pushButton = new QPushButton( parent );
pushButton->setText( text );
pushButton->setCheckable( true );
pushButton->setAutoExclusive( true );
pushButton->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
pushButton->setAttribute( Qt::WA_LayoutUsesWidgetRect );
pushButton->setAttribute( Qt::WA_MacNoClickThrough );
return pushButton;
}
示例9: SetLabel
logical OToolBox :: SetLabel (int32 indx0, QString qsText )
{
logical term = NO;
QAbstractButton *button = NULL;
BEGINSEQ
if(!(button=GetButton(indx0))) ERROR
button->setText(qsText);
RECOVER
term = YES;
ENDSEQ
return(term);
}
示例10: 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);
}
}
示例11: setTitle
void UIWizardNewVDPageBasic1::retranslateUi()
{
/* Translate page: */
setTitle(UIWizardNewVD::tr("Hard drive file type"));
/* Translate widgets: */
m_pLabel->setText(UIWizardNewVD::tr("Please choose the type of file that you would like to use "
"for the new virtual hard drive. If you do not need to use it "
"with other virtualization software you can leave this setting unchanged."));
QList<QAbstractButton*> buttons = m_pFormatButtonGroup->buttons();
for (int i = 0; i < buttons.size(); ++i)
{
QAbstractButton *pButton = buttons[i];
pButton->setText(VBoxGlobal::fullMediumFormatName(m_formatNames[m_pFormatButtonGroup->id(pButton)]));
}
}
示例12: View
CSVSettings::BooleanView::BooleanView (CSMSettings::Setting *setting,
Page *parent)
: View (setting, parent), mType(setting->type())
{
foreach (const QString &value, setting->declaredValues())
{
QAbstractButton *button = 0;
switch (mType)
{
case CSMSettings::Type_CheckBox: {
if(mButtons.empty()) // show only one for checkboxes
{
button = new QCheckBox (value, this);
button->setChecked (setting->defaultValues().at(0) == "true" ? true : false);
// special visual treatment option for checkboxes
if(setting->specialValueText() != "") {
Frame::setTitle("");
button->setText(setting->specialValueText());
}
}
}
break;
case CSMSettings::Type_RadioButton:
button = new QRadioButton (value, this);
break;
default:
break;
}
if(button && (mType != CSMSettings::Type_CheckBox || mButtons.empty()))
{
connect (button, SIGNAL (clicked (bool)),
this, SLOT (slotToggled (bool)));
button->setObjectName (value);
addWidget (button);
mButtons[value] = button;
}
}
示例13: 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;
}
示例14: retranslateUi
void UIWizardCloneVDPageExpert::retranslateUi()
{
/* Translate widgets: */
m_pDestinationCnt->setTitle(UIWizardCloneVD::tr("&New disk image to create"));
m_pDestinationDiskOpenButton->setToolTip(UIWizardCloneVD::tr("Choose a location for new virtual disk image file..."));
m_pFormatCnt->setTitle(UIWizardCloneVD::tr("Disk image file &type"));
QList<QAbstractButton*> buttons = m_pFormatButtonGroup->buttons();
for (int i = 0; i < buttons.size(); ++i)
{
QAbstractButton *pButton = buttons[i];
UIMediumFormat enmFormat = gpConverter->fromInternalString<UIMediumFormat>(m_formatNames[m_pFormatButtonGroup->id(pButton)]);
pButton->setText(gpConverter->toString(enmFormat));
}
m_pVariantCnt->setTitle(UIWizardCloneVD::tr("Storage on physical hard disk"));
m_pDynamicalButton->setText(UIWizardCloneVD::tr("&Dynamically allocated"));
m_pFixedButton->setText(UIWizardCloneVD::tr("&Fixed size"));
m_pSplitBox->setText(UIWizardCloneVD::tr("&Split into files of less than 2GB"));
}
示例15: retranslateUi
void UIWizardNewVDPageExpert::retranslateUi()
{
/* Translate widgets: */
m_pLocationCnt->setTitle(UIWizardNewVD::tr("File &location"));
m_pLocationOpenButton->setToolTip(UIWizardNewVD::tr("Choose a location for new virtual hard disk file..."));
m_pSizeCnt->setTitle(UIWizardNewVD::tr("File &size"));
m_pFormatCnt->setTitle(UIWizardNewVD::tr("Hard disk file &type"));
QList<QAbstractButton*> buttons = m_pFormatButtonGroup->buttons();
for (int i = 0; i < buttons.size(); ++i)
{
QAbstractButton *pButton = buttons[i];
pButton->setText(VBoxGlobal::fullMediumFormatName(m_formatNames[m_pFormatButtonGroup->id(pButton)]));
}
m_pVariantCnt->setTitle(UIWizardNewVD::tr("Storage on physical hard disk"));
m_pDynamicalButton->setText(UIWizardNewVD::tr("&Dynamically allocated"));
m_pFixedButton->setText(UIWizardNewVD::tr("&Fixed size"));
m_pSplitBox->setText(UIWizardNewVD::tr("&Split into files of less than 2GB"));
}