Source Code (Use browser search to find items of interest.)
Class Index
killustrator'BrushCells (./koffice/killustrator/share/BrushCells.h:37)
class BrushCells : public QTableView {
Q_OBJECT
public:
BrushCells (QWidget *parent = 0L, const QColor &colour = QT_PRFX::black,
const char *name = 0);
~BrushCells ();
QT_PRFX::BrushStyle brushStyle ();
void selectBrush (QT_PRFX::BrushStyle style);
void setColor(const QColor &);
protected:
virtual int cellWidth (int col);
virtual int cellHeight (int row);
virtual void paintCell (QPainter *, int row, int col);
virtual void mousePressEvent (QMouseEvent *event);
private:
std::vector<QPixmap> brushPixmaps;
int currentBrush;
};
killustrator'BrushCells::BrushCells() (./koffice/killustrator/share/BrushCells.cc:38)
BrushCells::BrushCells (QWidget *parent, const QColor &color, const char *name)
: QTableView (parent, name) {
setFrameStyle (QFrame::Panel | QFrame::Sunken);
setNumRows (3);
setNumCols (5);
setMinimumSize (5 * CELL_WIDTH, 3 * CELL_HEIGHT);
for (int i = 0; i < 14; i++) {
QPixmap pix (CELL_WIDTH, CELL_HEIGHT);
pix.fill (white);
QPainter p;
p.begin (&pix);
p.setPen (QT_PRFX::black);
QBrush brush (color, (QT_PRFX::BrushStyle) (i + 1));
// p.fillRect (0, 0, CELL_WIDTH - 1, CELL_HEIGHT - 1, brush);
qDrawShadeRect (&p, 0, 0, CELL_WIDTH, CELL_HEIGHT,
colorGroup (), true, 1, 1, &brush);
p.end ();
brushPixmaps.push_back (pix);
}
currentBrush = 0;
}
killustrator'BrushCells::~BrushCells() (./koffice/killustrator/share/BrushCells.cc:60)
BrushCells::~BrushCells () {
}
killustrator'BrushCells::setColor() (./koffice/killustrator/share/BrushCells.cc:63)
void BrushCells::setColor(const QColor &color)
{
brushPixmaps.clear();
for (int i = 0; i < 14; i++) {
QPixmap pix (CELL_WIDTH, CELL_HEIGHT);
pix.fill (white);
QPainter p;
p.begin (&pix);
p.setPen (QT_PRFX::black);
QBrush brush (color, (QT_PRFX::BrushStyle) (i + 1));
// p.fillRect (0, 0, CELL_WIDTH - 1, CELL_HEIGHT - 1, brush);
qDrawShadeRect (&p, 0, 0, CELL_WIDTH, CELL_HEIGHT,
colorGroup (), true, 1, 1, &brush);
p.end ();
brushPixmaps.push_back (pix);
}
}
killustrator'BrushCells::cellWidth() (./koffice/killustrator/share/BrushCells.cc:81)
int BrushCells::cellWidth (int) {
return CELL_WIDTH;
}
killustrator'BrushCells::cellHeight() (./koffice/killustrator/share/BrushCells.cc:85)
int BrushCells::cellHeight (int) {
return CELL_HEIGHT;
}
killustrator'BrushCells::paintCell() (./koffice/killustrator/share/BrushCells.cc:89)
void BrushCells::paintCell (QPainter *p, int row, int col) {
int pos = row * 5 + col;
if (pos < 14) {
p->drawPixmap (0, 0, brushPixmaps[pos]);
if (currentBrush == pos) {
qDrawShadeRect (p, 0, 0, CELL_WIDTH - 1, CELL_HEIGHT - 1,
colorGroup (), false, 1, 1, 0L);
}
}
}
killustrator'BrushCells::mousePressEvent() (./koffice/killustrator/share/BrushCells.cc:100)
void BrushCells::mousePressEvent (QMouseEvent *event) {
int row, col;
row = findRow (event->y ());
col = findCol (event->x ());
if (row != -1 && col != -1) {
int pos = row * 5 + col;
if (pos < 14) {
currentBrush = pos;
repaint ();
}
}
}
QT_PRFX::BrushStyle BrushCells::brushStyle () {
return (QT_PRFX::BrushStyle) (currentBrush + 1);
}
killustrator'BrushCells::selectBrush() (./koffice/killustrator/share/BrushCells.cc:119)
void BrushCells::selectBrush (QT_PRFX::BrushStyle style) {
currentBrush = (int) style - 1;
repaint ();
}