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


C++ PlainTextEditor类代码示例

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


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

示例1: PlainTextEditor

Core::IEditor *PlainTextEditorEditable::duplicate(QWidget *parent)
{
    PlainTextEditor *newEditor = new PlainTextEditor(parent);
    newEditor->duplicateFrom(editor());
    TextEditorPlugin::instance()->initializeEditor(newEditor);
    return newEditor->editableInterface();
}
开发者ID:TheProjecter,项目名称:project-qtcreator,代码行数:7,代码来源:plaintexteditor.cpp

示例2: wrapLines

void MainUI::wrapLines(bool wrap){
  settings->setValue("wrapLines",wrap);
  for(int i=0; i<ui->tabWidget->count(); i++){
    PlainTextEditor *edit = static_cast<PlainTextEditor*>(ui->tabWidget->widget(i));
    edit->setLineWrapMode( wrap ? QPlainTextEdit::WidgetWidth : QPlainTextEdit::NoWrap);
  }	
}
开发者ID:yamajun,项目名称:lumina,代码行数:7,代码来源:MainUI.cpp

示例3: check_PlainTextEditor_blockCount

void BlackMilordTests::check_PlainTextEditor_blockCount()
{
    PlainTextEditor *editor = Gui::plainTextEditor();
    QString testString = "test\ntest";
    editor->setPlainText(testString);
    QVERIFY(editor->blockCount() == 2);
}
开发者ID:blackmilord,项目名称:blackmilord,代码行数:7,代码来源:Tests.cpp

示例4: showLineNumbers

void MainUI::showLineNumbers(bool show){
  settings->setValue("showLineNumbers",show);
  for(int i=0; i<ui->tabWidget->count(); i++){
    PlainTextEditor *edit = static_cast<PlainTextEditor*>(ui->tabWidget->widget(i));
    edit->showLineNumbers(show);
  }
}
开发者ID:yamajun,项目名称:lumina,代码行数:7,代码来源:MainUI.cpp

示例5: check_PlainTextEditor_typing

void BlackMilordTests::check_PlainTextEditor_typing()
{
    PlainTextEditor *editor = Gui::plainTextEditor();
    QTest::keyEvent(QTest::Click, editor->asWidget(), Qt::Key_A);
    QVERIFY(editor->toPlainText() == "a");
    QTest::keyEvent(QTest::Click, editor->asWidget(), Qt::Key_B);
    QVERIFY(editor->toPlainText() == "ab");
}
开发者ID:blackmilord,项目名称:blackmilord,代码行数:8,代码来源:Tests.cpp

示例6: check_PlainTextEditor_visibleBlocks

void BlackMilordTests::check_PlainTextEditor_visibleBlocks()
{
    PlainTextEditor *editor = Gui::plainTextEditor();
    QString testString = "test\ntest";
    editor->setPlainText(testString);
    QVERIFY(editor->firstVisibleBlock() == 0);
    QVERIFY(editor->lastVisibleBlock() == 1);
}
开发者ID:blackmilord,项目名称:blackmilord,代码行数:8,代码来源:Tests.cpp

示例7: currentEditor

void MainUI::openReplace(){
  PlainTextEditor *cur = currentEditor();
  if(cur==0){ return; }
  ui->groupReplace->setVisible(true);
  ui->line_find->setText( cur->textCursor().selectedText() );
  ui->line_replace->setText(""); 
  ui->line_replace->setFocus();
}
开发者ID:yamajun,项目名称:lumina,代码行数:8,代码来源:MainUI.cpp

示例8: tabClosed

void MainUI::tabClosed(int tab){
  PlainTextEditor *edit = static_cast<PlainTextEditor*>(ui->tabWidget->widget(tab));
  if(edit==0){ return; } //should never happen
  if(edit->hasChange()){
    //Verify if the user wants to lose any unsaved changes
	  
  }
  ui->tabWidget->removeTab(tab);
  edit->deleteLater();
}
开发者ID:yamajun,项目名称:lumina,代码行数:10,代码来源:MainUI.cpp

示例9: check_PlainTextEditor_setTextgetText

void BlackMilordTests::check_PlainTextEditor_setTextgetText()
{
    PlainTextEditor *editor = Gui::plainTextEditor();
    QString testString = "test";
    editor->setPlainText(testString);
    QVERIFY(editor->toPlainText() == testString);
    testString = "test\ntest";
    editor->setPlainText(testString);
    QVERIFY(editor->toPlainText() == testString);
}
开发者ID:blackmilord,项目名称:blackmilord,代码行数:10,代码来源:Tests.cpp

示例10: check_PlainTextEditor_getCursorPosition

void BlackMilordTests::check_PlainTextEditor_getCursorPosition()
{
    PlainTextEditor *editor = Gui::plainTextEditor();
    QVERIFY(editor->getCursorPosition() == 0);
    QTest::keyEvent(QTest::Click, editor->asWidget(), Qt::Key_A);
    QVERIFY(editor->getCursorPosition() == 1);
    QTest::keyEvent(QTest::Click, editor->asWidget(), Qt::Key_B);
    QVERIFY(editor->getCursorPosition() == 2);
    QTest::keyEvent(QTest::Click, editor->asWidget(), Qt::Key_Enter);
    QVERIFY(editor->getCursorPosition() == 3);
    QTest::keyEvent(QTest::Click, editor->asWidget(), Qt::Key_A);
    QVERIFY(editor->getCursorPosition() == 4);
}
开发者ID:blackmilord,项目名称:blackmilord,代码行数:13,代码来源:Tests.cpp

示例11: updateTab

