File indexing completed on 2024-05-12 05:46:54
0001 /* 0002 * This file is part of the proxy model test suite. 0003 * 0004 * Copyright 2009 Stephen Kelly <steveire@gmail.com> 0005 * 0006 * This library is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU Lesser General Public 0008 * License as published by the Free Software Foundation; either 0009 * version 2.1 of the License, or (at your option) any later version. 0010 * 0011 * This library is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 * Lesser General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU Lesser General Public 0017 * License along with this library; if not, write to the Free Software 0018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 0019 * 02110-1301 USA 0020 */ 0021 0022 #ifndef LESSTHANWIDGET_H 0023 #define LESSTHANWIDGET_H 0024 0025 #include <QWidget> 0026 #include <QItemSelectionModel> 0027 0028 #include "dynamictreemodel.h" 0029 0030 class ColoredTreeModel : public DynamicTreeModel 0031 { 0032 Q_OBJECT 0033 public: 0034 ColoredTreeModel(QObject *parent = nullptr); 0035 0036 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 0037 0038 void setSelectionModel(QItemSelectionModel *selectionModel); 0039 0040 protected Q_SLOTS: 0041 void recolor(const QModelIndex &parent = QModelIndex()); 0042 0043 private: 0044 QItemSelectionModel *m_selectionModel; 0045 QColor m_lessThanColour; 0046 QColor m_greaterThanColour; 0047 }; 0048 0049 class LessThanWidget : public QWidget 0050 { 0051 Q_OBJECT 0052 public: 0053 LessThanWidget(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags()); 0054 0055 void insertGrid(QList<int> address); 0056 private: 0057 ColoredTreeModel *m_coloredTreeModel; 0058 }; 0059 0060 #endif