1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
15 Author: Stefan Hundhammer <sh@suse.de>
20 #include <qpushbutton.h>
22 #define y2log_component "qt-ui"
23 #include <ycp/y2log.h>
28 #include "YQPushButton.h"
31 YQPushButton::YQPushButton( YWidget * parent,
32 const std::string & label )
33 : YQGenericButton( parent, label )
37 QPushButton * button = new QPushButton( fromUTF8( label ), this );
38 Q_CHECK_PTR( button );
40 setQPushButton( button );
42 button->setMinimumSize( 2, 2 );
43 button->move( YQButtonBorder, YQButtonBorder );
44 setMinimumSize( button->minimumSize()
45 + 2 * QSize( YQButtonBorder, YQButtonBorder ) );
47 connect( button, SIGNAL( clicked() ),
48 this, SLOT ( hit() ) );
52 YQPushButton::~YQPushButton()
57 int YQPushButton::preferredWidth()
59 return 2 * YQButtonBorder + qPushButton()->sizeHint().width();
63 int YQPushButton::preferredHeight()
65 return 2 * YQButtonBorder + qPushButton()->sizeHint().height();
69 void YQPushButton::setSize( int newWidth, int newHeight )
71 qPushButton()->resize( newWidth - 2 * YQButtonBorder,
72 newHeight - 2 * YQButtonBorder );
73 resize( newWidth, newHeight );
77 void YQPushButton::hit()
79 YQUI::ui()->sendEvent( new YWidgetEvent( this, YEvent::Activated ) );
83 #include "YQPushButton.moc"