Changeset 39593 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Dec 13, 2011 9:26:40 AM (13 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 7 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r39453 r39593 257 257 src/extensions/QITableView.h \ 258 258 src/extensions/QIToolButton.h \ 259 src/extensions/QITextEdit.h \ 259 260 src/extensions/QITreeView.h \ 260 261 src/extensions/QITreeWidget.h \ … … 418 419 src/extensions/QIStatusBar.cpp \ 419 420 src/extensions/QITableView.cpp \ 421 src/extensions/QITextEdit.cpp \ 420 422 src/extensions/QITreeView.cpp \ 421 423 src/extensions/QITreeWidget.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QITextEdit.cpp
r39591 r39593 3 3 * 4 4 * VBox frontends: Qt GUI ("VirtualBox"): 5 * QILineEdit class implementation5 * VirtualBox Qt extensions: QITextEdit class implementation 6 6 */ 7 7 8 8 /* 9 * Copyright (C) 20 08Oracle Corporation9 * Copyright (C) 2011 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 18 18 */ 19 19 20 #include "QILineEdit.h" 20 /* Local includes: */ 21 #include "QITextEdit.h" 21 22 22 /* Qt includes */ 23 #include <QStyleOptionFrame> 24 25 #if defined (Q_WS_WIN32) 26 #include <QWindowsVistaStyle> 27 #include <QLibrary> 28 #endif 29 30 void QILineEdit::setMinimumWidthByText (const QString &aText) 23 /* Constructor: */ 24 QITextEdit::QITextEdit(QWidget *pParent) 25 : QTextEdit(pParent) 31 26 { 32 setMinimumWidth (featTextWidth (aText).width());33 27 } 34 28 35 void QILineEdit::setFixedWidthByText (const QString &aText) 29 QSize QITextEdit::sizeHint() const 36 30 { 37 setFixedWidth (featTextWidth (aText).width());31 return document()->size().toSize(); 38 32 } 39 33 40 QSize QILineEdit::featTextWidth (const QString &aText) const41 {42 QStyleOptionFrame sof;43 sof.initFrom (this);44 sof.rect = contentsRect();45 sof.lineWidth = hasFrame() ? style()->pixelMetric (QStyle::PM_DefaultFrameWidth) : 0;46 sof.midLineWidth = 0;47 sof.state |= QStyle::State_Sunken;48 49 /* The margins are based on qlineedit.cpp of Qt. Maybe they where changed50 * at some time in the future. */51 QSize sc (fontMetrics().width (aText) + 2*2,52 fontMetrics().xHeight() + 2*1);53 QSize sa = style()->sizeFromContents (QStyle::CT_LineEdit, &sof, sc, this);54 55 #if defined (Q_WS_WIN32)56 /* Vista l&f style has a bug where the last parameter of sizeFromContents57 * function ('widget' what corresponds to 'this' in our class) is ignored.58 * Due to it QLineEdit processed as QComboBox and size calculation includes59 * non-existing combo-box button of 23 pix in width. So fixing it here: */60 if (qobject_cast <QWindowsVistaStyle*> (style()))61 {62 /* Check if l&f style theme is really active else painting performed by63 * Windows Classic theme and there is no such shifting error. */64 typedef bool (*IsAppThemedFunction)();65 IsAppThemedFunction isAppThemed =66 (IsAppThemedFunction) QLibrary::resolve ("uxtheme", "IsAppThemed");67 if (isAppThemed && isAppThemed()) sa -= QSize (23, 0);68 }69 #endif70 71 return sa;72 }73 -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QITextEdit.h
r39591 r39593 2 2 * 3 3 * VBox frontends: Qt GUI ("VirtualBox"): 4 * QILineEdit class declarations4 * VirtualBox Qt extensions: QITextEdit class declaration 5 5 */ 6 6 7 7 /* 8 * Copyright (C) 20 08Oracle Corporation8 * Copyright (C) 2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 17 17 */ 18 18 19 #ifndef __QI LineEdit_h__20 #define __QI LineEdit_h__19 #ifndef __QITextEdit_h__ 20 #define __QITextEdit_h__ 21 21 22 /* Qt includes*/23 #include <Q LineEdit>22 /* Global includes: */ 23 #include <QTextEdit> 24 24 25 class QILineEdit: public QLineEdit 25 /* QTextEdit class extension: */ 26 class QITextEdit : public QTextEdit 26 27 { 28 Q_OBJECT; 29 27 30 public: 28 31 29 QILineEdit (QWidget *aParent = 0) 30 :QLineEdit (aParent) {} 31 QILineEdit (const QString &aContents, QWidget *aParent = 0) 32 :QLineEdit (aContents, aParent) {} 32 /* Constructor: */ 33 QITextEdit(QWidget *pParent = 0); 33 34 34 void setMinimumWidthByText (const QString &aText); 35 void setFixedWidthByText (const QString &aText); 36 37 private: 38 39 QSize featTextWidth (const QString &aText) const; 35 /* Size hint: */ 36 QSize sizeHint() const; 40 37 }; 41 38 42 #endif /* __QILineEdit_h__ */ 43 39 #endif // __QITextEdit_h__ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIFirstRunWzd.cpp
r38311 r39593 7 7 8 8 /* 9 * Copyright (C) 2008-201 0Oracle Corporation9 * Copyright (C) 2008-2011 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 285 285 .arg(tr("Source", "summary"), source) 286 286 ; 287 /* Feat summary to 3 lines */288 setSummaryFieldLinesNumber(m_pSummaryText, 2);289 287 290 288 m_pSummaryText->setText("<table cellspacing=0 cellpadding=0>" + summary + "</table>"); … … 296 294 retranslateUi(); 297 295 296 /* Update summary geometry: */ 297 m_pSummaryText->updateGeometry(); 298 298 /* Summary should initially have focus */ 299 299 m_pSummaryText->setFocus(); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIFirstRunWzdPage3.ui
r33656 r39593 4 4 VBox frontends: Qt4 GUI ("VirtualBox"): 5 5 6 Copyright (C) 2009-201 0Oracle Corporation6 Copyright (C) 2009-2011 Oracle Corporation 7 7 8 8 This file is part of VirtualBox Open Source Edition (OSE), as … … 55 55 </item> 56 56 <item> 57 <widget class="Q TextEdit" name="m_pSummaryText">57 <widget class="QITextEdit" name="m_pSummaryText"> 58 58 <property name="sizePolicy"> 59 <sizepolicy hsizetype="Expanding" vsizetype=" Fixed">59 <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> 60 60 <horstretch>0</horstretch> 61 61 <verstretch>0</verstretch> … … 117 117 <header>QILabel.h</header> 118 118 </customwidget> 119 <customwidget> 120 <class>QITextEdit</class> 121 <extends>QTextEdit</extends> 122 <header>QITextEdit.h</header> 123 </customwidget> 119 124 </customwidgets> 120 125 <resources/> -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newhd/UINewHDWizard.cpp
r39128 r39593 996 996 .arg(UINewHDWizard::tr("Size", "summary"), sizeFormatted, sizeUnformatted); 997 997 998 /* Feat summary to 4 lines: */999 setSummaryFieldLinesNumber(m_pSummaryText, 4);1000 1001 998 m_pSummaryText->setText("<table cellspacing=0 cellpadding=0>" + strSummary + "</table>"); 1002 999 } … … 1007 1004 retranslateUi(); 1008 1005 1006 /* Update summary geometry: */ 1007 m_pSummaryText->updateGeometry(); 1009 1008 /* Summary should have focus initially: */ 1010 1009 m_pSummaryText->setFocus(); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newhd/UINewHDWizardPageSummary.ui
r37406 r39593 42 42 </item> 43 43 <item> 44 <widget class="Q TextEdit" name="m_pSummaryText">44 <widget class="QITextEdit" name="m_pSummaryText"> 45 45 <property name="sizePolicy"> 46 <sizepolicy hsizetype="Expanding" vsizetype=" Fixed">46 <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> 47 47 <horstretch>0</horstretch> 48 48 <verstretch>0</verstretch> … … 88 88 <header>QILabel.h</header> 89 89 </customwidget> 90 <customwidget> 91 <class>QITextEdit</class> 92 <extends>QTextEdit</extends> 93 <header>QITextEdit.h</header> 94 </customwidget> 90 95 </customwidgets> 91 96 <resources/> -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp
r39476 r39593 673 673 .arg(tr("Base Memory", "summary"), ram, VBoxGlobal::tr("MB", "size suffix MBytes=1024KBytes")) 674 674 ; 675 /* Feat summary to 3 lines */676 setSummaryFieldLinesNumber(m_pSummaryText, 3);677 675 678 676 /* Add hard-disk info */ … … 682 680 "<tr><td><nobr>%8: </nobr></td><td><nobr>%9</nobr></td></tr>") 683 681 .arg(tr("Start-up Disk", "summary"), field("hardDiskName").toString()); 684 /* Extend summary to 4 lines */685 setSummaryFieldLinesNumber(m_pSummaryText, 4);686 682 } 687 683 … … 701 697 retranslateUi(); 702 698 699 /* Update summary geometry: */ 700 m_pSummaryText->updateGeometry(); 703 701 /* Summary should have focus initially */ 704 702 m_pSummaryText->setFocus(); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzdPage5.ui
r28800 r39593 4 4 VBox frontends: Qt4 GUI ("VirtualBox"): 5 5 6 Copyright (C) 2009 Oracle Corporation6 Copyright (C) 2009-2011 Oracle Corporation 7 7 8 8 This file is part of VirtualBox Open Source Edition (OSE), as … … 51 51 </item> 52 52 <item> 53 <widget class="Q TextEdit" name="m_pSummaryText">53 <widget class="QITextEdit" name="m_pSummaryText"> 54 54 <property name="sizePolicy"> 55 <sizepolicy hsizetype="Expanding" vsizetype=" Fixed">55 <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> 56 56 <horstretch>0</horstretch> 57 57 <verstretch>0</verstretch> … … 91 91 <header>QILabel.h</header> 92 92 </customwidget> 93 <customwidget> 94 <class>QITextEdit</class> 95 <extends>QTextEdit</extends> 96 <header>QITextEdit.h</header> 97 </customwidget> 93 98 </customwidgets> 94 99 <resources/>
Note:
See TracChangeset
for help on using the changeset viewer.