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(); }
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 }
HaiQTextEdit::HaiQTextEdit(QWidget *parent) : QTextEdit(parent), num_tab_spaces(0), emit_key_only_mode(false) { setTabStopWidth(20); //pixels setFrameStyle(QFrame::NoFrame); //here's a temporary workaround to the setLineWrapMode(QTextEdit:NoWrap) bug... setLineWrapMode(QTextEdit::NoWrap); //CHECK IF THIS WORKS!! //setLineWrapMode(QTextEdit::FixedPixelWidth); //setLineWrapColumnOrWidth(2500); ////////////////s////////////////////////////////////////////////////////////////// braces_highlighting_timer.setSingleShot(true); braces_highlighting_timer.setInterval(600); connect(&braces_highlighting_timer,SIGNAL(timeout()),this,SLOT(slot_clear_braces_highlighting())); setAcceptRichText(true); grabShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Tab), Qt::ApplicationShortcut); has_temporary_marker=false; do_emit_modification_changed=true; }
QMarkdownTextEdit::QMarkdownTextEdit(QWidget *parent) : QTextEdit(parent) { installEventFilter( this ); viewport()->installEventFilter( this ); // setup the markdown highlighting _highlighter = new HGMarkdownHighlighter( document(), 1000 ); // TODO: migrate to somewhere else // load text edit font QSettings settings; QFont font = this->font(); QString fontString = settings.value("MainWindow/noteTextEdit.font").toString(); if ( fontString != "" ) { // set the note text edit font font.fromString( fontString ); setFont( font ); // set the default size for the highlighter _highlighter->setDefaultStyles( font.pointSize() ); } // set the tab stop to the width of 4 spaces in the editor const int tabStop = 4; QFontMetrics metrics( font ); setTabStopWidth( tabStop * metrics.width( ' ' ) ); }
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(); }
void PostWindow::applySettings(Settings::Manager * settings) { int scrollback = settings->value("IDE/postWindow/scrollback").toInt(); QFont font = settings->codeFont(); QPalette palette; settings->beginGroup("IDE/editor/colors"); if (settings->contains("text")) { QTextCharFormat format = settings->value("text").value<QTextCharFormat>(); QBrush bg = format.background(); QBrush fg = format.foreground(); if (bg.style() != Qt::NoBrush) palette.setBrush(QPalette::Base, bg); if (fg.style() != Qt::NoBrush) palette.setBrush(QPalette::Text, fg); } settings->endGroup(); // colors bool lineWrap = settings->value("IDE/postWindow/lineWrap").toBool(); setMaximumBlockCount(scrollback); setFont(font); setPalette(palette); setLineWrap( lineWrap ); QFontMetrics metrics (font); QString stringOfSpaces (settings->value("IDE/editor/indentWidth").toInt(), QChar(' ')); setTabStopWidth(metrics.width(stringOfSpaces)); updateActionShortcuts(settings); }
//Reset the console void pConsole::reset() { clear(); setTextInteractionFlags( Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard | Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard | Qt::TextEditable ); setUndoRedoEnabled( false ); setTabStopWidth( 30 ); QFont font = QFont( "Bitstream Vera Sans Mono", 11 ); font.setBold( true ); setFont( font ); QPalette pal = viewport()->palette(); pal.setColor( viewport()->backgroundRole(), QColor( Qt::black ) ); pal.setColor( viewport()->foregroundRole(), QColor( Qt::white ) ); viewport()->setPalette( pal ); mColors[ ctCommand ] = Qt::white; mColors[ ctError ] = Qt::red; mColors[ ctOutput ] = Qt::blue; mColors[ ctCompletion ] = Qt::green; mRecordedScript.clear(); mTypedCommand.clear(); setHistory( QStringList() ); setPromptVisible( true ); setPrompt( "@:/> " ); }
Wt_TextEdit::Wt_TextEdit() { QFont font; font.setFamily("monaco"); font.setFixedPitch(true); font.setPointSize(9); setFont(font); setTabStopWidth(4 * fontMetrics().width(' ')); //setStyleSheet("QPlainTextEdit {background: #262626; color:#D4D4D4}"); setStyleSheet("QPlainTextEdit {background: #373737; color:#D4D4D4;}"); //setStyleSheet("QPlainTextEdit {background: #F2F2F2; color:#D4D4D4}"); //setStyleSheet("QPlainTextEdit {background: url('bg2.png'); color:#D4D4D4}"); setLineWrapMode(QPlainTextEdit::NoWrap); setTabChangesFocus(true); highLight = new Wt_HighLight(this->document()); //QShortcut *action = new QShortcut(QKeySequence(tr("ctrl+f")),this); //connect(action, SIGNAL(activated()), this, SLOT(wt_selectionHighLight())); //connect(this, SIGNAL(selectionChanged()), this, SLOT(wt_selectionChanged())); //Wt_HighLight *searchTextHighLight = new Wt_HighLight(this->document(), Wt_HighLight::HighLightSearchText); //searchTextHighLight->initSearchTextHighlighting(tr("include")); //this->document()->setTextWidth(100); //block().blockFormat().setLineHeight(20, QTextBlockFormat::FixedHeight); }
void CodeEditer::setTab() { QFont font = this->font(); QFontMetrics fm(font); int pixelsWide = fm.width("x"); setTabStopWidth(TAB_SIZE * pixelsWide); }
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())); }
StyleSheetEditor::StyleSheetEditor(QWidget *parent) : QTextEdit(parent) { setTabStopWidth(fontMetrics().width(QLatin1Char(' '))*4); setAcceptRichText(false); new CssHighlighter(document()); }
void CodeEditor::onPrefsChanged( const QString &name ){ QString t( name ); Prefs *prefs=Prefs::prefs(); if( t=="" || t=="backgroundColor" || t=="fontFamily" || t=="fontSize" || t=="tabSize" || t=="smoothFonts" ){ QColor bg=prefs->getColor( "backgroundColor" ); QColor fg( 255-bg.red(),255-bg.green(),255-bg.blue() ); QPalette p=palette(); p.setColor( QPalette::Base,bg ); p.setColor( QPalette::Text,fg ); setPalette( p ); QFont font; font.setFamily( prefs->getString( "fontFamily" ) ); font.setPixelSize( prefs->getInt( "fontSize" ) ); if( prefs->getBool( "smoothFonts" ) ){ font.setStyleStrategy( QFont::PreferAntialias ); }else{ font.setStyleStrategy( QFont::NoAntialias ); } setFont( font ); QFontMetrics fm( font ); setTabStopWidth( fm.width( 'X' )* prefs->getInt( "tabSize" ) ); } }
//! 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(); }
void SourceWindow::setTabWidth(int numChars) { if (numChars <= 0) numChars = 8; QFontMetrics fm(document()->defaultFont()); QString s; int w = fm.width(s.fill('x', numChars)); setTabStopWidth(w); }
ClientTextEdit::ClientTextEdit(QWidget* parent) : QTextEdit(parent) { setReadOnly(true); setOverwriteMode(true); setUndoRedoEnabled(false); setDocumentTitle("mClient"); setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse); setTabChangesFocus(false); //_doc->setMaximumBlockCount(Config().scrollbackSize); // max number of lines? document()->setUndoRedoEnabled(false); QTextFrame* frame = document()->rootFrame(); _cursor = frame->firstCursorPosition(); // Default Colors _foregroundColor = Qt::lightGray; _backgroundColor = Qt::black; _blackColor = Qt::darkGray; _redColor = Qt::darkRed; _greenColor = Qt::darkGreen; _yellowColor = Qt::darkYellow; _blueColor = Qt::darkBlue; _magentaColor = Qt::darkMagenta; _cyanColor = Qt::darkCyan; _grayColor = Qt::lightGray; _darkGrayColor = Qt::gray; _brightRedColor = Qt::red; _brightGreenColor = Qt::green; _brightYellowColor = Qt::yellow; _brightBlueColor = Qt::blue; _brightMagentaColor = Qt::magenta; _brightCyanColor = Qt::cyan; _whiteColor = Qt::white; // Default Fonts _serverOutputFont = QFont("Monospace", 10); _inputLineFont = QFont("Monospace", 10); //QApplication::font(); _serverOutputFont.setStyleHint(QFont::TypeWriter, QFont::PreferAntialias); QTextFrameFormat frameFormat = frame->frameFormat(); frameFormat.setBackground(_backgroundColor); frameFormat.setForeground(_foregroundColor); frame->setFrameFormat(frameFormat); _format = _cursor.charFormat(); setDefaultFormat(_format); _defaultFormat = _format; _cursor.setCharFormat(_format); QFontMetrics fm(_serverOutputFont); setTabStopWidth(fm.width(" ") * 8); // A tab is 8 spaces wide QScrollBar* scrollbar = verticalScrollBar(); scrollbar->setSingleStep(fm.leading()+fm.height()); connect(scrollbar, SIGNAL(sliderReleased()), this, SLOT(scrollBarReleased())); previous = 0; }
CPPSourceCodeView::CPPSourceCodeView(shared_ptr<CPPCodeGenerator> const &cg, QWidget *parent) : QTextEdit(parent) , m_CodeGen(cg) { setTabStopWidth(24); std::ostringstream oss; cg->operator ()(oss); setPlainText(oss.str().c_str()); }
void SyntaxTextEditor::loadConfig(QSettings *settings, const QString &mimeType) { autoIndent = settings->value(mimeType+"/autoindent",true).toBool(); autoBlock = settings->value(mimeType+"/autoblock",true).toBool(); curFont.setFamily(settings->value(mimeType+"/family","Courier").toString()); curFont.setPointSize(settings->value(mimeType+"/fontsize",12).toInt()); setFont(curFont); setTabStopWidth(fontMetrics().width("main")); autoWord = settings->value(mimeType+"/autoword",false).toBool(); }
//------------------------------------------------------------------------- CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent) { lineNumberArea = 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))); updateLineNumberAreaWidth(0); setTabStopWidth (20); }
void TextEdit::setPalette(const PythonPalette& p) { QFont fnt(p.mainFont, p.mainFontPointSize); setFont(fnt); auto w = p.tabWidth * fontMetrics().width(' '); setTabStopWidth(w); if (m_Highlighter) m_Highlighter->setPalette(p); }
ScriptEdit::ScriptEdit(ScriptEngine *scriptEngine, QWidget *parent) : QTextEdit(parent) { document()->setDefaultFont(QFont("Courier", 11, -1, false)); setTabStopWidth(32); setLineWrapMode(QTextEdit::NoWrap); m.syntaxHighlighter = new SyntaxHighlighter(document()); m.scriptEngine = scriptEngine; m.suggesting = false; }
void QEditor::updateStyles() { //kdDebug(9032) << "QEditor::updateStyles()" << endl; int tabwidth = tabStop(); QSourceColorizer* colorizer = dynamic_cast<QSourceColorizer*>( getDocument()->preProcessor() ); if( colorizer ){ setFont( colorizer->format( 0 )->font() ); setTabStopWidth( colorizer->format(0)->width('x') * tabwidth ); getDocument()->setTabStops( colorizer->format(0)->width('x') * tabwidth ); } Q3TextEdit::updateStyles(); }
EBTextEdit::EBTextEdit(const QString & sFullFileName, EditorView::Type viewType, EditorTabWidget *parent) : QPlainTextEdit(parent), m_FullFileName(sFullFileName), m_ViewType(viewType), m_EditorTabWidget(parent), m_Highlighter(NULL) { setBaseSize(50,50); setTabStopWidth(16); if (viewType == EditorView::XmlSource) m_Highlighter = new XmlHighlighter(document()); }
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent), m_lineNumMode(NORMAL) { lineNumberArea = new LineNumberArea(this); setTabStopWidth(20); 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(); }
void EditorView::loadPreferences() { QSettings settings; settings.beginGroup("Features"); tabStop = settings.value("tabStop", 4).toInt(); autoComplete = settings.value("autoComplete", true).toBool(); smartIndent = settings.value("smartIndent", true).toBool(); indentGuides = settings.value("indentGuides", true).toBool(); highlightLine = settings.value("highlightLine", true).toBool(); settings.endGroup(); setTabStopWidth(tabStop * QFontMetrics(currentTheme->getFont()).width(' ')); }
CSVWorld::ScriptEdit::ScriptEdit (const CSMDoc::Document& document, ScriptHighlighter::Mode mode, QWidget* parent) : QPlainTextEdit (parent), mDocument (document), mWhiteListQoutes("^[a-z|_]{1}[a-z|0-9|_]{0,}$", Qt::CaseInsensitive), mChangeLocked (0) { // setAcceptRichText (false); setLineWrapMode (QPlainTextEdit::NoWrap); setTabStopWidth (4); setUndoRedoEnabled (false); // we use OpenCS-wide undo/redo instead mAllowedTypes <<CSMWorld::UniversalId::Type_Journal <<CSMWorld::UniversalId::Type_Global <<CSMWorld::UniversalId::Type_Topic <<CSMWorld::UniversalId::Type_Sound <<CSMWorld::UniversalId::Type_Spell <<CSMWorld::UniversalId::Type_Cell <<CSMWorld::UniversalId::Type_Referenceable <<CSMWorld::UniversalId::Type_Activator <<CSMWorld::UniversalId::Type_Potion <<CSMWorld::UniversalId::Type_Apparatus <<CSMWorld::UniversalId::Type_Armor <<CSMWorld::UniversalId::Type_Book <<CSMWorld::UniversalId::Type_Clothing <<CSMWorld::UniversalId::Type_Container <<CSMWorld::UniversalId::Type_Creature <<CSMWorld::UniversalId::Type_Door <<CSMWorld::UniversalId::Type_Ingredient <<CSMWorld::UniversalId::Type_CreatureLevelledList <<CSMWorld::UniversalId::Type_ItemLevelledList <<CSMWorld::UniversalId::Type_Light <<CSMWorld::UniversalId::Type_Lockpick <<CSMWorld::UniversalId::Type_Miscellaneous <<CSMWorld::UniversalId::Type_Npc <<CSMWorld::UniversalId::Type_Probe <<CSMWorld::UniversalId::Type_Repair <<CSMWorld::UniversalId::Type_Static <<CSMWorld::UniversalId::Type_Weapon <<CSMWorld::UniversalId::Type_Script <<CSMWorld::UniversalId::Type_Region; mHighlighter = new ScriptHighlighter (document.getData(), mode, ScriptEdit::document()); connect (&document.getData(), SIGNAL (idListChanged()), this, SLOT (idListChanged())); connect (&mUpdateTimer, SIGNAL (timeout()), this, SLOT (updateHighlighting())); mUpdateTimer.setSingleShot (true); }
void ScriptTextEdit::setupUi() { QFont font; font.setFamily("courier"); font.setPointSize(10); setFont( font ); setTabStopWidth(40); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth())); connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateLineNumberAreaWidth(); }
void ScriptView::installFont() { QFont font; font.setFamily("Courier"); font.setFixedPitch(true); font.setPointSize(10); setFont(font); const int tabstop = 3; QFontMetrics metrics(font); mTabWidth = metrics.width(' ') * tabstop; setTabStopWidth(mTabWidth); }
PythonTypeIn::PythonTypeIn() { prompt(false); QTextCursor tc = textCursor(); tc.movePosition(QTextCursor::End); tail_ = tc.position(); setTabStopWidth(4); completer_ = new QCompleter(this); completer_->setWidget(this); QObject::connect(completer_, SIGNAL(activated(const QString &)), this, SLOT(insertCompletion(const QString &))); }
MyTextEdit::MyTextEdit(QWidget *parent) : QPlainTextEdit(parent), m_contextMenu(this), m_tabulatorWidth(8) { setLineWrapMode(QPlainTextEdit::NoWrap); setTabStopWidth(40); m_lineNumbers = new MyLineNumbers(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(highlightLines())); updateLineNumberAreaWidth(0); highlightLines(); // highlightCurrentLine(); }
CodeEdit::CodeEdit(QWidget* parent) : QPlainTextEdit(parent) { statusArea_ = new StatusArea(this); font_.setFamily("Courier New"); font_.setStyleHint(QFont::TypeWriter); font_.insertSubstitution("Courier New", "monospace"); font_.setFixedPitch(true); font_.setPointSize(9); setFont(font_); QFontMetrics metrics(font_); setTabStopWidth(metrics.width(" ")*4); connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateStatusAreaWidth(int))); connect(this, SIGNAL(updateRequest(const QRect &, int)), this, SLOT(updateStatusArea(const QRect &, int))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateStatusAreaWidth(0); highlightCurrentLine(); }