Changeset 93998 in vbox
- Timestamp:
- Feb 28, 2022 10:42:04 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/activity/overview/UIVMActivityOverviewWidget.cpp
r93990 r93998 1718 1718 int iColumnTitleWidth = m_columnTitles.value(i, QString()).length(); 1719 1719 int iMax = iColumnStringWidth > iColumnTitleWidth ? iColumnStringWidth : iColumnTitleWidth; 1720 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 1721 columnWidthsInPixels[i] = iMax * fontMetrics.horizontalAdvance('x') + 1722 #else 1720 1723 columnWidthsInPixels[i] = iMax * fontMetrics.width('x') + 1724 #endif 1721 1725 QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin) + 1722 1726 QApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin) + -
trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.cpp
r93990 r93998 495 495 cursorPosition.x(), height() - m_iMarginBottom); 496 496 QString strValue = QString::number(data->at(data->size() - m_iDataIndexUnderCursor)); 497 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 498 painter.drawText(m_iMarginLeft - fontMetrics.horizontalAdvance(strValue) - iAverageFontWidth, 499 height() - (fHeight + m_iMarginBottom) + 0.5 * iFontHeight, strValue); 500 #else 497 501 painter.drawText(m_iMarginLeft - fontMetrics.width(strValue) - iAverageFontWidth, 498 502 height() - (fHeight + m_iMarginBottom) + 0.5 * iFontHeight, strValue); 503 #endif 499 504 500 505 } … … 547 552 int iTextX = m_lineChartRect.left() + i * m_lineChartRect.width() / (float) (iXSubAxisCount + 1); 548 553 QString strCurrentSec = QString::number(iTotalSeconds - i * iTotalSeconds / (float)(iXSubAxisCount + 1)); 554 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 555 int iTextWidth = fontMetrics.horizontalAdvance(strCurrentSec); 556 #else 549 557 int iTextWidth = fontMetrics.width(strCurrentSec); 558 #endif 550 559 if (i == 0) 551 560 { … … 648 657 font.setPixelSize(iFontSize); 649 658 --iFontSize; 650 }while(QFontMetrics(font).width(m_strGAWarning) >= 0.8 * m_lineChartRect.width()); 659 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 660 } while (QFontMetrics(font).horizontalAdvance(m_strGAWarning) >= 0.8 * m_lineChartRect.width()); 661 #else 662 } while (QFontMetrics(font).width(m_strGAWarning) >= 0.8 * m_lineChartRect.width()); 663 #endif 651 664 font.setBold(true); 652 665 painter.setFont(font); … … 1021 1034 { 1022 1035 QFontMetrics labelFontMetric(pLabel->font()); 1036 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 1037 int iWidth = iMaximum * labelFontMetric.horizontalAdvance('X'); 1038 #else 1023 1039 int iWidth = iMaximum * labelFontMetric.width('X'); 1040 #endif 1024 1041 foreach (QLabel *pInfoLabel, m_infoLabels) 1025 1042 pInfoLabel->setFixedWidth(iWidth); -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILabel.cpp
r93996 r93998 324 324 const QString strFlat = removeHtmlTags(QString(strWork).remove(strCompact)); 325 325 /* What size will the text have without the compact text: */ 326 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 327 const int iFlatWidth = fm.horizontalAdvance(strFlat); 328 #else 326 329 const int iFlatWidth = fm.width(strFlat); 330 #endif 327 331 /* Create the shortened text: */ 328 332 const QString strNew = fm.elidedText(strElide, toTextElideMode(strElideMode), width() - (2 * HOR_PADDING) - iFlatWidth); -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.cpp
r93115 r93998 172 172 // The margins are based on qlineedit.cpp of Qt. 173 173 // Maybe they where changed at some time in the future. 174 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 175 QSize sc(fontMetrics().horizontalAdvance(strText) + 2 * 2, 176 fontMetrics().xHeight() + 2 * 1); 177 #else 174 178 QSize sc(fontMetrics().width(strText) + 2 * 2, 175 179 fontMetrics().xHeight() + 2 * 1); 180 #endif 176 181 const QSize sa = style()->sizeFromContents(QStyle::CT_LineEdit, &sof, sc, this); 177 182 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r93996 r93998 329 329 pixmapSize.width() + 330 330 2 * m_iSpacing + 331 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 332 qMax(fm.horizontalAdvance(index.data(Field_Name).toString()), 333 fm.horizontalAdvance(index.data(Field_ID).toString())) + 334 #else 331 335 qMax(fm.width(index.data(Field_Name).toString()), 332 336 fm.width(index.data(Field_ID).toString())) + 337 #endif 333 338 m_iMargin; 334 339 /* Calculate height: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r93987 r93998 2416 2416 QFontMetrics metrics(pSpinBox->font(), pSpinBox); 2417 2417 const QString strDummy(cCount, '0'); 2418 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 2419 const int iTextWidth = metrics.horizontalAdvance(strDummy); 2420 #else 2418 2421 const int iTextWidth = metrics.width(strDummy); 2422 #endif 2419 2423 2420 2424 /* Tune spin-box minimum-width: */ -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp
r93990 r93998 446 446 if (i < folderList.size() - 1) 447 447 { 448 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 449 iWidth += fontMetrics().horizontalAdvance(" > "); 450 #else 448 451 iWidth += fontMetrics().width(" > "); 452 #endif 449 453 strWord.append("<b> > </b>"); 450 454 } 455 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 456 iWidth += fontMetrics().horizontalAdvance(strFolder); 457 #else 451 458 iWidth += fontMetrics().width(strFolder); 459 #endif 452 460 453 461 if (iWidth < width()) -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.cpp
r93990 r93998 298 298 setFocusProxy(m_pSearchLineEdit); 299 299 QFontMetrics fontMetric(m_pSearchLineEdit->font()); 300 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 301 setMinimumSize(40 * fontMetric.horizontalAdvance("x"), 302 fontMetric.height() + 303 qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin) + 304 qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin)); 305 306 #else 300 307 setMinimumSize(40 * fontMetric.width("x"), 301 308 fontMetric.height() + 302 309 qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin) + 303 310 qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin)); 304 311 #endif 305 312 connect(m_pSearchLineEdit, &UISearchLineEdit::textChanged, 306 313 this, &UIFindInPageWidget::sigSearchTextChanged); -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogPage.cpp
r93115 r93998 31 31 #include "UIVMLogViewerTextEdit.h" 32 32 33 33 34 /********************************************************************************************************************************* 34 * UIVMLogTab implementation. *35 * UIVMLogTab implementation. * 35 36 *********************************************************************************************************************************/ 36 37 … … 51 52 } 52 53 54 53 55 /********************************************************************************************************************************* 54 * UIVMLogPage implementation. *56 * UIVMLogPage implementation. * 55 57 *********************************************************************************************************************************/ 56 58 … … 77 79 78 80 /* Compute a width for 132 characters plus scrollbar and frame width: */ 81 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 82 int iDefaultWidth = m_pTextEdit->fontMetrics().horizontalAdvance(QChar('x')) * 132 + 83 #else 79 84 int iDefaultWidth = m_pTextEdit->fontMetrics().width(QChar('x')) * 132 + 85 #endif 80 86 m_pTextEdit->verticalScrollBar()->width() + 81 87 m_pTextEdit->frameWidth() * 2; -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerFilterPanel.cpp
r93996 r93998 110 110 /** Try to guess the width of the space between filter terms so that remove button 111 111 we display when a term is selected does not hide the next/previous word: */ 112 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 113 int spaceWidth = fontMetrics().horizontalAdvance(' '); 114 #else 112 115 int spaceWidth = fontMetrics().width(' '); 116 #endif 113 117 if (spaceWidth != 0) 114 118 m_iTrailingSpaceCount = (m_iRemoveTermButtonSize / spaceWidth) + 1; … … 163 167 m_pRemoveTermButton->show(); 164 168 int buttonSize = m_iRemoveTermButtonSize; 169 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 170 int charWidth = fontMetrics().horizontalAdvance('x'); 171 #else 165 172 int charWidth = fontMetrics().width('x'); 173 #endif 166 174 #ifdef VBOX_WS_MAC 167 175 int buttonLeft = cursorRect().left() + 1; -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerTextEdit.cpp
r93990 r93998 253 253 } 254 254 255 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 256 int space = 3 + fontMetrics().horizontalAdvance(QLatin1Char('9')) * digits; 257 #else 255 258 int space = 3 + fontMetrics().width(QLatin1Char('9')) * digits; 259 #endif 256 260 257 261 return space; -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp
r93990 r93998 238 238 return 0; 239 239 /* Compute a width for 132 characters plus scrollbar and frame width: */ 240 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 241 int iDefaultWidth = pBrowser->fontMetrics().horizontalAdvance(QChar('x')) * 132 + 242 #else 240 243 int iDefaultWidth = pBrowser->fontMetrics().width(QChar('x')) * 132 + 244 #endif 241 245 pBrowser->verticalScrollBar()->width() + 242 246 pBrowser->frameWidth() * 2; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.cpp
r93990 r93998 576 576 /* Return text size, based on font-metrics: */ 577 577 QFontMetrics fm(font, pPaintDevice); 578 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 579 return QSize(fm.horizontalAdvance(strText), fm.height()); 580 #else 578 581 return QSize(fm.width(strText), fm.height()); 582 #endif 579 583 } 580 584 … … 586 590 QString strString; 587 591 strString.fill('_', iCount); 592 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 593 return fm.horizontalAdvance(strString); 594 #else 588 595 return fm.width(strString); 596 #endif 589 597 } 590 598 … … 598 606 /* Check if passed text fits maximum width: */ 599 607 QFontMetrics fm(font, pPaintDevice); 608 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 609 if (fm.horizontalAdvance(strText) <= iWidth) 610 #else 600 611 if (fm.width(strText) <= iWidth) 612 #endif 601 613 return strText; 602 614 603 615 /* Truncate otherwise: */ 604 616 QString strEllipsis = QString("..."); 617 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 618 int iEllipsisWidth = fm.horizontalAdvance(strEllipsis + " "); 619 while (!strText.isEmpty() && fm.horizontalAdvance(strText) + iEllipsisWidth > iWidth) 620 strText.truncate(strText.size() - 1); 621 #else 605 622 int iEllipsisWidth = fm.width(strEllipsis + " "); 606 623 while (!strText.isEmpty() && fm.width(strText) + iEllipsisWidth > iWidth) 607 624 strText.truncate(strText.size() - 1); 625 #endif 608 626 return strText + strEllipsis; 609 627 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.cpp
r93115 r93998 499 499 QPaintDevice *pPaintDevice = model()->paintDevice(); 500 500 const QFontMetrics fm(m_nameFont, pPaintDevice); 501 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 502 const int iMinimumNameWidth = fm.horizontalAdvance(compressText(m_nameFont, pPaintDevice, name(), 503 textWidth(m_nameFont, pPaintDevice, 15))); 504 #else 501 505 const int iMinimumNameWidth = fm.width(compressText(m_nameFont, pPaintDevice, name(), textWidth(m_nameFont, pPaintDevice, 15))); 506 #endif 502 507 503 508 /* Is there something changed? */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp
r93996 r93998 1553 1553 int iMaximumNameWidth = textWidth(m_nameFont, pPaintDevice, 20); 1554 1554 QString strCompressedName = compressText(m_nameFont, pPaintDevice, name(), iMaximumNameWidth); 1555 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 1556 int iMinimumNameWidth = fm.horizontalAdvance(strCompressedName); 1557 #else 1555 1558 int iMinimumNameWidth = fm.width(strCompressedName); 1559 #endif 1556 1560 int iMinimumNameHeight = fm.height(); 1557 1561 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp
r93115 r93998 760 760 QPaintDevice *pPaintDevice = model()->paintDevice(); 761 761 QFontMetrics fm(m_nameFont, pPaintDevice); 762 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 763 int iMinimumNameWidth = fm.horizontalAdvance(compressText(m_nameFont, pPaintDevice, name(), 764 textWidth(m_nameFont, pPaintDevice, 15))); 765 #else 762 766 int iMinimumNameWidth = fm.width(compressText(m_nameFont, pPaintDevice, name(), textWidth(m_nameFont, pPaintDevice, 15))); 767 #endif 763 768 764 769 /* Is there something changed? */ … … 780 785 { 781 786 QFontMetrics fm(m_snapshotNameFont, model()->paintDevice()); 787 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 788 int iBracketWidth = fm.horizontalAdvance("()"); /* bracket width */ 789 int iActualTextWidth = fm.horizontalAdvance(cache()->toLocal()->snapshotName()); /* snapshot-name width */ 790 int iMinimumTextWidth = fm.horizontalAdvance("..."); /* ellipsis width */ 791 #else 782 792 int iBracketWidth = fm.width("()"); /* bracket width */ 783 793 int iActualTextWidth = fm.width(cache()->toLocal()->snapshotName()); /* snapshot-name width */ 784 794 int iMinimumTextWidth = fm.width("..."); /* ellipsis width */ 795 #endif 785 796 iMinimumSnapshotNameWidth = iBracketWidth + qMin(iActualTextWidth, iMinimumTextWidth); 786 797 } … … 869 880 870 881 /* Calculate new visible snapshot-name: */ 882 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 883 int iBracketWidth = QFontMetrics(m_snapshotNameFont, pPaintDevice).horizontalAdvance("()"); 884 #else 871 885 int iBracketWidth = QFontMetrics(m_snapshotNameFont, pPaintDevice).width("()"); 886 #endif 872 887 QString strVisibleSnapshotName = compressText(m_snapshotNameFont, pPaintDevice, cache()->toLocal()->snapshotName(), 873 888 m_iMaximumSnapshotNameWidth - iBracketWidth); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp
r93115 r93998 349 349 m_strName = strName; 350 350 QFontMetrics fm(m_nameFont, model()->paintDevice()); 351 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 352 m_nameSize = QSize(fm.horizontalAdvance(m_strName), fm.height()); 353 #else 351 354 m_nameSize = QSize(fm.width(m_strName), fm.height()); 355 #endif 352 356 353 357 /* Update linked values: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.cpp
r93990 r93998 633 633 const int iWidthOf15Letters = textWidthMonospace(m_nameFont, pPaintDevice, 15); 634 634 const QString strNameCompressedTo15Letters = compressText(m_nameFont, pPaintDevice, m_strName, iWidthOf15Letters); 635 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 636 const QSize minimumNameSize = QSize(fm.horizontalAdvance(strNameCompressedTo15Letters), fm.height()); 637 #else 635 638 const QSize minimumNameSize = QSize(fm.width(strNameCompressedTo15Letters), fm.height()); 639 #endif 636 640 637 641 /* Update linked values: */ … … 687 691 QString strString; 688 692 strString.fill('_', iCount); 693 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 694 return fm.horizontalAdvance(strString); 695 #else 689 696 return fm.width(strString); 697 #endif 690 698 } 691 699 … … 699 707 /* Check if passed text already fits maximum width: */ 700 708 QFontMetrics fm(font, pPaintDevice); 709 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 710 if (fm.horizontalAdvance(strText) <= iWidth) 711 #else 701 712 if (fm.width(strText) <= iWidth) 713 #endif 702 714 return strText; 703 715 704 716 /* Truncate otherwise: */ 705 717 QString strEllipsis = QString("..."); 718 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 719 int iEllipsisWidth = fm.horizontalAdvance(strEllipsis + " "); 720 while (!strText.isEmpty() && fm.horizontalAdvance(strText) + iEllipsisWidth > iWidth) 721 strText.truncate(strText.size() - 1); 722 #else 706 723 int iEllipsisWidth = fm.width(strEllipsis + " "); 707 724 while (!strText.isEmpty() && fm.width(strText) + iEllipsisWidth > iWidth) 708 725 strText.truncate(strText.size() - 1); 726 #endif 709 727 return strText + strEllipsis; 710 728 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationConfiguration.cpp
r93115 r93998 226 226 m_pTableWidget->insertRow(iRow); 227 227 m_pTableWidget->setRowHeight(iRow, fontMetrics.height() + m_iRowTopMargin + m_iRowBottomMargin); 228 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 229 iMaxColumn1Length = qMax(iMaxColumn1Length, fontMetrics.horizontalAdvance(strText1)); 230 #else 228 231 iMaxColumn1Length = qMax(iMaxColumn1Length, fontMetrics.width(strText1)); 232 #endif 229 233 m_pTableWidget->setItem(iRow, 1, new QTableWidgetItem(strText1)); 230 234 m_pTableWidget->setItem(iRow, 2, new QTableWidgetItem(strText2)); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationRuntime.cpp
r93990 r93998 216 216 } 217 217 QFontMetrics fontMetrics(font()); 218 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 219 setColumnWidth(0, 1.5 * fontMetrics.horizontalAdvance(*strLongest)); 220 #else 218 221 setColumnWidth(0, 1.5 * fontMetrics.width(*strLongest)); 222 #endif 219 223 220 224 /* Make the API calls and populate the table: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
r93996 r93998 207 207 return; 208 208 const QFontMetrics fm = treeWidget()->fontMetrics(); 209 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 210 const int iOldSize = fm.horizontalAdvance(strOneString); 211 #else 209 212 const int iOldSize = fm.width(strOneString); 213 #endif 210 214 const int iItemIndent = parentItem() ? treeWidget()->indentation() * 2 : treeWidget()->indentation(); 215 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 216 int iIndentSize = fm.horizontalAdvance(" ... "); 217 #else 211 218 int iIndentSize = fm.width(" ... "); 219 #endif 212 220 if (iColumn == 0) 213 221 iIndentSize += iItemIndent; … … 221 229 do 222 230 { 231 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 232 iTextWidth = fm.horizontalAdvance(strOneString); 233 #else 223 234 iTextWidth = fm.width(strOneString); 235 #endif 224 236 if ( iTextWidth 225 237 && iTextWidth + iIndentSize > cWidth) … … 264 276 if (iPosition || m_enmFormat == FormatType_EllipsisFile) 265 277 strOneString.insert(iPosition, "..."); 278 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 279 const int iNewSize = fm.horizontalAdvance(strOneString); 280 #else 266 281 const int iNewSize = fm.width(strOneString); 282 #endif 267 283 setText(iColumn, iNewSize < iOldSize ? strOneString : m_fields.at(iColumn)); 268 284 setToolTip(iColumn, text(iColumn) == getText(iColumn) ? QString() : getText(iColumn)); 269 285 270 286 /* Calculate item's size-hint: */ 287 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 288 setSizeHint(iColumn, QSize(fm.horizontalAdvance(QString(" %1 ").arg(getText(iColumn))), fm.height())); 289 #else 271 290 setSizeHint(iColumn, QSize(fm.width(QString(" %1 ").arg(getText(iColumn))), fm.height())); 291 #endif 272 292 } 273 293 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp
r93996 r93998 432 432 if (m_pLabelIRQ) 433 433 m_pLabelIRQ->setBuddy(m_pLineEditIRQ); 434 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 435 m_pLineEditIRQ->setFixedWidth(m_pLineEditIRQ->fontMetrics().horizontalAdvance("8888")); 436 #else 434 437 m_pLineEditIRQ->setFixedWidth(m_pLineEditIRQ->fontMetrics().width("8888")); 438 #endif 435 439 m_pLineEditIRQ->setValidator(new QIULongValidator(0, 255, this)); 436 440 pLayoutPortSettings->addWidget(m_pLineEditIRQ, 0, 3); … … 446 450 if (m_pLabelIOPort) 447 451 m_pLabelIOPort->setBuddy(m_pLineEditIOPort); 452 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 453 m_pLineEditIOPort->setFixedWidth(m_pLineEditIOPort->fontMetrics().horizontalAdvance("8888888")); 454 #else 448 455 m_pLineEditIOPort->setFixedWidth(m_pLineEditIOPort->fontMetrics().width("8888888")); 456 #endif 449 457 m_pLineEditIOPort->setValidator(new QIULongValidator(0, 0xFFFF, this)); 450 458 pLayoutPortSettings->addWidget(m_pLineEditIOPort, 0, 5); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r93990 r93998 2878 2878 QFont font = pModel->data(index, Qt::FontRole).value<QFont>(); 2879 2879 QFontMetrics fm(font); 2880 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 2881 while ((strShortText.size() > 1) && (fm.horizontalAdvance(strShortText) + fm.horizontalAdvance("...") > iTextWidth)) 2882 #else 2880 2883 while ((strShortText.size() > 1) && (fm.width(strShortText) + fm.width("...") > iTextWidth)) 2884 #endif 2881 2885 strShortText.truncate(strShortText.size() - 1); 2882 2886 if (strShortText != strText) -
trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp
r93990 r93998 2059 2059 painter.setFont(painterFont); 2060 2060 QFontMetrics fontMetrics = painter.fontMetrics(); 2061 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 2062 int iMargin = 0.25 * fontMetrics.horizontalAdvance('X'); 2063 #else 2061 2064 int iMargin = 0.25 * fontMetrics.width('X'); 2065 #endif 2062 2066 2063 2067 int iTopWidth = 0; … … 2072 2076 #endif 2073 2077 foreach (const QString &strPart, strList) 2078 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 2079 iTopWidth = qMax(iTopWidth, fontMetrics.horizontalAdvance(strPart)); 2080 #else 2074 2081 iTopWidth = qMax(iTopWidth, fontMetrics.width(strPart)); 2082 #endif 2075 2083 strList.clear(); 2076 2084 #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) … … 2084 2092 int iBottomWidth = 0; 2085 2093 foreach (const QString &strPart, strList) 2094 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 2095 iBottomWidth = qMax(iBottomWidth, fontMetrics.horizontalAdvance(strPart)); 2096 #else 2086 2097 iBottomWidth = qMax(iBottomWidth, fontMetrics.width(strPart)); 2098 #endif 2087 2099 int iTextWidth = 2 * iMargin + qMax(iTopWidth, iBottomWidth); 2088 2100 int iTextHeight = 0; … … 2110 2122 2111 2123 QFontMetrics fontMetrics = painter.fontMetrics(); 2124 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 2125 int iMargin = 0.25 * fontMetrics.horizontalAdvance('X'); 2126 #else 2112 2127 int iMargin = 0.25 * fontMetrics.width('X'); 2128 #endif 2113 2129 QRect textRect; 2114 2130 if (key.keyboardRegion() == KeyboardRegion_MultimediaKeys) -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.cpp
r93996 r93998 499 499 return strFullText; 500 500 501 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 502 int iOldSize = fontMetrics().horizontalAdvance(strFullText); 503 int iIndentSize = fontMetrics().horizontalAdvance("x...x"); 504 #else 501 505 int iOldSize = fontMetrics().width(strFullText); 502 506 int iIndentSize = fontMetrics().width("x...x"); 507 #endif 503 508 504 509 /* Compress text: */ … … 508 513 int iTextWidth = 0; 509 514 do { 515 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 516 iTextWidth = fontMetrics().horizontalAdvance(strFullText); 517 #else 510 518 iTextWidth = fontMetrics().width(strFullText); 519 #endif 511 520 if (iTextWidth + iIndentSize > iWidth) 512 521 { … … 529 538 530 539 strFullText.insert(iPosition, "..."); 540 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 541 int newSize = fontMetrics().horizontalAdvance(strFullText); 542 #else 531 543 int newSize = fontMetrics().width(strFullText); 544 #endif 532 545 533 546 return newSize < iOldSize ? strFullText : fullPath(false); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp
r93996 r93998 748 748 case UIPortForwardingDataType_HostIp: 749 749 case UIPortForwardingDataType_GuestIp: 750 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 751 return QSize(QApplication::fontMetrics().horizontalAdvance(" 888.888.888.888 "), 752 QApplication::fontMetrics().height()); 753 #else 750 754 return QSize(QApplication::fontMetrics().width(" 888.888.888.888 "), QApplication::fontMetrics().height()); 755 #endif 751 756 default: return QVariant(); 752 757 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UISearchLineEdit.cpp
r93115 r93998 49 49 QFont pfont = font(); 50 50 QString strText = QString("%1/%2").arg(QString::number(m_iScrollToIndex + 1)).arg(QString::number(m_iMatchCount)); 51 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 52 QSize textSize(QApplication::fontMetrics().horizontalAdvance(strText), 53 QApplication::fontMetrics().height()); 54 #else 51 55 QSize textSize(QApplication::fontMetrics().width(strText), 52 56 QApplication::fontMetrics().height()); 57 #endif 53 58 54 59 /* Dont draw anything if we dont have enough space: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsTextPane.cpp
r93996 r93998 202 202 QString strLeftLine = fRightColumnPresent ? line.string1() + ":" : line.string1(); 203 203 QString strRightLine = line.string2(); 204 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 205 iMaximumLeftColumnWidth = qMax(iMaximumLeftColumnWidth, fm.horizontalAdvance(strLeftLine)); 206 iMaximumRightColumnWidth = qMax(iMaximumRightColumnWidth, fm.horizontalAdvance(strRightLine)); 207 #else 204 208 iMaximumLeftColumnWidth = qMax(iMaximumLeftColumnWidth, fm.width(strLeftLine)); 205 209 iMaximumRightColumnWidth = qMax(iMaximumRightColumnWidth, fm.width(strRightLine)); 210 #endif 206 211 } 207 212 iMaximumLeftColumnWidth += 1; … … 507 512 QRect symbolRect = QRect(layoutPosition.x() + linePosition.x() + iSymbolX, 508 513 layoutPosition.y() + linePosition.y(), 509 fm.width(strLayoutText[iTextPosition]) + 1, fm.height()); 514 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 515 fm.horizontalAdvance(strLayoutText[iTextPosition]) + 1, 516 #else 517 fm.width(strLayoutText[iTextPosition]) + 1, 518 #endif 519 fm.height()); 510 520 formatRegion += symbolRect; 511 521 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/addcloudvm/UIWizardAddCloudVMPageSource.cpp
r93233 r93998 329 329 * horizontally and 8 lines vertically: */ 330 330 const QFontMetrics fm(m_pSourceInstanceList->font()); 331 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 332 const int iFontWidth = fm.horizontalAdvance('x'); 333 #else 331 334 const int iFontWidth = fm.width('x'); 335 #endif 332 336 const int iTotalWidth = 50 * iFontWidth; 333 337 const int iFontHeight = fm.height(); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.cpp
r93115 r93998 172 172 { 173 173 const QFontMetrics fm(m_pProfileInstanceList->font()); 174 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 175 const int iFontWidth = fm.horizontalAdvance('x'); 176 #else 174 177 const int iFontWidth = fm.width('x'); 178 #endif 175 179 const int iTotalWidth = 50 * iFontWidth; 176 180 const int iFontHeight = fm.height(); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageSource.cpp
r93115 r93998 548 548 m_pProfileInstanceLabel->setBuddy(m_pProfileInstanceLabel); 549 549 const QFontMetrics fm(m_pProfileInstanceList->font()); 550 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 551 const int iFontWidth = fm.horizontalAdvance('x'); 552 #else 550 553 const int iFontWidth = fm.width('x'); 554 #endif 551 555 const int iTotalWidth = 50 * iFontWidth; 552 556 const int iFontHeight = fm.height(); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageSource.cpp
r93234 r93998 387 387 * horizontally and 8 lines vertically: */ 388 388 const QFontMetrics fm(m_pSourceImageList->font()); 389 #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) 390 const int iFontWidth = fm.horizontalAdvance('x'); 391 #else 389 392 const int iFontWidth = fm.width('x'); 393 #endif 390 394 const int iTotalWidth = 50 * iFontWidth; 391 395 const int iFontHeight = fm.height();
Note:
See TracChangeset
for help on using the changeset viewer.