yolobs-studio/UI/visibility-item-widget.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.1 KiB
C++
Raw Permalink Normal View History

2016-02-23 23:16:51 +00:00
#pragma once
#include <QWidget>
#include <QStyledItemDelegate>
#include <obs.hpp>
class QLabel;
class QLineEdit;
class QListWidget;
class QListWidgetItem;
class VisibilityCheckBox;
class VisibilityItemWidget : public QWidget {
Q_OBJECT
private:
OBSSource source;
QLabel *label = nullptr;
VisibilityCheckBox *vis = nullptr;
QString oldName;
OBSSignal enabledSignal;
OBSSignal renamedSignal;
bool active = false;
bool selected = false;
static void OBSSourceEnabled(void *param, calldata_t *data);
static void OBSSourceRenamed(void *param, calldata_t *data);
private slots:
void VisibilityClicked(bool visible);
void SourceEnabled(bool enabled);
void SourceRenamed(QString name);
public:
VisibilityItemWidget(obs_source_t *source);
void SetColor(const QColor &color, bool active, bool selected);
};
class VisibilityItemDelegate : public QStyledItemDelegate {
Q_OBJECT
public:
VisibilityItemDelegate(QObject *parent = nullptr);
void paint(QPainter *painter, const QStyleOptionViewItem &option,
2019-09-22 21:19:10 +00:00
const QModelIndex &index) const override;
2016-02-23 23:16:51 +00:00
};
void SetupVisibilityItem(QListWidget *list, QListWidgetItem *item,
2019-09-22 21:19:10 +00:00
obs_source_t *source);