-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquickmemo.cpp
More file actions
42 lines (38 loc) · 1.06 KB
/
quickmemo.cpp
File metadata and controls
42 lines (38 loc) · 1.06 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
#include "quickmemo.h"
#include "ui_quickmemo.h"
#include <QDebug>
#include <QKeyEvent>
QuickMemo::QuickMemo(QWidget *parent)
: QDialog(parent)
, ui(new Ui::QuickMemo)
{
ui->setupUi(this);
this->setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint);
connect(ui->btnSave,&QPushButton::clicked,this,&QuickMemo::saveQuit);
this->setWindowFlags(Qt::WindowStaysOnTopHint);
// ui->input->setStyleSheet("color: white;"
// //"selection-background-color: white;"
// );
}
QuickMemo::~QuickMemo()
{
delete ui;
}
void QuickMemo::saveQuit()
{
QString msg=ui->input->toPlainText();
wrapper w;
//ptr->sendMemos(ui->input->toPlainText());
w.sendMemos(msg);
this->close();
}
void QuickMemo::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_S && event->modifiers() == Qt::ControlModifier) {
saveQuit();
event->accept(); // 接受该事件,不再继续传递
}
else {
QWidget::keyPressEvent(event); // 其他情况交由父类处理
}
}