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


C++ QPlainTextEdit::setPlainText方法代码示例

本文整理汇总了C++中QPlainTextEdit::setPlainText方法的典型用法代码示例。如果您正苦于以下问题:C++ QPlainTextEdit::setPlainText方法的具体用法?C++ QPlainTextEdit::setPlainText怎么用?C++ QPlainTextEdit::setPlainText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QPlainTextEdit的用法示例。


在下文中一共展示了QPlainTextEdit::setPlainText方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setValue


//.........这里部分代码省略.........

    case QgsVectorLayer::DialRange:
    case QgsVectorLayer::SliderRange:
    case QgsVectorLayer::EditRange:
    {
      if ( myFieldType == QVariant::Int )
      {
        if ( editType == QgsVectorLayer::EditRange )
        {
          QSpinBox *sb = qobject_cast<QSpinBox *>( editor );
          if ( !sb )
            return false;
          sb->setValue( value.toInt() );
        }
        else
        {
          QAbstractSlider *sl = qobject_cast<QAbstractSlider *>( editor );
          if ( !sl )
            return false;
          sl->setValue( value.toInt() );
        }
        break;
      }
      else if ( myFieldType == QVariant::Double )
      {
        QDoubleSpinBox *dsb = qobject_cast<QDoubleSpinBox *>( editor );
        if ( !dsb )
          return false;
        dsb->setValue( value.toDouble() );
      }
    }

    case QgsVectorLayer::CheckBox:
    {
      QCheckBox *cb = qobject_cast<QCheckBox *>( editor );
      if ( cb )
      {
        QPair<QString, QString> states = vl->checkedState( idx );
        cb->setChecked( value == states.first );
        break;
      }
    }

    // fall-through

    case QgsVectorLayer::LineEdit:
    case QgsVectorLayer::UniqueValuesEditable:
    case QgsVectorLayer::Immutable:
    case QgsVectorLayer::UuidGenerator:
    default:
    {
      QLineEdit *le = qobject_cast<QLineEdit *>( editor );
      QTextEdit *te = qobject_cast<QTextEdit *>( editor );
      QPlainTextEdit *pte = qobject_cast<QPlainTextEdit *>( editor );
      if ( !le && !te && !pte )
        return false;

      QString text;
      if ( value.isNull() )
      {
        if ( myFieldType == QVariant::Int || myFieldType == QVariant::Double || myFieldType == QVariant::LongLong )
          text = "";
        else if ( editType == QgsVectorLayer::UuidGenerator )
          text = QUuid::createUuid().toString();
        else
          text = nullValue;
      }
      else
      {
        text = value.toString();
      }

      if ( le )
        le->setText( text );
      if ( te )
        te->setHtml( text );
      if ( pte )
        pte->setPlainText( text );
    }
    break;

    case QgsVectorLayer::FileName:
    case QgsVectorLayer::Calendar:
    {
      QLineEdit* le = qobject_cast<QLineEdit*>( editor );
      if ( !le )
      {
        le = editor->findChild<QLineEdit *>();
      }
      if ( !le )
      {
        return false;
      }
      le->setText( value.toString() );
    }
    break;
  }

  return true;
}
开发者ID:hCivil,项目名称:Quantum-GIS,代码行数:101,代码来源:qgsattributeeditor.cpp

示例2: configToWidget