void MainUI::updateTab(QString file){
  PlainTextEditor *cur = 0;
  int index = -1;
  for(int i=0; i<ui->tabWidget->count(); i++){
    PlainTextEditor *tmp = static_cast<PlainTextEditor*>(ui->tabWidget->widget(i));
    if(tmp->currentFile()==file){
	cur = tmp;
	index = i;
	break;
    }
  }
  if(cur==0){ return; } //should never happen
  bool changes = cur->hasChange();
  //qDebug() << "Update Tab:" << file << cur << changes;
  ui->tabWidget->setTabText(index,(changes ? "*" : "") + file.section("/",-1));
  ui->actionSave_File->setEnabled(changes);
  this->setWindowTitle( ui->tabWidget->tabText( ui->tabWidget->currentIndex() ) );
}
开发者ID:yamajun,项目名称:lumina,代码行数:18,代码来源:MainUI.cpp

示例12: updateEditorInfoBar

void PlainTextEditorFactory::updateEditorInfoBar(Core::IEditor *editor)
{
    PlainTextEditor *editorEditable = qobject_cast<PlainTextEditor *>(editor);
    if (editorEditable) {
        PlainTextEditorWidget *textEditor = static_cast<PlainTextEditorWidget *>(editorEditable->editorWidget());
        if (textEditor->isMissingSyntaxDefinition() &&
            !textEditor->ignoreMissingSyntaxDefinition() &&
            TextEditorSettings::instance()->highlighterSettings().alertWhenNoDefinition()) {
            Core::EditorManager::instance()->showEditorInfoBar(
                Constants::INFO_SYNTAX_DEFINITION,
                tr("A highlight definition was not found for this file. "
                   "Would you like to try to find one?"),
                tr("Show highlighter options"),
                textEditor,
                SLOT(acceptMissingSyntaxDefinitionInfo()),
                SLOT(ignoreMissingSyntaxDefinitionInfo()));
            return;
        }
    }
    Core::EditorManager::instance()->hideEditorInfoBar(Constants::INFO_SYNTAX_DEFINITION);
}
开发者ID:NoobSaibot,项目名称:qtcreator-minimap,代码行数:21,代码来源:plaintexteditorfactory.cpp

示例13: tr

void MainUI::OpenFile(QString file){
  QStringList files;
  if(file.isEmpty()){
    //Prompt for a file to open
    files = QFileDialog::getOpenFileNames(this, tr("Open File(s)"), currentFileDir(), tr("Text Files (*)") );
    if(files.isEmpty()){ return; } //cancelled
  }else{
    files << file;
  }
  for(int i=0; i<files.length(); i++){
    PlainTextEditor *edit = new PlainTextEditor(settings, this);
      connect(edit, SIGNAL(FileLoaded(QString)), this, SLOT(updateTab(QString)) );
      connect(edit, SIGNAL(UnsavedChanges(QString)), this, SLOT(updateTab(QString)) );
    ui->tabWidget->addTab(edit, files[i].section("/",-1));
    edit->showLineNumbers(ui->actionLine_Numbers->isChecked());
    edit->setLineWrapMode( ui->actionWrap_Lines->isChecked() ? QPlainTextEdit::WidgetWidth : QPlainTextEdit::NoWrap);
    edit->setFocusPolicy(Qt::ClickFocus); //no "tabbing" into this widget
    ui->tabWidget->setCurrentWidget(edit);
    edit->LoadFile(files[i]);
    edit->setFocus();
    QApplication::processEvents(); //to catch the fileLoaded() signal
  }
}
开发者ID:yamajun,项目名称:lumina,代码行数:23,代码来源:MainUI.cpp

示例14: check_PlainTextEditor_setCursorPosition

void BlackMilordTests::check_PlainTextEditor_setCursorPosition()
{
    PlainTextEditor *editor = Gui::plainTextEditor();
    QString testString = "testtest";
    editor->setPlainText(testString);
    QVERIFY(editor->getCursorPosition() == 8);
    editor->setCursorPosition(4);
    QVERIFY(editor->getCursorPosition() == 4);
    editor->setCursorPosition(0);
    QVERIFY(editor->getCursorPosition() == 0);
    editor->setCursorPositionToEnd();
    QVERIFY(editor->getCursorPosition() == 8);
    editor->setCursorPositionToStart();
    QVERIFY(editor->getCursorPosition() == 0);
}
开发者ID:blackmilord,项目名称:blackmilord,代码行数:15,代码来源:Tests.cpp

示例15: check_PlainTextEditor_redoUndoAvailability

void BlackMilordTests::check_PlainTextEditor_redoUndoAvailability()
{
    PlainTextEditor *editor = Gui::plainTextEditor();
    QVERIFY(!editor->canRedo());
    QVERIFY(!editor->canUndo());
    QTest::keyEvent(QTest::Click, editor->asWidget(), Qt::Key_A);
    QVERIFY(!editor->canRedo());
    QVERIFY(editor->canUndo());
    QTest::keyEvent(QTest::Click, editor->asWidget(), Qt::Key_Enter);
    QVERIFY(!editor->canRedo());
    QVERIFY(editor->canUndo());
    QTest::keyEvent(QTest::Click, editor->asWidget(), Qt::Key_A);
    QVERIFY(!editor->canRedo());
    QVERIFY(editor->canUndo());

    editor->undo();
    QVERIFY(editor->canRedo());
    QVERIFY(editor->canUndo());

    editor->undo();
    QVERIFY(editor->canRedo());
    QVERIFY(!editor->canUndo());

    editor->redo();
    QVERIFY(editor->canRedo());
    QVERIFY(editor->canUndo());

    editor->redo();
    QVERIFY(!editor->canRedo());
    QVERIFY(editor->canUndo());
}
开发者ID:blackmilord,项目名称:blackmilord,代码行数:31,代码来源:Tests.cpp


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