1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
15 Author: Stefan Hundhammer <sh@suse.de>
20 #define y2log_component "qt-ui"
21 #include <ycp/y2log.h>
32 YQFrame::YQFrame( YWidget * parent,
33 const string & initialLabel )
34 : Q3GroupBox( (QWidget *) parent->widgetRep() )
35 , YFrame( parent, initialLabel )
37 setWidgetRep ( this );
38 QGroupBox::setTitle( fromUTF8( label() ) );
48 void YQFrame::setEnabled( bool enabled )
50 QGroupBox::setEnabled( enabled );
51 YWidget::setEnabled( enabled );
56 YQFrame::setSize( int newWidth, int newHeight )
58 resize( newWidth, newHeight );
62 int newChildWidth = max ( 0, newWidth - 2 * frameWidth() - 1 );
63 int newChildHeight = max ( 0, newHeight - frameWidth() - fontMetrics().height() - 1 );
65 firstChild()->setSize( newChildWidth, newChildHeight );
67 QWidget * qChild = (QWidget *) firstChild()->widgetRep();
68 qChild->move( frameWidth(), fontMetrics().height() );
74 YQFrame::setLabel( const string & newLabel )
76 YFrame::setLabel( newLabel );
77 QGroupBox::setTitle( fromUTF8( label() ) );
81 int YQFrame::preferredWidth()
84 int childPreferredWidth = hasChildren() ? firstChild()->preferredWidth() : 0;
86 preferredWidth = max( childPreferredWidth,
87 (10 + fontMetrics().width( title() ) ) );
88 preferredWidth += 2*frameWidth() + 1;
90 return preferredWidth;
94 int YQFrame::preferredHeight()
96 int preferredHeight = hasChildren() ? firstChild()->preferredHeight() : 0;
97 preferredHeight += frameWidth() + fontMetrics().height() + 1;
99 return preferredHeight;
103 #include "YQFrame.moc"