VirtualBox

Ignore:
Timestamp:
Apr 12, 2021 6:16:18 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
143732
Message:

FE/Qt: bugref:9831. Better guesses for the zoomed image margins.

File:
1 edited

Legend:

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

    r88474 r88475  
    642642        if (m_fOverlayMode)
    643643        {
    644             QSize size(qMin((int)(0.9 * width()), m_overlayPixmap.width()),
    645                         qMin((int)(0.9 * height()), height()));
     644            /* Scale the image to 1005 as long as it fits into avaible space (minus some margins and scrollbar sizes): */
     645            int vWidth = 0;
     646            if (verticalScrollBar() && verticalScrollBar()->isVisible())
     647                vWidth = verticalScrollBar()->width();
     648            int hMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) +
     649                qApp->style()->pixelMetric(QStyle::PM_LayoutRightMargin) + vWidth;
     650
     651            int hHeight = 0;
     652            if (horizontalScrollBar() && horizontalScrollBar()->isVisible())
     653                hHeight = horizontalScrollBar()->height();
     654            int vMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin) +
     655                qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin) + hHeight;
     656
     657            QSize size(qMin(width() - hMargin, m_overlayPixmap.width()),
     658                        qMin(height() - vMargin, m_overlayPixmap.height()));
    646659            m_pOverlayLabel->setPixmap(m_overlayPixmap.scaled(size,  Qt::KeepAspectRatio, Qt::SmoothTransformation));
    647             int x = 0.5 * (width() - m_pOverlayLabel->width());
    648             int y = 0.5 * (height() - m_pOverlayLabel->height());
     660            /* Center the label: */
     661            int x = 0.5 * (width() - vWidth - m_pOverlayLabel->width());
     662            int y = 0.5 * (height() - hHeight - m_pOverlayLabel->height());
    649663            m_pOverlayLabel->move(x, y);
    650664            m_pOverlayLabel->show();
Note: See TracChangeset for help on using the changeset viewer.

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