File indexing completed on 2024-04-28 04:41:48
0001 /*************************************************************************** 0002 * Copyright (C) 2017 by Emmanuel Lepage Vallee * 0003 * Author : Emmanuel Lepage Vallee <emmanuel.lepage@kde.org> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 3 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 0017 **************************************************************************/ 0018 #ifndef KQUICKITEMVIEWS_SCROLLBARADAPTER_H 0019 #define KQUICKITEMVIEWS_SCROLLBARADAPTER_H 0020 0021 // Qt 0022 #include <QtCore/QObject> 0023 #include <QtCore/QSharedPointer> 0024 class QQuickItem; 0025 class QAbstractItemModel; 0026 0027 class ScrollBarAdapterPrivate; 0028 0029 class ScrollBarAdapter : public QObject 0030 { 0031 Q_OBJECT 0032 0033 public: 0034 explicit ScrollBarAdapter(QObject* parent = nullptr); 0035 virtual ~ScrollBarAdapter(); 0036 0037 Q_PROPERTY(QSharedPointer<QAbstractItemModel> model READ model WRITE setModel) 0038 Q_PROPERTY(QQuickItem* target READ target WRITE setTarget) 0039 0040 QSharedPointer<QAbstractItemModel> model() const; 0041 void setModel(QSharedPointer<QAbstractItemModel> m); 0042 0043 QQuickItem* target() const; 0044 void setTarget(QQuickItem* item); 0045 0046 private Q_SLOTS: 0047 void rowsInserted(); 0048 0049 private: 0050 ScrollBarAdapterPrivate* d_ptr; 0051 Q_DECLARE_PRIVATE(ScrollBarAdapter) 0052 }; 0053 0054 Q_DECLARE_METATYPE(ScrollBarAdapter*) 0055 Q_DECLARE_METATYPE(QSharedPointer<QAbstractItemModel>) 0056 0057 #endif