VirtualBox

Changeset 2592 in vbox


Ignore:
Timestamp:
May 11, 2007 12:31:38 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
21090
Message:

1764: Better default size in "Create VDI" wizard when called from "Create VM" wizard:

Fixing QILabel: layout reactivation upon every parent's child show event.
Used in NewVM & NewHD Wizards to ensure all widget stack's pages have required initial height.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxUtils.h

    r2578 r2592  
    2929#include <qtextedit.h>
    3030#include <qlabel.h>
     31#include <qlayout.h>
    3132
    3233/**
     
    206207
    207208    QILabel (QWidget *aParent, const char *aName)
    208          : QLabel (aParent, aName), mSizeHint (-1, -1)
     209         : QLabel (aParent, aName), mShowed (false)
    209210    {
    210211        /* setup default size policy and alignment */
     
    215216        setAlignment (int (QLabel::WordBreak | QLabel::AlignTop));
    216217        /* install show-parent-widget watcher */
    217         aParent->installEventFilter (this);
     218        aParent->topLevelWidget()->installEventFilter (this);
    218219    }
    219220
    220221    QSize sizeHint() const
    221222    {
    222         /* use cashed sizeHint if mSizeHint is valid */
    223         if (!mSizeHint.isValid())
    224             mSizeHint = QLabel::sizeHint();
    225         return mSizeHint;
     223        return mShowed ?
     224            QSize (width(), heightForWidth (width())) : QLabel::sizeHint();
    226225    }
    227226
     
    234233            case QEvent::Show:
    235234            {
    236                 /* watch for parent's show-event to recalculate sizeHint */
    237                 mSizeHint = QSize (width(), heightForWidth (width()));
    238                 updateGeometry();
     235                mShowed = true;
     236                if (parent() && ((QWidget*)parent())->layout())
     237                    ((QWidget*)parent())->layout()->activate();
    239238                break;
    240239            }
     
    245244    }
    246245
    247     mutable QSize mSizeHint;
     246    bool mShowed;
    248247};
    249248
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