File indexing completed on 2024-05-12 04:04:16
0001 /* 0002 This file is part of Knights, a chess board for KDE SC 4. 0003 SPDX-FileCopyrightText: 2009, 2010, 2011 Miha Čančula <miha@noughmad.eu> 0004 0005 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 #ifndef KNIGHTS_SEEKGRAPH_H 0009 #define KNIGHTS_SEEKGRAPH_H 0010 0011 #include <KPlotWidget> 0012 0013 #include <QMap> 0014 0015 namespace Knights { 0016 struct FicsGameOffer; 0017 0018 class SeekGraph : public KPlotWidget { 0019 Q_OBJECT 0020 public: 0021 explicit SeekGraph ( QWidget* parent = nullptr ); 0022 ~SeekGraph() override; 0023 0024 void addSeek ( const FicsGameOffer& offer ); 0025 void removeSeek ( int id ); 0026 void clearOffers(); 0027 void setRect ( const QRectF rect ); 0028 0029 protected: 0030 void paintEvent ( QPaintEvent* event ) override; 0031 void mouseMoveEvent ( QMouseEvent* event ) override; 0032 void mouseReleaseEvent ( QMouseEvent* event ) override; 0033 0034 Q_SIGNALS: 0035 void seekClicked( int id ); 0036 0037 private: 0038 QMap<KPlotPoint*, int> m_pointIds; 0039 QMap<int, KPlotObject*> m_objects; 0040 QRectF m_dataRect; 0041 }; 0042 0043 } 0044 0045 #endif // KNIGHTS_SEEKGRAPH_H