VirtualBox

Changeset 88465 in vbox


Ignore:
Timestamp:
Apr 12, 2021 11:20:21 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9831. Fixes.

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  
    378378    pMainLayout->addWidget(m_pValueLabel, Qt::AlignCenter);
    379379    pMainLayout->addWidget(m_pPlusButton);
     380    setZoomPercentage(100);
    380381}
    381382
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.cpp

    r88439 r88465  
    425425    if (!fVisible)
    426426    {
    427         document()->undo();
     427        /* Clear highlights: */
     428        setExtraSelections(QList<QTextEdit::ExtraSelection>());
    428429        m_pFindInPageWidget->clearSearchField();
    429430        verticalScrollBar()->setValue(iPosition);
     
    529530            this, &UIHelpViewer::sltHandleCopyLink);
    530531
    531 
    532532    QAction *pFindInPage = new QAction(UIHelpBrowserWidget::tr("Find in Page"));
    533533    pFindInPage->setCheckable(true);
     
    582582void UIHelpViewer::mouseReleaseEvent(QMouseEvent *pEvent)
    583583{
     584    bool fOverlayMode = m_fOverlayMode;
    584585    clearOverlay();
    585586
     
    597598    QIWithRetranslateUI<QTextBrowser>::mouseReleaseEvent(pEvent);
    598599
    599     loadImageAtPosition(pEvent->globalPos());
     600    if (!fOverlayMode)
     601        loadImageAtPosition(pEvent->globalPos());
    600602}
    601603
    602604void UIHelpViewer::mousePressEvent(QMouseEvent *pEvent)
    603605{
    604     clearOverlay();
    605606    QIWithRetranslateUI<QTextBrowser>::mousePressEvent(pEvent);
    606     loadImageAtPosition(pEvent->globalPos());
    607607}
    608608
     
    730730    QTextDocument* pDocument = document();
    731731    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
    738735    for (int i = 0; i < m_matchedCursorPosition.size(); ++i)
    739736    {
    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);
    750749}
    751750
     
    847846        {
    848847            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;
    853852        }
    854853    }
     
    869868        QTextCursor cursor = textCursor();
    870869        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);
    872871        if (cursor.isNull())
    873872            continue;
     
    877876        QTextImageFormat imageFormat = format.toImageFormat();
    878877        imageFormat.setWidth((*iterator).m_fInitialWidth * m_iZoomPercentage / 100.);
    879         cursor.deleteChar();
     878        cursor.deletePreviousChar();
    880879        cursor.insertImage(imageFormat);
    881880    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette