28 #define YUILogComponent "qt-ui"
29 #include <yui/YUILog.h>
33 #include "YQApplication.h"
36 #define AUTO_WRAP_WIDTH 150
37 #define AUTO_WRAP_HEIGHT 10
47 : QLabel( (QWidget *) parent->widgetRep() )
48 , YLabel( parent, text, isHeading, isOutputField )
49 , _layoutPass1Width( 0 )
53 setTextInteractionFlags( Qt::TextSelectableByMouse );
54 setTextFormat( Qt::PlainText );
55 QLabel::setText( fromUTF8( text ) );
62 else if ( isOutputField )
64 setFrameStyle ( QFrame::Panel | QFrame::Sunken );
69 setMargin( YQWidgetMargin );
70 setAlignment( Qt::AlignLeft | Qt::AlignTop );
82 YLabel::setText( newText );
83 QLabel::setText( fromUTF8( newText ) );
93 YLabel::setUseBoldFont( useBold );
97 void YQLabel::setAutoWrap(
bool autoWrap )
99 YLabel::setAutoWrap( autoWrap );
100 QLabel::setWordWrap( autoWrap );
106 QLabel::setEnabled( enabled );
107 YWidget::setEnabled( enabled );
117 if ( layoutPass() == 2 )
128 width = _layoutPass1Width;
142 width = AUTO_WRAP_WIDTH;
147 width = sizeHint().width();
160 if ( layoutPass() == 2 )
171 height = heightForWidth( _layoutPass1Width );
175 height = AUTO_WRAP_HEIGHT;
180 height = sizeHint().height();
191 _layoutPass1Width = layoutPass() == 1 ?
195 resize( newWidth, newHeight );
virtual int preferredWidth()
Preferred width of the widget.
YQLabel(YWidget *parent, const std::string &text, bool isHeading=false, bool isOutputField=false)
Constructor.
virtual ~YQLabel()
Destructor.
virtual int preferredHeight()
Preferred height of the widget.
virtual void setText(const std::string &newText)
Set the text the widget displays.
virtual void setUseBoldFont(bool bold)
Switch bold font on or off.
virtual void setSize(int newWidth, int newHeight)
Set the new size of the widget.
virtual void setEnabled(bool enabled)
Set enabled / disabled state.
static YQApplication * yqApp()
Return the global YApplication object as YQApplication.