4 #include <QFontMetrics>
6 #include <QRegularExpression>
20 if (mMatchPositions.
empty())
28 int fh = mMetrics->
height();
29 int rw =
rect().width();
30 int rh =
rect().height();
48 drawSubstring(painter, p0, p1.first-p0,
false);
49 drawSubstring(painter, p1.first, p1.second,
true);
50 p0 = p1.first + p1.second;
53 drawSubstring(painter, p0,
text().
size()-p0,
false);
57 void SearchableLabel::drawSubstring(
QPainter& painter,
int pos,
int len,
bool hilite)
64 int fh = mMetrics->
height();
70 painter.
drawText(xText,yText,fw,fh,0,sub);
74 painter.
setPen(storeColor);
78 bool SearchableLabel::exactWordMatch(
int pos,
int len)
const
80 if (
pos && !
text().at(
pos-1).isSpace())
return false;
87 return !mMatchPositions.
isEmpty();
92 mMatchPositions.
clear();
95 if (!
string.isEmpty())
bool isExactMatch() const
bool isCaseSensitive() const
bool isRegularExpression() const
SearchableLabel(QWidget *parent=nullptr)
void paintEvent(QPaintEvent *ev) override
void handleSearchChanged(const QString &string, int option)
option(PL_GUI "PL_GUI" ON) if(PL_GUI OR BUILD_ALL_PLUGINS) cmake_minimum_required(VERSION 3.1.0) if(APPLE AND CMAKE_HOST_APPLE AND NOT Qt5_DIR) set(Qt5_DIR "/usr/local/opt/qt@5/lib/cmake") endif(APPLE AND CMAKE_HOST_APPLE AND NOT Qt5_DIR) find_package(Qt5 COMPONENTS Core REQUIRED) find_package(Qt5 COMPONENTS Widgets REQUIRED) if(Qt5Widgets_FOUND) message(VERBOSE "Qt5Widgets_INCLUDE_DIRS
int horizontalAdvance(const QString &text, int len) const const
virtual void paintEvent(QPaintEvent *) override
void append(const T &value)
bool isEmpty() const const
void drawText(const QPointF &position, const QString &text)
void fillRect(const QRectF &rectangle, const QBrush &brush)
const QPen & pen() const const
void setPen(const QColor &color)
QColor color() const const
bool isValid() const const
QString captured(int nth) const const