mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Parse html links in the Notes section.
In the spirit of "Do the simplest thing that could possibly work": capture Ctrl+leftclick mouse events in the Notes area. If the string under the clicked position is a valid url, then launch it. Many common URI schemes will work. Typing a url that starts with https:// will work. So will mailto: and file:// See #733 Signed-off-by: K. Heller <pestophagous@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
99ed01e571
commit
0a2f5d25c0
3 changed files with 178 additions and 0 deletions
|
@ -231,6 +231,26 @@ private:
|
|||
Ui::FilterWidget ui;
|
||||
};
|
||||
|
||||
class TextHyperlinkEventFilter : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TextHyperlinkEventFilter(QTextEdit *txtEdit);
|
||||
|
||||
virtual bool eventFilter(QObject *target, QEvent *evt);
|
||||
|
||||
private:
|
||||
void handleUrlClick(const QString &urlStr);
|
||||
void handleUrlTooltip(const QString &urlStr, const QPoint &pos);
|
||||
bool stringMeetsOurUrlRequirements(const QString &maybeUrlStr);
|
||||
QString fromCursorTilWhitespace(QTextCursor *cursor, const bool searchBackwards);
|
||||
QString tryToFormulateUrl(QTextCursor *cursor);
|
||||
|
||||
QTextEdit const *const textEdit;
|
||||
QWidget const *const scrollView;
|
||||
|
||||
Q_DISABLE_COPY(TextHyperlinkEventFilter)
|
||||
};
|
||||
|
||||
bool isGnome3Session();
|
||||
QImage grayImage(const QImage &coloredImg);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue