Changeset View
Changeset View
Standalone View
Standalone View
src/kcombobox.h
Show First 20 Lines • Show All 140 Lines • ▼ Show 20 Line(s) | |||||
141 | * \image html kcombobox.png "KComboBox widgets, one non-editable, one editable with KUrlCompletion" | 141 | * \image html kcombobox.png "KComboBox widgets, one non-editable, one editable with KUrlCompletion" | ||
142 | * | 142 | * | ||
143 | * @author Dawit Alemayehu <adawit@kde.org> | 143 | * @author Dawit Alemayehu <adawit@kde.org> | ||
144 | */ | 144 | */ | ||
145 | class KCOMPLETION_EXPORT KComboBox : public QComboBox, public KCompletionBase //krazy:exclude=qclasses | 145 | class KCOMPLETION_EXPORT KComboBox : public QComboBox, public KCompletionBase //krazy:exclude=qclasses | ||
146 | { | 146 | { | ||
147 | Q_OBJECT | 147 | Q_OBJECT | ||
148 | Q_PROPERTY(bool autoCompletion READ autoCompletion WRITE setAutoCompletion) | 148 | Q_PROPERTY(bool autoCompletion READ autoCompletion WRITE setAutoCompletion) | ||
149 | #ifndef KCOMPLETION_NO_DEPRECATED | 149 | #if KCOMPLETION_BUILD_DEPRECATED_SINCE(5, 0) | ||
150 | Q_PROPERTY(bool urlDropsEnabled READ urlDropsEnabled WRITE setUrlDropsEnabled) | 150 | Q_PROPERTY(bool urlDropsEnabled READ urlDropsEnabled WRITE setUrlDropsEnabled) | ||
151 | #endif | 151 | #endif | ||
152 | Q_PROPERTY(bool trapReturnKey READ trapReturnKey WRITE setTrapReturnKey) | 152 | Q_PROPERTY(bool trapReturnKey READ trapReturnKey WRITE setTrapReturnKey) | ||
153 | Q_DECLARE_PRIVATE(KComboBox) | 153 | Q_DECLARE_PRIVATE(KComboBox) | ||
154 | 154 | | |||
155 | public: | 155 | public: | ||
156 | 156 | | |||
157 | /** | 157 | /** | ||
Show All 11 Lines | |||||
169 | */ | 169 | */ | ||
170 | explicit KComboBox(bool rw, QWidget *parent = nullptr); | 170 | explicit KComboBox(bool rw, QWidget *parent = nullptr); | ||
171 | 171 | | |||
172 | /** | 172 | /** | ||
173 | * Destructor. | 173 | * Destructor. | ||
174 | */ | 174 | */ | ||
175 | ~KComboBox() override; | 175 | ~KComboBox() override; | ||
176 | 176 | | |||
177 | #if KCOMPLETION_ENABLE_DEPRECATED_SINCE(4, 5) | ||||
177 | /** | 178 | /** | ||
178 | * Deprecated to reflect Qt api changes | 179 | * Deprecated to reflect Qt api changes | ||
179 | * @deprecated since 4.5 | 180 | * @deprecated since 4.5 | ||
180 | */ | 181 | */ | ||
181 | #ifndef KCOMPLETION_NO_DEPRECATED | 182 | KCOMPLETION_DEPRECATED_VERSION(4, 5, "Use KComboBox::insertUrl(int, const QUrl&)") | ||
182 | KCOMPLETION_DEPRECATED void insertURL(const QUrl &url, int index = -1) | 183 | void insertURL(const QUrl &url, int index = -1) | ||
183 | { | 184 | { | ||
184 | insertUrl(index < 0 ? count() : index, url); | 185 | insertUrl(index < 0 ? count() : index, url); | ||
185 | } | 186 | } | ||
186 | KCOMPLETION_DEPRECATED void insertURL(const QPixmap &pixmap, const QUrl &url, int index = -1) | 187 | KCOMPLETION_DEPRECATED_VERSION(4, 5, "Use KComboBox::insertUrl(int, const QIcon&, const QUrl&)") | ||
188 | void insertURL(const QPixmap &pixmap, const QUrl &url, int index = -1) | ||||
187 | { | 189 | { | ||
188 | insertUrl(index < 0 ? count() : index, QIcon(pixmap), url); | 190 | insertUrl(index < 0 ? count() : index, QIcon(pixmap), url); | ||
189 | } | 191 | } | ||
190 | KCOMPLETION_DEPRECATED void changeURL(const QUrl &url, int index) | 192 | KCOMPLETION_DEPRECATED_VERSION(4, 5, "Use KComboBox::changeUrl(int, const QUrl&)") | ||
193 | void changeURL(const QUrl &url, int index) | ||||
191 | { | 194 | { | ||
192 | changeUrl(index, url); | 195 | changeUrl(index, url); | ||
193 | } | 196 | } | ||
194 | KCOMPLETION_DEPRECATED void changeURL(const QPixmap &pixmap, const QUrl &url, int index) | 197 | KCOMPLETION_DEPRECATED_VERSION(4, 5, "Use KComboBox::changeUrl(int, const QIcon&, const QUrl&)") | ||
198 | void changeURL(const QPixmap &pixmap, const QUrl &url, int index) | ||||
195 | { | 199 | { | ||
196 | changeUrl(index, QIcon(pixmap), url); | 200 | changeUrl(index, QIcon(pixmap), url); | ||
197 | } | 201 | } | ||
198 | #endif | 202 | #endif | ||
199 | 203 | | |||
200 | /** | 204 | /** | ||
201 | * Sets @p url into the edit field of the combo box. | 205 | * Sets @p url into the edit field of the combo box. | ||
202 | * | 206 | * | ||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Line(s) | |||||
282 | * Returns @c true if the current completion mode is set | 286 | * Returns @c true if the current completion mode is set | ||
283 | * to automatic. See its more comprehensive replacement | 287 | * to automatic. See its more comprehensive replacement | ||
284 | * completionMode(). | 288 | * completionMode(). | ||
285 | * | 289 | * | ||
286 | * @return @c true when completion mode is automatic. | 290 | * @return @c true when completion mode is automatic. | ||
287 | */ | 291 | */ | ||
288 | bool autoCompletion() const; | 292 | bool autoCompletion() const; | ||
289 | 293 | | |||
294 | #if KCOMPLETION_BUILD_DEPRECATED_SINCE(4, 5) | ||||
290 | /** | 295 | /** | ||
291 | * Enables or disables the popup (context) menu. | 296 | * Enables or disables the popup (context) menu. | ||
292 | * | 297 | * | ||
293 | * This method only works if this widget is editable, and | 298 | * This method only works if this widget is editable, and | ||
294 | * allows you to enable/disable the context menu. It does nothing if invoked | 299 | * allows you to enable/disable the context menu. It does nothing if invoked | ||
295 | * for a non-editable combo box. | 300 | * for a non-editable combo box. | ||
296 | * | 301 | * | ||
297 | * By default, the context menu is created if this widget is editable. | 302 | * By default, the context menu is created if this widget is editable. | ||
298 | * Call this function with the argument set to false to disable the popup | 303 | * Call this function with the argument set to false to disable the popup | ||
299 | * menu. | 304 | * menu. | ||
300 | * | 305 | * | ||
301 | * @param showMenu If @c true, show the context menu. | 306 | * @param showMenu If @c true, show the context menu. | ||
302 | * @deprecated since 4.5, use setContextMenuPolicy instead | 307 | * @deprecated since 4.5, use setContextMenuPolicy instead | ||
303 | */ | 308 | */ | ||
304 | #ifndef KCOMPLETION_NO_DEPRECATED | 309 | KCOMPLETION_DEPRECATED_VERSION(4, 5, "Use QWidget::setContextMenuPolicy(...)") | ||
305 | virtual KCOMPLETION_DEPRECATED void setContextMenuEnabled(bool showMenu); | 310 | virtual void setContextMenuEnabled(bool showMenu); | ||
306 | #endif | 311 | #endif | ||
307 | 312 | | |||
313 | #if KCOMPLETION_ENABLE_DEPRECATED_SINCE(5, 0) | ||||
308 | /** | 314 | /** | ||
309 | * Enables/Disables handling of URL drops. | 315 | * Enables/Disables handling of URL drops. | ||
310 | * | 316 | * | ||
311 | * If enabled and the user drops an URL, the decoded URL will | 317 | * If enabled and the user drops an URL, the decoded URL will | ||
312 | * be inserted. Otherwise the default behavior of QComboBox is used, | 318 | * be inserted. Otherwise the default behavior of QComboBox is used, | ||
313 | * which inserts the encoded URL. | 319 | * which inserts the encoded URL. | ||
314 | * | 320 | * | ||
315 | * @param enable If @c true, insert decoded URLs | 321 | * @param enable If @c true, insert decoded URLs | ||
316 | * @deprecated since 5.0. Use lineEdit()->installEventFilter with a LineEditUrlDropEventFilter | 322 | * @deprecated since 5.0. Use lineEdit()->installEventFilter with a LineEditUrlDropEventFilter | ||
317 | */ | 323 | */ | ||
318 | #ifndef KCOMPLETION_NO_DEPRECATED | 324 | KCOMPLETION_DEPRECATED_VERSION(5, 0, "Use KComboBox::lineEdit()->installEventFilter(...) with a LineEditUrlDropEventFilter") | ||
319 | KCOMPLETION_DEPRECATED void setUrlDropsEnabled(bool enable); | 325 | void setUrlDropsEnabled(bool enable); | ||
320 | #endif | 326 | #endif | ||
321 | 327 | | |||
322 | /** | 328 | /** | ||
323 | * Returns @c true when decoded URL drops are enabled | 329 | * Returns @c true when decoded URL drops are enabled | ||
324 | */ | 330 | */ | ||
325 | bool urlDropsEnabled() const; | 331 | bool urlDropsEnabled() const; | ||
326 | 332 | | |||
327 | /** | 333 | /** | ||
▲ Show 20 Lines • Show All 210 Lines • Show Last 20 Lines |