From 5b6c7d2355a99fe1773cd9e47e4f132d9f04e88e Mon Sep 17 00:00:00 2001 From: codeboss <2422523675@qq.com> Date: Sun, 18 Feb 2024 21:04:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B9=B1=E7=A0=81=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QtNovelDesc.pro.user | 141 +--------------------------------- libTextEdit/text_modelx.cpp | 2 +- libTextEdit/text_modelx.h | 2 +- libTextEdit/text_present.h | 148 ++---------------------------------- 4 files changed, 12 insertions(+), 281 deletions(-) diff --git a/QtNovelDesc.pro.user b/QtNovelDesc.pro.user index 94782ff..07275fc 100644 --- a/QtNovelDesc.pro.user +++ b/QtNovelDesc.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -234,152 +234,15 @@ 1 - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - - 25 - - 1 - true - false - true - - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 2 Qt4ProjectManager.Qt4RunConfiguration:D:/Projects/Cpp/QtNovelDesc/u_test/u_test.pro D:/Projects/Cpp/QtNovelDesc/u_test/u_test.pro - false - true true - false - true D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/u_test - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - - 25 - - 1 - true - false - true - - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:D:/Projects/Cpp/QtNovelDesc/WordsIDE/WordsIDE.pro - D:/Projects/Cpp/QtNovelDesc/WordsIDE/WordsIDE.pro - false - true - true - false - true - D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/WordsIDE - - 2 + 1 diff --git a/libTextEdit/text_modelx.cpp b/libTextEdit/text_modelx.cpp index 6de1c42..8a76f56 100644 --- a/libTextEdit/text_modelx.cpp +++ b/libTextEdit/text_modelx.cpp @@ -1 +1 @@ -#include "text_model.h" +#include "text_modelx.h" diff --git a/libTextEdit/text_modelx.h b/libTextEdit/text_modelx.h index ad365ba..fe7fe16 100644 --- a/libTextEdit/text_modelx.h +++ b/libTextEdit/text_modelx.h @@ -5,7 +5,7 @@ namespace text_model { - // 涓枃鍐呭 + } #endif // TEXT_MODELX_H diff --git a/libTextEdit/text_present.h b/libTextEdit/text_present.h index 9272383..54c7f88 100644 --- a/libTextEdit/text_present.h +++ b/libTextEdit/text_present.h @@ -10,8 +10,6 @@ namespace model_text { typedef QList CharStream; - /** - * @brief UTF-16瀛楃闆嗛殣鍠 */ class LIBTEXTEDIT_EXPORT CharSetU16 { public: static CharStream combineToU(const QString &buffer); @@ -20,9 +18,6 @@ namespace model_text { static uint size(); }; - /** - * @brief 璁剧疆鍗曚釜瀛楃鐨勬牸寮忥紝榛樿浠庡乏鍒板彸鎺掑竷 - */ class LIBTEXTEDIT_EXPORT CharFormat { private: qulonglong unique_id; @@ -66,9 +61,7 @@ namespace model_text { bool operator==(const CharFormat &other); CharFormat &operator=(const CharFormat &other); }; - /** - * @brief 瀹氫箟鏂囨。鏍煎紡锛岄粯璁ゆ帓甯冧粠宸﹀埌鍙筹紝浠庝笂鍒颁笅 - */ + class LIBTEXTEDIT_EXPORT DocFormat { private: std::shared_ptr char_format; @@ -111,48 +104,22 @@ namespace model_text { virtual void refer(std::weak_ptr ptr) = 0; virtual std::weak_ptr blockRefer() const = 0; - /** - * @brief 鑾峰彇鍏冪礌鎵€鍦ㄧ殑娈佃惤绱㈠紩 - * @return - */ virtual uint32_t blockIndex() const = 0; - /** - * @brief 鍏冪礌缁戝畾瀛楃鏍煎紡 - * @return - */ virtual std::shared_ptr getFormat() const = 0; - /** - * @brief 缁戝畾瀛楃鏍煎紡 - * @param format - */ + virtual void bindFormat(std::shared_ptr format) = 0; - /** - * @brief 鍏冪礌绫诲瀷 - * @return - */ virtual Type type() const = 0; - /** - * @brief 鏂囨。灞傛鍐咃紝鍏ㄥ眬璧峰绱㈠紩 - * @return - */ + virtual uint32_t index() const = 0; - /** - * @brief 鑾峰彇鏂囨湰鍐呭琛ㄧず - * @return - */ + virtual QString toText() const = 0; - /** - * @brief 瀛愬厓绱犳暟閲 * @return - */ + virtual uint32_t childCount() const = 0; }; - /** - * @brief 鍗曚釜瀛楃鍐呭瓨妯″瀷 - */ class LIBTEXTEDIT_EXPORT WsChar : public Element { private: uint32_t code_store; @@ -180,68 +147,28 @@ namespace model_text { }; - /** - * @brief 鏂囧瓧鐗囨鍐呭瓨妯″瀷 - */ class LIBTEXTEDIT_EXPORT WsPart : public Element { public: - /** - * @brief 鎻掑叆鏂囨湰鐗囨 - * @param text 鏂囨湰鍐呭 - * @param index - */ + void insertChars(const QList &text, uint32_t offset = -1); - /** - * @brief 鑾峰彇鏂囨湰鐗囨鍐呭 - * @param offset 璧峰绱㈠紩 - * @param count 鏁伴噺 - * @return - */ + QList getChars(uint32_t offset, uint32_t count) const; - /** - * @brief 鍒犻櫎鏂囨湰鐗囨鍐呭 - * @param offset - * @param count - */ + void delChars(uint32_t offset, uint32_t count); }; - /** - * @brief 鏂囨。鍧楋紙娈佃惤锛夊厓绱犲唴瀛樺疄渚 */ class LIBTEXTEDIT_EXPORT WsBlock { private: QList element_store; public: uint32_t blockIndex() const; - /** - * @brief 鎻掑叆鍏冪礌闆嗗悎 - * @param text 鏂囨湰鍐呭 - * @param index - */ void addElements(const QList &text, uint32_t offset = UINT32_MAX); - /** - * @brief 鑾峰彇鏂囨湰鐗囨鍐呭 - * @param offset - * @param count - * @return - */ QList getElements(uint32_t offset, uint32_t count) const; - /** - * @brief 鍒犻櫎鏂囨湰鐗囨鍐呭 - * @param offset - * @param count - */ void delElements(uint32_t offset, uint32_t count); - /** - * @brief 鑾峰彇娈佃惤鐨勬枃鏈〃绀 * @return - */ QString toText() const; }; - /** - * @brief 鏂囨。鍐呭瓨瀹炰緥 - */ class LIBTEXTEDIT_EXPORT WsDocument : public QObject { Q_OBJECT private: @@ -249,86 +176,27 @@ namespace model_text { QList> block_store; public: - /** - * @brief 缁戝畾鏂囨。鏍煎紡 - * @param f - */ void bindFormat(std::shared_ptr f); - /** - * @brief 鑾峰彇鏂囨。鏍煎紡 - * @return - */ std::shared_ptr getFormat() const; - // 鍐呭瓨鏂囨。缁撴瀯鎺ュ彛 =================================================== - /** - * @brief 鎻掑叆娈佃惤 - * @param blks - * @param offset - */ void addBlocks(const QList> &blks, uint32_t offset = UINT32_MAX); - /** - * @brief 娈佃惤鏁伴噺 - * @return - */ uint32_t blockCount() const; - /** - * @brief 鑾峰彇娈佃惤寮曠敤 - * @param offset - * @param count - * @return - */ QList> getBlocks(uint32_t offset, uint32_t count = 1) const; - /** - * @brief 鍒犻櫎鎸囧畾鑼冨洿鍐呯殑娈佃惤 - * @param offset 璧峰绱㈠紩 - * @param count 娈佃惤鏁伴噺 - */ void delBlocks(uint32_t offset, uint32_t count = 1); - - // // 鍐呭瓨鏂囨湰鎿嶄綔鎺ュ彛 =================================================== - // /** - // * @brief 鎸囧畾浣嶇疆鎻掑叆鏂囨湰 - // * @param part 鏂囨湰鐗囨 - // * @param index 璧峰绱㈠紩锛宨ndex<0琛ㄧず杩藉姞 - // */ // void insertText(QList part, uint32_t index = -1); - // /** - // * @brief 鑾峰彇鎸囧畾浣嶇疆鐨勬枃鏈 // * @param index 璧峰绱㈠紩 - // * @param count 鏂囨湰鏁伴噺 - // * @return - // */ // QList getText(uint32_t index, uint32_t count); - // /** - // * @brief 鍒犻櫎鎸囧畾浣嶇疆鐨勬枃鏈 // * @param index 璧峰绱㈠紩锛岃秴鍑烘湁鏁堣寖鍥存墽琛屾棤鏁堟灉 - // * @param count 鍒犻櫎鏁伴噺 - // */ // void delText(uint32_t index, uint32_t count); - - // // 閫夋嫨鎿嶄綔鎺ュ彛 ====================================================== // void select(uint32_t index, uint32_t count); - - // 鍐呭瓨鏂囨湰瀛樺彇鎺ュ彛 =================================================== QString toPlainText() const; void setPlainText(const QString &text); // signals: // void blockHasbeenInserted(uint32_t index); - // /** - // * @brief 鐗囨灏嗚琚垹闄 // * @param index - // */ // void blockAboutTobeDelete(uint32_t index); - // /** - // * @brief 鐗囨宸茬粡琚慨鏀 // * @param index - // */ // void blockHasbeenChanged(uint32_t index); // void redoAvaliable(); // void undoAvaliable(); - // /** - // * @brief 鍏夋爣浣嶇疆宸茬粡鍙樺寲 - // * @param index 鍏夋爣浣嶇疆 - // */ // void cursorPosChanged(uint32_t index); // void selectionChanged(uint32_t index, uint32_t count); };