qt/LedOK/program/sendprogramdialog.h

52 lines
1.7 KiB
C
Raw Normal View History

2023-04-18 14:14:46 +08:00
#ifndef SENDPROGRAMDIALOG_H
#define SENDPROGRAMDIALOG_H
2023-05-15 16:06:10 +08:00
#include "globaldefine.h"
2023-08-07 09:04:53 +08:00
#include "gutil/qgui.h"
#include <QDialog>
#include <QCheckBox>
#include <QProxyStyle>
#include <QApplication>
2023-04-18 14:14:46 +08:00
class SendProgramDialog : public QDialog {
Q_OBJECT
public:
explicit SendProgramDialog(QString, QWidget *parent = nullptr);
signals:
void stopAllThd();
protected slots:
2023-08-07 09:04:53 +08:00
void refresh();
protected:
void closeEvent(QCloseEvent *event) override;
2023-04-18 14:14:46 +08:00
void sendNext();
2023-08-07 09:04:53 +08:00
void addRow(LedCard);
void updRow(int, LedCard);
2023-04-18 14:14:46 +08:00
2023-08-07 09:04:53 +08:00
Table *table;
QCheckBox *fdCheckAll;
2023-04-18 14:14:46 +08:00
int mWaitCnt{0};
QLabel *label;
QString mProgName;
QString m_strUrl;
2023-08-07 09:04:53 +08:00
enum {isSending = Qt::UserRole};
};
class ViewItemStyle : public QProxyStyle {
public:
ViewItemStyle() : QProxyStyle(QApplication::style()) {}
QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const override {
auto res = QProxyStyle::subElementRect(element, option, widget);
if(option && option->type==QStyleOption::SO_ViewItem && ((QStyleOptionViewItem*)option)->features & QStyleOptionViewItem::HasCheckIndicator && ((QStyleOptionViewItem*)option)->index.internalId()==0) res.setLeft(res.x() + 6);
return res;
}
int pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const override {
auto res = QProxyStyle::pixelMetric(metric, option, widget);
if(metric==PM_FocusFrameHMargin && option && option->type==QStyleOption::SO_ViewItem && ((QStyleOptionViewItem*)option)->features & QStyleOptionViewItem::HasCheckIndicator) res += 4;
return res;
}
2023-04-18 14:14:46 +08:00
};
#endif // SENDPROGRAMDIALOG_H