Added list of constraints to the tables page.
Last column shows the full textual definition until I have decided on a better way to visualize the details.
This commit is contained in:
parent
22db22c6b1
commit
a99f059b70
27 changed files with 663 additions and 22 deletions
29
pglab/IconColumnDelegate.h
Normal file
29
pglab/IconColumnDelegate.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef ICONCOLUMNDELEGATE_H
|
||||
#define ICONCOLUMNDELEGATE_H
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
#include <map>
|
||||
|
||||
/** This class asumes that the string values supplies for the column data
|
||||
* can be Resolved by QIcon to an actual icon. Icons are cached and reused.
|
||||
*
|
||||
*/
|
||||
class IconColumnDelegate: public QStyledItemDelegate {
|
||||
public:
|
||||
IconColumnDelegate(QWidget *parent = nullptr);
|
||||
~IconColumnDelegate();
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
QSize sizeHint(const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const override;
|
||||
|
||||
void clearCache();
|
||||
private:
|
||||
using t_IconCache = std::map<QString, QIcon*>;
|
||||
|
||||
mutable t_IconCache m_Icons;
|
||||
|
||||
QIcon* getIcon(const QString &name) const;
|
||||
};
|
||||
|
||||
#endif // ICONCOLUMNDELEGATE_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue