VirtualBox

Changeset 75154 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Oct 29, 2018 2:51:56 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9241: VirtualBox Manager: Chooser pane: Don't forget to take into account tool button margins (while performing size hint calculations); Fix drag object size (it can't be of minimum size, only of current one).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp

    r75106 r75154  
    430430    const int iMinorSpacing = data(MachineItemData_MinorSpacing).toInt();
    431431    const int iParentIndent = data(MachineItemData_ParentIndent).toInt();
     432    const int iButtonMargin = data(MachineItemData_ButtonMargin).toInt();
    432433
    433434    /* Calculating proposed width: */
     
    449450                            iMiddleColumnWidth +
    450451                            iMajorSpacing +
    451                             m_toolsPixmapSize.width();
     452                            m_toolsPixmapSize.width() + 2 * iButtonMargin;
    452453    iProposedWidth += iMachineItemWidth;
    453454
     
    459460{
    460461    /* Prepare variables: */
    461     int iMargin = data(MachineItemData_Margin).toInt();
    462     int iMachineItemTextSpacing = data(MachineItemData_TextSpacing).toInt();
     462    const int iMargin = data(MachineItemData_Margin).toInt();
     463    const int iMachineItemTextSpacing = data(MachineItemData_TextSpacing).toInt();
     464    const int iButtonMargin = data(MachineItemData_ButtonMargin).toInt();
    463465
    464466    /* Calculating proposed height: */
     
    474476                              iBottomLineHeight;
    475477    QList<int> heights;
    476     heights << m_pixmapSize.height() << iMiddleColumnHeight << m_toolsPixmapSize.height();
     478    heights << m_pixmapSize.height() << iMiddleColumnHeight << m_toolsPixmapSize.height() + 2 * iButtonMargin;
    477479    int iMaxHeight = 0;
    478480    foreach (int iHeight, heights)
     
    496498{
    497499    /* Ask item to paint itself into pixmap: */
    498     QSize minimumSize = minimumSizeHint().toSize();
    499     QPixmap pixmap(minimumSize);
     500    const QSize actualSize = size().toSize();
     501    QPixmap pixmap(actualSize);
    500502    QPainter painter(&pixmap);
    501503    QStyleOptionGraphicsItem options;
    502     options.rect = QRect(QPoint(0, 0), minimumSize);
     504    options.rect = QRect(QPoint(0, 0), actualSize);
    503505    paint(&painter, &options);
    504506    return pixmap;
     
    777779{
    778780    /* Prepare variables: */
    779     int iMargin = data(MachineItemData_Margin).toInt();
    780     int iMajorSpacing = data(MachineItemData_MajorSpacing).toInt();
     781    const int iMargin = data(MachineItemData_Margin).toInt();
     782    const int iMajorSpacing = data(MachineItemData_MajorSpacing).toInt();
     783    const int iParentIndent = data(MachineItemData_ParentIndent).toInt();
     784    const int iButtonMargin = data(MachineItemData_ButtonMargin).toInt();
    781785
    782786    /* Calculate new maximum width for the first row: */
    783787    int iFirstRowMaximumWidth = (int)geometry().width();
     788    iFirstRowMaximumWidth -= iParentIndent * level();
    784789    iFirstRowMaximumWidth -= iMargin; /* left margin */
    785     iFirstRowMaximumWidth -= m_pixmapSize.width(); /* pixmap width */
    786     iFirstRowMaximumWidth -= iMajorSpacing; /* spacing between pixmap and name(s) */
     790    iFirstRowMaximumWidth -= m_pixmapSize.width(); /* left pixmap width */
     791    iFirstRowMaximumWidth -= iMajorSpacing; /* spacing between left pixmap and name(s) */
     792    iFirstRowMaximumWidth -= iMajorSpacing; /* spacing between name(s) and right pixmap */
     793    iFirstRowMaximumWidth -= m_toolsPixmapSize.width() + 2 * iButtonMargin; /* right pixmap width */
    787794    iFirstRowMaximumWidth -= iMargin; /* right margin */
    788795
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