/**
  @brief Initialise un widget avec une liste de parametres
  @param widget Widget parent
  @param list Liste des parametres
  @remarks Les noms des widgets doivent correspondres avec les noms de paramètres
*/
void Configurable::configToWidget(QObject* widget,ConfigParamList& list){

    //scan les elements enfants
    for(ConfigParamList::const_iterator cur = list.begin(); cur != list.end(); cur++){
        QString name = cur->first;
        QString value = cur->second->getValue();
        QWidget* child = widget->findChild<QWidget*>(name);
        if(child==0){
            QPRINT("configToWidget: "+name+" not found");
            continue;
        }

        // QLineEdit ?
        QLineEdit *lineEdit = qobject_cast<QLineEdit *>(child);
        if(lineEdit){
           lineEdit->setText(value);
           continue;
        }

        // QComboBox ?
        QComboBox *comboBox = qobject_cast<QComboBox *>(child);
        if(comboBox){
            comboBox->setCurrentIndex(comboBox->findText(value));
            continue;
         }

        // QSpinBox ?
        QSpinBox *spinBox = qobject_cast<QSpinBox *>(child);
        if(spinBox){
            spinBox->setValue(value.toInt());
            continue;
         }


        // QDoubleSpinBox ?
        QDoubleSpinBox *doubleSpinBox = qobject_cast<QDoubleSpinBox *>(child);
        if(doubleSpinBox){
            doubleSpinBox->setValue(value.toInt());
            continue;
         }

        // QTextEdit ?
        QTextEdit *textEdit = qobject_cast<QTextEdit *>(child);
        if(textEdit){
            textEdit->setPlainText(value);
            continue;
         }

        // QPlainTextEdit ?
        QPlainTextEdit *plainTextEdit = qobject_cast<QPlainTextEdit *>(child);
        if(plainTextEdit){
            plainTextEdit->setPlainText(value);
            continue;
         }

        // QTimeEdit ?
        QTimeEdit *timeEdit = qobject_cast<QTimeEdit *>(child);
        if(timeEdit){
            timeEdit->setTime(QTime::fromString(value));
            continue;
         }

        // QDateTimeEdit ?
        QDateTimeEdit *dateTimeEdit = qobject_cast<QDateTimeEdit *>(child);
        if(dateTimeEdit){
            timeEdit->setDateTime(QDateTime::fromString(value));
            continue;
         }

        // QDateEdit ?
        QDateEdit *dateEdit = qobject_cast<QDateEdit *>(child);
        if(dateEdit){
            dateEdit->setDate(QDate::fromString(value));
            continue;
         }

        // QDial ?
        QDial *dial = qobject_cast<QDial *>(child);
        if(dial){
            dial->setValue(value.toInt());
            continue;
         }

        // QSlider ?
        QSlider *slider = qobject_cast<QSlider *>(child);
        if(slider){
            slider->setValue(value.toInt());
            continue;
         }

    }

}
开发者ID:Ace4teaM,项目名称:Arduino-Project,代码行数:99,代码来源:configurable.cpp

示例3: createQmlItemNode

