Changeset View
Changeset View
Standalone View
Standalone View
krusader/Dialogs/krsqueezedtextlabel.h
Show All 38 Lines | |||||
39 | 39 | | |||
40 | NEW: a special setText() method allows to choose which part of the string should | 40 | NEW: a special setText() method allows to choose which part of the string should | ||
41 | be displayed (example: make sure that search results won't be cut out) | 41 | be displayed (example: make sure that search results won't be cut out) | ||
42 | */ | 42 | */ | ||
43 | class KrSqueezedTextLabel : public KSqueezedTextLabel | 43 | class KrSqueezedTextLabel : public KSqueezedTextLabel | ||
44 | { | 44 | { | ||
45 | Q_OBJECT | 45 | Q_OBJECT | ||
46 | public: | 46 | public: | ||
47 | explicit KrSqueezedTextLabel(QWidget *parent = 0); | 47 | explicit KrSqueezedTextLabel(QWidget *parent = nullptr); | ||
48 | ~KrSqueezedTextLabel(); | 48 | ~KrSqueezedTextLabel() override; | ||
49 | 49 | | |||
50 | public slots: | 50 | public slots: | ||
51 | void setText(const QString &text, int index = -1, int length = -1); | 51 | void setText(const QString &text, int index = -1, int length = -1); | ||
52 | 52 | | |||
53 | signals: | 53 | signals: | ||
54 | void clicked(QMouseEvent *); /**< emitted when someone clicks on the label */ | 54 | void clicked(QMouseEvent *); /**< emitted when someone clicks on the label */ | ||
55 | 55 | | |||
56 | protected: | 56 | protected: | ||
57 | void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE { | 57 | void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE { | ||
58 | squeezeTextToLabel(_index, _length); | 58 | squeezeTextToLabel(_index, _length); | ||
59 | } | 59 | } | ||
60 | virtual void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE; | 60 | void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE; | ||
61 | virtual void paintEvent(QPaintEvent * e) Q_DECL_OVERRIDE; | 61 | void paintEvent(QPaintEvent * e) Q_DECL_OVERRIDE; | ||
62 | void squeezeTextToLabel(int index = -1, int length = -1); | 62 | void squeezeTextToLabel(int index = -1, int length = -1); | ||
63 | 63 | | |||
64 | QString fullText; | 64 | QString fullText; | ||
65 | 65 | | |||
66 | private: | 66 | private: | ||
67 | int _index, _length; | 67 | int _index, _length; | ||
68 | }; | 68 | }; | ||
69 | 69 | | |||
70 | #endif | 70 | #endif |