VirtualBox

Changeset 106651 in vbox


Ignore:
Timestamp:
Oct 24, 2024 10:57:35 AM (3 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9072. Apply correct margin to to bottom/up buttons as the text edit content changes.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/logviewer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerTextEdit.cpp

    r106061 r106651  
    493493        m_pLineNumberArea->setGeometry(QRect(cr.left(), cr.top(), lineNumberAreaWidth(), cr.height()));
    494494    }
    495 
    496    if (m_pScrollToBottomLabel && m_pScrollToTopLabel)
    497    {
    498        QScrollBar *pVScrollBar = verticalScrollBar();
    499        QScrollBar *pHScrollBar = horizontalScrollBar();
    500 
    501        int iMarginX = 0;
    502        if (pVScrollBar)
    503            iMarginX = pVScrollBar->width();
    504        if (iMarginX == 0)
    505            iMarginX = m_pScrollToBottomLabel->width();
    506        iMarginX += 2 * QApplication::style()->pixelMetric(QStyle::PM_FocusFrameHMargin);
    507        int iMarginY = 0;
    508        if (pHScrollBar)
    509            iMarginY = pHScrollBar->height();
    510        if (iMarginY == 0)
    511            iMarginY = m_pScrollToTopLabel->height();
    512 
    513 
    514        m_pScrollToBottomLabel->move(width() - iMarginX - m_pScrollToBottomLabel->width(),
     495    repositionToBottomToUpButtons();
     496}
     497
     498void UIVMLogViewerTextEdit::repositionToBottomToUpButtons()
     499{
     500    if (m_pScrollToBottomLabel && m_pScrollToTopLabel)
     501    {
     502        QScrollBar *pVScrollBar = verticalScrollBar();
     503        QScrollBar *pHScrollBar = horizontalScrollBar();
     504        QSize iconSize = m_pScrollToBottomLabel->pixmap().size();
     505        int iMarginX = 0;
     506        if (pVScrollBar)
     507            iMarginX = pVScrollBar->width();
     508        if (iMarginX == 0)
     509            iMarginX = iconSize.width();
     510        iMarginX += 2 * QApplication::style()->pixelMetric(QStyle::PM_FocusFrameHMargin);
     511        int iMarginY = 0;
     512        if (pHScrollBar)
     513            iMarginY = pHScrollBar->height();
     514        if (iMarginY == 0)
     515            iMarginY = iconSize.height();
     516
     517         m_pScrollToBottomLabel->move(width() - iMarginX - iconSize.width(),
    515518                                     0.5 * m_pScrollToBottomLabel->height());
    516519
    517        m_pScrollToTopLabel->move(width() - iMarginX - m_pScrollToTopLabel->width(),
    518                                   height() - iMarginY - 1.5 * m_pScrollToTopLabel->height());
    519    }
     520        m_pScrollToTopLabel->move(width() - iMarginX - iconSize.width(),
     521                                  height() - iMarginY - 1.5 * iconSize.height());
     522    }
    520523}
    521524
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerTextEdit.h

    r106061 r106651  
    113113    /** If bookmark exists this function removes it, if not it adds the bookmark. */
    114114    void toggleBookmark(const UIVMLogBookmark& bookmark);
     115    void repositionToBottomToUpButtons();
    115116
    116117    UIVMLogBookmark  m_iContextMenuBookmark;
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