Add GUI control to test kcontrol mouse double-click setting

This resolves Bug 1324
pull/2/head
Michele Calgaro 11 years ago committed by Slávek Banko
parent 7d6186b592
commit c4083c1d47

@ -256,6 +256,7 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name)
" The goal is to select a comfortable interval that you find"
" is not too fast or slow.");
TQWhatsThis::add( doubleClickLabel, wtstr );
doubleClickStatus = false; // First image will be displayed
doubleClickButton = new TQPushButton( tab2 );
doubleClickButton->setAcceptDrops( false );
// The images are 32x32.
@ -266,6 +267,9 @@ MouseConfig::MouseConfig (TQWidget * parent, const char *name)
lay->addWidget(doubleClickButton);
// Use the same What's This help for the pushbutton.
TQWhatsThis::add( doubleClickButton, wtstr );
connect(doubleClickButton, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotDoubleClickButtonPressed()));
doubleClickTimer=new TQTimer();
connect(doubleClickTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotDoubleClickTimerDone()) );
lay->addSpacing(10);
@ -641,6 +645,31 @@ void MouseConfig::slotClick()
}
void MouseConfig::slotDoubleClickButtonPressed()
{
if (!doubleClickTimer->isActive())
{
// First click or click after the timer has expired -> start the timer
doubleClickTimer->start(doubleClickInterval->value(), true);
}
else
{
// Double click event: stop the timer and change the picture
doubleClickTimer->stop();
if (!doubleClickStatus)
doubleClickButton->setPixmap(locate("data", "kcminput/pics/doubleclick_2.png"));
else
doubleClickButton->setPixmap(locate("data", "kcminput/pics/doubleclick_1.png"));
doubleClickStatus= !doubleClickStatus;
}
}
void MouseConfig::slotDoubleClickTimerDone()
{
// Stop the timer, even though not strictly needed since it is a single shot timer
doubleClickTimer->stop();
}
/** No descriptions */
void MouseConfig::slotHandedChanged(int val){
if(val==RIGHT_HANDED)

@ -37,6 +37,7 @@
#include <tqlcdnumber.h>
#include <tqpushbutton.h>
#include <tqradiobutton.h>
#include <tqtimer.h>
#include <tdeapplication.h>
@ -104,6 +105,8 @@ public:
private slots:
void slotClick();
void slotDoubleClickButtonPressed();
void slotDoubleClickTimerDone();
/** No descriptions */
void slotHandedChanged(int val);
void slotScrollPolarityChanged();
@ -149,9 +152,10 @@ private:
KIntNumInput *mk_delay, *mk_interval, *mk_time_to_max, *mk_max_speed,
*mk_curve;
TQLabel *doubleClickLabel;
TQLabel *doubleClickLabel;
TQPushButton *doubleClickButton;
TQTimer *doubleClickTimer;
bool doubleClickStatus;
};
#endif

Loading…
Cancel
Save