尝试状态值自动

This commit is contained in:
hm
2021-04-25 09:28:46 +08:00
parent efdc426f39
commit 8374802b69
7 changed files with 82 additions and 22 deletions
+8 -8
View File
@@ -9,7 +9,7 @@ StateWidget::StateWidget(int flag,int index,QWidget *parent) : QWidget(parent)
title = new QLabel("new status");
title->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
title->setFixedSize(w/2,h+offset);
title->setFixedSize(w/2,h+m_offset);
gridlayout->addWidget(title,0,0,1,1);
@@ -17,7 +17,7 @@ StateWidget::StateWidget(int flag,int index,QWidget *parent) : QWidget(parent)
{
label = new QLabel("0");
label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
label->setFixedSize(w/2,h+offset);
label->setFixedSize(w/2,h+m_offset);
setColor(state::gray);
gridlayout->addWidget(label,0,1,1,1);
}
@@ -27,12 +27,12 @@ StateWidget::StateWidget(int flag,int index,QWidget *parent) : QWidget(parent)
bar->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
bar->setRange(0,100);
bar->setValue(0);
bar->setFixedSize(w/2,h+offset);
bar->setFixedSize(w/2,h+m_offset);
gridlayout->addWidget(bar,0,1,1,1);
}
this->setLayout(gridlayout);
this->resize(w,h+ 2 * offset);
this->resize(w,h+ 2 * m_offset);
}
StateWidget::StateWidget(int flag, QString t,QVariant v,state s,int index, QWidget *parent) : QWidget(parent)
@@ -47,7 +47,7 @@ StateWidget::StateWidget(int flag, QString t,QVariant v,state s,int index, QWidg
title = new QLabel(t);
title->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
title->setFixedSize(w/2,h+offset);
title->setFixedSize(w/2,h+m_offset);
gridlayout->addWidget(title,0,0,1,1);
@@ -55,7 +55,7 @@ StateWidget::StateWidget(int flag, QString t,QVariant v,state s,int index, QWidg
{
label = new QLabel(v.toString());
label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
label->setFixedSize(w/2,h+offset);
label->setFixedSize(w/2,h+m_offset);
setColor(s);
gridlayout->addWidget(label,0,1,1,1);
}
@@ -66,12 +66,12 @@ StateWidget::StateWidget(int flag, QString t,QVariant v,state s,int index, QWidg
bar->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
bar->setRange(0,100);
bar->setValue(v.toDouble());
bar->setFixedSize(w/2,h+offset);
bar->setFixedSize(w/2,h+m_offset);
gridlayout->addWidget(bar,0,1,1,1);
}
this->setLayout(gridlayout);
this->resize(w,h + 2 * offset);
this->resize(w,h + 2 * m_offset);
}