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

Class Index

killustrator'ColorField (./koffice/killustrator/share/ColorField.h:33)

class ColorField : public QButton {
  Q_OBJECT
public:
  ColorField (int idx, const QBrush& b, 
	      QWidget *parent = 0, const char* name = 0);

  void setBrush (const QBrush& b);

public slots:
  void highlight (bool flag);

protected:
  void drawButton (QPainter* p);
  void mouseReleaseEvent (QMouseEvent* e);
    
signals:
  void colorSelected (int flag, int idx, const QBrush& b);

private:
  QBrush brush;
  bool highlighted;
  int id;
};

killustrator'ColorField::ColorField() (./koffice/killustrator/share/ColorField.cc:33)

ColorField::ColorField (int idx, const QBrush& b, 
			QWidget* parent, const char* name) 
  : QButton (parent, name) {
  setFixedSize (15, 15);
  resize (15, 15);
  brush = b;
  highlighted = false;
  id = idx;
}


killustrator'ColorField::setBrush() (./koffice/killustrator/share/ColorField.cc:43)

void ColorField::setBrush (const QBrush& b) {
  brush = b;
  repaint ();
}


killustrator'ColorField::highlight() (./koffice/killustrator/share/ColorField.cc:48)

void ColorField::highlight (bool flag) {
  if (highlighted != flag) {
    highlighted = flag;
    repaint ();
  }
}


killustrator'ColorField::drawButton() (./koffice/killustrator/share/ColorField.cc:55)

void ColorField::drawButton (QPainter* p) {
  QRect r = rect ();
  QBrush fill (brush.color ());
  qDrawShadeRect (p, r, colorGroup (), TRUE, 1, 1, &fill);
  if (brush.style () == NoBrush) {
    p->setPen (darkGray);
    p->drawLine (1, 1, 13, 13);
    p->drawLine (13, 1, 1, 13);
  }
  if (highlighted)
    p->drawWinFocusRect (1, 1, 13, 13);
}


killustrator'ColorField::mouseReleaseEvent() (./koffice/killustrator/share/ColorField.cc:68)

void ColorField::mouseReleaseEvent (QMouseEvent* e) {
  if (e->state () == RightButton)
    emit colorSelected (0, id, brush);
  else if (e->state () == LeftButton)
    emit colorSelected (1, id, brush);
}