SceneSwitcher/lib/utils/resource-table.hpp
WarmUpTill 3bc15e585c Switch QPushButton to QToolButton
This will be more consistent with the widget styles used throughout OBS
and solves a few layout issues
2024-06-20 21:41:28 +02:00

51 lines
1.2 KiB
C++

#pragma once
#include "export-symbol-helper.hpp"
#include <QLabel>
#include <QString>
#include <QToolButton>
#include <QTableWidget>
class QResizeEvent;
namespace advss {
class ADVSS_EXPORT ResourceTable : public QWidget {
Q_OBJECT
public:
ResourceTable(QTabWidget *parent, const QString &help,
const QString &addToolTip, const QString &removeToolTip,
const QStringList &headers,
const std::function<void()> &openSettings);
virtual ~ResourceTable();
QTableWidget *Table() const { return _table; }
void SetHelpVisible(bool) const;
void HighlightAddButton(bool);
protected slots:
virtual void Add() {}
virtual void Remove() {}
protected:
void resizeEvent(QResizeEvent *event);
private:
QTableWidget *_table;
QToolButton *_add;
QToolButton *_remove;
QLabel *_help;
QObject *_highlightConnection = nullptr;
};
EXPORT void AddItemTableRow(QTableWidget *table, const QStringList &cells);
EXPORT void UpdateItemTableRow(QTableWidget *table, int row,
const QStringList &cells);
EXPORT void RenameItemTableRow(QTableWidget *table, const QString &oldName,
const QString &newName);
EXPORT void RemoveItemTableRow(QTableWidget *table, const QString &name);
} // namespace advss