QmlItemNode QmlModelView::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, const QPointF &position, QmlItemNode parentNode)
{
    if (!parentNode.isValid())
        parentNode = rootQmlItemNode();

    Q_ASSERT(parentNode.isValid());

    QmlItemNode newNode;

    try {
        RewriterTransaction transaction = beginRewriterTransaction();
        if (itemLibraryEntry.typeName().contains('.')) {

            const QString newImportUrl = itemLibraryEntry.requiredImport();

            if (!itemLibraryEntry.requiredImport().isEmpty()) {
                const QString newImportVersion = QString("%1.%2").arg(QString::number(itemLibraryEntry.majorVersion()), QString::number(itemLibraryEntry.minorVersion()));
                Import newImport = Import::createLibraryImport(newImportUrl, newImportVersion);

                foreach (const Import &import, model()->imports()) {
                    if (import.isLibraryImport()
                            && import.url() == newImport.url()
                            && import.version() == newImport.version()) {
                        // reuse this import
                        newImport = import;
                        break;
                    }
                }

                if (!model()->hasImport(newImport, true, true)) {
                    model()->changeImports(QList<Import>() << newImport, QList<Import>());
                }
            }
        }

        QList<QPair<QString, QVariant> > propertyPairList;
        propertyPairList.append(qMakePair(QString("x"), QVariant(round(position.x(), 4))));
        propertyPairList.append(qMakePair(QString("y"), QVariant(round(position.y(), 4))));

        if (itemLibraryEntry.qml().isEmpty()) {
            foreach (const PropertyContainer &property, itemLibraryEntry.properties())
                propertyPairList.append(qMakePair(property.name(), property.value()));

            newNode = createQmlItemNode(itemLibraryEntry.typeName(), itemLibraryEntry.majorVersion(), itemLibraryEntry.minorVersion(), propertyPairList);
        } else {
            QScopedPointer<Model> inputModel(Model::create("QtQuick.Rectangle", 1, 0, model()));
            inputModel->setFileUrl(model()->fileUrl());
            QPlainTextEdit textEdit;


            textEdit.setPlainText(Utils::FileReader::fetchQrc(itemLibraryEntry.qml()));
            NotIndentingTextEditModifier modifier(&textEdit);

            QScopedPointer<RewriterView> rewriterView(new RewriterView(RewriterView::Amend, 0));
            rewriterView->setCheckSemanticErrors(false);
            rewriterView->setTextModifier(&modifier);
            inputModel->attachView(rewriterView.data());

            if (rewriterView->errors().isEmpty() && rewriterView->rootModelNode().isValid()) {
                ModelNode rootModelNode = rewriterView->rootModelNode();
                inputModel->detachView(rewriterView.data());

                rootModelNode.variantProperty("x") = propertyPairList.first().second;
                rootModelNode.variantProperty("y") = propertyPairList.at(1).second;

                ModelMerger merger(this);
                newNode = merger.insertModel(rootModelNode);               
            }
        }

        if (parentNode.hasDefaultProperty()) {
            parentNode.nodeAbstractProperty(parentNode.defaultProperty()).reparentHere(newNode);
        }

        if (!newNode.isValid())
            return newNode;

        QString id;
        int i = 1;
        QString name(itemLibraryEntry.name().toLower());
        //remove forbidden characters
        name.replace(QRegExp(QLatin1String("[^a-zA-Z0-9_]")), QLatin1String("_"));
        do {
            id = name + QString::number(i);
            i++;
        } while (hasId(id)); //If the name already exists count upwards

        newNode.setId(id);

        if (!currentState().isBaseState()) {
            newNode.modelNode().variantProperty("opacity") = 0;
            newNode.setVariantProperty("opacity", 1);
        }

        Q_ASSERT(newNode.isValid());
    }
开发者ID:KDE,项目名称:android-qt-creator,代码行数:96,代码来源:qmlmodelview.cpp

示例4: createValueWidget

void SettingWidget::createValueWidget()
{
    rsArgument* argument = task->getArgument(option->name);
    
    switch(option->type) {
        case G_OPTION_ARG_FILENAME:
        case G_OPTION_ARG_STRING:
        case G_OPTION_ARG_STRING_ARRAY:
        case G_OPTION_ARG_CALLBACK:
        case G_OPTION_ARG_INT:
        case G_OPTION_ARG_INT64:
        case G_OPTION_ARG_DOUBLE:
            {
                // Display text box if number of values is not restricted
                if ( option->allowedValues == NULL ) {
                    if ( option->nLines < 2 ) {
                        QLineEdit *w = new QLineEdit();
                        valueWidget = w;
                        w->setPlaceholderText(option->cli_arg_description);
                        connect(w, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
                        if ( argument != NULL ) {
                            w->setText(argument->value);
                        } else if ( option->defaultValue != NULL ) {
                            w->setText(option->defaultValue);
                        }
                    } else { // create a QTextEdit field instead
                        QPlainTextEdit *w = new QPlainTextEdit();
                        valueWidget = w;
                        connect(w, SIGNAL(textChanged()), this, SLOT(textChanged()));
                        if ( argument != NULL ) {
                            w->setPlainText(argument->value);
                        } else if ( option->defaultValue != NULL ) {
                            w->setPlainText(option->defaultValue);
                        }
                        QFontMetrics m(w->font()) ;
                        int rowHeight = m.lineSpacing() ;
                        w->setFixedHeight(option->nLines * rowHeight) ;
                        w->setLineWrapMode(QPlainTextEdit::NoWrap);
                    }
                } else { // if the allowed values are restricted display radio buttons instead
                    QWidget *w = new QWidget();
                    QBoxLayout *wLayout = new QBoxLayout(QBoxLayout::TopToBottom);
                    QButtonGroup *buttonGroup = new QButtonGroup();
                    buttonGroup->setExclusive(true);
                    valueWidget = w;
                    connect(buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(buttonClicked(int)));
                    
                    // go through all options and add a radio button for them
                    rsUIOptionValue** values = option->allowedValues;
                    for (size_t i=0; values[i] != NULL; i++ ) {
                        // add radio button
                        QRadioButton *b = new QRadioButton(QString("'")+QString(values[i]->name)+QString("'"));
                        QFont f("Arial", 12, QFont::Bold);
                        b->setFont(f);
                        buttonGroup->addButton(b, (int)i);
                        wLayout->addWidget(b);
                        
                        // set it to checked if it is the default or set value
                        b->setChecked(false);
                        if ( argument != NULL ) {
                            if ( ! strcmp(argument->value,values[i]->name) ) {
                                b->setChecked(true);
                            }
                        } else if ( ! strcmp(option->defaultValue,values[i]->name) ) {
                            b->setChecked(true);
                        }
                        
                        // add its description
                        QLabel *label = new QLabel(values[i]->description);
                        label->setIndent(22);
                        label->setWordWrap(true);
                        label->setContentsMargins(0, 0, 0, 4);
                        QFont f2("Arial", 11, QFont::Normal);
                        label->setFont(f2);
                        wLayout->addWidget(label);
                    }
                    w->setLayout(wLayout);
                }
            }
            break;
        /*
        case G_OPTION_ARG_INT:
        case G_OPTION_ARG_INT64:
            valueWidget = new QSpinBox();
            break;
        case G_OPTION_ARG_DOUBLE:
            valueWidget = new QDoubleSpinBox();
            break;
        */
        case G_OPTION_ARG_NONE:
            {
                QCheckBox *w = new QCheckBox("Enabled"); // new SwitchWidget();
                valueWidget = w;
                connect(w, SIGNAL(stateChanged(int)), this, SLOT(stateChanged(int)));
                if ( argument != NULL ) {
                    w->setCheckState(Qt::Checked);
                } else {
                    w->setCheckState(Qt::Unchecked);
                }
            }
//.........这里部分代码省略.........
开发者ID:janeisklar,项目名称:RSTools-jobeditor,代码行数:101,代码来源:SettingWidget.cpp

示例5: create

ByteArrayModifier* ByteArrayModifier::create(const QString& data)
{
    QPlainTextEdit* edit = new QPlainTextEdit;
    edit->setPlainText(data);
    return new ByteArrayModifier(edit);
}
开发者ID:Gardenya,项目名称:qtcreator,代码行数:6,代码来源:bytearraymodifier.cpp

示例6: propertyUpdated

void protoObject::propertyUpdated(QString propertyName){
    QObject *receiver = mapper->mapping(propertyName);
    QWidget *widget;

    if (receiver) return; //if not binding, just leave

    widget = qobject_cast<QLabel*>(receiver);
    if (widget) {
        QLabel* edit = qobject_cast<QLabel*>(receiver);
        QString value = this->property(propertyName.toLatin1()).toString();
        edit->blockSignals(true);
        edit->setText(edit->text().arg(value));
        edit->blockSignals(false);
    };

    widget = qobject_cast<QLineEdit*>(receiver);
    if (widget) {
        QLineEdit* edit = qobject_cast<QLineEdit*>(receiver);
        QString value = this->property(propertyName.toLatin1()).toString();
        edit->blockSignals(true);
        edit->setText(value);
        edit->blockSignals(false);
    };

    widget = qobject_cast<QComboBox*>(receiver);
    if (widget) {
        QComboBox* edit = qobject_cast<QComboBox*>(receiver);
        edit->blockSignals(true);
        edit->setCurrentIndex(edit->findData(this->property(propertyName.toLatin1()), Qt::UserRole));
        edit->blockSignals(false);
    };

    widget = qobject_cast<QRadioButton*>(receiver);
    if (widget) {
        QRadioButton* edit = qobject_cast<QRadioButton*>(receiver);
        bool value = this->property(propertyName.toLatin1()).toBool();
        edit->blockSignals(true);
        edit->setChecked(value);
        edit->blockSignals(false);
    };

    widget = qobject_cast<QCheckBox*>(receiver);
    if (widget) {
        QCheckBox* edit = qobject_cast<QCheckBox*>(receiver);
        bool value = this->property(propertyName.toLatin1()).toBool();
        edit->blockSignals(true);
        edit->setChecked(value);
        edit->blockSignals(false);
    };

    widget = qobject_cast<QPlainTextEdit*>(receiver);
    if (widget) {
        QPlainTextEdit* edit = qobject_cast<QPlainTextEdit*>(receiver);
        QString value = this->property(propertyName.toLatin1()).toString();
        edit->blockSignals(true);
        edit->setPlainText(value);
        edit->blockSignals(false);
    };

    widget = qobject_cast<QSpinBox*>(receiver);
    if (widget) {
        QSpinBox* edit = qobject_cast<QSpinBox*>(receiver);
        int value = this->property(propertyName.toLatin1()).toInt();
        edit->blockSignals(true);
        edit->setValue(value);
        edit->blockSignals(false);
    };

    widget = qobject_cast<QDoubleSpinBox*>(receiver);
    if (widget) {
        QDoubleSpinBox* edit = qobject_cast<QDoubleSpinBox*>(receiver);
        double value = this->property(propertyName.toLatin1()).toDouble();
        edit->blockSignals(true);
        edit->setValue(value);
        edit->blockSignals(false);
    };

    widget = qobject_cast<QDateTimeEdit*>(receiver);
    if (widget) {
        QDateTimeEdit* edit = qobject_cast<QDateTimeEdit*>(receiver);
        QDateTime value = this->property(propertyName.toLatin1()).toDateTime();
        edit->blockSignals(true);
        edit->setDateTime(value);
        edit->blockSignals(false);
    };
}
开发者ID:jcapoduri,项目名称:ndlite,代码行数:86,代码来源:protoobject.cpp

示例7: PageChanged

void ResourceWizard::PageChanged(int PageId)
{
    //qDebug()<<"start"<<"PageId"<<PageId<<"CurrentPageId"<<CurrentPageId;
    if(CurrentPageId == 0)
    {
        MultiLanguageString str;
        str.SetTranslation("en",ui->DescriptionEn->text());
        str.SetTranslation("ru",ui->DescripnionRu->text());

        ResourceWidget->SetVariableName(ui->Name->text());
        ResourceWidget->SetDescription(str);
    }else if(CurrentPageId == 1)
    {
        ResourceWidget->SetTypeId(Type);

    }else if(CurrentPageId == 2)
    {
        if(Type == "FixedString")
        {
            QCheckBox * e = ResourceWidget->GetTemplateWidgetByType(false,Type)->findChild<QCheckBox *>("NotEmptyCheckBox");
            if(e)
                e->setChecked(ui->StringNotEmpty->isChecked());

            QLineEdit * FixedStringValue = ResourceWidget->GetTemplateWidgetByType(true,Type)->findChild<QLineEdit *>("FixedStringValue");
            if(FixedStringValue)
                FixedStringValue->setText(ui->StringDefaultValue->text());
        }
    }else if(CurrentPageId == 10)
    {
        if(IsAdditionalTab)
        {
            IsAdditionalTab = false;
            MultiLanguageString str;
            str.SetTranslation("en",ui->TabEn->text());
            str.SetTranslation("ru",ui->TabRu->text());
            ResourceWidget->SetSectionName(str);
        }
    }else if(CurrentPageId == 9)
    {
        if(IsAdditionalIf)
        {
            IsAdditionalIf = false;
            ResourceWidget->SetVisibilityConditionValue(ui->VisibilityValue->text());
            ResourceWidget->SetVisibilityConditionVariable(ui->VisibilityName->text());

        }
    }else if(CurrentPageId == 8)
    {
        if(Type == "Select")
        {
            QComboBox * SelectTypeCombo = ResourceWidget->GetTemplateWidgetByType(false,Type)->findChild<QComboBox *>("SelectTypeCombo");
            if(SelectTypeCombo)
                SelectTypeCombo->setCurrentText(ui->SelectType->currentText());

            QPlainTextEdit * SelectValuesEdit = ResourceWidget->GetTemplateWidgetByType(false,Type)->findChild<QPlainTextEdit *>("SelectValuesEdit");
            if(SelectValuesEdit)
                SelectValuesEdit->setPlainText(ui->SelectLines->toPlainText());

            QWidget *child = ResourceWidget->GetTemplateWidgetByType(true,Type)->findChild<QWidget *>("SelectWidget");
            QLayout * layout = child->layout();

            /*MultiSelect * OldSelect = child->findChild<MultiSelect *>();
            if(OldSelect)
                OldSelect->deleteLater();

            MultiSelect * Select = new MultiSelect(child);*/

            MultiSelect * Select = child->findChild<MultiSelect *>();

            QStringList list = ui->SelectLines->toPlainText().split(QRegExp("[\r\n]"),QString::SkipEmptyParts);

            MultiSelect *multi = ui->SelectDefaultValueContainer->findChild<MultiSelect *>();

            Select->Update(ui->SelectType->currentText(), list, multi->GetSelectedIndex());
            layout->addWidget(Select);


        }
    }else if(CurrentPageId == 7)
    {
        if(Type == "RandomString")
        {
            QLineEdit * RandomStringValue = ResourceWidget->GetTemplateWidgetByType(true,Type)->findChild<QLineEdit *>("RandomStringValue");
            if(RandomStringValue)
                RandomStringValue->setText(ui->RandomStringValue->text());
        }
    }else if(CurrentPageId == 4)
    {
        if(Type == "FixedInteger")
        {
            QSpinBox * min = ResourceWidget->GetTemplateWidgetByType(false,Type)->findChild<QSpinBox *>("EditMinimum");
            QSpinBox * max = ResourceWidget->GetTemplateWidgetByType(false,Type)->findChild<QSpinBox *>("EditMaximum");
            if(min)
                min->setValue(ui->MinValueNumber->value());
            if(max)
                max->setValue(ui->MaxValueNumber->value());

            QSpinBox * FixedIntegerValue = ResourceWidget->GetTemplateWidgetByType(true,Type)->findChild<QSpinBox *>("FixedIntegerValue");
            if(FixedIntegerValue)
                FixedIntegerValue->setValue(ui->Number->value());
//.........这里部分代码省略.........
开发者ID:bablosoft,项目名称:BAS,代码行数:101,代码来源:resourcewizard.cpp

示例8: KPageDialog

ConfigurationDialog::ConfigurationDialog(QWidget *parent) : KPageDialog(parent)
{
	setCaption(i18nc("@title:window", "Configure Kaffeine"));

	QWidget *widget = new QWidget(this);
	QGridLayout *gridLayout = new QGridLayout(widget);

	startupDisplayModeBox = new KComboBox(widget);
	startupDisplayModeBox->addItem(i18nc("@item:inlistbox 'Startup display mode:'",
		"Normal Mode"));
	startupDisplayModeBox->addItem(i18nc("@item:inlistbox 'Startup display mode:'",
		"Minimal Mode"));
	startupDisplayModeBox->addItem(i18nc("@item:inlistbox 'Startup display mode:'",
		"Full Screen Mode"));
	startupDisplayModeBox->addItem(i18nc("@item:inlistbox 'Startup display mode:'",
		"Remember Last Setting"));
	startupDisplayModeBox->setCurrentIndex(Configuration::instance()->getStartupDisplayMode());
	gridLayout->addWidget(startupDisplayModeBox, 0, 1);

	QLabel *label = new QLabel(i18nc("@label:listbox", "Startup display mode:"), widget);
	label->setBuddy(startupDisplayModeBox);
	gridLayout->addWidget(label, 0, 0);

	shortSkipBox = new QSpinBox(widget);
	shortSkipBox->setRange(1, 600);
	shortSkipBox->setValue(Configuration::instance()->getShortSkipDuration());
	gridLayout->addWidget(shortSkipBox, 1, 1);

	label = new QLabel(i18nc("@label:spinbox", "Short skip duration:"), widget);
	label->setBuddy(shortSkipBox);
	gridLayout->addWidget(label, 1, 0);

	longSkipBox = new QSpinBox(widget);
	longSkipBox->setRange(1, 600);
	longSkipBox->setValue(Configuration::instance()->getLongSkipDuration());
	gridLayout->addWidget(longSkipBox, 2, 1);

	label = new QLabel(i18nc("@label:spinbox", "Long skip duration:"), widget);
	label->setBuddy(longSkipBox);
	gridLayout->addWidget(label, 2, 0);
	gridLayout->setRowStretch(3, 1);

	KPageWidgetItem *page = new KPageWidgetItem(widget, i18nc("@title:group", "General"));
	page->setIcon(KIcon(QLatin1String("configure")));
	addPage(page);

	widget = new QWidget(this);
	gridLayout = new QGridLayout(widget);

	label = new QLabel(i18nc("@label:textbox", "Log messages:"), widget);
	gridLayout->addWidget(label, 0, 0);

	QPushButton *pushButton = new QPushButton(i18nc("@action:button", "Show dmesg"));
	pushButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
	connect(pushButton, SIGNAL(clicked()), this, SLOT(showDmesg()));
	gridLayout->addWidget(pushButton, 0, 1);

	QPlainTextEdit *textEdit = new QPlainTextEdit(widget);
	textEdit->setPlainText(Log::getLog());
	textEdit->setReadOnly(true);
	gridLayout->addWidget(textEdit, 1, 0, 1, 2);
	gridLayout->setRowStretch(2, 1);

	page = new KPageWidgetItem(widget, i18nc("@title:group", "Diagnostics"));
	page->setIcon(KIcon(QLatin1String("page-zoom")));
	addPage(page);
}
开发者ID:Brandhand,项目名称:kaffeine-vlc,代码行数:67,代码来源:configurationdialog.cpp


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