12int main(
int argc,
char *argv[])
21 imageFormat.
setName(
":/images/advert.png");
22 cursor.insertImage(imageFormat);
29 fragment =
it.fragment();
40 newImageFormat.
setName(
":/images/newimage.png");
54 cursor.insertText(
"Code less. Create more.");
57 editor->setWindowTitle(
tr(
"Text Document Image Format"));
58 editor->resize(320, 480);
The QApplication class manages the GUI application's control flow and main settings.
static int exec()
Enters the main event loop and waits until exit() is called, then returns the value that was set to e...
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
\macro QT_RESTRICTED_CAST_FROM_ASCII
iterator begin() const
Returns a text block iterator pointing to the beginning of the text block.
\reentrant \inmodule QtGui
void setPosition(int pos, MoveMode mode=MoveAnchor)
Moves the cursor to the absolute position in the document specified by pos using a MoveMode specified...
void setCharFormat(const QTextCharFormat &format)
Sets the cursor's current character format to the given format.
\reentrant \inmodule QtGui
The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
void setDocument(QTextDocument *document)
QTextImageFormat toImageFormat() const
Returns this format as an image format.
bool contains(int position) const
Returns true if the text fragment contains the text at the given position in the document; otherwise ...
bool isValid() const
Returns true if this is a valid text fragment (i.e.
QTextCharFormat charFormat() const
Returns the text fragment's character format.
int length() const
Returns the number of characters in the text fragment.
int position() const
Returns the position of this text fragment in the document.
bool isValid() const
Returns true if this image format is valid; otherwise returns false.
void setName(const QString &name)
Sets the name of the image.
QSet< QString >::iterator it
QApplication app(argc, argv)
[0]