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>
23 #include "YQAlignment.h"
28 YQAlignment::YQAlignment( YWidget * parent,
29 YAlignmentType horAlign,
30 YAlignmentType vertAlign )
31 : QWidget( (QWidget *) parent->widgetRep() )
32 , YAlignment( parent, horAlign, vertAlign )
38 YQAlignment::YQAlignment( YWidget * yParent,
40 YAlignmentType horAlign,
41 YAlignmentType vertAlign )
43 , YAlignment( yParent, horAlign, vertAlign )
49 void YQAlignment::setEnabled( bool enabled )
51 QWidget::setEnabled( enabled );
52 YWidget::setEnabled( enabled );
56 void YQAlignment::moveChild( YWidget * child, int newX, int newY )
58 QWidget * qw = (QWidget *) ( child->widgetRep() );
59 qw->move( newX, newY );
63 void YQAlignment::setSize( int newWidth, int newHeight )
65 resize( newWidth, newHeight );
66 YAlignment::setSize( newWidth, newHeight );
70 void YQAlignment::setBackgroundPixmap( const string & pixmapFileName )
72 string pixmapName = pixmapFileName;
74 YAlignment::setBackgroundPixmap( pixmapName ); // Prepend path etc.
75 pixmapName = YAlignment::backgroundPixmap();
77 if ( pixmapName.empty() ) // Delete any old background pixmap
79 setPalette(QPalette());
81 else // Set a new background pixmap
83 QPixmap pixmap( pixmapName.c_str() );
85 if ( pixmap.isNull() )
87 y2error( "Can't load background pixmap %s", pixmapName.c_str() );
92 palette.setBrush(backgroundRole(), QBrush(pixmap));
98 #include "YQAlignment.moc"