- Timestamp:
- Apr 8, 2021 2:05:51 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.cpp
r88415 r88418 389 389 m_pFindInPageWidget->clearSearchField(); 390 390 } 391 scaleImages(); 391 392 } 392 393 … … 463 464 m_iZoomPercentage = iZoomPercentage; 464 465 scaleFont(); 466 scaleImages(); 465 467 emit sigZoomPercentageChanged(m_iZoomPercentage); 466 468 } … … 730 732 void UIHelpViewer::iterateDocumentImages() 731 733 { 732 m_image SizesMap.clear();734 m_imageMap.clear(); 733 735 QTextCursor cursor = textCursor(); 734 736 cursor.movePosition(QTextCursor::Start); … … 738 740 if (cursor.charFormat().isImageFormat()) 739 741 { 742 DocumentImage image; 740 743 QTextImageFormat imageFormat = cursor.charFormat().toImageFormat(); 741 m_imageSizesMap[imageFormat.name()] = imageFormat.width(); 744 image.m_fInitialWidth = imageFormat.width(); 745 image.m_iPosition = cursor.position(); 746 m_imageMap[imageFormat.name()] = image; 742 747 } 743 748 } … … 751 756 } 752 757 758 void UIHelpViewer::scaleImages() 759 { 760 for (QMap<QString, DocumentImage>::iterator iterator = m_imageMap.begin(); 761 iterator != m_imageMap.end(); ++iterator) 762 { 763 QTextCursor cursor = textCursor(); 764 cursor.movePosition(QTextCursor::Start); 765 cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::MoveAnchor, (*iterator).m_iPosition - 1); 766 if (cursor.isNull()) 767 continue; 768 QTextCharFormat format = cursor.charFormat(); 769 if (!format.isImageFormat()) 770 continue; 771 QTextImageFormat imageFormat = format.toImageFormat(); 772 imageFormat.setWidth((*iterator).m_fInitialWidth * m_iZoomPercentage / 100.); 773 cursor.deleteChar(); 774 cursor.insertImage(imageFormat); 775 } 776 } 777 778 753 779 #include "UIHelpViewer.moc" 754 780 -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.h
r88411 r88418 95 95 private: 96 96 97 struct DocumentImage 98 { 99 qreal m_fInitialWidth; 100 int m_iPosition; 101 }; 102 97 103 void retranslateUi(); 98 104 bool isRectInside(const QRect &rect, int iMargin) const; … … 103 109 void iterateDocumentImages(); 104 110 void scaleFont(); 111 void scaleImages(); 105 112 const QHelpEngine* m_pHelpEngine; 106 113 UIFindInPageWidget *m_pFindInPageWidget; … … 113 120 int m_iSearchTermLength; 114 121 int m_iInitialFontPointSize; 115 /** A container to store the original image sizes in the document. key is image name value is the width. */116 QMap<QString, qreal> m_imageSizesMap;122 /** A container to store the original image sizes/positions in the document. key is image name value is DocumentImage. */ 123 QMap<QString, DocumentImage> m_imageMap; 117 124 /** As percentage. */ 118 125 int m_iZoomPercentage;
Note:
See TracChangeset
for help on using the changeset viewer.