下载编译qscintilla2_qt5.lib

Qscitinlla下载:https://riverbankcomputing.com/software/qscintilla/download
在Qt4Qt5目录中用QtCreator打开qscintilla.pro文件,分别编译release与debug版的qscintilla2_qt5.lib与qscintilla2_qt5d.lib

使用

1,把Qt4Qt5目录中的Qsci目录拷贝到要使用的工程源码目录,我的:app/source/Qsci
2,app.pro添加

INCLUDEPATH += ./source

# release
# LIBS += -L./Lib -lqscintilla2_qt5
# debug
LIBS += -L./Lib -lqscintilla2_qt5d

3,使用

#include "Qsci/qsciscintilla.h"  
#include "Qsci/qscilexerpython.h" 
#include "Qsci/qsciapis.h"  

QsciScintilla* editor = new QsciScintilla;

QsciLexerPython* textLexer = new QsciLexerPython;
editor -> setLexer(textLexer);
editor -> setMarginType(0, QsciScintilla::NumberMargin);
editor -> setMarginLineNumbers(0, true);
editor -> setMarginWidth(0, 30);

QsciAPIs* apis = new QsciAPIs(textLexer);
apis -> add(QString("import"));
apis -> prepare();

editor -> setAutoCompletionSource(QsciScintilla::AcsAll);
editor -> setAutoCompletionCaseSensitivity(true);
editor -> setAutoCompletionThreshold(1);
editor -> SendScintilla(QsciScintilla::SCI_SETCODEPAGE, QsciScintilla::SC_CP_UTF8);

QVBoxLayout* leftLayout = new QVBoxLayout;
leftLayout -> addWidget(editor);

效果:

内容来源于网络如有侵权请私信删除

文章来源: 博客园

原文链接: https://www.cnblogs.com/tjhd/p/13889484.html

你还没有登录,请先登录注册
  • 还没有人评论,欢迎说说您的想法!

相关课程

3690 0元 限免
3730 0元 50元 限免