| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
url_link_delegate.h
Go to the documentation of this file.
1
11
12#ifndef URL_LINK_DELEGATE_H
13#define URL_LINK_DELEGATE_H
14
15#include <QStyledItemDelegate>
16#include <QStyleOptionViewItem>
17#include <QModelIndex>
18#include <QRegularExpression>
19
23 class UrlLinkDelegate : public QStyledItemDelegate
24{
25 public:
30 explicit UrlLinkDelegate(QObject *parent = Q_NULLPTR);
31
35 ~UrlLinkDelegate();
36
37 // If pattern matches the string in column, render as a URL.
38 // Otherwise render as plain text.
44 void setColCheck(int column, QString &pattern);
45
46 protected:
53 virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
54
55 private:
57 int re_col_;
58
60 QRegularExpression *url_re_;
61};
62#endif // URL_LINK_DELEGATE_H
UrlLinkDelegate::paint
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Custom paint method to render the cell text as a URL if it matches the pattern.
Definition url_link_delegate.cpp:34
UrlLinkDelegate::UrlLinkDelegate
UrlLinkDelegate(QObject *parent=Q_NULLPTR)
Constructs a new UrlLinkDelegate object.
Definition url_link_delegate.cpp:17
UrlLinkDelegate::~UrlLinkDelegate
~UrlLinkDelegate()
Destroys the UrlLinkDelegate object.
Definition url_link_delegate.cpp:23
UrlLinkDelegate::setColCheck
void setColCheck(int column, QString &pattern)
Configures a column to be checked against a regular expression pattern for URL rendering.
Definition url_link_delegate.cpp:28