添加快捷键

This commit is contained in:
yangjiaxuan 2023-03-23 15:37:58 +08:00
parent 4e19cd2567
commit 9edf27b6e4
5 changed files with 146 additions and 40 deletions

View File

@ -24,10 +24,15 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="dialog_excepdesc.cpp" line="14"/> <location filename="dialog_excepdesc.cpp" line="15"/>
<source>input excep desc: </source> <source>input excep desc: </source>
<translation> </translation> <translation> </translation>
</message> </message>
<message>
<location filename="dialog_excepdesc.cpp" line="17"/>
<source>Enter to enter, Ctrl+Enter to confirm</source>
<translation>Enter换行Ctrl+Enter确定</translation>
</message>
</context> </context>
<context> <context>
<name>Dialog_HGMessageBox</name> <name>Dialog_HGMessageBox</name>
@ -699,49 +704,99 @@
<translation>VIDPID:</translation> <translation>VIDPID:</translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.ui" line="101"/> <location filename="form_maininterface.ui" line="66"/>
<source>Esc</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="104"/>
<source>Privious Step</source> <source>Privious Step</source>
<translation></translation> <translation>()</translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.ui" line="115"/> <location filename="form_maininterface.ui" line="107"/>
<source>Up</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="117"/>
<source>Down</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="124"/>
<source>PASS</source> <source>PASS</source>
<translation></translation> <translation>(P)</translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.ui" line="122"/> <location filename="form_maininterface.ui" line="127"/>
<source>P</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="134"/>
<source>FAIL</source> <source>FAIL</source>
<translation></translation> <translation>(F)</translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.ui" line="129"/> <location filename="form_maininterface.ui" line="137"/>
<source>F</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="144"/>
<source>START</source> <source>START</source>
<translation></translation> <translation>(Enter)</translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.ui" line="143"/> <location filename="form_maininterface.ui" line="147"/>
<source>Enter</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="161"/>
<source>PrePage</source> <source>PrePage</source>
<translation></translation> <translation>()</translation>
</message>
<message>
<location filename="form_maininterface.ui" line="150"/>
<source>NextPage</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="157"/>
<source>LeftRotate</source>
<translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.ui" line="164"/> <location filename="form_maininterface.ui" line="164"/>
<source>Left</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="171"/>
<source>NextPage</source>
<translation>()</translation>
</message>
<message>
<location filename="form_maininterface.ui" line="174"/>
<source>Right</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="181"/>
<source>LeftRotate</source>
<translation>(L)</translation>
</message>
<message>
<location filename="form_maininterface.ui" line="184"/>
<source>L</source>
<translation></translation>
</message>
<message>
<location filename="form_maininterface.ui" line="191"/>
<source>RightRotate</source> <source>RightRotate</source>
<translation></translation> <translation>(R)</translation>
</message>
<message>
<location filename="form_maininterface.ui" line="194"/>
<source>R</source>
<translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.ui" line="63"/> <location filename="form_maininterface.ui" line="63"/>
<source>STOP</source> <source>STOP</source>
<translation></translation> <translation>(Esc)</translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.ui" line="22"/> <location filename="form_maininterface.ui" line="22"/>
@ -749,14 +804,14 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.ui" line="136"/> <location filename="form_maininterface.ui" line="154"/>
<source>SHOWIMG</source> <source>SHOWIMG</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.ui" line="108"/> <location filename="form_maininterface.ui" line="114"/>
<source>Next Step</source> <source>Next Step</source>
<translation></translation> <translation>()</translation>
</message> </message>
<message> <message>
<source>Device has connected</source> <source>Device has connected</source>
@ -866,13 +921,13 @@
</translation> </translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="271"/> <location filename="form_maininterface.cpp" line="272"/>
<source>device model:%1</source> <source>device model:%1</source>
<translation>%1</translation> <translation>%1</translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="705"/> <location filename="form_maininterface.cpp" line="706"/>
<location filename="form_maininterface.cpp" line="766"/> <location filename="form_maininterface.cpp" line="767"/>
<source>device history scan count:</source> <source>device history scan count:</source>
<translation></translation> <translation></translation>
</message> </message>
@ -881,37 +936,37 @@
<translation type="vanished">%1</translation> <translation type="vanished">%1</translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="406"/> <location filename="form_maininterface.cpp" line="407"/>
<source>ID</source> <source>ID</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="406"/> <location filename="form_maininterface.cpp" line="407"/>
<source>Test items</source> <source>Test items</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="406"/> <location filename="form_maininterface.cpp" line="407"/>
<source>status</source> <source>status</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="488"/> <location filename="form_maininterface.cpp" line="489"/>
<source>not test</source> <source>not test</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="488"/> <location filename="form_maininterface.cpp" line="489"/>
<source>not pass</source> <source>not pass</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="488"/> <location filename="form_maininterface.cpp" line="489"/>
<source>not support</source> <source>not support</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="488"/> <location filename="form_maininterface.cpp" line="489"/>
<source>pass</source> <source>pass</source>
<translation></translation> <translation></translation>
</message> </message>
@ -937,14 +992,14 @@
<translation type="vanished">Pid</translation> <translation type="vanished">Pid</translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="699"/> <location filename="form_maininterface.cpp" line="700"/>
<location filename="form_maininterface.cpp" line="760"/> <location filename="form_maininterface.cpp" line="761"/>
<source>device roller count:</source> <source>device roller count:</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="200"/> <location filename="form_maininterface.cpp" line="200"/>
<location filename="form_maininterface.cpp" line="554"/> <location filename="form_maininterface.cpp" line="555"/>
<source>image pixel: </source> <source>image pixel: </source>
<translation>标准圆: * : </translation> <translation>标准圆: * : </translation>
</message> </message>
@ -969,7 +1024,7 @@
</translation> </translation>
</message> </message>
<message> <message>
<location filename="form_maininterface.cpp" line="596"/> <location filename="form_maininterface.cpp" line="597"/>
<source> minute</source> <source> minute</source>
<translation> </translation> <translation> </translation>
</message> </message>

