model_filter.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /* models/model_filter.h
  2. * Copyright (C) 2017 caryoscelus
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef STUDIO_MODELS_MODEL_FILTER_H_3CC6FF1C_6D72_55AB_B53C_CF69EC923561
  18. #define STUDIO_MODELS_MODEL_FILTER_H_3CC6FF1C_6D72_55AB_B53C_CF69EC923561
  19. #include <KRecursiveFilterProxyModel>
  20. namespace rainynite::studio {
  21. class RecursiveFilterProxyModel : public KRecursiveFilterProxyModel {
  22. protected:
  23. bool acceptRow(int row, QModelIndex const& parent) const override {
  24. return KRecursiveFilterProxyModel::acceptRow(row, parent)
  25. || (parent.parent().isValid() && KRecursiveFilterProxyModel::acceptRow(parent.row(), parent.parent()));
  26. }
  27. };
  28. } // namespace rainynite::studio
  29. #endif