]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
fix gui (plot) bugs (#604)
authormarshmellow42 <marshmellow42@users.noreply.github.com>
Tue, 15 May 2018 06:19:49 +0000 (02:19 -0400)
committerpwpiwi <pwpiwi@users.noreply.github.com>
Tue, 15 May 2018 06:19:49 +0000 (08:19 +0200)
G keypress event would cause a crash if no data
Q keypress didn't work.

Thanks to @iceman1001 for identifying and providing the fixes.

client/proxguiqt.cpp
client/proxguiqt.h

index dc8279b52ec340596c6420deb94634c561bd7457..ab0976cceb4442e3b157bbc1403ff1b18721329a 100644 (file)
@@ -269,6 +269,7 @@ int Plot::xCoordOf(int i, QRect r )
 int Plot::yCoordOf(int v, QRect r, int maxVal)
 {
        int z = (r.bottom() - r.top())/2;
+       if ( maxVal == 0 ) maxVal++;
        return -(z * v) / maxVal + z;
 }
 
@@ -579,6 +580,8 @@ Plot::Plot(QWidget *parent) : QWidget(parent), GraphStart(0), GraphPixelsPerPoin
        CursorBPos = 0;
 
        setWindowTitle(tr("Sliders"));
+
+       master = parent;
 }
 
 void Plot::closeEvent(QCloseEvent *event)
@@ -688,7 +691,7 @@ void Plot::keyPressEvent(QKeyEvent *event)
                        break;
 
                case Qt::Key_Q:
-                       this->hide();
+                       master->hide();
                        break;
 
                default:
index 45a65b040c5702dc922644c8deb18bbbbe6206a0..e43311ee2ff1af0ed65387079d7d53c50e181953 100644 (file)
@@ -28,6 +28,7 @@
 class Plot: public QWidget
 {
 private:
+       QWidget *master;
        int GraphStart;
        double GraphPixelsPerPoint;
        int CursorAPos;
Impressum, Datenschutz