Sayonara Player
Delegate.h
1 /* PlaylistItemDelegate.h */
2 
3 /* Copyright (C) 2011-2017 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 #ifndef PLAYLISTITEMDELEGATE_H_
22 #define PLAYLISTITEMDELEGATE_H_
23 
24 #include "Utils/Settings/SayonaraClass.h"
25 #include "GUI/Utils/Delegates/StyledItemDelegate.h"
26 
27 class QListView;
30  public SayonaraClass
31 {
32  Q_OBJECT
33 
34 public:
35  PlaylistItemDelegate(QListView* parent);
36  virtual ~PlaylistItemDelegate();
37 
38  void paint( QPainter *painter, const QStyleOptionViewItem &option,
39  const QModelIndex &index) const override;
40 
41 
42  QWidget* createEditor(QWidget *parent,
43  const QStyleOptionViewItem &option,
44  const QModelIndex &index) const override;
45 
46  void set_drag_index(int row);
47  bool is_drag_index(int row) const;
48  int drag_index() const;
49 
50 
51 private:
52  int _drag_row;
53  bool _show_numbers;
54  QString _entry_template;
55 
56 
57 private slots:
58  int draw_number(QPainter* painter, int number, QFont& font, QRect& rect) const;
59 
60  void _sl_show_numbers_changed();
61  void _sl_look_changed();
62 };
63 
64 #endif /* PLAYLISTITEMDELEGATEINTERFACE_H_ */
Definition: StyledItemDelegate.h:30
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:29
Definition: Delegate.h:28