/* ** Configure QsciScintilla query widget */ void ScriptWidget::_configureQueryText() { QsciLexerJavaScript *javaScriptLexer = new JSLexer(this); javaScriptLexer->setFont(_textFont); _queryText->setFixedHeight(23); _queryText->setAutoIndent(true); _queryText->setIndentationsUseTabs(false); _queryText->setIndentationWidth(4); _queryText->setUtf8(true); _queryText->installEventFilter(this); _queryText->setMarginWidth(1, 0); // to hide left gray column _queryText->setBraceMatching(QsciScintilla::StrictBraceMatch); _queryText->setFont(_textFont); _queryText->setPaper(QColor(255, 0, 0, 127)); _queryText->setLexer(javaScriptLexer); _queryText->setCaretForegroundColor(QColor("#FFFFFF")); _queryText->setMatchedBraceBackgroundColor(QColor(73, 76, 78)); _queryText->setMatchedBraceForegroundColor(QColor("#FF8861")); //1AB0A6 _queryText->setWrapMode((QsciScintilla::WrapMode)QsciScintilla::SC_WRAP_NONE); _queryText->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); _queryText->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); //_queryText->SendScintilla(QsciScintilla::SCI_SETFONTQUALITY, QsciScintilla::SC_EFF_QUALITY_LCD_OPTIMIZED); //_queryText->SendScintilla (QsciScintillaBase::SCI_SETKEYWORDS, "db"); _queryText->setStyleSheet("QFrame { background-color: rgb(73, 76, 78); border: 1px solid #c7c5c4; border-radius: 4px; margin: 0px; padding: 0px;}"); connect(_queryText, SIGNAL(linesChanged()), SLOT(ui_queryLinesCountChanged())); connect(_queryText, SIGNAL(textChanged()), SLOT(onTextChanged())); connect(_queryText, SIGNAL(cursorPositionChanged(int,int)), SLOT(onCursorPositionChanged(int,int))); }
/* ** Configure QsciScintilla query widget */ void FunctionTextEditor::_configureQueryText() { QsciLexerJavaScript *javaScriptLexer = new JSLexer(this); javaScriptLexer->setFont(_textFont); _queryText->setAutoIndent(true); _queryText->setIndentationsUseTabs(false); _queryText->setIndentationWidth(4); _queryText->setUtf8(true); _queryText->installEventFilter(this); _queryText->setMarginWidth(1, 0); // to hide left gray column _queryText->setBraceMatching(QsciScintilla::StrictBraceMatch); _queryText->setFont(_textFont); _queryText->setPaper(QColor(255, 0, 0, 127)); _queryText->setLexer(javaScriptLexer); _queryText->setCaretForegroundColor(QColor("#FFFFFF")); _queryText->setMatchedBraceBackgroundColor(QColor(73, 76, 78)); _queryText->setMatchedBraceForegroundColor(QColor("#FF8861")); //1AB0A6 _queryText->setWrapMode((QsciScintilla::WrapMode)QsciScintilla::SC_WRAP_NONE); _queryText->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); _queryText->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); // Wrap mode turned off because it introduces huge performance problems // even for medium size documents. _queryText->setWrapMode((QsciScintilla::WrapMode)QsciScintilla::SC_WRAP_NONE); _queryText->setStyleSheet("QFrame { background-color: rgb(73, 76, 78); border: 1px solid #c7c5c4; border-radius: 4px; margin: 0px; padding: 0px;}"); }
static PyObject *meth_QsciLexerJavaScript_language(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; bool sipSelfWasArg = (!sipSelf || sipIsDerived((sipSimpleWrapper *)sipSelf)); { QsciLexerJavaScript *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QsciLexerJavaScript, &sipCpp)) { const char *sipRes; Py_BEGIN_ALLOW_THREADS sipRes = (sipSelfWasArg ? sipCpp->QsciLexerJavaScript::language() : sipCpp->language()); Py_END_ALLOW_THREADS if (sipRes == NULL) { Py_INCREF(Py_None); return Py_None; } return SIPBytes_FromString(sipRes); } } /* Raise an exception if the arguments couldn't be parsed. */ sipNoMethod(sipParseErr, sipName_QsciLexerJavaScript, sipName_language, doc_QsciLexerJavaScript_language); return NULL; }
void CreateCollectionDialog::configureFrameText(JSONFrame* frame) { QsciLexerJavaScript *javaScriptLexer = new JSLexer(this); QFont font = GuiRegistry::instance().font(); javaScriptLexer->setFont(font); frame->sciScintilla()->setBraceMatching(QsciScintilla::StrictBraceMatch); frame->sciScintilla()->setFont(font); frame->sciScintilla()->setPaper(QColor(255, 0, 0, 127)); frame->sciScintilla()->setLexer(javaScriptLexer); frame->sciScintilla()->setWrapMode((QsciScintilla::WrapMode)QsciScintilla::SC_WRAP_WORD); frame->sciScintilla()->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); frame->sciScintilla()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); frame->sciScintilla()->setStyleSheet("QFrame { background-color: rgb(73, 76, 78); border: 1px solid #c7c5c4; border-radius: 4px; margin: 0px; padding: 0px;}"); }
/* ** Configure QsciScintilla query widget */ void DocumentTextEditor::_configureQueryText() { QsciLexerJavaScript *javaScriptLexer = new JSLexer(this); QFont font = GuiRegistry::instance().font(); javaScriptLexer->setFont(font); _queryText->sciScintilla()->setAppropriateBraceMatching(); _queryText->sciScintilla()->setFont(font); _queryText->sciScintilla()->setPaper(QColor(255, 0, 0, 127)); _queryText->sciScintilla()->setLexer(javaScriptLexer); _queryText->sciScintilla()->setWrapMode((QsciScintilla::WrapMode)QsciScintilla::SC_WRAP_WORD); _queryText->sciScintilla()->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); _queryText->sciScintilla()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); _queryText->sciScintilla()->setStyleSheet("QFrame { background-color: rgb(73, 76, 78); border: 1px solid #c7c5c4; border-radius: 4px; margin: 0px; padding: 0px;}"); }
RoboScintilla *Robomongo::OutputItemContentWidget::_configureLogText() { QFont textFont = font(); #if defined(Q_OS_MAC) textFont.setPointSize(12); textFont.setFamily("Monaco"); #elif defined(Q_OS_UNIX) textFont.setFamily("Monospace"); textFont.setFixedPitch(true); //textFont.setWeight(QFont::Bold); // textFont.setPointSize(12); #elif defined(Q_OS_WIN) textFont.setPointSize(10); textFont.setFamily("Courier"); #endif QsciLexerJavaScript *javaScriptLexer = new JSLexer(this); javaScriptLexer->setFont(textFont); RoboScintilla *_logText = new RoboScintilla; _logText->setLexer(javaScriptLexer); _logText->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); _logText->setAutoIndent(true); _logText->setIndentationsUseTabs(false); _logText->setIndentationWidth(4); _logText->setTabWidth(4); _logText->setUtf8(true); _logText->installEventFilter(this); _logText->setCaretForegroundColor(QColor("#FFFFFF")); _logText->setMarginWidth(1, 0); // to hide left gray column _logText->setMatchedBraceBackgroundColor(QColor(73, 76, 78)); _logText->setMatchedBraceForegroundColor(QColor("#FF8861")); //1AB0A6 _logText->setBraceMatching(QsciScintilla::StrictBraceMatch); _logText->setFont(textFont); _logText->setReadOnly(true); // Wrap mode turned off because it introduces huge performance problems // even for medium size documents. _logText->setWrapMode((QsciScintilla::WrapMode)QsciScintilla::SC_WRAP_NONE); _logText->setStyleSheet("QFrame {background-color: rgb(73, 76, 78); border: 1px solid #c7c5c4; border-radius: 0px; margin: 0px; padding: 0px;}"); return _logText; }
FindFrame *Robomongo::OutputItemContentWidget::configureLogText() { const QFont &textFont = GuiRegistry::instance().font(); QsciLexerJavaScript *javaScriptLexer = new JSLexer(this); javaScriptLexer->setFont(textFont); FindFrame *_logText = new FindFrame(this); _logText->sciScintilla()->setLexer(javaScriptLexer); _logText->sciScintilla()->setTabWidth(4); _logText->sciScintilla()->setBraceMatching(QsciScintilla::StrictBraceMatch); _logText->sciScintilla()->setFont(textFont); _logText->sciScintilla()->setReadOnly(true); _logText->sciScintilla()->setWrapMode((QsciScintilla::WrapMode) QsciScintilla::SC_WRAP_NONE); _logText->sciScintilla()->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); _logText->sciScintilla()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); // Wrap mode turned off because it introduces huge performance problems // even for medium size documents. _logText->sciScintilla()->setStyleSheet("QFrame {background-color: rgb(73, 76, 78); border: 1px solid #c7c5c4; border-radius: 0px; margin: 0px; padding: 0px;}"); return _logText; }
static PyObject *meth_QsciLexerJavaScript_defaultColor(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; bool sipSelfWasArg = (!sipSelf || sipIsDerived((sipSimpleWrapper *)sipSelf)); { int a0; QsciLexerJavaScript *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "Bi", &sipSelf, sipType_QsciLexerJavaScript, &sipCpp, &a0)) { QColor *sipRes; Py_BEGIN_ALLOW_THREADS sipRes = new QColor((sipSelfWasArg ? sipCpp->QsciLexerJavaScript::defaultColor(a0) : sipCpp->defaultColor(a0))); Py_END_ALLOW_THREADS return sipConvertFromNewType(sipRes,sipType_QColor,NULL); } }
void scriptwidget::seteditor() { textEdit = new QsciScintilla(); //textEdit->autoCompleteFromAll(); QsciLexerJavaScript* jscript = new QsciLexerJavaScript(textEdit); /* QsciAPIs* api = new QsciAPIs(jscript); api->add("hsf.makeline(p1,p2)"); api->add("hsf.makepoint(x,y,z)"); api->add("hsf.addshapelist(list,object)"); api->prepare();*/ //textEdit->setAutoCompletionThreshold(1); QFont font; font.setFamily("arial"); font.setFixedPitch(true); font.setPointSize(12); //font.setStretch(20); //font.setBold(true); // font.setWeight(300); font.setStyleStrategy(QFont::StyleStrategy::PreferQuality); QFontMetrics fm = QFontMetrics(font); jscript->setFont(font); textEdit->setMarginWidth(0, fm.width( "0000" )); textEdit->setMarginLineNumbers(0, true); textEdit->setEdgeMode(QsciScintilla::EdgeLine); textEdit->setEdgeColumn(0); textEdit->setEdgeColor(QColor("green")); textEdit->setLexer(jscript); textEdit->setFolding(QsciScintilla::FoldStyle::BoxedTreeFoldStyle); //textEdit->setAutoCompletionSource(QsciScintilla::AutoCompletionSource::AcsAll); textEdit->setAutoIndent(true); textEdit->setBraceMatching(QsciScintilla::BraceMatch::SloppyBraceMatch); textEdit->setCallTipsStyle(QsciScintilla::CallTipsStyle::CallTipsContext); textEdit->show(); textEdit->zoomIn(2); ui.vertlayout->addWidget(textEdit); // make code interactive connect(textEdit, SIGNAL(textChanged()), this, SLOT(evaluatetext())); }