6477
|
1 |
#include "mouseoverfilter.h"
|
|
2 |
#include "ui/page/AbstractPage.h"
|
|
3 |
#include "ui_hwform.h"
|
|
4 |
|
|
5 |
#include <QEvent>
|
|
6 |
#include <QWidget>
|
|
7 |
#include <QStackedLayout>
|
|
8 |
#include <QLabel>
|
|
9 |
|
|
10 |
MouseOverFilter::MouseOverFilter(QObject *parent) :
|
|
11 |
QObject(parent)
|
|
12 |
{
|
|
13 |
}
|
|
14 |
|
|
15 |
bool MouseOverFilter::eventFilter( QObject *dist, QEvent *event )
|
|
16 |
{
|
|
17 |
if (event->type() == QEvent::Enter)
|
|
18 |
{
|
|
19 |
QWidget * widget = dynamic_cast<QWidget*>(dist);
|
|
20 |
|
|
21 |
abstractpage = qobject_cast<AbstractPage*>(ui->Pages->currentWidget());
|
|
22 |
|
|
23 |
if (widget->whatsThis() != NULL)
|
|
24 |
abstractpage->setButtonDescription(widget->whatsThis());
|
|
25 |
else if (widget->toolTip() != NULL)
|
|
26 |
abstractpage->setButtonDescription(widget->toolTip());
|
|
27 |
|
|
28 |
return true;
|
|
29 |
}
|
|
30 |
else if (event->type() == QEvent::Leave)
|
|
31 |
{
|
|
32 |
abstractpage = qobject_cast<AbstractPage*>(ui->Pages->currentWidget());
|
|
33 |
|
|
34 |
if (abstractpage->getDefautDescription() != NULL)
|
|
35 |
{
|
|
36 |
abstractpage->setButtonDescription( * abstractpage->getDefautDescription());
|
|
37 |
}
|
|
38 |
else
|
|
39 |
abstractpage->setButtonDescription("");
|
|
40 |
}
|
|
41 |
|
|
42 |
return false;
|
|
43 |
}
|
|
44 |
|
|
45 |
void MouseOverFilter::setUi(Ui_HWForm *uiForm)
|
|
46 |
{
|
|
47 |
ui = uiForm;
|
|
48 |
}
|