KHTML
khtmlviewbarwidget.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "khtmlviewbarwidget.h"
00021
00022 #include <kicon.h>
00023
00024 #include <QtGui/QHBoxLayout>
00025 #include <QtGui/QToolButton>
00026 #include <QtGui/QResizeEvent>
00027
00028 KHTMLViewBarWidget::KHTMLViewBarWidget( bool addCloseButton, QWidget *parent )
00029 : QWidget( parent )
00030 {
00031 QHBoxLayout *layout = new QHBoxLayout;
00032
00033
00034 layout->setMargin( 2 );
00035
00036
00037 if ( addCloseButton ) {
00038 QToolButton *hideButton = new QToolButton( this );
00039 hideButton->setAutoRaise( true );
00040 hideButton->setIcon( KIcon( "dialog-close" ) );
00041 connect( hideButton, SIGNAL( clicked() ), SIGNAL( hideMe() ) );
00042 layout->addWidget( hideButton );
00043 layout->setAlignment( hideButton, Qt::AlignLeft | Qt::AlignTop );
00044 }
00045
00046
00047 m_centralWidget = new QWidget( this );
00048 layout->addWidget( m_centralWidget );
00049
00050 setLayout( layout );
00051 setFocusProxy( m_centralWidget );
00052 }
00053
00054 void KHTMLViewBarWidget::resizeEvent( QResizeEvent *event )
00055 {
00056 if ( event->size().width() != width() )
00057 resize( event->size().width(), minimumSize().height() );
00058 QWidget::resizeEvent( event );
00059 }