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


C++ setText函数代码示例

本文整理汇总了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"));
}
开发者ID:eagafonov,项目名称:qtmoko,代码行数:99,代码来源:pathdeform.cpp

示例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();
    }
开发者ID:Digmaster,项目名称:openmw,代码行数:68,代码来源:race.cpp

示例3: setText

void SFMLCursesTextBox::append(const std::string& text)
{
	setText(m_text.append(text));
}
开发者ID:elliothatch,项目名称:ASCII-Palette,代码行数:4,代码来源:SFMLCursesTextBox.cpp

示例4: setText

void DoubleEditor::setValue(const double &d) { setText(formatValue(d)); }
开发者ID:DanNixon,项目名称:mantid,代码行数:1,代码来源:DoubleEditorFactory.cpp

示例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);
}
开发者ID:rumatakira,项目名称:qupzilla,代码行数:75,代码来源:locationbar.cpp

示例6: setText

void ChangeTileTerrain::initText() {
    setText(QCoreApplication::translate("Undo Commands",
                                        "Change Tile Terrain"));
}
开发者ID:ATSOTECK,项目名称:Aurora-Game-Editor,代码行数:4,代码来源:changeTileTerrain.cpp

示例7: setText

void FolderListItem::setName(const QString& name)
{
    setText(0, name);
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:4,代码来源:folderlistview.cpp

示例8: setText

void SubProjectItem::setDescription(QString desc)
{
    m_description = desc;
    setText(1, m_description);
}
开发者ID:eddrog,项目名称:kdenlive,代码行数:5,代码来源:subprojectitem.cpp

示例9: setText

void KDatePickerPrivateYearSelector::setYear(int year)
{
  setText(QString::number(year));
}
开发者ID:CGenie,项目名称:kmymoney,代码行数:4,代码来源:kmymoneycalendar.cpp

示例10: setIcon

void WSimpleManufacturerItem::setItemData(const hacc::TDBID &manufacturerIconID, const QString &manufacturerName)
{
    setIcon(0, 0, manufacturerIconID);
    setText(0, 0, manufacturerName);
}
开发者ID:Sheridan,项目名称:HAcc,代码行数:5,代码来源:wsimplemanufactureritem.cpp

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

示例12: QWidget

KLanguageButton::KLanguageButton( const QString &text, QWidget *parent )
  : QWidget( parent ),
    d( new KLanguageButtonPrivate(this) )
{
  setText(text);
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:6,代码来源:klanguagebutton.cpp

示例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);
}
开发者ID:shujaatak,项目名称:QtCreator-Markdown-Editor-Plugin,代码行数:99,代码来源:markdowneditortoolbutton.cpp

示例14: track

CTrackUndoCommandPurgePts::CTrackUndoCommandPurgePts(CTrack *track)
: track(track)
{
    setText(QObject::tr("Purge Selection"));
}
开发者ID:Nikoli,项目名称:qlandkartegt,代码行数:5,代码来源:CTrackUndoCommandPurgePts.cpp

示例15: setText

void kMyMoneyLineEdit::resetText()
{
  setText(d->m_text);
}
开发者ID:KDE,项目名称:kmymoney,代码行数:4,代码来源:kmymoneylineedit.cpp


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