mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-22 09:15:57 -05:00
Add ResourceTable class
Base class to be used to display items in a table
This commit is contained in:
50
lib/utils/resource-table.hpp
Normal file
50
lib/utils/resource-table.hpp
Normal file
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
#include "export-symbol-helper.hpp"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QString>
|
||||
#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;
|
||||
QPushButton *_add;
|
||||
QPushButton *_remove;
|
||||
QLabel *_help;
|
||||
|
||||
QMetaObject::Connection _highlightConnection;
|
||||
};
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user