- Timestamp:
- Apr 13, 2021 4:56:17 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp
r88485 r88496 927 927 else 928 928 addNewTab(url, false); 929 930 929 updateTabUrlTitleList(); 931 930 } -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.cpp
r88493 r88496 489 489 { 490 490 m_helpFileList = helpFileList; 491 /* File list necessary to get the image data from the help engine: */ 492 iterateDocumentImages(); 493 scaleImages(); 491 494 } 492 495 … … 580 583 else if (pEvent->modifiers() & Qt::ControlModifier) 581 584 { 582 if (pEvent->angleDelta().y() <0)585 if (pEvent->angleDelta().y() > 0) 583 586 zoom(ZoomOperation_In); 584 else if (pEvent->angleDelta().y() >0)587 else if (pEvent->angleDelta().y() < 0) 585 588 zoom(ZoomOperation_Out); 586 589 } … … 644 647 { 645 648 QIWithRetranslateUI<QTextBrowser>::paintEvent(pEvent); 646 647 649 QPainter painter(viewport()); 650 foreach(const DocumentImage &image, m_imageMap) 651 { 652 QRect rect = cursorRect(image.m_textCursor); 653 QPixmap newPixmap = image.m_pixmap.scaledToWidth(image.m_fScaledWidth, Qt::SmoothTransformation); 654 QRectF imageRect(rect.x() - newPixmap.width(), rect.y(), newPixmap.width(), newPixmap.height()); 655 656 int iMargin = 3; 657 QRectF fillRect(imageRect.x() - iMargin, imageRect.y() - iMargin, 658 imageRect.width() + 2 * iMargin, imageRect.height() + 2 * iMargin); 659 660 painter.fillRect(fillRect, Qt::white); 661 painter.drawPixmap(imageRect, newPixmap, newPixmap.rect()); 662 } 648 663 // if (m_pOverlayLabel) 649 664 // { … … 875 890 DocumentImage &image = iterator.value(); 876 891 image.m_fInitialWidth = imageFormat.width(); 877 //image.m_iPosition = cursor.position();892 image.m_strName = imageFormat.name(); 878 893 image.m_textCursor = cursor; 879 894 QUrl imageFileUrl; … … 905 920 void UIHelpViewer::scaleImages() 906 921 { 907 // for (QHash<QString, DocumentImage>::iterator iterator = m_imageMap.begin(); 908 // iterator != m_imageMap.end(); ++iterator) 909 foreach(const DocumentImage &image, m_imageMap) 910 { 911 912 // QTextCursor cursor = textCursor(); 913 // cursor.movePosition(QTextCursor::Start); 914 // cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::MoveAnchor, image.m_iPosition); 915 // if (cursor.isNull()) 916 // continue; 922 for (QHash<QString, DocumentImage>::iterator iterator = m_imageMap.begin(); 923 iterator != m_imageMap.end(); ++iterator) 924 { 925 DocumentImage &image = *iterator; 917 926 QTextCursor cursor = image.m_textCursor; 918 927 QTextCharFormat format = cursor.charFormat(); … … 920 929 continue; 921 930 QTextImageFormat imageFormat = format.toImageFormat(); 922 imageFormat.setWidth(image.m_fInitialWidth * m_iZoomPercentage / 100.); 931 image.m_fScaledWidth = image.m_fInitialWidth * m_iZoomPercentage / 100.; 932 imageFormat.setWidth(image.m_fScaledWidth); 923 933 cursor.deletePreviousChar(); 924 934 cursor.deleteChar(); -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.h
r88488 r88496 109 109 { 110 110 qreal m_fInitialWidth; 111 qreal m_fScaledWidth; 111 112 //int m_iPosition; 112 113 QTextCursor m_textCursor; 113 114 QPixmap m_pixmap; 115 QString m_strName; 114 116 }; 115 117
Note:
See TracChangeset
for help on using the changeset viewer.