View File

@ -1,5 +1,6 @@
#include "dialog_excepdesc.h" #include "dialog_excepdesc.h"
#include "ui_dialog_excepdesc.h" #include "ui_dialog_excepdesc.h"
#include <QKeyEvent>
Dialog_ExcepDesc::Dialog_ExcepDesc(QWidget *parent) : Dialog_ExcepDesc::Dialog_ExcepDesc(QWidget *parent) :
QDialog(parent), QDialog(parent),
@ -12,6 +13,8 @@ Dialog_ExcepDesc::Dialog_ExcepDesc(QWidget *parent) :
this->setFont(ft); this->setFont(ft);
ui->label->setText(tr("input excep desc: ")); ui->label->setText(tr("input excep desc: "));
ui->textEdit->installEventFilter(this);
ui->textEdit->setPlaceholderText(tr("Enter to enter, Ctrl+Enter to confirm"));
} }
Dialog_ExcepDesc::~Dialog_ExcepDesc() Dialog_ExcepDesc::~Dialog_ExcepDesc()
@ -24,6 +27,21 @@ QString Dialog_ExcepDesc::getExcepDesc()
return ui->textEdit->toPlainText(); return ui->textEdit->toPlainText();
} }
bool Dialog_ExcepDesc::eventFilter(QObject *obj, QEvent *e)
{
Q_ASSERT(obj == ui->textEdit);
if (e->type() == QEvent::KeyPress)
{
QKeyEvent *event = static_cast<QKeyEvent*>(e);
if (event->key() == Qt::Key_Return && (event->modifiers() & Qt::ControlModifier))
{
accept();
return true;
}
}
return false;
}
void Dialog_ExcepDesc::on_pbtn_ok_clicked() void Dialog_ExcepDesc::on_pbtn_ok_clicked()
{ {
accept(); accept();

View File

@ -17,6 +17,9 @@ public:
QString getExcepDesc(); QString getExcepDesc();
protected:
bool eventFilter(QObject *obj, QEvent *e);
private slots: private slots:
void on_pbtn_ok_clicked(); void on_pbtn_ok_clicked();

View File

@ -62,6 +62,9 @@
<property name="text"> <property name="text">
<string>STOP</string> <string>STOP</string>
</property> </property>
<property name="shortcut">
<string>Esc</string>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -100,6 +103,9 @@
<property name="text"> <property name="text">
<string>Privious Step</string> <string>Privious Step</string>
</property> </property>
<property name="shortcut">
<string>Up</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -107,6 +113,9 @@
<property name="text"> <property name="text">
<string>Next Step</string> <string>Next Step</string>
</property> </property>
<property name="shortcut">
<string>Down</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -114,6 +123,9 @@
<property name="text"> <property name="text">
<string>PASS</string> <string>PASS</string>
</property> </property>
<property name="shortcut">
<string>P</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -121,6 +133,9 @@
<property name="text"> <property name="text">
<string>FAIL</string> <string>FAIL</string>
</property> </property>
<property name="shortcut">
<string>F</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -128,6 +143,9 @@
<property name="text"> <property name="text">
<string>START</string> <string>START</string>
</property> </property>
<property name="shortcut">
<string>Enter</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -142,6 +160,9 @@
<property name="text"> <property name="text">
<string>PrePage</string> <string>PrePage</string>
</property> </property>
<property name="shortcut">
<string>Left</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -149,6 +170,9 @@
<property name="text"> <property name="text">
<string>NextPage</string> <string>NextPage</string>
</property> </property>
<property name="shortcut">
<string>Right</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -156,6 +180,9 @@
<property name="text"> <property name="text">
<string>LeftRotate</string> <string>LeftRotate</string>
</property> </property>
<property name="shortcut">
<string>L</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -163,6 +190,9 @@
<property name="text"> <property name="text">
<string>RightRotate</string> <string>RightRotate</string>
</property> </property>
<property name="shortcut">
<string>R</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>