TikzEditor::TikzEditor(QWidget *parent) : QPlainTextEdit(parent) { m_showWhiteSpaces = true; m_showTabulators = true; m_showMatchingBrackets = true; m_whiteSpacesColor = Qt::gray; m_tabulatorsColor = Qt::gray; m_matchingColor = Qt::yellow; m_highlightCurrentLineColor = Qt::yellow;; m_completer = 0; // setLineWidth(0); // setFrameShape(QFrame::NoFrame); const QColor lineColor(QApplication::style()->standardPalette().color(QPalette::Normal, QPalette::Base)); const QColor altLineColor(QApplication::style()->standardPalette().color(QPalette::Normal, QPalette::AlternateBase)); // if (lineColor == altLineColor) // m_highlightCurrentLineColor = lineColor.darker(105); // else // m_highlightCurrentLineColor = altLineColor; connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); highlightCurrentLine(); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(showCursorPosition())); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(matchBrackets())); }
CCodeEditor::CCodeEditor(QWidget *parent) : QPlainTextEdit(parent) { lineNumberArea = new CCodeEditor_LineNumberArea(this); m_foldArea = new CCodeEditor_FoldArea( this ); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); connect(this, SIGNAL(updateRequest(const QRect &, int)), this, SLOT(updateLineNumberArea(const QRect &, int))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateLineNumberAreaWidth(0); highlightCurrentLine(); setFont( QFont( "Courier New" , 11 ) ); CFileSyntaxHighlighter* s = new CFileSyntaxHighlighter( this->document() ); s->loadFromFile( "kuka_syntax.xml" ); // This second loading fail and cause to lost of first // syntax file ( TODO ) /*s = new CFileSyntaxHighlighter( this->document() ); s->loadFromFile( SYNTAX_SYSTEMFILE );*/ m_ownerDocument = NULL; m_oldBlockCount = 0; }
GenericTextEditorDocument::GenericTextEditorDocument(QWidget *parent) : QPlainTextEdit(parent), mCodec(0), mCompleter(0), mDocName(""), mFilePath(""), mTextModified(false), mFile(0), mIsOfsFile(false), mInitialDisplay(true), mCloseEvtAlreadyProcessed(false) { QSettings settings; QFont fnt = font(); fnt.setFamily("Courier New"); fnt.setPointSize(settings.value("preferences/fontSize").toUInt()); setFont(fnt); QPlainTextEdit::LineWrapMode mode; if(settings.value("preferences/lineWrapping").toBool()) mode = QPlainTextEdit::WidgetWidth; else mode = QPlainTextEdit::NoWrap; setLineWrapMode(mode); setAttribute(Qt::WA_DeleteOnClose); QFontMetrics fm(fnt); setTabStopWidth(fm.width("abcd")); mLineNumberArea = new LineNumberArea(this); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); connect(this, SIGNAL(updateRequest(const QRect &, int)), this, SLOT(updateLineNumberArea(const QRect &, int))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateLineNumberAreaWidth(0); highlightCurrentLine(); }
SqlTextEdit::SqlTextEdit(QWidget* parent) : QPlainTextEdit(parent), m_defaultCompleterModel(0) { // basic auto completer for sqliteedit m_Completer = new QCompleter(this); m_Completer->setCaseSensitivity(Qt::CaseInsensitive); m_Completer->setCompletionMode(QCompleter::PopupCompletion); m_Completer->setWrapAround(false); m_Completer->setWidget(this); // Set font QFont font("Monospace"); font.setStyleHint(QFont::TypeWriter); font.setPointSize(PreferencesDialog::getSettingsValue("editor", "fontsize").toInt()); setFont(font); QFontMetrics fm(font); setTabStopWidth(fm.width(" ") * PreferencesDialog::getSettingsValue("editor", "tabsize").toInt()); // Create syntax highlighter m_syntaxHighlighter = new SQLiteSyntaxHighlighter(document()); // Create line number area lineNumberArea = new LineNumberArea(this); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth())); connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); connect(m_Completer, SIGNAL(activated(QString)), this, SLOT(insertCompletion(QString))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); highlightCurrentLine(); updateLineNumberAreaWidth(); }
CodeArea::CodeArea(QWidget *parent) :QPlainTextEdit(parent) ,highlighter(this->document()) { QFont font; font.setFamily("Courier"); font.setFixedPitch(true); font.setPointSize(10); font.insertSubstitution(" "," "); setFont(font); setWordWrapMode(QTextOption::NoWrap); lineNumberArea = new LineNumberArea(this); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateLineNumberAreaWidth(0); highlightCurrentLine(); mCompleter = new QCompleter(this); mCompleter->setModel(new QStringListModel(mWordList, mCompleter)); mCompleter->setModelSorting(QCompleter::CaseSensitivelySortedModel); mCompleter->setCaseSensitivity(Qt::CaseSensitive); mCompleter->setWrapAround(false); mCompleter->setWidget(this); mCompleter->setCompletionMode(QCompleter::PopupCompletion); mCompleter->setCaseSensitivity(Qt::CaseInsensitive); QObject::connect(mCompleter, SIGNAL(activated(QString)), this, SLOT(insertCompletion(QString))); connect(this,SIGNAL(textChanged()), this, SLOT(onTextChange())); }
TextEditor::TextEditor(QWidget *parent) : QPlainTextEdit(parent) { lineNumberArea = new LineNumberArea(this); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateLineNumberAreaWidth(0); highlightCurrentLine(); QFont font("consolas",9); const int tabStop = 4; // 4 characters QFontMetrics metrics(font); setTabStopWidth(tabStop * metrics.width(' ')); setFont(font); setLineWrapMode(QPlainTextEdit::NoWrap); m_highlighter = new Highlighter(document()); m_autoUpdate = false; m_timer = new QTimer(); m_timer->setSingleShot(true); m_timer->setInterval(1000); connect(m_timer, SIGNAL(timeout()), this, SLOT(updateShader())); connect(this, SIGNAL(textChanged()), this, SLOT(resetTimer())); }
NoteBox::NoteBox(QWidget *parent) : QFrame(parent) { //setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); //setLineWidth(2); // Setup the main view view = new QTextEdit(this); view->setFontFamily("Courier"); //view->setLineWrapMode(QTextEdit::NoWrap); //view->setFrameStyle(QFrame::NoFrame); //view->installEventFilter(this); //inherited from QObject highlighter = new Highlighter(view->document()); // Setup the line number pane numbers = new NumberBar(this); numbers->setTextEdit(view); box = new QHBoxLayout(this); box->setSpacing(0); box->setMargin(0); box->addWidget(numbers); box->addWidget(view); connect(view, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); highlightCurrentLine(); }
void CodeEdit::reloadSettings() { if(ApplicationManager::settings()->highlightCurrentLine()) { connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); highlightCurrentLine(); }else{ connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); } }
//! Constructor ModelicaEditor::ModelicaEditor(ProjectTab *pParent) : QPlainTextEdit(pParent) { mpParentProjectTab = pParent; setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); setTabStopWidth(Helper::tabWidth); setObjectName("ModelicaEditor"); document()->setDocumentMargin(2); setLineWrapMode(QPlainTextEdit::NoWrap); // depending on the project tab readonly state set the text view readonly state setReadOnly(mpParentProjectTab->isReadOnly()); connect(this, SIGNAL(focusOut()), mpParentProjectTab, SLOT(modelicaEditorTextChanged())); connect(this, SIGNAL(textChanged()), SLOT(hasChanged())); mpFindWidget = new QWidget; mpFindWidget->setContentsMargins(0, 0, 0, 0); mpFindWidget->hide(); mpSearchLabelImage = new QLabel; mpSearchLabelImage->setPixmap(QPixmap(":/Resources/icons/search.png")); mpSearchLabel = new QLabel(Helper::search); mpSearchTextBox = new QLineEdit; connect(mpSearchTextBox, SIGNAL(textChanged(QString)), SLOT(updateButtons())); connect(mpSearchTextBox, SIGNAL(returnPressed()), SLOT(findNextText())); mpPreviuosButton = new QToolButton; mpPreviuosButton->setAutoRaise(true); mpPreviuosButton->setText(tr("Previous")); mpPreviuosButton->setIcon(QIcon(":/Resources/icons/previous.png")); mpPreviuosButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); connect(mpPreviuosButton, SIGNAL(clicked()), SLOT(findPreviuosText())); mpNextButton = new QToolButton; mpNextButton->setAutoRaise(true); mpNextButton->setText(tr("Next")); mpNextButton->setIcon(QIcon(":/Resources/icons/next.png")); mpNextButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); connect(mpNextButton, SIGNAL(clicked()), SLOT(findNextText())); mpMatchCaseCheckBox = new QCheckBox(tr("Match case")); mpMatchWholeWordCheckBox = new QCheckBox(tr("Match whole word")); mpCloseButton = new QToolButton; mpCloseButton->setAutoRaise(true); mpCloseButton->setIcon(QIcon(":/Resources/icons/exit.png")); connect(mpCloseButton, SIGNAL(clicked()), SLOT(hideFindWidget())); mpLineNumberArea = new LineNumberArea(this); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateLineNumberAreaWidth(0); highlightCurrentLine(); // make previous and next buttons disabled for first time updateButtons(); }
//![constructor] //class constructor which also connects functions to buttons and instantiates the lineNumberArea class CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent) { lineNumberArea = new LineNumberArea(this); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateLineNumberAreaWidth(0); highlightCurrentLine(); }
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent), defaultSelectionColor(QColor(240,230,140).lighter(130)),backGroundColor(Qt::white),lineAreaBGColor(240,248,255) { lineNumberArea = new LineNumberArea(this); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateLineNumberAreaWidth(0); highlightCurrentLine(); }
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent){ lineNumberArea = new LineNumberArea(this); findDialog_ = new FindDialog(this); findDialog_->setModal(false); findDialog_->setTextEdit(this); findReplaceDialog_ = new FindReplaceDialog(this); findReplaceDialog_->setModal(false); findReplaceDialog_->setTextEdit(this); qtScriptReservedWords_<<"break"<<"case"<<"catch"<<"continue"<<"debugger"<<"default"<<"delete"<<"do"<<"else"<<"finally"<<\ "for"<<"function"<<"if"<<"in"<<"instanceof"<<"new"<<"return"<<"switch"<<"this"<<"throw"<<"try"<<\ "typeof"<<"var"<<"void"<<"while"<<"with"; syntaxHighlighter_ = new ScriptSyntaxHighlighter(this->document()); s = Global::guiSettings(this); s->beginGroup("CodeEditor"); QFont font = s->value("font",this->font()).value<QFont>(); this->setFont(font); s->endGroup(); findAction = new QAction("Find...",this); connect(findAction, SIGNAL(triggered()), this, SLOT(findDialog())); findAction->setShortcut(tr("Ctrl+F")); addAction(findAction); findReplaceAction = new QAction("Replace...",this); connect(findReplaceAction, SIGNAL(triggered()), this, SLOT(findReplaceDialog())); findReplaceAction->setShortcut(tr("Ctrl+R")); addAction(findReplaceAction); beautifyAction = new QAction("Beautify javascript code",this); connect(beautifyAction, SIGNAL(triggered()), this, SLOT(beautify())); beautifyAction->setShortcut(tr("Ctrl+B")); addAction(beautifyAction); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateLineNumberAreaWidth(0); highlightCurrentLine(); completer_ = new QCompleter(this); completer_->setModel(modelFromStringList(qtScriptReservedWords_)); completer_->setModelSorting(QCompleter::CaseInsensitivelySortedModel); completer_->setCaseSensitivity(Qt::CaseInsensitive); completer_->setWrapAround(false); this->setCompleter(completer_); }
/* TextEdit widget */ TextEdit::TextEdit(QWidget *parent) : QPlainTextEdit(parent) { gutter = new Gutter(this); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateGutterWidth(int))); connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateGutter(QRect,int))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateGutterWidth(0); highlightCurrentLine(); }
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent) { this->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); lineNumberArea = new LineNumberArea(this); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateLineNumberAreaWidth(0); highlightCurrentLine(); }
CodeEditor::CodeEditor(QWidget *parent) : QTextEdit(parent) { QFont font; font.setFamily("Courier"); font.setFixedPitch(true); font.setPointSize(10); this->setFont(font); new Highlighter(this->document()); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); highlightCurrentLine(); }
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent) { lineNumberArea = new LineNumberArea(this); setFont(QFont("Ubuntu Mono")); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateLineNumberAreaWidth(0); highlightCurrentLine(); sh = new SLHSyntaxHighlighter(this->document()); }
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent) { DIN lineNumberArea = new LineNumberArea(this); this->highlighter = new Highlighter(this->document()); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); connect(this, SIGNAL(updateRequest(const QRect &, int)), this, SLOT(updateLineNumberArea(const QRect &, int))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateLineNumberAreaWidth(0); highlightCurrentLine(); DOUT }
EditorWidget::EditorWidget(QWidget *parent, config *cfg) : QPlainTextEdit(parent), conf(cfg) { // doesn't work, wat: setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); lineNumberArea = new LineNumberArea(this); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateLineNumberAreaWidth(0); highlightCurrentLine(); }
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent) { lineNumberArea = new LineNumberArea(this); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); QFont font("Monospace"); font.setStyleHint(QFont::TypeWriter); setFont(font); updateLineNumberAreaWidth(0); highlightCurrentLine(); }
void BaseEditor::disableHighlightCurrentLine() { disconnect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); currentLineSelection.clear(); updateExtraSelection(); }
void RZQtCodeEditor::MoveCursorTo(QPoint pos) { QTextCursor c = cursorForPosition(pos); textCursor().setPosition(c.position()); setTextCursor(c); highlightCurrentLine(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_ui(new Ui::MainWindow), m_errorline(-1), m_isdebug(false), m_runline(-1), m_frame(0), m_rid(0) { g_MainWindow = this; m_ui->setupUi(this); m_ui->dockWidget->setVisible(false); m_ui->dockWidget_2->setVisible(false); m_ui->dockWidget_3->setVisible(false); m_ui->dockWidget_4->setVisible(false); m_file_name.clear(); m_ui->txtedit->setPlainText(""); m_ui->txtedit->setVisible(true); m_saved.clear(); m_ui->txtedit->setFont(QFont(tr("宋体"), 20, QFont::Normal)); m_ui->txtedit->setLineWrapMode(QPlainTextEdit::NoWrap); highlightCurrentLine(); m_ui->callstackview->setFont(QFont(tr("宋体"), 20, QFont::Normal)); m_ui->callstackview->setSpacing(5); m_ui->routineview->setFont(QFont(tr("宋体"), 20, QFont::Normal)); m_ui->routineview->setSpacing(5); m_ui->byteview->setFont(QFont(tr("宋体"), 10, QFont::Normal)); m_ui->byteview->setLineWrapMode(QTextEdit::NoWrap); m_ui->memview->setFont(QFont(tr("宋体"), 10, QFont::Normal)); m_ui->memview->setSpacing(5); new QSyntaxHighlighterFake(m_ui->txtedit->document()); memset(m_argv, 0, sizeof(m_argv)); m_fk = newfake(); fkopenalllib(m_fk); fkseterrorfunc(m_fk, fk_error_func); fksetprintfunc(m_fk, fk_print_func); QFileInfo fi("sample.fk"); if (fi.exists()) { Openfile("sample.fk"); UpdateStatusBar(); } m_ui->callstackview->hide(); m_ui->byteview->hide(); m_ui->memview->hide(); m_ui->routineview->hide(); m_ui->horizontalLayout_2->removeItem(m_ui->verticalLayout); }
/** * @brief CodeEditor::CodeEditor Create empty code editor. * @param parent Get parent of this object. * @param path Path of opened file. * @param type Type of opened shader. */ CodeEditor::CodeEditor(QWidget *parent, QString path, InfoManager::SHADERTYPE type) : QPlainTextEdit(parent) { lineNumberArea = new LineNumberArea(this); oldBlockNumber = 0; customConnect(); updateLineNumberAreaWidth(0); highlightCurrentLine(); pathSet = true; filePath = path; //textModif = false; // set shader type sType = type; // set syntax highlighter highlight = new Highlighter(this); highlight->setDocument(document()); // read the file readFile(); setDefaultSettings(); createRegExps(); }
void Editor::updateOnCursorPositionChange() { // convert the absolute pos into a row/col pair, and set current line aswell QString s = editor->toPlainText(); int pos = editor->textCursor().position(); int row = 1; int last_break = -1; int next_break = 0; for (int i = 0; i < s.length(); i++) { if (s.at(i) == '\n' && i < pos) { last_break = i; row++; } else if (s.at(i) == '\n' && i >= pos) { next_break = i; break; } } if (next_break == 0) next_break = s.length(); if (currentRow != row) { currentRow = row; highlightCurrentLine(); editor->highlightCurrentLine(); } currentCol = pos - last_break; currentLine = s.mid(last_break+1, next_break-last_break-1); emit cursorPositionChanged(); }
XmlEdit::XmlEdit(QWidget *parent) : QPlainTextEdit(parent), completedAndSelected(false) { createWidgets(); createConnections(); highlightCurrentLine(); }
QScriptEdit::QScriptEdit(QWidget *parent) : QPlainTextEdit(parent) { m_baseLineNumber = 1; m_executionLineNumber = -1; m_extraArea = new QScriptEditExtraArea(this); QObject::connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateExtraAreaWidth())); QObject::connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateExtraArea(QRect,int))); QObject::connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateExtraAreaWidth(); //> NeoScriptTools setTabStopWidth(24); #ifdef WIN32 QFont font("Courier New"); font.setPointSize(10); document()->setDefaultFont(font); #endif setLineWrapMode(QPlainTextEdit::NoWrap); //< NeoScriptTools #ifndef QT_NO_SYNTAXHIGHLIGHTER (void) new QScriptSyntaxHighlighter(document()); #endif }
MLScriptEditor::MLScriptEditor( QWidget* par /*= NULL*/ ) :QPlainTextEdit(par),regexps(),synt(NULL),synhigh(NULL),comp(NULL) { QTextDocument* mydoc = new QTextDocument(this); QPlainTextDocumentLayout* ld = new QPlainTextDocumentLayout(mydoc); mydoc->setDocumentLayout(ld); setDocument(mydoc); narea = new MLNumberArea(this); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); //connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateCursorPos(int))); connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateLineNumberAreaWidth(0); highlightCurrentLine(); }
/*! * \brief TextDoc::TextDoc Text document constructor * \param App_ is the parent object * \param Name_ is the initial text document name */ TextDoc::TextDoc(QucsApp *App_, const QString& Name_) : QPlainTextEdit(), QucsDoc(App_, Name_) { TextFont = QFont("Courier New"); TextFont.setPointSize(QucsSettings.font.pointSize()-1); TextFont.setStyleHint(QFont::Courier); TextFont.setFixedPitch(true); document()->setDefaultFont(TextFont); simulation = true; Library = ""; Libraries = ""; SetChanged = false; devtype = DEV_DEF; tmpPosX = tmpPosY = 1; // set to 1 to trigger line highlighting Scale = (float)TextFont.pointSize(); //TODO (not supported) setUndoDepth(QucsSettings.maxUndo); setLanguage (Name_); QFileInfo Info (Name_); if(App) { if(Name_.isEmpty()) { App->DocumentTab->addTab(this, QPixmap(empty_xpm), QObject::tr("untitled")); } else { App->DocumentTab->addTab(this, QPixmap(empty_xpm), Info.fileName()); } App->DocumentTab->setCurrentPage(App->DocumentTab->indexOf(this)); viewport()->setFocus(); setWordWrapMode(QTextOption::NoWrap); setPaletteBackgroundColor(QucsSettings.BGColor); connect(this, SIGNAL(textChanged()), SLOT(slotSetChanged())); connect(this, SIGNAL(cursorPositionChanged()), SLOT(slotCursorPosChanged())); syntaxHighlight = new SyntaxHighlighter(this); syntaxHighlight->setLanguage(language); syntaxHighlight->setDocument(document()); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); highlightCurrentLine(); } }
void XmlEdit::createConnections() { connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); connect(completer, SIGNAL(activated(const QString&)), this, SLOT(insertCompletion(const QString&))); (void) new QShortcut(QKeySequence(tr("Ctrl+M", "Complete")), this, SLOT(performCompletion())); }
GlslTextEdit::GlslTextEdit(QWidget *parent) : PlainTextWithLineNumberAreaSupport(parent) , m_highlighter(NULL) , m_completer(NULL) , m_lineNumberArea(NULL) , m_gotDocumentAssigned(false) , m_font(new QFont("Consolas, Courier New, Courier", 9)) { m_highlighter = new GlslHighlighter(); m_lineNumberArea = new LineNumberArea(*this); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); highlightCurrentLine(); setDocument(NULL, GLSLT_Undefined); }