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


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

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


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

示例1: processContent

//-------------------------------------------------------------------------
void MainWindow::processContent()
{
  QString fileName = getCurrentSourceFile();
  if(fileName.isEmpty())
  {
    return;
  }

  QPlainTextEdit *currentSourceCode = getCurrentSourceCode();

  std::vector<const char*> Args;
  std::list<std::string> commandLine;
  QByteArray sourceCode(currentSourceCode->toPlainText().toUtf8());
  APP::Application::addCmdArgsFromProject(Args, commandLine);

  std::string processedFile;
  std::stringstream diagnostics;
  APP::Application::processFile(sourceCode.constData(),
                                sourceCode.constData() + sourceCode.size(),
                                QFileInfo(fileName).canonicalFilePath().toUtf8().constData(),
                                Args, processedFile, diagnostics);
  clearLog();
//diagnostics<<processedFile;
  log(diagnostics.str());
  setTransformedSource(processedFile.c_str());

  ui.tabWidget_2->setTabText(0, QFileInfo(fileName).fileName());
}
开发者ID:kevinzhang334455,项目名称:Scout,代码行数:29,代码来源:MainWindow_GUI.cpp

示例2: openLinkInput

void MainForm::openLinkInput() {
    Ui_links link_ui;

    QDialog *dialog = new QDialog();

    link_ui.setupUi(dialog);

    int result = dialog->exec();

    QPlainTextEdit *line = dialog->findChild<QPlainTextEdit *>("edit_links");
    QLineEdit *name = dialog->findChild<QLineEdit *>("edit_name");

    std::list<std::string> urls = std::list<std::string>();

    if (result == QDialog::DialogCode::Accepted) {
        std::stringstream link_text(line->toPlainText().toStdString());
        std::string to;

        while (std::getline(link_text, to, '\n')) {
            if (to.size() > 0) {
                urls.push_back(to);
            }
        }
    }

    links->appendLinks(name->text().toStdString(), urls);
    delete dialog;
}
开发者ID:maxammann,项目名称:aqueduct,代码行数:28,代码来源:main.cpp

示例3: testQtOutputFormatter_appendMixedAssertAndAnsi

void QtSupportPlugin::testQtOutputFormatter_appendMixedAssertAndAnsi()
{
    QPlainTextEdit edit;
    TestQtOutputFormatter formatter;
    formatter.setPlainTextEdit(&edit);

    const QString inputText = QString::fromLatin1(
                "\x1b[38;2;0;0;127mHello\n"
                "Object::Test in test.cpp:123\n"
                "\x1b[38;2;0;0;127mHello\n");
    const QString outputText = QString::fromLatin1(
                "Hello\n"
                "Object::Test in test.cpp:123\n"
                "Hello\n");

    formatter.appendMessage(inputText, QTextCharFormat());

    QCOMPARE(edit.toPlainText(), outputText);

    edit.moveCursor(QTextCursor::Start);
    QCOMPARE(edit.currentCharFormat(), blueFormat());

    edit.moveCursor(QTextCursor::Down);
    edit.moveCursor(QTextCursor::EndOfLine);
    QCOMPARE(edit.currentCharFormat(), linkFormat(QTextCharFormat(), QLatin1String("test.cpp:123")));

    edit.moveCursor(QTextCursor::End);
    QCOMPARE(edit.currentCharFormat(), blueFormat());
}
开发者ID:Gardenya,项目名称:qtcreator,代码行数:29,代码来源:qtoutputformatter.cpp

示例4: mSltTxtChanged

void BiLiTextSourcePropertyDlg::mSltTxtChanged() {

	QPlainTextEdit *edit = static_cast<QPlainTextEdit*>(sender());
	obs_data_t *settingText = obs_source_get_settings(mSrc);
	obs_data_set_string(settingText, "text", edit->toPlainText().toUtf8().data());
	obs_data_release(settingText);
}
开发者ID:dourgulf,项目名称:biliobs,代码行数:7,代码来源:BiLiPropertyDlg_addTextSource.cpp

示例5: UpdateSelect

void ResourceWizard::UpdateSelect()
{
    QPlainTextEdit * SelectValuesEdit = ui->SelectLines;
    QComboBox * SelectTypeCombo = ui->SelectType;
    QStringList list = SelectValuesEdit->toPlainText().split(QRegExp("[\r\n]"),QString::SkipEmptyParts);
    QWidget* SelectWidget = ui->SelectDefaultValueContainer;
    MultiSelect *multi = SelectWidget->findChild<MultiSelect *>();
    if(multi)
        multi->Update(SelectTypeCombo->currentText(),list, QList<int>());
}
开发者ID:bablosoft,项目名称:BAS,代码行数:10,代码来源:resourcewizard.cpp

