From: nds Date: Tue, 9 Oct 2007 12:58:03 +0000 (+0000) Subject: Rename class CloseButton on QtxWorkstackAreaTitleButton. X-Git-Tag: TG_Saint_Valentine-Day~28 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aa1842be85888a591be4ba7cc92d3988703ddbcf;p=modules%2Fgui.git Rename class CloseButton on QtxWorkstackAreaTitleButton. Move this class to header for append Q_OBJECT. It's necessary for correct using in Salome_Style class when button is drawing. --- diff --git a/src/Qtx/QtxWorkstack.cxx b/src/Qtx/QtxWorkstack.cxx index 0927f0745..ce0a5fc88 100644 --- a/src/Qtx/QtxWorkstack.cxx +++ b/src/Qtx/QtxWorkstack.cxx @@ -240,31 +240,18 @@ void QtxWorkstackDrag::startDrawRect() myAreaRect->hide(); } - /* - \class CloseButton + \class QtxWorkstackAreaTitleButton \brief Workstack area close button. \internal */ -class CloseButton : public QAbstractButton -{ -public: - CloseButton( QWidget* ); - - QSize sizeHint() const; - QSize minimumSizeHint() const; - - void enterEvent( QEvent* ); - void leaveEvent( QEvent* ); - void paintEvent( QPaintEvent* ); -}; /*! \brief Constructor \internal \param parent parent widget */ -CloseButton::CloseButton( QWidget* parent ) +QtxWorkstackAreaTitleButton::QtxWorkstackAreaTitleButton( QWidget* parent ) : QAbstractButton( parent ) { setFocusPolicy( Qt::NoFocus ); @@ -275,7 +262,7 @@ CloseButton::CloseButton( QWidget* parent ) \internal \return size value */ -QSize CloseButton::sizeHint() const +QSize QtxWorkstackAreaTitleButton::sizeHint() const { ensurePolished(); int dim = 0; @@ -293,7 +280,7 @@ QSize CloseButton::sizeHint() const \internal \return minimum size value */ -QSize CloseButton::minimumSizeHint() const +QSize QtxWorkstackAreaTitleButton::minimumSizeHint() const { return sizeHint(); } @@ -303,7 +290,7 @@ QSize CloseButton::minimumSizeHint() const \internal \param event mouse enter event */ -void CloseButton::enterEvent( QEvent *event ) +void QtxWorkstackAreaTitleButton::enterEvent( QEvent *event ) { if ( isEnabled() ) update(); @@ -315,7 +302,7 @@ void CloseButton::enterEvent( QEvent *event ) \internal \param event mouse leave event */ -void CloseButton::leaveEvent( QEvent *event ) +void QtxWorkstackAreaTitleButton::leaveEvent( QEvent *event ) { if( isEnabled() ) update(); @@ -327,7 +314,7 @@ void CloseButton::leaveEvent( QEvent *event ) \internal \param event paint event */ -void CloseButton::paintEvent( QPaintEvent* ) +void QtxWorkstackAreaTitleButton::paintEvent( QPaintEvent* ) { QPainter p( this ); @@ -384,7 +371,7 @@ QtxWorkstackArea::QtxWorkstackArea( QWidget* parent ) myBar = new QtxWorkstackTabBar( top ); tl->addWidget( myBar, 1 ); - CloseButton* close = new CloseButton( top ); + QtxWorkstackAreaTitleButton* close = new QtxWorkstackAreaTitleButton( top ); close->setIcon( style()->standardIcon( QStyle::SP_TitleBarCloseButton ) ); myClose = close; tl->addWidget( myClose ); diff --git a/src/Qtx/QtxWorkstack.h b/src/Qtx/QtxWorkstack.h index d549965d3..abd42134b 100644 --- a/src/Qtx/QtxWorkstack.h +++ b/src/Qtx/QtxWorkstack.h @@ -29,6 +29,7 @@ #include #include #include +#include class QAction; class QSplitter; @@ -158,6 +159,20 @@ private: friend class QtxWorkstackDrag; }; +class QtxWorkstackAreaTitleButton : public QAbstractButton +{ + Q_OBJECT +public: + QtxWorkstackAreaTitleButton( QWidget* ); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + void enterEvent( QEvent* ); + void leaveEvent( QEvent* ); + void paintEvent( QPaintEvent* ); +}; + class QtxWorkstackArea : public QFrame { Q_OBJECT