Changeset 41152 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- May 3, 2012 9:52:23 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkManager.cpp
r40152 r41152 23 23 #include <QGridLayout> 24 24 #include <QProgressBar> 25 #include <QTextEdit>26 25 #include <QMainWindow> 27 26 #include <QVBoxLayout> … … 42 41 #include "UIPopupBox.h" 43 42 #include "QIToolButton.h" 43 #include "QIRichTextLabel.h" 44 44 45 45 /* Network-request widget: */ … … 58 58 59 59 /* Constructor: */ 60 UINetworkRequestWidget(Q Widget*pParent, UINetworkRequest *pNetworkRequest)60 UINetworkRequestWidget(QMainWindow *pParent, UINetworkRequest *pNetworkRequest) 61 61 : QIWithRetranslateUI<UIPopupBox>(pParent) 62 62 , m_pNetworkRequest(pNetworkRequest) … … 67 67 , m_pRetryButton(new QIToolButton(m_pContentWidget)) 68 68 , m_pCancelButton(new QIToolButton(m_pContentWidget)) 69 , m_pErrorPane(new Q TextEdit(m_pContentWidget))69 , m_pErrorPane(new QIRichTextLabel(m_pContentWidget)) 70 70 { 71 71 /* Setup self: */ … … 84 84 m_pTimer->setInterval(5000); 85 85 connect(m_pTimer, SIGNAL(timeout()), this, SLOT(sltTimeIsOut())); 86 87 /* Setup main-layout: */ 88 m_pMainLayout->setContentsMargins(6, 6, 6, 6); 86 89 87 90 /* Setup progress-bar: */ … … 103 106 104 107 /* Setup error-label: */ 105 m_pErrorPane->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Ignored); 106 m_pErrorPane->viewport()->setAutoFillBackground(false); 107 m_pErrorPane->setFrameShape(QFrame::NoFrame); 108 m_pErrorPane->setReadOnly(true); 108 m_pErrorPane->setHidden(true); 109 m_pErrorPane->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); 110 /* Calculate required width: */ 111 int iMinimumWidth = pParent->minimumWidth(); 112 int iLeft, iTop, iRight, iBottom; 113 /* Take into account content-widget layout margins: */ 114 m_pMainLayout->getContentsMargins(&iLeft, &iTop, &iRight, &iBottom); 115 iMinimumWidth -= iLeft; 116 iMinimumWidth -= iRight; 117 /* Take into account this layout margins: */ 118 layout()->getContentsMargins(&iLeft, &iTop, &iRight, &iBottom); 119 iMinimumWidth -= iLeft; 120 iMinimumWidth -= iRight; 121 /* Take into account parent layout margins: */ 122 QLayout *pParentLayout = qobject_cast<QMainWindow*>(parent())->centralWidget()->layout(); 123 pParentLayout->getContentsMargins(&iLeft, &iTop, &iRight, &iBottom); 124 iMinimumWidth -= iLeft; 125 iMinimumWidth -= iRight; 126 /* Set minimum text width: */ 127 m_pErrorPane->setMinimumTextWidth(iMinimumWidth); 109 128 110 129 /* Layout content: */ … … 161 180 162 181 /* Hide error label: */ 163 m_pErrorPane->set PlainText(QString());164 m_pErrorPane->set MinimumHeight(0);182 m_pErrorPane->setHidden(true); 183 m_pErrorPane->setText(QString()); 165 184 } 166 185 … … 205 224 206 225 /* Show error label: */ 226 m_pErrorPane->setHidden(false); 207 227 m_pErrorPane->setText(UINetworkManager::tr("Error: %1.").arg(strErrorText)); 208 m_pErrorPane->setMinimumHeight(m_pErrorPane->document()->size().toSize().height());209 228 } 210 229 … … 231 250 QIToolButton *m_pRetryButton; 232 251 QIToolButton *m_pCancelButton; 233 Q TextEdit*m_pErrorPane;252 QIRichTextLabel *m_pErrorPane; 234 253 }; 235 254 … … 277 296 /* Create main-layout: */ 278 297 m_pMainLayout = new QVBoxLayout(centralWidget()); 279 m_pMainLayout->set Margin(6);298 m_pMainLayout->setContentsMargins(6, 6, 6, 6); 280 299 281 300 /* Create description-label: */
Note:
See TracChangeset
for help on using the changeset viewer.