Source Code (Use browser search to find items of interest.)

Class Index

kdelibs'KStatusBarLabel (./kdelibs/kdeui/kstatusbar.h:34)

class KStatusBarLabel : public QLabel
{
  Q_OBJECT

public:


  KStatusBarLabel( const QString& text, int _id, KStatusBar* parent = 0L, const char *name=0L );
  ~KStatusBarLabel () {};

protected:

  void mousePressEvent (QMouseEvent* _event);
  void mouseReleaseEvent (QMouseEvent* _event);
  
private:
  
  int id;

signals:

  void itemPressed (int id);
  void itemReleased (int id);
};

/**
 *  Display status messages.
 *
 *  You can insert text labels or custom widgets. Their geometry is managed
 *  internally. KStatusBar resizes itself, but positioning is left to
 *  @ref KTMainWindow (or to you, if you don't use @ref KTMainWindow ).
 *
 *  A special type of item is a message which is a temporary text-message
 *  displayed on top of other items in full-width. Messages are visible for
 *  specified time, or until you call the slot @ref QStatusBar::clear(). See
 *  @ref QStatusBar::message for details.
 *
 *  KStatusBar inherits @ref QStatusBar, you can freely use all @ref QStatusBar
 *  methods.
 *
 *  Empty text items are not visible. They will become visible when you change
 *  (add) text.
 *
 *  @short KDE statusbar widget
 *  @author Mark Donohoe (donohoe@kde.org) Maintained by Sven Radej <radej@kde.org>
 *  @version $Id: kstatusbar.h,v 1.28 2000/03/16 10:01:05 radej Exp $
 */

kdelibs'KStatusBarLabel::KStatusBarLabel() (./kdelibs/kdeui/kstatusbar.cpp:30)

KStatusBarLabel::KStatusBarLabel( const QString& text, int _id,
                                 KStatusBar *parent, const char *name) :
  QLabel( parent, name) 
{   
  id = _id;

  // Commented out - not needed? (sven)
  //int w, h;
  //QFontMetrics fm = fontMetrics();
  //w = fm.width( text )+8;
  //h = fm.height() + FONT_Y_DELTA;
  //resize( w, h );


  setText( text );

  // umm... Mosfet? Can you help here?
  
  // Warning: QStatusBar draws shaded rectangle around every item - which
  // IMHO is stupid.
  // So NoFrame|PLain is the best you get. the problem is that only in case of
  // StyledPanel|Something you get QFrame to call QStyle::drawPanel().
  
  setLineWidth  (0);
  setFrameStyle (QFrame::NoFrame);
  
  setAlignment( AlignHCenter | AlignVCenter );

  connect (this, SIGNAL(itemPressed(int)), parent, SLOT(slotPressed(int)));
  connect (this, SIGNAL(itemReleased(int)), parent, SLOT(slotReleased(int)));
}


kdelibs'KStatusBarLabel::mousePressEvent() (./kdelibs/kdeui/kstatusbar.cpp:62)

void KStatusBarLabel::mousePressEvent (QMouseEvent *)
{
  emit itemPressed (id);
}


kdelibs'KStatusBarLabel::mouseReleaseEvent() (./kdelibs/kdeui/kstatusbar.cpp:67)

void KStatusBarLabel::mouseReleaseEvent (QMouseEvent *)
{
  emit itemReleased (id);
}