1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
13 File: YQWidgetCaption.h
15 Author: Stefan Hundhammer <sh@suse.de>
20 #ifndef YQWidgetCaption_h
21 #define YQWidgetCaption_h
29 * Helper class for captions (labels) above a widget: Takes care of hiding
30 * itself when its text is empty and showing when its text becomes non-empty.
32 class YQWidgetCaption: public QLabel
41 * If the text is empty, the widget will be created, but hidden right
42 * away. It can later be made visible again with setText() with a non-empty
45 YQWidgetCaption( QWidget * parent, const string & text );
46 YQWidgetCaption( QWidget * parent, const QString & text );
51 virtual ~YQWidgetCaption();
54 * Change the text and handle visibility:
55 * If the new text is empty, hide this widget.
56 * If the new text is non-empty, show this widget.
58 virtual void setText ( const string & newText );
59 virtual void setText ( const QString & newText );
64 * Make the widget visible if the text is non-empty or hide it if it is
67 void handleVisibility( const string & text );
68 void handleVisibility( const QString & text );
69 void handleVisibility( bool textIsEmpty );
73 #endif // YQWidgetCaption_h