26 #include <qprogressbar.h>
27 #include <QVBoxLayout>
30 #define YUILogComponent "qt-ui"
31 #include <yui/YUILog.h>
37 #include "YQProgressBar.h"
38 #include "YQWidgetCaption.h"
42 const std::string & label,
44 : QFrame( (QWidget *) parent->widgetRep() )
45 , YProgressBar( parent, label, maxValue )
47 QVBoxLayout* layout =
new QVBoxLayout(
this );
52 layout->setSpacing( YQWidgetSpacing );
53 layout->setMargin ( YQWidgetMargin );
56 YUI_CHECK_NEW( _caption );
57 layout->addWidget( _caption );
59 _qt_progressbar =
new QProgressBar(
this );
60 _qt_progressbar->setRange(0, maxValue);
61 YUI_CHECK_NEW( _qt_progressbar );
62 layout->addWidget( _qt_progressbar );
64 _caption->setBuddy( _qt_progressbar );
77 YProgressBar::setLabel( label );
83 YProgressBar::setValue( newValue );
84 _qt_progressbar->setValue( value() );
91 _caption->setEnabled( enabled );
92 _qt_progressbar->setEnabled( enabled );
93 YWidget::setEnabled( enabled );
99 int hintWidth = !_caption->isHidden() ?
100 _caption->sizeHint().width() + layout()->margin() : 0;
102 return max( 200, hintWidth );
108 return sizeHint().height();
114 resize( newWidth, newHeight );
120 _qt_progressbar->setFocus();
126 #include "YQProgressBar.moc"
virtual bool setKeyboardFocus()
Accept the keyboard focus.
virtual int preferredHeight()
Preferred height of the widget.
virtual void setValue(int newValue)
Set the current progress value ( <= maxValue() ).
virtual void setLabel(const std::string &label)
Set the label (the caption above the progress bar).
virtual int preferredWidth()
Preferred width of the widget.
YQProgressBar(YWidget *parent, const std::string &label, int maxValue=100)
Constructor.
virtual void setSize(int newWidth, int newHeight)
Set the new size of the widget.
virtual ~YQProgressBar()
Destructor.
virtual void setEnabled(bool enabled)
Set enabled/disabled state.