| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#pragma once |
| 6 |
|
| 7 |
#include <DListWidget> |
| 8 |
#include <DWidget> |
| 9 |
#include <DLabel> |
| 10 |
|
| 11 |
#include <QRadioButton> |
| 12 |
#include <QItemDelegate> |
| 13 |
#include <QImageReader> |
| 14 |
|
| 15 |
DWIDGET_USE_NAMESPACE |
| 16 |
|
| 17 |
class DeviceDelegate : public QItemDelegate |
| 18 |
{ |
| 19 |
Q_OBJECT |
| 20 |
|
| 21 |
public: |
| 22 |
|
| 23 |
DeviceDelegate(QObject *parent = nullptr); |
| 24 |
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; |
| 25 |
}; |
| 26 |
|
| 27 |
class DeviceInfoItem : public DWidget |
| 28 |
{ |
| 29 |
Q_OBJECT |
| 30 |
public: |
| 31 |
explicit DeviceInfoItem(const QString &name, |
| 32 |
const QString &device, |
| 33 |
const QString &cap, |
| 34 |
int percent, DWidget *parent = Q_NULLPTR); |
| 35 |
explicit DeviceInfoItem(DWidget *parent = Q_NULLPTR); |
| 36 |
|
| 37 |
void setCheck(bool flag); |
| 38 |
bool isChecked(); |
| 39 |
bool needFormat() const; |
| 40 |
void setNeedFormat(bool format); |
| 41 |
|
| 42 |
protected: |
| 43 |
void paintEvent(QPaintEvent *event) override; |
| 44 |
private: |
| 45 |
QPixmap renderSVG(const QString &filePath, const QSize &size); |
| 46 |
bool checked = false; |
| 47 |
DLabel *m_deviceIcon = nullptr; |
| 48 |
DLabel *m_fillingposition = nullptr; |
| 49 |
QString m_filepath; |
| 50 |
QPixmap s_removeDevice; |
| 51 |
}; |
| 52 |
|