示例6: setModelData

void ItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
                                const QModelIndex &index) const
{
    ItemWidget *w = m_cache[index.row()];
    if ( w != NULL) {
        w->setModelData(editor, model, index);
    } else {
        QPlainTextEdit *textEdit = (qobject_cast<QPlainTextEdit*>(editor));
        model->setData(index, textEdit->toPlainText());
    }
}
开发者ID:libbkmz,项目名称:CopyQ,代码行数:11,代码来源:itemdelegate.cpp

示例7:

QMap<LanguageManager::LangId, QString> GroupchatTopicDlg::subjectMap() const
{
    QMap<LanguageManager::LangId, QString> ret;
    for (int i = 0; i < m_ui->twLang->count(); i++) {
        QPlainTextEdit *edit = static_cast<QPlainTextEdit *>(m_ui->twLang->widget(i));
        LanguageManager::LangId id = edit->property("langId").value<LanguageManager::LangId>();
        QString text = edit->toPlainText();
        ret.insert(id, text);
    }
    return ret;
}
开发者ID:psi-im,项目名称:psi,代码行数:11,代码来源:groupchattopicdlg.cpp

示例8: changeText

void QgsStringRelay::changeText()
{
    QObject* sObj = QObject::sender();
    QTextEdit *te = qobject_cast<QTextEdit *>( sObj );
    QPlainTextEdit *pte = qobject_cast<QPlainTextEdit *>( sObj );

    if ( te )
        changeText( te->toPlainText() );
    if ( pte )
        changeText( pte->toPlainText() );
}
开发者ID:tomyun,项目名称:Quantum-GIS,代码行数:11,代码来源:qgsattributeeditor.cpp

示例9: displaySourceFile

//-------------------------------------------------------------------------
bool MainWindow::displaySourceFile(const QString& fileName, bool alwaysLoad)
{
  QPlainTextEdit *tab = getTab(fileName);
  bool result = true;

  if(alwaysLoad || tab->toPlainText().isEmpty())
  {
    result = loadSourceFile(fileName, tab);
  }
  ui.tabWidget->setCurrentWidget(tab);
  return result;
}
开发者ID:kevinzhang334455,项目名称:Scout,代码行数:13,代码来源:MainWindow_GUI.cpp

示例10: TextChanged

void WidgetInfo::TextChanged(const char *setting)
{
	obs_text_type type  = obs_proprety_text_type(property);

	if (type == OBS_TEXT_MULTILINE) {
		QPlainTextEdit *edit = static_cast<QPlainTextEdit*>(widget);
		obs_data_set_string(view->settings, setting,
				QT_TO_UTF8(edit->toPlainText()));
		return;
	}

	QLineEdit *edit = static_cast<QLineEdit*>(widget);
	obs_data_set_string(view->settings, setting, QT_TO_UTF8(edit->text()));
}
开发者ID:Antidote,项目名称:obs-studio,代码行数:14,代码来源:properties-view.cpp

示例11: if

void CSVWorld::CommandDelegate::setEditorData (QWidget *editor, const QModelIndex& index, bool tryDisplay) const
{
    QVariant variant = index.data(Qt::EditRole);
    if (tryDisplay)
    {
        if (!variant.isValid())
        {
            variant = index.data(Qt::DisplayRole);
            if (!variant.isValid())
            {
                return;
            }
        }
        QPlainTextEdit* plainTextEdit = qobject_cast<QPlainTextEdit*>(editor);
        if(plainTextEdit) //for some reason it is easier to brake the loop here
        {
            if (plainTextEdit->toPlainText() == variant.toString())
            {
                return;
            }
        }
    }

    // Color columns use a custom editor, so we need explicitly set a data for it
    CSVWidget::ColorEditor *colorEditor = qobject_cast<CSVWidget::ColorEditor *>(editor);
    if (colorEditor != nullptr)
    {
        colorEditor->setColor(variant.toInt());
        return;
    }

    QByteArray n = editor->metaObject()->userProperty().name();

    if (n == "dateTime")
    {
        if (editor->inherits("QTimeEdit"))
            n = "time";
        else if (editor->inherits("QDateEdit"))
            n = "date";
    }

    if (!n.isEmpty())
    {
        if (!variant.isValid())
            variant = QVariant(editor->property(n).userType(), (const void *)0);
        editor->setProperty(n, variant);
    }

}
开发者ID:yurikrupenin,项目名称:openmw,代码行数:49,代码来源:util.cpp

