I want to use a field (kind of QTextEdit), which is capabale of storing picture and text (like MS Word is doing) and it serializes and deserialaizes picture+text data. Is there any Qt Widget that allows us to manipulate with picture and text simultaniously and it has set/get functions which operate with serializable type? In othger words, I want to know if there exsists any Qt widget that can store picture+text and has "get" types of function that returns the content of that widgets editable area, which is a Type that could be serialized with QDataStream.
相关问题
- Views base64 encoded blob in HTML with PHP
- QML: Cannot read property 'xxx' of undefin
- How to get the background from multiple images by
- Json.NET deserializing contents of a JObject?
- QTextEdit.find() doesn't work in Python
相关文章
- ubuntu20.4中c#通过c++库调用python脚本
- Qt槽函数自动执行多遍
- 放在input的text下文本一直出现一个/(即使还没输入任何值)是什么情况
- Use savefig in Python with string and iterative in
- serializing a list of objects into a file in java
- Where does this quality loss on Images come from?
- Is there a non-java, cross platform way to launch
- How to get a settings storage path in a cross-plat
See this:
How to serialize and deserialize rich text in QTextEdit?
I would create a data structure that contains the text and picture for you. You can then use that data structure (or object) within your display widget. This allows you to serialize your data without trying to serialize the widget, which is probably not what you want.
For serialization, I'd recommend you take a look at QDataStream.
The following posts provide some details about QDataStream:
Serialization with Qt
Overloading the QDataStream << and >> operators for a user-defined type
Reading/Writing QObject
I dont think there is something that will satisfy all your needs.
To display text + images you could use QTextEdit, that is capable of displaying a pretty rich subset of HTML. Basically QTextEdit allows you to read and edit QTextDocument object, that is essentially what you want to serialize and deserialize.
But as far as I know there is no default implementation of serialization for QTextDocument. I saw a request for this feature, but who knows when it will be implemented: http://bugreports.qt-project.org/browse/QTBUG-9258
Edit 1: Implementing serialization/deserialization of QTextDocument should not be way to complicated, because all the building blocks of QTextDocument are serializable. Images are stored in QTextDocument and are available as QVariants, html itself is just a string, so it should not be too complicated to wrap everything together.