blob: 429725c00f9cbe0ba501cb3cacfe0f25de1e4fdb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
// Copyright 2009-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
#ifndef MUMBLE_MUMBLE_USERVIEW_H_
#define MUMBLE_MUMBLE_USERVIEW_H_
#include <QtCore/QtGlobal>
#include <QtWidgets/QStyledItemDelegate>
#include <QtWidgets/QTreeView>
#include "Timer.h"
class UserDelegate : public QStyledItemDelegate {
private:
Q_OBJECT
Q_DISABLE_COPY(UserDelegate)
public:
UserDelegate(QObject *parent = nullptr);
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
//! Width/height in px of user/channel flag icons
const static int FLAG_ICON_DIMENSION;
//! Padding in px around user/channel flag icons
const static int FLAG_ICON_PADDING;
//! Width/height in px of user/channel flags including padding
const static int FLAG_DIMENSION;
public slots:
bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option,
const QModelIndex &index) Q_DECL_OVERRIDE;
};
class UserView : public QTreeView {
private:
Q_OBJECT
Q_DISABLE_COPY(UserView)
protected:
void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
bool event(QEvent *) Q_DECL_OVERRIDE;
QTimer *qtSearch;
QPersistentModelIndex qpmiSearch;
Timer tSearch;
QString qsSearch;
public:
UserView(QWidget *);
void keyboardSearch(const QString &search) Q_DECL_OVERRIDE;
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
const QVector< int > &roles = QVector< int >()) Q_DECL_OVERRIDE;
public slots:
void nodeActivated(const QModelIndex &idx);
void selectSearchResult();
void updateChannel(const QModelIndex &index);
};
#endif
|