List of all members.
Constructor & Destructor Documentation
ColorPickerButton::ColorPickerButton |
( |
QWidget * |
parent |
) |
|
Member Function Documentation
void ColorPickerButton::clicked |
( |
|
) |
[signal] |
void ColorPickerButton::focusInEvent |
( |
QFocusEvent * |
e |
) |
[protected] |
void ColorPickerButton::focusOutEvent |
( |
QFocusEvent * |
e |
) |
[protected] |
void ColorPickerButton::keyPressEvent |
( |
QKeyEvent * |
e |
) |
[protected] |
{
if (e->key() == Qt::Key_Up
|| e->key() == Qt::Key_Down
|| e->key() == Qt::Key_Left
|| e->key() == Qt::Key_Right) {
qApp->sendEvent(parent(), e);
} else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return) {
setFrameShadow(Sunken);
update();
} else {
QFrame::keyPressEvent(e);
}
}
void ColorPickerButton::keyReleaseEvent |
( |
QKeyEvent * |
e |
) |
[protected] |
{
if (e->key() == Qt::Key_Up
|| e->key() == Qt::Key_Down
|| e->key() == Qt::Key_Left
|| e->key() == Qt::Key_Right) {
qApp->sendEvent(parent(), e);
} else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return) {
setFrameShadow(Raised);
repaint();
emit clicked();
} else {
QFrame::keyReleaseEvent(e);
}
}
void ColorPickerButton::mouseMoveEvent |
( |
QMouseEvent * |
e |
) |
[protected] |
{
setFocus();
update();
}
void ColorPickerButton::mousePressEvent |
( |
QMouseEvent * |
e |
) |
[protected] |
{
setFrameShadow(Sunken);
update();
}
void ColorPickerButton::mouseReleaseEvent |
( |
QMouseEvent * |
e |
) |
[protected] |
{
setFrameShadow(Raised);
repaint();
emit clicked();
}
void ColorPickerButton::paintEvent |
( |
QPaintEvent * |
e |
) |
[protected] |
Reimplemented from QFrame.
{
QFrame::paintEvent(e);
QPainter p(this);
p.fillRect(contentsRect(), palette().button());
QRect r = rect();
int offset = frameShadow() == Sunken ? 1 : 0;
QPen pen(palette().buttonText(), 1);
p.setPen(pen);
p.drawRect(r.center().x() + offset - 4, r.center().y() + offset, 1, 1);
p.drawRect(r.center().x() + offset , r.center().y() + offset, 1, 1);
p.drawRect(r.center().x() + offset + 4, r.center().y() + offset, 1, 1);
if (hasFocus()) {
p.setPen( QPen( Qt::black, 0, Qt::SolidLine ) );
p.drawRect(0, 0, width() - 1, height() - 1);
}
p.end();
}
The documentation for this class was generated from the following file: