-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtopbar.cpp
More file actions
72 lines (68 loc) · 1.49 KB
/
topbar.cpp
File metadata and controls
72 lines (68 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "topbar.h"
#include "ui_topbar.h"
topBar::topBar(QWidget *parent) :
QWidget(parent),
ui(new Ui::topBar)
{
ui->setupUi(this);
kb = NULL;
ui->sBox->installEventFilter(this);
}
topBar::~topBar()
{
delete ui;
}
void topBar::on_taskSwitch_clicked()
{
emit this->changeTask();
}
void topBar::on_sButton_clicked()
{
emit this->searchRequest(ui->sBox->text());
}
void topBar::on_closeButton_clicked()
{
emit this->closeApp();
}
void topBar::changeEvent(QEvent *e)
{
QWidget::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void topBar::resizeEvent(QResizeEvent *e)
{
if(e->type() == QEvent::Resize)
{
#if defined(Q_WS_MAEMO_5) || defined(Q_WS_HILDON)
if(((QWidget *)this->parent())->testAttribute(Qt::WA_Maemo5PortraitOrientation))
{
ui->sBox->setReadOnly(true);
//ui->sBox->setText("Portrait");
}
else
ui->sBox->setReadOnly(false);
#endif
}
}
bool topBar::eventFilter(QObject *obj, QEvent *e)
{
if(obj == ui->sBox && ui->sBox->isReadOnly() && e->type() == QEvent::MouseButtonRelease)
{
if(!kb)
{
this->kb = new vkb(this);
connect(kb,SIGNAL(submitText(QString)),ui->sBox,SLOT(setText(QString)));
}
kb->setText(ui->sBox->text());
kb->show();
}
else
return QWidget::eventFilter(obj,e);
return true;
}