File indexing completed on 2024-05-12 17:07:11

0001 /*
0002     This file is part of the KDE Control Center Module for Joysticks
0003 
0004     SPDX-FileCopyrightText: 2003, 2005, 2006 Martin Koller <kollix@aon.at>
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include <QList>
0011 #include <QWidget>
0012 class QPaintEvent;
0013 
0014 /**
0015   Widget to display the joystick-selected (x,y) position
0016 */
0017 class PosWidget : public QWidget
0018 {
0019     Q_OBJECT
0020 
0021 public:
0022     PosWidget(QWidget *parent = nullptr);
0023 
0024     void changeX(int x);
0025     void changeY(int y);
0026 
0027     // define if a trace of the moving joystick shall be displayed
0028     // changing it will erase all previous marks from the widget
0029     void showTrace(bool t);
0030 
0031 protected:
0032     void paintEvent(QPaintEvent *) override;
0033 
0034 private:
0035     int x, y;
0036     bool trace;
0037     QList<QPoint> tracePoints;
0038 };