File indexing completed on 2024-10-06 04:31:43

0001 /* This file is part of the KDE project
0002 
0003    Copyright (C) 2005 Dario Massarin <nekkar@libero.it>
0004    Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org>
0005    Copyright (C) 2007 Javier Goday <jgoday @ gmail.com>
0006    Copyright (C) 2010 Matthias Fuchs <mat69@gmx.net>
0007 
0008    This program is free software; you can redistribute it and/or
0009    modify it under the terms of the GNU General Public
0010    License as published by the Free Software Foundation; either
0011    version 2 of the License, or (at your option) any later version.
0012 */
0013 
0014 #ifndef TRANSFERSGROUPTREE_H
0015 #define TRANSFERSGROUPTREE_H
0016 
0017 #include "ui/transfersviewdelegate.h"
0018 
0019 #include <QStyledItemDelegate>
0020 #include <QTreeView>
0021 
0022 class TransfersGroupDelegate : public BasicTransfersViewDelegate
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     TransfersGroupDelegate(QAbstractItemView *parent);
0028 
0029     QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
0030     void setEditorData(QWidget *editor, const QModelIndex &index) const override;
0031     void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
0032 };
0033 
0034 class TransfersGroupTree : public QTreeView
0035 {
0036     Q_OBJECT
0037 public:
0038     TransfersGroupTree(QWidget *parent = nullptr);
0039     void setModel(QAbstractItemModel *model) override;
0040 
0041 public Q_SLOTS:
0042     void editCurrent();
0043     void addGroup();
0044     void deleteSelectedGroup();
0045     void renameSelectedGroup();
0046     void changeIcon(const QString &icon);
0047 
0048 private:
0049     void rowsInserted(const QModelIndex &index, int start, int end) override;
0050 };
0051 
0052 #endif