Changeset 88465 in vbox
- Timestamp:
- Apr 12, 2021 11:20:21 AM (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/UIHelpBrowserWidget.cpp
r88437 r88465 378 378 pMainLayout->addWidget(m_pValueLabel, Qt::AlignCenter); 379 379 pMainLayout->addWidget(m_pPlusButton); 380 setZoomPercentage(100); 380 381 } 381 382 -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.cpp
r88439 r88465 425 425 if (!fVisible) 426 426 { 427 document()->undo(); 427 /* Clear highlights: */ 428 setExtraSelections(QList<QTextEdit::ExtraSelection>()); 428 429 m_pFindInPageWidget->clearSearchField(); 429 430 verticalScrollBar()->setValue(iPosition); … … 529 530 this, &UIHelpViewer::sltHandleCopyLink); 530 531 531 532 532 QAction *pFindInPage = new QAction(UIHelpBrowserWidget::tr("Find in Page")); 533 533 pFindInPage->setCheckable(true); … … 582 582 void UIHelpViewer::mouseReleaseEvent(QMouseEvent *pEvent) 583 583 { 584 bool fOverlayMode = m_fOverlayMode; 584 585 clearOverlay(); 585 586 … … 597 598 QIWithRetranslateUI<QTextBrowser>::mouseReleaseEvent(pEvent); 598 599 599 loadImageAtPosition(pEvent->globalPos()); 600 if (!fOverlayMode) 601 loadImageAtPosition(pEvent->globalPos()); 600 602 } 601 603 602 604 void UIHelpViewer::mousePressEvent(QMouseEvent *pEvent) 603 605 { 604 clearOverlay();605 606 QIWithRetranslateUI<QTextBrowser>::mousePressEvent(pEvent); 606 loadImageAtPosition(pEvent->globalPos());607 607 } 608 608 … … 730 730 QTextDocument* pDocument = document(); 731 731 AssertReturnVoid(pDocument); 732 /* Clear previous highlight: */ 733 pDocument->undo(); 734 735 QTextCursor highlightCursor(pDocument); 736 QTextCursor cursor(pDocument); 737 cursor.beginEditBlock(); 732 733 QList<QTextEdit::ExtraSelection> extraSelections; 734 738 735 for (int i = 0; i < m_matchedCursorPosition.size(); ++i) 739 736 { 740 highlightCursor.setPosition(m_matchedCursorPosition[i]); 741 742 QTextCharFormat colorFormat(highlightCursor.charFormat()); 743 colorFormat.setBackground(Qt::yellow); 744 745 highlightCursor.setPosition(m_matchedCursorPosition[i] + iSearchTermLength, QTextCursor::KeepAnchor); 746 if (!highlightCursor.isNull()) 747 highlightCursor.setCharFormat(colorFormat); 748 } 749 cursor.endEditBlock(); 737 QTextEdit::ExtraSelection selection; 738 QTextCursor cursor = textCursor(); 739 cursor.setPosition(m_matchedCursorPosition[i]); 740 cursor.setPosition(m_matchedCursorPosition[i] + iSearchTermLength, QTextCursor::KeepAnchor); 741 QTextCharFormat format = cursor.charFormat(); 742 format.setBackground(Qt::yellow); 743 744 selection.cursor = cursor; 745 selection.format = format; 746 extraSelections.append(selection); 747 } 748 setExtraSelections(extraSelections); 750 749 } 751 750 … … 847 846 { 848 847 DocumentImage image; 849 QTextImageFormat imageFormat = cursor.charFormat().toImageFormat();850 image.m_fInitialWidth = imageFormat.width();851 image.m_iPosition = cursor.position();852 m_imageMap[imageFormat.name()] = image;848 QTextImageFormat imageFormat = cursor.charFormat().toImageFormat(); 849 image.m_fInitialWidth = imageFormat.width(); 850 image.m_iPosition = cursor.position(); 851 m_imageMap[imageFormat.name()] = image; 853 852 } 854 853 } … … 869 868 QTextCursor cursor = textCursor(); 870 869 cursor.movePosition(QTextCursor::Start); 871 cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::MoveAnchor, (*iterator).m_iPosition - 1);870 cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::MoveAnchor, (*iterator).m_iPosition); 872 871 if (cursor.isNull()) 873 872 continue; … … 877 876 QTextImageFormat imageFormat = format.toImageFormat(); 878 877 imageFormat.setWidth((*iterator).m_fInitialWidth * m_iZoomPercentage / 100.); 879 cursor.delete Char();878 cursor.deletePreviousChar(); 880 879 cursor.insertImage(imageFormat); 881 880 }
Note:
See TracChangeset
for help on using the changeset viewer.