Changeset View
Changeset View
Standalone View
Standalone View
src/ksqueezedtextlabel.h
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | |||||
66 | 66 | | |||
67 | /* | 67 | /* | ||
68 | * QLabel | 68 | * QLabel | ||
69 | */ | 69 | */ | ||
70 | class KWIDGETSADDONS_EXPORT KSqueezedTextLabel : public QLabel | 70 | class KWIDGETSADDONS_EXPORT KSqueezedTextLabel : public QLabel | ||
71 | { | 71 | { | ||
72 | Q_OBJECT | 72 | Q_OBJECT | ||
73 | Q_PROPERTY(Qt::TextElideMode textElideMode READ textElideMode WRITE setTextElideMode) | 73 | Q_PROPERTY(Qt::TextElideMode textElideMode READ textElideMode WRITE setTextElideMode) | ||
74 | Q_PROPERTY(int indent READ indent WRITE setIndent) | ||||
75 | Q_PROPERTY(int margin READ margin WRITE setMargin) | ||||
74 | 76 | | |||
75 | public: | 77 | public: | ||
76 | /** | 78 | /** | ||
77 | * Default constructor. | 79 | * Default constructor. | ||
78 | * @param parent the label's parent object | 80 | * @param parent the label's parent object | ||
79 | */ | 81 | */ | ||
80 | explicit KSqueezedTextLabel(QWidget *parent = nullptr); | 82 | explicit KSqueezedTextLabel(QWidget *parent = nullptr); | ||
81 | 83 | | |||
Show All 14 Lines | |||||
96 | 98 | | |||
97 | /** | 99 | /** | ||
98 | * @return the label's preferred size, which is wide enough | 100 | * @return the label's preferred size, which is wide enough | ||
99 | * to display the text without squeezing it | 101 | * to display the text without squeezing it | ||
100 | */ | 102 | */ | ||
101 | QSize sizeHint() const Q_DECL_OVERRIDE; | 103 | QSize sizeHint() const Q_DECL_OVERRIDE; | ||
102 | 104 | | |||
103 | /** | 105 | /** | ||
106 | * Sets the indentation of the label. | ||||
107 | * | ||||
108 | * @param indent the amount of indentation in pixels | ||||
109 | * | ||||
110 | * Reimplementation of QLabel::setIndent(). | ||||
111 | * | ||||
112 | * @warning The corresponding function in the base class is not virtual. | ||||
113 | * Therefore make sure to call this function on objects of type KSqueezedTextLabel, | ||||
114 | * as shown in the @ref non-virtual-warning "example in the class description". | ||||
115 | * | ||||
116 | * @since 5.39 | ||||
117 | */ | ||||
118 | void setIndent(int indent); | ||||
119 | | ||||
120 | /** | ||||
121 | * Sets the margin of the label. | ||||
122 | * | ||||
123 | * @param margin the margin size in pixels | ||||
124 | * | ||||
125 | * Reimplementation of QLabel::setMargin(). | ||||
126 | * | ||||
127 | * @warning The corresponding function in the base class is not virtual. | ||||
128 | * Therefore make sure to call this function on objects of type KSqueezedTextLabel, | ||||
129 | * as shown in the @ref non-virtual-warning "example in the class description". | ||||
130 | * | ||||
131 | * @since 5.39 | ||||
132 | */ | ||||
133 | void setMargin(int margin); | ||||
134 | | ||||
135 | /** | ||||
104 | * Overridden for internal reasons; the API remains unaffected. | 136 | * Overridden for internal reasons; the API remains unaffected. | ||
105 | */ | 137 | */ | ||
106 | virtual void setAlignment(Qt::Alignment); | 138 | virtual void setAlignment(Qt::Alignment); | ||
107 | 139 | | |||
108 | /** | 140 | /** | ||
109 | * @return the text elide mode | 141 | * @return the text elide mode | ||
110 | */ | 142 | */ | ||
111 | Qt::TextElideMode textElideMode() const; | 143 | Qt::TextElideMode textElideMode() const; | ||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |