本文整理汇总了C++中setText函数的典型用法代码示例。如果您正苦于以下问题:C++ setText函数的具体用法?C++ setText怎么用?C++ setText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QGroupBox
void PathDeformControls::layoutForDesktop()
{
QGroupBox* mainGroup = new QGroupBox(this);
mainGroup->setTitle(tr("Controls"));
QGroupBox *radiusGroup = new QGroupBox(mainGroup);
radiusGroup->setTitle(tr("Lens Radius"));
QSlider *radiusSlider = new QSlider(Qt::Horizontal, radiusGroup);
radiusSlider->setRange(15, 150);
radiusSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
QGroupBox *deformGroup = new QGroupBox(mainGroup);
deformGroup->setTitle(tr("Deformation"));
QSlider *deformSlider = new QSlider(Qt::Horizontal, deformGroup);
deformSlider->setRange(-100, 100);
deformSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
QGroupBox *fontSizeGroup = new QGroupBox(mainGroup);
fontSizeGroup->setTitle(tr("Font Size"));
QSlider *fontSizeSlider = new QSlider(Qt::Horizontal, fontSizeGroup);
fontSizeSlider->setRange(16, 200);
fontSizeSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
QGroupBox *textGroup = new QGroupBox(mainGroup);
textGroup->setTitle(tr("Text"));
QLineEdit *textInput = new QLineEdit(textGroup);
QPushButton *animateButton = new QPushButton(mainGroup);
animateButton->setText(tr("Animated"));
animateButton->setCheckable(true);
QPushButton *showSourceButton = new QPushButton(mainGroup);
showSourceButton->setText(tr("Show Source"));
#ifdef QT_OPENGL_SUPPORT
QPushButton *enableOpenGLButton = new QPushButton(mainGroup);
enableOpenGLButton->setText(tr("Use OpenGL"));
enableOpenGLButton->setCheckable(true);
enableOpenGLButton->setChecked(m_renderer->usesOpenGL());
if (!QGLFormat::hasOpenGL())
enableOpenGLButton->hide();
#endif
QPushButton *whatsThisButton = new QPushButton(mainGroup);
whatsThisButton->setText(tr("What's This?"));
whatsThisButton->setCheckable(true);
mainGroup->setFixedWidth(180);
QVBoxLayout *mainGroupLayout = new QVBoxLayout(mainGroup);
mainGroupLayout->addWidget(radiusGroup);
mainGroupLayout->addWidget(deformGroup);
mainGroupLayout->addWidget(fontSizeGroup);
mainGroupLayout->addWidget(textGroup);
mainGroupLayout->addWidget(animateButton);
mainGroupLayout->addStretch(1);
#ifdef QT_OPENGL_SUPPORT
mainGroupLayout->addWidget(enableOpenGLButton);
#endif
mainGroupLayout->addWidget(showSourceButton);
mainGroupLayout->addWidget(whatsThisButton);
QVBoxLayout *radiusGroupLayout = new QVBoxLayout(radiusGroup);
radiusGroupLayout->addWidget(radiusSlider);
QVBoxLayout *deformGroupLayout = new QVBoxLayout(deformGroup);
deformGroupLayout->addWidget(deformSlider);
QVBoxLayout *fontSizeGroupLayout = new QVBoxLayout(fontSizeGroup);
fontSizeGroupLayout->addWidget(fontSizeSlider);
QVBoxLayout *textGroupLayout = new QVBoxLayout(textGroup);
textGroupLayout->addWidget(textInput);
QVBoxLayout * mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(mainGroup);
mainLayout->setMargin(0);
connect(radiusSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setRadius(int)));
connect(deformSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setIntensity(int)));
connect(fontSizeSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setFontSize(int)));
connect(animateButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setAnimated(bool)));
#ifdef QT_OPENGL_SUPPORT
connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool)));
#endif
connect(textInput, SIGNAL(textChanged(QString)), m_renderer, SLOT(setText(QString)));
connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)),
whatsThisButton, SLOT(setChecked(bool)));
connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setDescriptionEnabled(bool)));
connect(showSourceButton, SIGNAL(clicked()), m_renderer, SLOT(showSource()));
animateButton->animateClick();
deformSlider->setValue(80);
fontSizeSlider->setValue(120);
radiusSlider->setValue(100);
textInput->setText(tr("Qt"));
}
示例2: WindowModal
RaceDialog::RaceDialog()
: WindowModal("openmw_chargen_race.layout")
, mGenderIndex(0)
, mFaceIndex(0)
, mHairIndex(0)
, mCurrentAngle(0)
, mPreviewDirty(true)
{
// Centre dialog
center();
setText("AppearanceT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu1", "Appearance"));
getWidget(mPreviewImage, "PreviewImage");
getWidget(mHeadRotate, "HeadRotate");
mHeadRotate->setScrollRange(1000);
mHeadRotate->setScrollPosition(500);
mHeadRotate->setScrollViewPage(50);
mHeadRotate->setScrollPage(50);
mHeadRotate->setScrollWheelPage(50);
mHeadRotate->eventScrollChangePosition += MyGUI::newDelegate(this, &RaceDialog::onHeadRotate);
// Set up next/previous buttons
MyGUI::Button *prevButton, *nextButton;
setText("GenderChoiceT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu2", "Change Sex"));
getWidget(prevButton, "PrevGenderButton");
getWidget(nextButton, "NextGenderButton");
prevButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousGender);
nextButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectNextGender);
setText("FaceChoiceT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu3", "Change Face"));
getWidget(prevButton, "PrevFaceButton");
getWidget(nextButton, "NextFaceButton");
prevButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousFace);
nextButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectNextFace);
setText("HairChoiceT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu4", "Change Hair"));
getWidget(prevButton, "PrevHairButton");
getWidget(nextButton, "NextHairButton");
prevButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousHair);
nextButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectNextHair);
setText("RaceT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu5", "Race"));
getWidget(mRaceList, "RaceList");
mRaceList->setScrollVisible(true);
mRaceList->eventListSelectAccept += MyGUI::newDelegate(this, &RaceDialog::onAccept);
mRaceList->eventListChangePosition += MyGUI::newDelegate(this, &RaceDialog::onSelectRace);
setText("SkillsT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sBonusSkillTitle", "Skill Bonus"));
getWidget(mSkillList, "SkillList");
setText("SpellPowerT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu7", "Specials"));
getWidget(mSpellPowerList, "SpellPowerList");
MyGUI::Button* backButton;
getWidget(backButton, "BackButton");
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onBackClicked);
MyGUI::Button* okButton;
getWidget(okButton, "OKButton");
okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", ""));
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onOkClicked);
updateRaces();
updateSkills();
updateSpellPowers();
}
示例3: setText
void SFMLCursesTextBox::append(const std::string& text)
{
setText(m_text.append(text));
}
示例4: setText
void DoubleEditor::setValue(const double &d) { setText(formatValue(d)); }
示例5: switch
void LocationBar::keyPressEvent(QKeyEvent* event)
{
switch (event->key()) {
case Qt::Key_V:
if (event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier)) {
pasteAndGo();
event->accept();
return;
}
break;
case Qt::Key_Down:
m_completer->complete(text());
break;
case Qt::Key_Left:
m_completer->closePopup();
break;
case Qt::Key_Escape:
m_webView->setFocus();
showUrl(m_webView->url());
event->accept();
break;
case Qt::Key_Alt:
m_holdingAlt = true;
break;
case Qt::Key_Return:
case Qt::Key_Enter:
switch (event->modifiers()) {
case Qt::ControlModifier:
if (!text().endsWith(QL1S(".com")))
setText(text().append(QL1S(".com")));
requestLoadUrl();
m_holdingAlt = false;
break;
case Qt::AltModifier:
m_completer->closePopup();
m_window->tabWidget()->addView(createLoadRequest());
m_holdingAlt = false;
break;
default:
requestLoadUrl();
m_holdingAlt = false;
}
break;
case Qt::Key_0:
case Qt::Key_1:
case Qt::Key_2:
case Qt::Key_3:
case Qt::Key_4:
case Qt::Key_5:
case Qt::Key_6:
case Qt::Key_7:
case Qt::Key_8:
case Qt::Key_9:
if (event->modifiers() & Qt::AltModifier || event->modifiers() & Qt::ControlModifier) {
event->ignore();
m_holdingAlt = false;
return;
}
break;
default:
m_holdingAlt = false;
}
LineEdit::keyPressEvent(event);
}
示例6: setText
void ChangeTileTerrain::initText() {
setText(QCoreApplication::translate("Undo Commands",
"Change Tile Terrain"));
}
示例7: setText
void FolderListItem::setName(const QString& name)
{
setText(0, name);
}
示例8: setText
void SubProjectItem::setDescription(QString desc)
{
m_description = desc;
setText(1, m_description);
}
示例9: setText
void KDatePickerPrivateYearSelector::setYear(int year)
{
setText(QString::number(year));
}
示例10: setIcon
void WSimpleManufacturerItem::setItemData(const hacc::TDBID &manufacturerIconID, const QString &manufacturerName)
{
setIcon(0, 0, manufacturerIconID);
setText(0, 0, manufacturerName);
}
示例11: ui
SlitherBot::SlitherBot() :
ui(new Ui::SlitherBot)
{
ui->setupUi(this);
connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
//connect(ui->actionCreate, SIGNAL(triggered(bool)), this, SLOT(newInstance()));
QToolBar *toolBar = new QToolBar;
QLabel* nowPlaying = new QLabel();
connect(&player, SIGNAL(nowPlaying(QString)), nowPlaying, SLOT(setText(QString)));
toolBar->addWidget(nowPlaying);
nowPlaying->setText("Now Playing: ...");
QWidget* spacer = new QWidget();
spacer->setMinimumWidth(12);
toolBar->addWidget(spacer);
QPushButton* button = new QPushButton();
button->setText("New Tab");
connect(button, SIGNAL(clicked(bool)), this, SLOT(newInstance()));
toolBar->addWidget(button);
button = new QPushButton();
button->setText("Next Song");
connect(button, SIGNAL(clicked(bool)), &player, SLOT(next()));
toolBar->addWidget(button);
button = new QPushButton();
button->setText("Menu");
connect(button, &QPushButton::clicked, [=]() {
Menu menu(this);
menu.setMessages(messages);
menu.setXMPath(settings.value("xmpath", "").toString());
menu.setTwitchChannel(settings.value("twitchchannel", "").toString());
menu.setTwitchOAuth(settings.value("twitchoauth", "").toString());
if(menu.exec() == QDialog::Accepted) {
QString xmPath = menu.xmPath();
QString twitchOAuth = menu.twitchOAuth();
QString twitchChannel = menu.twitchChannel();
QStringList messages = menu.messages();
settings.setValue("xmpath", xmPath);
settings.setValue("twitchoauth", twitchOAuth);
settings.setValue("twitchchannel", twitchChannel);
settings.setValue("messages", messages);
emit updateMessages(messages);
this->messages = messages;
player.play(xmPath);
}
});
toolBar->addWidget(button);
ui->tabWidget->setCornerWidget(toolBar);
QString xmPath = settings.value("xmpath").toString();
if(!xmPath.isEmpty())
player.play(xmPath);
QString oauth = settings.value("twitchoauth").toString();
QString channel = settings.value("twitchchannel").toString();
if(!oauth.isEmpty() && !channel.isEmpty())
twitchChat.connect(channel, oauth);
messages = settings.value("messages").toStringList();
QMetaObject::invokeMethod(&player, "next", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "newInstance", Qt::QueuedConnection);
}
示例12: QWidget
KLanguageButton::KLanguageButton( const QString &text, QWidget *parent )
: QWidget( parent ),
d( new KLanguageButtonPrivate(this) )
{
setText(text);
}
示例13: switch
void MarkdownEditorToolButton::setButtonId(ButtonId id)
{
d->m_ButtonId = id;
QImage img;
QString tooltips;
switch (id) {
case ID_Bold:
tooltips = QString::fromUtf8("Bold");
img = QImage(QLatin1String(":/mdeditor/icons/bold.png"));
break;
case ID_Italic:
tooltips = QString::fromUtf8("Italic");
img = QImage(QLatin1String(":/mdeditor/icons/italic.png"));
break;
case ID_StrikeThrough:
img = QImage(QLatin1String(":/mdeditor/icons/strikethrough.png"));
tooltips = QString::fromUtf8("Strike Through");
break;
case ID_H1:
setText(QString::fromUtf8("H1"));
break;
case ID_H2:
setText(QString::fromUtf8("H2"));
break;
case ID_H3:
setText(QString::fromUtf8("H3"));
break;
case ID_H4:
setText(QString::fromUtf8("H4"));
break;
case ID_H5:
setText(QString::fromUtf8("H5"));
break;
case ID_H6:
setText(QString::fromUtf8("H6"));
break;
case ID_HorizonalRule:
img = QImage(QLatin1String(":/mdeditor/icons/line.png"));
tooltips = QString::fromUtf8("Horizonal Rule");
break;
case ID_Tastlist:
img = QImage(QLatin1String(":/mdeditor/icons/tasklist.png"));
tooltips = QString::fromUtf8("Task List");
break;
case ID_Link:
img = QImage(QLatin1String(":/mdeditor/icons/link.png"));
tooltips = QString::fromUtf8("Link");
break;
case ID_Image:
img = QImage(QLatin1String(":/mdeditor/icons/image.png"));
tooltips = QString::fromUtf8("Image");
break;
case ID_Table:
img = QImage(QLatin1String(":/mdeditor/icons/table.png"));
tooltips = QString::fromUtf8("Table");
break;
case ID_MathFormula:
img = QImage(QLatin1String(":/mdeditor/icons/math.png"));
tooltips = QString::fromUtf8("Math Formula");
break;
case ID_Code:
img = QImage(QLatin1String(":/mdeditor/icons/code.png"));
tooltips = QString::fromUtf8("Code");
break;
case ID_FlowChart:
img = QImage(QLatin1String(":/mdeditor/icons/flow.png"));
tooltips = QString::fromUtf8("Flow Chart");
break;
case ID_SequenceDiagram:
img = QImage(QLatin1String(":/mdeditor/icons/sequence.png"));
tooltips = QString::fromUtf8("Sequence Diagram");
break;
case ID_Help:
img = QImage(QLatin1String(":/mdeditor/icons/help.png"));
tooltips = QString::fromUtf8("Help Contents");
break;
default:
break;
}
if(!img.isNull())
{
int h, s, v, a;
for(int i = 0; i< img.width(); i++)
{
for(int j = 0; j < img.height(); j++)
{
QRgb rgb = img.pixel(i,j);
QColor cl(rgb);
cl.setAlpha(qAlpha(rgb));
cl.getHsv(&h, &s, &v, &a);
cl.setHsv(h, s, 255 - v, a);
img.setPixel(i, j, cl.rgba());
}
}
setIcon(QIcon(QPixmap::fromImage(img)));
}
setToolTip(tooltips);
}
示例14: track
CTrackUndoCommandPurgePts::CTrackUndoCommandPurgePts(CTrack *track)
: track(track)
{
setText(QObject::tr("Purge Selection"));
}
示例15: setText
void kMyMoneyLineEdit::resetText()
{
setText(d->m_text);
}