QTfrontend/ui/mouseoverfilter.cpp
changeset 8729 b19be476a2fa
parent 8326 023a71940f26
child 8732 57c10f640b60
equal deleted inserted replaced
8728:d2f6262452a3 8729:b19be476a2fa
     3 #include <QWidget>
     3 #include <QWidget>
     4 #include <QStackedLayout>
     4 #include <QStackedLayout>
     5 #include <QLabel>
     5 #include <QLabel>
     6 #include <QLineEdit>
     6 #include <QLineEdit>
     7 #include <QCheckBox>
     7 #include <QCheckBox>
       
     8 #include <QListView>
     8 
     9 
     9 #include "mouseoverfilter.h"
    10 #include "mouseoverfilter.h"
    10 #include "ui/page/AbstractPage.h"
    11 #include "ui/page/AbstractPage.h"
    11 #include "ui_hwform.h"
    12 #include "ui_hwform.h"
    12 #include "hwform.h"
    13 #include "hwform.h"
    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