21 #include "kkeybutton.h"
22 #include "tdeshortcutdialog.h"
25 #include <tqdrawutil.h>
26 #include <tqpainter.h>
27 #include <tdeapplication.h>
29 #include <kglobalaccel.h>
37 #include <X11/keysymdef.h>
40 const int XFocusOut = FocusOut;
41 const int XFocusIn = FocusIn;
42 const int XKeyPress = KeyPress;
43 const int XKeyRelease = KeyRelease;
55 class KKeyButtonPrivate
69 : TQPushButton( parent, name )
71 d =
new KKeyButtonPrivate;
72 setFocusPolicy( TQWidget::StrongFocus );
74 connect(
this, TQ_SIGNAL(clicked()),
this, TQ_SLOT(
captureShortcut()) );
85 d->bQtShortcut = bQtShortcut;
88 keyStr.replace(
'&', TQString::fromLatin1(
"&&"));
89 setText( keyStr.isEmpty() ? i18n(
"None") : keyStr );
100 TQPushButton::setText( text );
101 setFixedSize( sizeHint().width()+12, sizeHint().height()+8 );
113 if( dlg.exec() == KDialog::Accepted )
114 cut = dlg.shortcut();
117 emit capturedShortcut( cut );
126 a.setPoint( 0, 0, 0) ;
127 a.setPoint( 1, width(), 0 );
128 a.setPoint( 2, 0, height() );
129 a.setPoint( 3, 0, 0 );
132 painter->setClipRegion( r1 );
133 painter->setBrush( backgroundColor().light() );
134 painter->drawRoundRect( 0, 0, width(), height(), 20, 20);
136 a.setPoint( 0, width(), height() );
137 a.setPoint( 1, width(), 0 );
138 a.setPoint( 2, 0, height() );
139 a.setPoint( 3, width(), height() );
142 painter->setClipRegion( r2 );
143 painter->setBrush( backgroundColor().dark() );
144 painter->drawRoundRect( 0, 0, width(), height(), 20, 20 );
146 painter->setClipping(
false );
147 if( width() > 12 && height() > 8 )
148 qDrawShadePanel( painter, 6, 4, width() - 12, height() - 8,
149 colorGroup(),
true, 1, 0L );
152 painter->setPen( colorGroup().base() );
153 painter->setBrush( colorGroup().base() );
157 painter->setPen( backgroundColor() );
158 painter->setBrush( backgroundColor() );
160 if( width() > 14 && height() > 10 )
161 painter->drawRect( 7, 5, width() - 14, height() - 10 );
163 drawButtonLabel( painter );
165 painter->setPen( colorGroup().text() );
166 painter->setBrush( NoBrush );
167 if( hasFocus() || m_bEditing )
169 if( width() > 16 && height() > 12 )
170 painter->drawRect( 8, 6, width() - 16, height() - 12 );
175 void KKeyButton::virtual_hook(
int,
void* )
178 #include "kkeybutton.moc"
Dialog for configuring a shortcut.
TQString toString() const