forked from zhazhaog/qqmsuic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsrechmusicfrom.cpp
52 lines (46 loc) · 1.13 KB
/
srechmusicfrom.cpp
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
#include "srechmusicfrom.h"
#include "ui_srechmusicfrom.h"
#include "iconfont.h"
SrechMusicFrom::SrechMusicFrom(QWidget *parent) :
QWidget(parent),
ui(new Ui::SrechMusicFrom)
{
ui->setupUi(this);
QString str;
str.resize(7);
str[0]=QChar(0xe621);
str[1]=QChar('S');
str[2]=QChar('r');
str[3]=QChar('e');
str[4]=QChar('a');
str[5]=QChar('c');
str[6]=QChar('h');
Iconfont iconfont;
ui->lineEdit->setFont(iconfont.font);
ui->lineEdit->setPlaceholderText(str);
connect(ui->lineEdit,&QLineEdit::textChanged,this,[=](QString text)
{
qInfo()<< "数据变化:"<< text;
emit textchange(text);
});
ui->lineEdit->installEventFilter(this);
}
bool SrechMusicFrom::eventFilter(QObject *watched, QEvent *event)
{
if (watched == ui->lineEdit)
{
if (event->type() == QEvent::MouseButtonPress)
{
ui->lineEdit->setFocus();
emit Boxshow(true);
}
}
return QObject::eventFilter(watched,event);
}
SrechMusicFrom::~SrechMusicFrom()
{
delete ui;
}
void SrechMusicFrom::clearFocu(){
ui->lineEdit->clearFocus();
}