QTfrontend/ui/mouseoverfilter.cpp
branchwebgl
changeset 8833 c13ebed437cb
parent 8801 c38ce9cf4c3a
child 9577 9577634bd284
equal deleted inserted replaced
8450:404ddce27b23 8833:c13ebed437cb
     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"
    29 
    30 
    30         if (widget->whatsThis() != NULL)
    31         if (widget->whatsThis() != NULL)
    31             abstractpage->setButtonDescription(widget->whatsThis());
    32             abstractpage->setButtonDescription(widget->whatsThis());
    32         else if (widget->toolTip() != NULL)
    33         else if (widget->toolTip() != NULL)
    33             abstractpage->setButtonDescription(widget->toolTip());
    34             abstractpage->setButtonDescription(widget->toolTip());
       
    35     }
       
    36     else if (event->type() == QEvent::FocusIn)
       
    37     {
       
    38         abstractpage = qobject_cast<AbstractPage*>(ui->Pages->currentWidget());
    34 
    39 
    35         // play a sound when mouse hovers certain ui elements
    40         // play a sound when mouse hovers certain ui elements
    36         QPushButton * button = dynamic_cast<QPushButton*>(dist);
    41         QPushButton * button = dynamic_cast<QPushButton*>(dist);
    37         QLineEdit * textfield = dynamic_cast<QLineEdit*>(dist);
    42         QLineEdit * textfield = dynamic_cast<QLineEdit*>(dist);
    38         QCheckBox * checkbox = dynamic_cast<QCheckBox*>(dist);
    43         QCheckBox * checkbox = dynamic_cast<QCheckBox*>(dist);
    39         QComboBox * droplist = dynamic_cast<QComboBox*>(dist);
    44         QComboBox * droplist = dynamic_cast<QComboBox*>(dist);
    40         QSlider * slider = dynamic_cast<QSlider*>(dist);
    45         QSlider * slider = dynamic_cast<QSlider*>(dist);
    41         QTabWidget * tab = dynamic_cast<QTabWidget*>(dist);
    46         QTabWidget * tab = dynamic_cast<QTabWidget*>(dist);
    42         if (button || textfield || checkbox || droplist || slider || tab)
    47         QListView * listview = dynamic_cast<QListView*>(dist);
       
    48         if (button || textfield || checkbox || droplist || slider || tab || listview)
    43         {
    49         {
    44             SDLInteraction::instance().playSoundFile("/Sounds/steps.ogg");
    50             SDLInteraction::instance().playSoundFile("/Sounds/steps.ogg");
    45         }
    51         }
    46 
    52 
    47         return true;
    53         return true;
    48     }
    54     }
    49     else if (event->type() == QEvent::Leave)
    55     else if (event->type() == QEvent::Leave)
    50     {
    56     {
    51         abstractpage = qobject_cast<AbstractPage*>(ui->Pages->currentWidget());
    57         abstractpage = qobject_cast<AbstractPage*>(ui->Pages->currentWidget());
    52 
    58 
    53         if (abstractpage->getDefautDescription() != NULL)
    59         if (abstractpage->getDefaultDescription() != NULL)
    54         {
    60         {
    55             abstractpage->setButtonDescription( * abstractpage->getDefautDescription());
    61             abstractpage->setButtonDescription( * abstractpage->getDefaultDescription());
    56         }
    62         }
    57         else
    63         else
    58             abstractpage->setButtonDescription("");
    64             abstractpage->setButtonDescription("");
    59     }
    65     }
    60 
    66