File indexing completed on 2026-10-11 05:40:40
0001 /* 0002 SPDX-FileCopyrightText: 2012 Daniel Nicoletti <dantti12@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef PRINTERSORTFILTERMODEL_H 0008 #define PRINTERSORTFILTERMODEL_H 0009 0010 #include <QSortFilterProxyModel> 0011 #include <kcupslib_export.h> 0012 #include <qqmlregistration.h> 0013 0014 class KCUPSLIB_EXPORT PrinterSortFilterModel : public QSortFilterProxyModel 0015 { 0016 Q_OBJECT 0017 QML_ELEMENT 0018 0019 Q_PROPERTY(QString filteredPrinters READ filteredPrinters WRITE setFilteredPrinters NOTIFY filteredPrintersChanged) 0020 Q_PROPERTY(QAbstractItemModel *sourceModel READ sourceModel WRITE setModel NOTIFY sourceModelChanged) 0021 Q_PROPERTY(int count READ count NOTIFY countChanged) 0022 public: 0023 explicit PrinterSortFilterModel(QObject *parent = nullptr); 0024 0025 void setModel(QAbstractItemModel *model); 0026 void setFilteredPrinters(const QString &printers); 0027 QString filteredPrinters() const; 0028 int count() const; 0029 0030 signals: 0031 void countChanged(); 0032 void sourceModelChanged(QObject *); 0033 void filteredPrintersChanged(); 0034 0035 private: 0036 bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; 0037 // bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; 0038 0039 QStringList m_filteredPrinters; 0040 }; 0041 0042 #endif // PRINTERSORTFILTERMODEL_H