19 { |
20 { |
20 } |
21 } |
21 |
22 |
22 bool MouseOverFilter::eventFilter( QObject *dist, QEvent *event ) |
23 bool MouseOverFilter::eventFilter( QObject *dist, QEvent *event ) |
23 { |
24 { |
24 if (event->type() == QEvent::Enter) |
25 if (event->type() == QEvent::FocusIn) |
25 { |
26 { |
26 QWidget * widget = dynamic_cast<QWidget*>(dist); |
27 QWidget * widget = dynamic_cast<QWidget*>(dist); |
27 |
28 |
28 abstractpage = qobject_cast<AbstractPage*>(ui->Pages->currentWidget()); |
29 abstractpage = qobject_cast<AbstractPage*>(ui->Pages->currentWidget()); |
29 |
30 |
37 QLineEdit * textfield = dynamic_cast<QLineEdit*>(dist); |
38 QLineEdit * textfield = dynamic_cast<QLineEdit*>(dist); |
38 QCheckBox * checkbox = dynamic_cast<QCheckBox*>(dist); |
39 QCheckBox * checkbox = dynamic_cast<QCheckBox*>(dist); |
39 QComboBox * droplist = dynamic_cast<QComboBox*>(dist); |
40 QComboBox * droplist = dynamic_cast<QComboBox*>(dist); |
40 QSlider * slider = dynamic_cast<QSlider*>(dist); |
41 QSlider * slider = dynamic_cast<QSlider*>(dist); |
41 QTabWidget * tab = dynamic_cast<QTabWidget*>(dist); |
42 QTabWidget * tab = dynamic_cast<QTabWidget*>(dist); |
42 if (button || textfield || checkbox || droplist || slider || tab) |
43 QListView * listview = dynamic_cast<QListView*>(dist); |
|
44 if (button || textfield || checkbox || droplist || slider || tab || listview) |
43 { |
45 { |
44 SDLInteraction::instance().playSoundFile("/Sounds/steps.ogg"); |
46 SDLInteraction::instance().playSoundFile("/Sounds/steps.ogg"); |
45 } |
47 } |
46 |
48 |
47 return true; |
49 return true; |
48 } |
50 } |
49 else if (event->type() == QEvent::Leave) |
51 else if (event->type() == QEvent::Leave) |
50 { |
52 { |
51 abstractpage = qobject_cast<AbstractPage*>(ui->Pages->currentWidget()); |
53 abstractpage = qobject_cast<AbstractPage*>(ui->Pages->currentWidget()); |
52 |
54 |
53 if (abstractpage->getDefautDescription() != NULL) |
55 if (abstractpage->getDefaultDescription() != NULL) |
54 { |
56 { |
55 abstractpage->setButtonDescription( * abstractpage->getDefautDescription()); |
57 abstractpage->setButtonDescription( * abstractpage->getDefaultDescription()); |
56 } |
58 } |
57 else |
59 else |
58 abstractpage->setButtonDescription(""); |
60 abstractpage->setButtonDescription(""); |
59 } |
61 } |
60 |
62 |