Changeset 71869 in vbox for trunk/src/VBox
- Timestamp:
- Apr 17, 2018 10:34:38 AM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r71866 r71869 658 658 src/extensions/QILabel.h \ 659 659 src/extensions/QILabelSeparator.h \ 660 src/extensions/QILineEdit.h \ 660 661 src/extensions/QIMainWindow.h \ 661 662 src/extensions/QIMessageBox.h \ … … 733 734 src/extensions/QILabel.h \ 734 735 src/extensions/QILabelSeparator.h \ 736 src/extensions/QILineEdit.h \ 735 737 src/extensions/QIMainWindow.h \ 736 738 src/extensions/QIMessageBox.h \ … … 907 909 src/UITakeSnapshotDialog.cpp \ 908 910 src/extensions/QIFlowLayout.cpp \ 909 src/extensions/QILineEdit.cpp \910 911 src/extensions/QIMainDialog.cpp \ 911 912 src/extensions/QIManagerDialog.cpp \ … … 1157 1158 src/extensions/QILabel.cpp \ 1158 1159 src/extensions/QILabelSeparator.cpp \ 1160 src/extensions/QILineEdit.cpp \ 1159 1161 src/extensions/QIMainWindow.cpp \ 1160 1162 src/extensions/QIMessageBox.cpp \ … … 1259 1261 src/extensions/QILabel.cpp \ 1260 1262 src/extensions/QILabelSeparator.cpp \ 1263 src/extensions/QILineEdit.cpp \ 1261 1264 src/extensions/QIMainWindow.cpp \ 1262 1265 src/extensions/QIMessageBox.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.cpp
r71027 r71869 1 1 /* $Id$ */ 2 2 /** @file 3 * V irtualBox Qt GUI -QILineEdit class implementation.3 * VBox Qt GUI - Qt extensions: QILineEdit class implementation. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2008-201 7Oracle Corporation7 * Copyright (C) 2008-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 29 29 30 30 31 void QILineEdit::setMinimumWidthByText (const QString &aText)31 void QILineEdit::setMinimumWidthByText(const QString &strText) 32 32 { 33 setMinimumWidth (featTextWidth (aText).width());33 setMinimumWidth(featTextWidth(strText).width()); 34 34 } 35 35 36 void QILineEdit::setFixedWidthByText (const QString &aText)36 void QILineEdit::setFixedWidthByText(const QString &strText) 37 37 { 38 setFixedWidth (featTextWidth (aText).width());38 setFixedWidth(featTextWidth(strText).width()); 39 39 } 40 40 41 QSize QILineEdit::featTextWidth (const QString &aText) const41 QSize QILineEdit::featTextWidth(const QString &strText) const 42 42 { 43 43 QStyleOptionFrame sof; 44 sof.initFrom 44 sof.initFrom(this); 45 45 sof.rect = contentsRect(); 46 sof.lineWidth = hasFrame() ? style()->pixelMetric 46 sof.lineWidth = hasFrame() ? style()->pixelMetric(QStyle::PM_DefaultFrameWidth) : 0; 47 47 sof.midLineWidth = 0; 48 48 sof.state |= QStyle::State_Sunken; 49 49 50 /* The margins are based on qlineedit.cpp of Qt. Maybe they where changed 51 * at some time in the future. */ 52 QSize sc (fontMetrics().width (aText) + 2*2, 53 fontMetrics().xHeight() + 2*1); 54 QSize sa = style()->sizeFromContents (QStyle::CT_LineEdit, &sof, sc, this); 50 /** @todo make it wise.. */ 51 // WORKAROUND: 52 // The margins are based on qlineedit.cpp of Qt. 53 // Maybe they where changed at some time in the future. 54 QSize sc(fontMetrics().width(strText) + 2 * 2, 55 fontMetrics().xHeight() + 2 * 1); 56 const QSize sa = style()->sizeFromContents(QStyle::CT_LineEdit, &sof, sc, this); 55 57 56 58 return sa; 57 59 } 58 -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.h
r71027 r71869 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - Q ILineEdit class declarations.3 * VBox Qt GUI - Qt extensions: QILineEdit class declaration. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2008-201 7Oracle Corporation7 * Copyright (C) 2008-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 */ 17 17 18 #ifndef __ QILineEdit_h__19 #define __ QILineEdit_h__18 #ifndef ___QILineEdit_h___ 19 #define ___QILineEdit_h___ 20 20 21 21 /* Qt includes */ 22 22 #include <QLineEdit> 23 23 24 class QILineEdit: public QLineEdit 24 /* GUI includes: */ 25 #include "UILibraryDefs.h" 26 27 /** QLineEdit extension with advanced functionality. */ 28 class SHARED_LIBRARY_STUFF QILineEdit : public QLineEdit 25 29 { 30 Q_OBJECT; 31 26 32 public: 27 33 28 QILineEdit (QWidget *aParent = 0) 29 :QLineEdit (aParent) {} 30 QILineEdit (const QString &aContents, QWidget *aParent = 0) 31 :QLineEdit (aContents, aParent) {} 34 /** Constructs label-separator passing @a pParent to the base-class. */ 35 QILineEdit(QWidget *pParent = 0) 36 : QLineEdit(pParent) {} 37 /** Constructs label-separator passing @a pParent to the base-class. 38 * @param strContents Brings the line-edit text. */ 39 QILineEdit(const QString &strContents, QWidget *pParent = 0) 40 : QLineEdit(strContents, pParent) {} 32 41 33 void setMinimumWidthByText (const QString &aText); 34 void setFixedWidthByText (const QString &aText); 42 /** Forces line-edit to adjust minimum width acording to passed @a strText. */ 43 void setMinimumWidthByText(const QString &strText); 44 /** Forces line-edit to adjust fixed width acording to passed @a strText. */ 45 void setFixedWidthByText(const QString &strText); 35 46 36 47 private: 37 48 38 QSize featTextWidth (const QString &aText) const; 49 /** Calculates suitable @a strText size. */ 50 QSize featTextWidth(const QString &strText) const; 39 51 }; 40 52 41 #endif /* __QILineEdit_h__ */ 42 53 #endif /* !___QILineEdit_h___ */
Note:
See TracChangeset
for help on using the changeset viewer.