1 /***************************************************************************
2 kcheckeduca.cpp - description
5 copyright : (C) 2000 by Javier Campos Morales
6 email : javi@asyris.org
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
18 #include "kcheckeduca.h"
19 #include "kcheckeduca.moc"
22 #include <kaccelmanager.h>
24 KCheckEduca::KCheckEduca(QWidget
*parent
, const char *name
) : QCheckBox(parent
,name
)
27 KAcceleratorManager::setNoAccel( this );
30 KCheckEduca::~KCheckEduca()
36 void KCheckEduca::drawButtonLabel( QPainter
*p
){
38 int extra_width
, indicator_width
;
41 indicator_width
= style().pixelMetric(QStyle::PM_IndicatorWidth
, 0);
44 x
= indicator_width
+ extra_width
; //###
50 _doc
= new QSimpleRichText( text(), font() );
53 _doc
->setWidth(p
, cr
.width() );
54 int rw
= _doc
->widthUsed() + extra_width
;
55 int rh
= _doc
->height();
61 yo
= (cr
.height()-rh
)/2;
64 QColorGroup cg
= colorGroup();
65 cg
.setColor( QColorGroup::Text
, cg
.light() );
66 _doc
->draw(p
, cr
.x()+xo
+1, cr
.y()+yo
+1, cr
, cg
, 0);
68 _doc
->draw(p
, cr
.x()+xo
, cr
.y()+yo
, cr
, colorGroup(), 0);
71 // QRect br = style().itemRect( p, x, y, rw, rh+yo,
72 // AlignLeft|AlignVCenter|ShowPrefix,
74 // pixmap(), text().visual() );
75 QRect
br(x
,y
,rw
,rh
+yo
);
77 br
.setLeft( br
.left()-3 );
78 br
.setRight( br
.right()+2 );
79 br
.setTop( br
.top()-2 );
80 br
.setBottom( br
.bottom()+2);
81 br
= br
.intersect( QRect(0,0,rw
, rh
+yo
) );
83 style().drawPrimitive( QStyle::PE_FocusRect
, p
, br
, colorGroup());