mirror of
https://github.com/wh201906/Proxmark3GUI.git
synced 2025-02-16 22:21:30 +08:00
Fix a bug in RawCommand Tab
If a widget is set to NoFocus, then it will not respond to the key Event
This commit is contained in:
parent
aa6b93984c
commit
705c8de54c
@ -33,7 +33,7 @@ MainWindow::MainWindow(QWidget *parent):
|
||||
util = new Util(this);
|
||||
mifare = new Mifare(ui, util, this);
|
||||
|
||||
keyEventFilter = new MyEventFilter(QEvent::KeyRelease);
|
||||
keyEventFilter = new MyEventFilter(QEvent::KeyPress);
|
||||
resizeEventFilter = new MyEventFilter(QEvent::Resize);
|
||||
|
||||
// hide unused tabs
|
||||
@ -155,7 +155,7 @@ void MainWindow::on_PM3_disconnectButton_clicked()
|
||||
void MainWindow::refreshOutput(const QString& output)
|
||||
{
|
||||
// qDebug() << "MainWindow::refresh:" << output;
|
||||
ui->Raw_outputEdit->insertPlainText(output);
|
||||
ui->Raw_outputEdit->appendPlainText(output);
|
||||
ui->Raw_outputEdit->moveCursor(QTextCursor::End);
|
||||
}
|
||||
|
||||
@ -240,11 +240,13 @@ void MainWindow::refreshCMD(const QString& cmd)
|
||||
ui->Raw_CMDEdit->blockSignals(false);
|
||||
}
|
||||
|
||||
void MainWindow::on_Raw_CMDEdit_keyPressed(QObject* obj_addr, QEvent& event)
|
||||
void MainWindow::on_Raw_keyPressed(QObject* obj_addr, QEvent& event)
|
||||
{
|
||||
if(obj_addr == ui->Raw_CMDEdit && event.type() == QEvent::KeyRelease)
|
||||
if(event.type() == QEvent::KeyPress)
|
||||
{
|
||||
QKeyEvent& keyEvent = static_cast<QKeyEvent&>(event);
|
||||
if(obj_addr == ui->Raw_CMDEdit)
|
||||
{
|
||||
if(keyEvent.key() == Qt::Key_Up)
|
||||
{
|
||||
if(stashedIndex > 0)
|
||||
@ -269,6 +271,11 @@ void MainWindow::on_Raw_CMDEdit_keyPressed(QObject* obj_addr, QEvent& event)
|
||||
ui->Raw_CMDEdit->blockSignals(false);
|
||||
}
|
||||
}
|
||||
else if(obj_addr == ui->Raw_outputEdit)
|
||||
{
|
||||
ui->Raw_CMDEdit->setFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
// *****************************************************
|
||||
|
||||
@ -907,11 +914,12 @@ void MainWindow::MF_widgetReset()
|
||||
|
||||
void MainWindow::uiInit()
|
||||
{
|
||||
connect(ui->Raw_CMDEdit, &QLineEdit::editingFinished, this, &MainWindow::sendMSG);
|
||||
connect(ui->Raw_CMDEdit, &QLineEdit::returnPressed, this, &MainWindow::sendMSG);
|
||||
ui->Raw_CMDEdit->installEventFilter(keyEventFilter);
|
||||
connect(keyEventFilter, &MyEventFilter::eventHappened, this, &MainWindow::on_Raw_CMDEdit_keyPressed);
|
||||
connect(keyEventFilter, &MyEventFilter::eventHappened, this, &MainWindow::on_Raw_keyPressed);
|
||||
ui->MF_keyWidget->installEventFilter(resizeEventFilter);
|
||||
connect(resizeEventFilter, &MyEventFilter::eventHappened, this, &MainWindow::on_MF_keyWidget_resized);
|
||||
ui->Raw_outputEdit->installEventFilter(keyEventFilter);
|
||||
|
||||
connectStatusBar = new QLabel(this);
|
||||
programStatusBar = new QLabel(this);
|
||||
@ -994,6 +1002,7 @@ void MainWindow::uiInit()
|
||||
ui->MF_RW_keyTypeBox->addItem("B", Mifare::KEY_B);
|
||||
|
||||
on_Raw_CMDHistoryBox_stateChanged(Qt::Unchecked);
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::signalInit()
|
||||
|
@ -53,7 +53,7 @@ public slots:
|
||||
void setStatusBar(QLabel* target, const QString& text);
|
||||
void onPM3StateChanged(bool st, const QString& info);
|
||||
void MF_onMFCardTypeChanged(int id, bool st);
|
||||
void on_Raw_CMDEdit_keyPressed(QObject *obj_addr, QEvent &event);
|
||||
void on_Raw_keyPressed(QObject *obj_addr, QEvent &event);
|
||||
void on_MF_keyWidget_resized(QObject *obj_addr, QEvent &event);
|
||||
private slots:
|
||||
|
||||
@ -208,7 +208,6 @@ private:
|
||||
|
||||
MF_trailerDecoderDialog* decDialog;
|
||||
|
||||
|
||||
void signalInit();
|
||||
void MF_widgetReset();
|
||||
void setTableItem(QTableWidget *widget, int row, int column, const QString& text);
|
||||
|
@ -1446,9 +1446,6 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||
</property>
|
||||
|
Loading…
x
Reference in New Issue
Block a user