15 quitAction->setShortcut(
tr(
"Ctrl+Q"));
20 cutAction->setShortcut(
tr(
"Ctrl+X"));
24 copyAction->setShortcut(
tr(
"Ctrl+C"));
28 pasteAction->setShortcut(
tr(
"Ctrl+V"));
55 tr(
"Open file"), currentFile,
"HTML files (*.html);;Text files (*.txt)");
82 if (
cursor.hasSelection()) {
83 selection =
cursor.selection();
84 cursor.removeSelectedText();
91 if (
cursor.hasSelection()) {
92 selection =
cursor.selection();
100 cursor.insertFragment(selection);
The QAction class provides an abstraction for user commands that can be added to different user inter...
void close() override
Calls QFileDevice::flush() and closes the file.
static QString getOpenFileName(QWidget *parent=nullptr, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString(), QString *selectedFilter=nullptr, Options options=Options())
This is a convenience static function that returns an existing file selected by the user.
\inmodule QtCore \reentrant
QString completeSuffix() const
Returns the complete suffix (extension) of the file.
bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
QByteArray readAll()
Reads all remaining data from the device, and returns it as a byte array.
The QKeySequence class encapsulates a key sequence as used by shortcuts.
void setCentralWidget(QWidget *widget)
Sets the given widget to be the main window's central widget.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
\macro QT_RESTRICTED_CAST_FROM_ASCII
\reentrant \inmodule QtGui
bool isEmpty() const
Returns true if the fragment is empty; otherwise returns false.
\reentrant \inmodule QtGui
The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
void setTextCursor(const QTextCursor &cursor)
Sets the visible cursor.
void setPlainText(const QString &text)
Changes the text of the text edit to the string text.
QTextCursor textCursor() const
Returns a copy of the QTextCursor that represents the currently visible cursor.
void setHtml(const QString &text)
void setDocument(QTextDocument *document)
void selectionChanged()
This signal is emitted whenever the selection changes.
QFileInfo info(fileName)
[8]