Sayonara Player
PlaylistItemDelegateInterface.h
1 /* PlaylistItemDelegateInterface.cpp */
2 
3 /* Copyright (C) 2012 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 #ifndef PLAYLISTITEMDELEGATEINTERFACE_H_
23 #define PLAYLISTITEMDELEGATEINTERFACE_H_
24 
25 
26 #include <QObject>
27 #include <QLabel>
28 #include <QListView>
29 #include <QItemDelegate>
30 #include ""
31 
32 
33 class PlaylistItemDelegate : public QItemDelegate {
34 
35 public:
36  PlaylistItemDelegate(QListView *parent = 0, bool small);
37  virtual ~PlaylistItemDelegate();
38 
39  public:
40 
41 
42  virtual void paint( QPainter *painter, const QStyleOptionViewItem &option,
43  const QModelIndex &index) const;
44 
45 
46  QSize PlaylistItemDelegateSmall::sizeHint(const QStyleOptionViewItem &option,
47  const QModelIndex &index) const;
48 
49  void setMaxWidth(int w);
50  int rowHeight();
51 
52 
53 
54 
55  private:
56  int _rendered_items;
57  int _row_height;
58  int _max_width;
59  QListView* _parent;
60 
61 public:
62  virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
63  virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
64  virtual QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
65 
66 };
67 
68 
69 #endif /* PLAYLISTITEMDELEGATEINTERFACE_H_ */