• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setText函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setText函数的典型用法代码示例。如果您正苦于以下问题:C++ setText函数的具体用法?C++ setText怎么用?C++ setText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setText函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: _opacity

scrolText::scrolText(QWidget *parent)
        :QWidget(parent),
        _opacity(1)
{
   setText(QString());
}
开发者ID:tavu,项目名称:karakaxa,代码行数:6,代码来源:scrolText.cpp


示例17: setText

void QtFontButton::setFont(const QFont & font)
{
	QWidget::setFont(font);
	setText(font);
	emit fontChanged(font);
}
开发者ID:mihailikus,项目名称:QDBFRedactor,代码行数:6,代码来源:qtfontbutton.cpp


示例18: Tool

  /**
   * Constructor, creates and sets up widgets for this tool.
   *
   * @param parent
   */
  StatisticsTool::StatisticsTool(QWidget *parent) : Tool(parent) {
    p_boxSamps = 3;
    p_boxLines = 3;

    p_ulSamp = -1;
    p_ulLine = -1;

    p_set = false;

    p_dialog = new QDialog(parent);
    p_dialog->setWindowTitle("Statistics");

    p_visualBox = new QGroupBox("Visual Display");

    p_visualScroll = new QScrollArea;
    p_visualScroll->setBackgroundRole(QPalette::Dark);
    
    p_visualDisplay = new VisualDisplay(p_visualScroll);
    p_visualDisplay->setObjectName("dnDisplay");

    QCheckBox *checkBox = new QCheckBox("Hide Display");
    connect(checkBox, SIGNAL(toggled(bool)), this, SLOT(hideDisplay(bool)));

    QLabel *boxLabel = new QLabel("Box Size:");
    p_boxLabel = new QLabel;
    QString samps, lines;
    samps.setNum(p_boxSamps);
    lines.setNum(p_boxLines);
    p_boxLabel->setText(samps + "x" + lines);

    QHBoxLayout *boxLabelLayout = new QHBoxLayout;

    boxLabelLayout->addWidget(checkBox);
    boxLabelLayout->addStretch(1);
    boxLabelLayout->addWidget(boxLabel);
    boxLabelLayout->addWidget(p_boxLabel);

    QSlider *slider = new QSlider(Qt::Vertical);
    slider->setRange(2, 18);
    slider->setSliderPosition(10);
    slider->setSingleStep(1);
    slider->setTickInterval(1);
    slider->setTickPosition(QSlider::TicksBelow);
    connect(slider, SIGNAL(valueChanged(int)), p_visualDisplay, SLOT(setBoxSize(int)));
    connect(slider, SIGNAL(valueChanged(int)), this, SLOT(resizeScrollbars()));
    p_visualScroll->setWidget(p_visualDisplay);

    QGroupBox *displayMode = new QGroupBox("Display Mode");
    QRadioButton *displayText = new QRadioButton("Show Text");
    displayText->setToolTip("Display the pixels of a region as text");
    QRadioButton *displayPixels = new QRadioButton("Show Pixel Values");
    displayPixels->setToolTip("Display the pixels of a region");
    QRadioButton *displayDeviation = new QRadioButton("Show Deviation");
    displayDeviation->setToolTip("Display standard deviation over a region,\n where red denotes a larger deviation");

    QHBoxLayout *displayModeLayout = new QHBoxLayout;
    displayModeLayout->addWidget(displayText);
    displayModeLayout->addWidget(displayPixels);
    displayModeLayout->addWidget(displayDeviation);

    displayMode->setLayout(displayModeLayout);

    connect(displayText, SIGNAL(toggled(bool)), p_visualDisplay, SLOT(showText(bool)));
    connect(displayText, SIGNAL(toggled(bool)), slider, SLOT(setDisabled(bool)));
    connect(displayPixels, SIGNAL(toggled(bool)), p_visualDisplay, SLOT(showPixels(bool)));
    connect(displayDeviation, SIGNAL(toggled(bool)), p_visualDisplay, SLOT(showDeviation(bool)));

    displayText->setChecked(true);

    QHBoxLayout *visualHBoxLayout = new QHBoxLayout;
    visualHBoxLayout->addWidget(p_visualScroll);
    visualHBoxLayout->addWidget(slider);

    QVBoxLayout *visualVBoxLayout = new QVBoxLayout;
    visualVBoxLayout->addLayout(visualHBoxLayout);
    visualVBoxLayout->addWidget(displayMode);

    p_visualBox->setLayout(visualVBoxLayout);

    QGroupBox *statsBox = new QGroupBox("Statistics");

    p_minLabel = new QLabel("Minimum: n/a");
    p_minLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    p_minLabel->setLineWidth(1);
    p_minLabel->setMargin(10);
    p_minLabel->setAlignment(Qt::AlignLeft);

    p_maxLabel = new QLabel("Maximum: n/a");
    p_maxLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    p_maxLabel->setLineWidth(1);
    p_maxLabel->setMargin(10);
    p_maxLabel->setAlignment(Qt::AlignLeft);

    p_avgLabel = new QLabel("Average: n/a");
    p_avgLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
//.........这里部分代码省略.........
开发者ID:corburn,项目名称:ISIS,代码行数:101,代码来源:StatisticsTool.cpp


示例19: setInfo

    void setInfo(const QString& l, const QString& d)
    {
	label = l;
	doc = d;
	setText(0,label);
    }
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:6,代码来源:main.cpp


示例20: switch

void CompleteLineEdit::keyPressEvent(QKeyEvent *e)
{
    if (!listView->isHidden())
    {
		int count = listView->model()->rowCount();	//一共有多少项
		QModelIndex currentIndex = listView->currentIndex();

		switch(e->key())
		{
			case Qt::Key_Down:
			{// 按向下方向键时,移动光标选中 下一个 完成列表中的项
				//qDebug()<<QString::fromUtf8("按下方向键下");
				int row = currentIndex.row() + 1;
				if (row >= count)
				{
					row = 0;
				}
				QModelIndex index = listView->model()->index(row, 0);
				listView->setCurrentIndex(index);
				break;
			}
			case Qt::Key_Up:
			{// 按向下方向键时,移动光标选中 上一个 完成列表中的项
				//qDebug()<<QString::fromUtf8("按下方向键上");
				int row = currentIndex.row() - 1;
				if (row < 0)
				{
					row = count - 1;
				}
				QModelIndex index = listView->model()->index(row, 0);
				listView->setCurrentIndex(index);
				break;
			}
			case Qt::Key_Escape:
			{// 按下Esc键时,隐藏完成列表
				listView->hide();
				break;
			}
			case Qt::Key_Return:
			{// 按下回车键时,使用完成列表中选中的项,并隐藏完成列表
				if (currentIndex.isValid())
				{
					QString text = listView->currentIndex().data().toString();
					setText(text);
				}
				listView->hide();
				qDebug()<<QString::fromUtf8("在这里调出流云的对话框~~");
				break;
			}
			default:
			{// 其他情况,隐藏完成列表,并使用QLineEdit的键盘按下事件
				listView->hide();
				QLineEdit::keyPressEvent(e);
				break;
			}
		}//end of switch
    }
    else
	{//嗯把其他的东西扔给基类总是明知的选择
        QLineEdit::keyPressEvent(e);
    }
}
开发者ID:MtDesert,项目名称:ChatClient,代码行数:62,代码来源:CompleteLineEdit.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setTextColor函数代码示例发布时间:2022-05-30
下一篇:
C++ setTempo函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap