File indexing completed on 2024-05-12 04:05:54
0001 /*************************************************************************** 0002 * Copyright 2007 Johannes Bergmeier <johannes.bergmeier@gmx.net> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify * 0005 * it under the terms of the GNU General Public License as published by * 0006 * the Free Software Foundation; either version 2 of the License, or * 0007 * (at your option) any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, * 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License * 0015 * along with this program; if not, write to the * 0016 * Free Software Foundation, Inc., * 0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 0018 ***************************************************************************/ 0019 0020 #ifndef _KSUDOKUVALUELISTWIDGET_H_ 0021 #define _KSUDOKUVALUELISTWIDGET_H_ 0022 0023 #include <QGraphicsItem> 0024 #include <QGraphicsView> 0025 #include <QList> 0026 0027 #include "symbols.h" 0028 0029 0030 namespace ksudoku { 0031 0032 class SymbolItem; 0033 class SelectionItem; 0034 0035 class ValueListWidget : public QGraphicsView { 0036 Q_OBJECT 0037 friend class SymbolItem; 0038 public: 0039 explicit ValueListWidget(QWidget* parent = nullptr); 0040 ~ValueListWidget() override; 0041 0042 // SymbolTable* currentTable() const; 0043 // void setCurrentTable(SymbolTable* table, int maxValue); 0044 void setMaxValue(int maxValue); 0045 0046 void resizeEvent(QResizeEvent*) override; 0047 0048 public Q_SLOTS: 0049 void selectValue(int value); 0050 0051 Q_SIGNALS: 0052 /** 0053 * This signal gets emitted when the ValueListWidget itself changed the 0054 * selected value. A call of selectValue(int) will not cause an Q_EMIT. 0055 */ 0056 void valueSelected(int value); 0057 0058 protected: 0059 inline QGraphicsScene* scene() { return m_scene; } 0060 void selectValueItem(int value); 0061 void wheelEvent (QWheelEvent* e) override; 0062 0063 private: 0064 // SymbolTable* m_table; 0065 QGraphicsScene* m_scene; 0066 QList<SymbolItem*> m_symbols; 0067 SelectionItem *m_selectionItem; 0068 int m_selectedValue; 0069 int m_maxValue; 0070 }; 0071 0072 } 0073 0074 #endif