VirtualBox

Changeset 24175 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 29, 2009 6:34:06 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
54114
Message:

FE/Qt4: VM Settings / Storage Page: More precise tree-view branches painting routine.

File:
1 edited

Legend:

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

    r24161 r24175  
    23402340
    23412341    aPainter->save();
    2342     aPainter->translate (aRect.x(), aRect.y());
    2343 
    2344     int rows = mStorageModel->rowCount (aIndex.parent());
    2345 
    2346     // TODO Draw Correct Braches!
    2347 
    2348     if (aIndex.row() == 0)
    2349         aPainter->drawLine (QPoint (aRect.width() / 2, 2), QPoint (aRect.width() / 2, aRect.height() / 2));
    2350     else
    2351         aPainter->drawLine (QPoint (aRect.width() / 2, 0), QPoint (aRect.width() / 2, aRect.height() / 2));
    2352 
    2353     if (aIndex.row() < rows - 1)
    2354         aPainter->drawLine (QPoint (aRect.width() / 2, aRect.height() / 2), QPoint (aRect.width() / 2, aRect.height()));
    2355 
    2356     aPainter->drawLine (QPoint (aRect.width() / 2, aRect.height() / 2), QPoint (aRect.width() - 2, aRect.height() / 2));
    2357 
     2342    QStyleOption options;
     2343    options.initFrom (mTwStorageTree);
     2344    options.rect = aRect;
     2345    options.state |= QStyle::State_Item;
     2346    if (aIndex.row() < mStorageModel->rowCount (aIndex.parent()) - 1)
     2347        options.state |= QStyle::State_Sibling;
     2348    /* This pen is commonly used by different
     2349     * look and feel styles to paint tree-view branches. */
     2350    QPen pen (QBrush (options.palette.dark().color(), Qt::Dense4Pattern), 0);
     2351    aPainter->setPen (pen);
     2352    /* If we want tree-view branches to be always painted we have to use QCommonStyle::drawPrimitive()
     2353     * because QCommonStyle performs branch painting as opposed to particular inherited sub-classing styles. */
     2354    qobject_cast <QCommonStyle*> (style())->QCommonStyle::drawPrimitive (QStyle::PE_IndicatorBranch, &options, aPainter);
    23582355    aPainter->restore();
    23592356}
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