1 Star 0 Fork 2

邢瑞/NDD-HexConverter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
MyQsciDoc.h 1.61 KB
一键复制 编辑 原始数据 按行查看 历史
#ifndef NDD_MY_QSCIDOC_H
#define NDD_MY_QSCIDOC_H
#include <vector>
#include <QWidget>
#include <QByteArray>
#include <qsciscintilla.h>
#include <Scintilla.h>
#include "Conversion.h"
typedef enum {
SEL_DIR_R2L,
SEL_DIR_L2R
} SelectDirection;
typedef enum {
SEL_SORT_BY_NONE,
SEL_SORT_BY_POSITION,
SEL_SORT_BY_SELECT_ORDER
} SelectSortType;
struct SelectInfo {
intptr_t leftPos = 0;
intptr_t rightPos = 0;
intptr_t order = -1; // 0 based index
SelectDirection direction = SEL_DIR_L2R; // L2R or R2L
intptr_t nbVirtualCaretSpc = 0;
intptr_t nbVirtualAnchorSpc = 0;
SelectInfo(intptr_t lPos, intptr_t rPos, intptr_t order, SelectDirection dir = SEL_DIR_L2R, intptr_t vAnchorNbSpc = 0, intptr_t vCaretNbSpc = 0);
bool Valid() const;
};
typedef std::vector<SelectInfo> SelectInfos;
typedef sptr_t(*SCINTILLA_FUNC) (sptr_t ptr, unsigned int, uptr_t, sptr_t);
typedef sptr_t SCINTILLA_PTR;
class MyQsciDoc : public QWidget
{
Q_OBJECT
#define REF_EDIT(edit) auto &edit = *(this->getCurrentEditFunc())
public:
MyQsciDoc(QWidget* parent, std::function<QsciScintilla* ()> func);
virtual ~MyQsciDoc();
SelectInfos GetMultipleSelections(SelectSortType sortType = SEL_SORT_BY_NONE);
void SelectMultipleRanges(const SelectInfos& selections);
void SetText(const QByteArray& text);
QByteArray GetText();
NewLineType GetNewLineType();
QsciScintilla* operator->();
bool Valid();
protected:
private:
QWidget* parentWidget;
std::function<QsciScintilla* ()> getCurrentEditFunc;
};
#endif // NDD_MY_QSCIDOC_H
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/xrui94/hexconverter.git
git@gitee.com:xrui94/hexconverter.git
xrui94
hexconverter
NDD-HexConverter
master

搜索帮助