20 #include "kpushbutton.h"
22 #include <tqdragobject.h>
23 #include <tqwhatsthis.h>
24 #include <tqtooltip.h>
28 #include <tdeglobalsettings.h>
29 #include <tdeconfig.h>
30 #include <tdeglobal.h>
32 #include <tdeapplication.h>
34 class KPushButton::KPushButtonPrivate
41 bool KPushButton::s_useIcons =
false;
44 : TQPushButton( parent, name ),
45 m_dragEnabled( false )
52 : TQPushButton( parent, name ),
53 m_dragEnabled( false )
59 TQWidget *parent,
const char *name )
60 : TQPushButton( text, parent, name ),
61 m_dragEnabled( false )
68 : TQPushButton( parent, name ),
69 m_dragEnabled( false )
83 void KPushButton::init(
const KGuiItem &item )
85 d =
new KPushButtonPrivate;
91 TQPushButton::setText( d->item.text() );
93 static bool initialized =
false;
101 setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Minimum ) );
103 TQToolTip::add(
this, item.toolTip() );
105 TQWhatsThis::add(
this, item.whatsThis() );
109 connect( kapp, TQ_SIGNAL( settingsChanged(
int) ),
110 TQ_SLOT( slotSettingsChanged(
int) ) );
111 kapp->addKipcEventMask( KIPC::SettingsChanged );
115 void KPushButton::readSettings()
126 TQPushButton::setText( d->item.text() );
128 TQWhatsThis::add(
this, d->item.whatsThis() );
150 TQPushButton::setText(text);
154 if (text.isEmpty() != d->item.text().isEmpty())
157 d->item.setText(text);
162 d->item.setIconSet(iconSet);
164 if ( s_useIcons || text().isEmpty() )
165 TQPushButton::setIconSet( iconSet );
167 TQPushButton::setIconSet( TQIconSet() );
170 void KPushButton::slotSettingsChanged(
int )
178 m_dragEnabled = enable;
185 TQPushButton::mousePressEvent( e );
190 if ( !m_dragEnabled )
192 TQPushButton::mouseMoveEvent( e );
196 if ( (e->state() & TQt::LeftButton) &&
197 (e->pos() - startPos).manhattanLength() >
217 void KPushButton::virtual_hook(
int,
void* )
220 #include "kpushbutton.moc"
An abstract class for GUI data such as ToolTip and Icon.
static bool showIconsOnPushButtons()
static int dndEventDelay()