VirtualBox

Changeset 88499 in vbox


Ignore:
Timestamp:
Apr 13, 2021 5:33:29 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
143760
Message:

FE/Qt: bugref:9831. Reviving click to zoom functionality.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.cpp

    r88497 r88499  
    592592void UIHelpViewer::mouseReleaseEvent(QMouseEvent *pEvent)
    593593{
    594     // bool fOverlayMode = m_fOverlayMode;
     594    bool fOverlayMode = m_fOverlayMode;
    595595    clearOverlay();
    596596
     
    608608    QIWithRetranslateUI<QTextBrowser>::mouseReleaseEvent(pEvent);
    609609
    610     // if (!fOverlayMode)
    611     //     loadImageAtPosition(pEvent->globalPos());
     610    if (!fOverlayMode)
     611        loadImageAtPosition(pEvent->globalPos());
    612612}
    613613
     
    660660        painter.fillRect(fillRect, Qt::white);
    661661        painter.drawPixmap(imageRect, newPixmap, newPixmap.rect());
    662      }
    663     // if (m_pOverlayLabel)
    664     // {
    665     //     if (m_fOverlayMode)
    666     //     {
    667     //         /* Scale the image to 1:1 as long as it fits into avaible space (minus some margins and scrollbar sizes): */
    668     //         int vWidth = 0;
    669     //         if (verticalScrollBar() && verticalScrollBar()->isVisible())
    670     //             vWidth = verticalScrollBar()->width();
    671     //         int hMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) +
    672     //             qApp->style()->pixelMetric(QStyle::PM_LayoutRightMargin) + vWidth;
    673 
    674     //         int hHeight = 0;
    675     //         if (horizontalScrollBar() && horizontalScrollBar()->isVisible())
    676     //             hHeight = horizontalScrollBar()->height();
    677     //         int vMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin) +
    678     //             qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin) + hHeight;
    679 
    680     //         QSize size(qMin(width() - hMargin, m_overlayPixmap.width()),
    681     //                     qMin(height() - vMargin, m_overlayPixmap.height()));
    682     //         m_pOverlayLabel->setPixmap(m_overlayPixmap.scaled(size,  Qt::KeepAspectRatio, Qt::SmoothTransformation));
    683     //         /* Center the label: */
    684     //         int x = 0.5 * (width() - vWidth - m_pOverlayLabel->width());
    685     //         int y = 0.5 * (height() - hHeight - m_pOverlayLabel->height());
    686     //         m_pOverlayLabel->move(x, y);
    687     //         m_pOverlayLabel->show();
    688     //     }
    689     //     else
    690     //         m_pOverlayLabel->hide();
    691     // }
     662    }
     663    if (m_pOverlayLabel)
     664    {
     665        if (m_fOverlayMode)
     666        {
     667            /* Scale the image to 1:1 as long as it fits into avaible space (minus some margins and scrollbar sizes): */
     668            int vWidth = 0;
     669            if (verticalScrollBar() && verticalScrollBar()->isVisible())
     670                vWidth = verticalScrollBar()->width();
     671            int hMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) +
     672                qApp->style()->pixelMetric(QStyle::PM_LayoutRightMargin) + vWidth;
     673
     674            int hHeight = 0;
     675            if (horizontalScrollBar() && horizontalScrollBar()->isVisible())
     676                hHeight = horizontalScrollBar()->height();
     677            int vMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin) +
     678                qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin) + hHeight;
     679
     680            QSize size(qMin(width() - hMargin, m_overlayPixmap.width()),
     681                       qMin(height() - vMargin, m_overlayPixmap.height()));
     682            m_pOverlayLabel->setPixmap(m_overlayPixmap.scaled(size,  Qt::KeepAspectRatio, Qt::SmoothTransformation));
     683            /* Center the label: */
     684            int x = 0.5 * (width() - vWidth - m_pOverlayLabel->width());
     685            int y = 0.5 * (height() - hHeight - m_pOverlayLabel->height());
     686            m_pOverlayLabel->move(x, y);
     687            m_pOverlayLabel->show();
     688        }
     689        else
     690            m_pOverlayLabel->hide();
     691    }
    692692}
    693693
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