Example #1
0
/*!

*/
void QSpinWidget::paintEvent( QPaintEvent * )
{
    QPainter p( this );

    QStyle::SFlags flags = QStyle::Style_Default;
    if (isEnabled())
	flags |= QStyle::Style_Enabled;
    if (hasFocus() || focusProxy() && focusProxy()->hasFocus())
	flags |= QStyle::Style_HasFocus;

    QStyle::SCFlags active;
    if ( d->theButton & 1 )
	active = QStyle::SC_SpinWidgetDown;
    else if ( d->theButton & 2 )
	active = QStyle::SC_SpinWidgetUp;
    else
	active = QStyle::SC_None;

    QRect fr = QStyle::visualRect(
	style().querySubControlMetrics( QStyle::CC_SpinWidget, this,
					QStyle::SC_SpinWidgetFrame ), this );
    style().drawComplexControl( QStyle::CC_SpinWidget, &p, this,
				fr, colorGroup(),
				flags,
				(uint)QStyle::SC_All,
				active );
}
Example #2
0
void GfxCanvasItem::setFocused(bool f)
{
    if(focusProxy()) {
        focusProxy()->setFocused(f);
        return;
    }
    GfxCanvasWindow *w = window();
    if(w) {
        if(f) {
            w->setFocused(this);
        } else {
            if(w->focused() == this)
                w->setFocused((GfxCanvasItem *)0);
        }
    } else {
        GfxCanvas *c = canvas();
        if(f) {
            c->setFocused(this);
        } else {
            if(c->focused() == this)
                c->setFocused(0);
        }
    }
}