示例12: setModelData

	void BudgetEntityDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const {
		BudgetEntity entity = qvariant_cast<BudgetEntity>(index.data());
		
		QDateEdit *dateEdit = qobject_cast<QDateEdit *>( editor->layout()->itemAt(0)->widget() );
		QPlainTextEdit *textEdit = qobject_cast<QPlainTextEdit *>( editor->layout()->itemAt(1)->widget() );
		QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox *>( editor->layout()->itemAt(2)->widget() );
		
		entity.setDate(dateEdit->date());
		entity.setDescription(textEdit->toPlainText());
		entity.setAmount(spinBox->value());
		
		QVariant val;
		val.setValue<BudgetEntity>(entity);
		model->setData(index, val, Qt::EditRole);
	}
开发者ID:LukyLuke,项目名称:PiTres,代码行数:15,代码来源:budget_BudgetEntityDelegate.cpp

示例13: testQtOutputFormatter_appendMessage

void QtSupportPlugin::testQtOutputFormatter_appendMessage()
{
    QPlainTextEdit edit;
    TestQtOutputFormatter formatter;
    formatter.setPlainTextEdit(&edit);

    QFETCH(QString, inputText);
    QFETCH(QString, outputText);
    QFETCH(QTextCharFormat, inputFormat);
    QFETCH(QTextCharFormat, outputFormat);

    formatter.appendMessage(inputText, inputFormat);

    QCOMPARE(edit.toPlainText(), outputText);
    QCOMPARE(edit.currentCharFormat(), outputFormat);
}
开发者ID:Gardenya,项目名称:qtcreator,代码行数:16,代码来源:qtoutputformatter.cpp

示例14: updateContent

void LiveDataWidget::updateContent()
{
    QPlainTextEdit *edit = qobject_cast<QPlainTextEdit*>(sender());
    if (edit == NULL)
        return;

    if (!edit->hasFocus())
        return;

    if (_shortNameListView->hasFocus())
        return;

    if (_isAddNew)
        return;

    QSqlQuery query(_db);
    //if (!query.prepare(QString("UPDATE [LiveData") +
    //    edit->objectName() + 
    //    QString("] Set Content='") +
    //    edit->toPlainText() +
    //    QString("'") + 
    //    QString("'") +
    //    QString(" WHERE ShortName='") +
    //    _shortNameListView->currentIndex().data().toString() +
    //    QString("' AND Catalog='") +
    //    _currentCatalog +
    //    QString("'")))
    //{
    //    QString err = query.lastError().databaseText();
    //    return;
    //}
    if (!query.prepare(QString("UPDATE [LiveData") +
        edit->objectName() +
        QString("] Set Content=:content WHERE ShortName=:shortName AND Catalog=:catalog")))
    {
        QString err = query.lastError().databaseText();
        return;
    }
    query.bindValue(":content", edit->toPlainText());
    query.bindValue(":shortName", _shortNameListView->currentIndex().data());
    query.bindValue(":catalog", _currentCatalog);

    query.exec();
}
开发者ID:Tomic-Tech,项目名称:Database,代码行数:44,代码来源:livedatawidget.cpp

示例15: if

void CSVWorld::CommandDelegate::setEditorData (QWidget *editor, const QModelIndex& index, bool tryDisplay) const
{
    QVariant v = index.data(Qt::EditRole);
    if (tryDisplay)
    {
        if (!v.isValid())
        {
            v = index.data(Qt::DisplayRole);
            if (!v.isValid())
            {
                return;
            }
        }
        QPlainTextEdit* plainTextEdit = qobject_cast<QPlainTextEdit*>(editor);
        if(plainTextEdit) //for some reason it is easier to brake the loop here
        {
            if(plainTextEdit->toPlainText() == v.toString())
            {
                return;
            }
        }
    }

    QByteArray n = editor->metaObject()->userProperty().name();

    if (n == "dateTime") {
        if (editor->inherits("QTimeEdit"))
            n = "time";
        else if (editor->inherits("QDateEdit"))
            n = "date";
    }

    if (!n.isEmpty()) {
        if (!v.isValid())
            v = QVariant(editor->property(n).userType(), (const void *)0);
        editor->setProperty(n, v);
    }

}
开发者ID:Kleptoid,项目名称:openmw,代码行数:39,代码来源:util.cpp


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