1 | /* $Id: QILineEdit.h 76553 2019-01-01 01:45:53Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - Qt extensions: QILineEdit class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2008-2019 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ___QILineEdit_h___
|
---|
19 | #define ___QILineEdit_h___
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Qt includes */
|
---|
25 | #include <QLineEdit>
|
---|
26 |
|
---|
27 | /* GUI includes: */
|
---|
28 | #include "UILibraryDefs.h"
|
---|
29 |
|
---|
30 | /** QLineEdit extension with advanced functionality. */
|
---|
31 | class SHARED_LIBRARY_STUFF QILineEdit : public QLineEdit
|
---|
32 | {
|
---|
33 | Q_OBJECT;
|
---|
34 |
|
---|
35 | public:
|
---|
36 |
|
---|
37 | /** Constructs label-separator passing @a pParent to the base-class. */
|
---|
38 | QILineEdit(QWidget *pParent = 0)
|
---|
39 | : QLineEdit(pParent) {}
|
---|
40 | /** Constructs label-separator passing @a pParent to the base-class.
|
---|
41 | * @param strContents Brings the line-edit text. */
|
---|
42 | QILineEdit(const QString &strContents, QWidget *pParent = 0)
|
---|
43 | : QLineEdit(strContents, pParent) {}
|
---|
44 |
|
---|
45 | /** Forces line-edit to adjust minimum width acording to passed @a strText. */
|
---|
46 | void setMinimumWidthByText(const QString &strText);
|
---|
47 | /** Forces line-edit to adjust fixed width acording to passed @a strText. */
|
---|
48 | void setFixedWidthByText(const QString &strText);
|
---|
49 |
|
---|
50 | private:
|
---|
51 |
|
---|
52 | /** Calculates suitable @a strText size. */
|
---|
53 | QSize featTextWidth(const QString &strText) const;
|
---|
54 | };
|
---|
55 |
|
---|
56 | #endif /* !___QILineEdit_h___ */
|
---|