修改显示停车场的样式,并且现在不用再把xml复制到输出文件夹了
This commit is contained in:
1 parent
91c77a42b5
commit
f4874096aa
11 files changed
+201
-34
No files matched your search
@@ -0,0 +1,32 @@
|
||||
#include "boundary.h"
|
||||
#include <QPainter>
|
||||
#include <QEvent>
|
||||
|
||||
Boundary::Boundary(const QString &dir, int l, QWidget *parent): QWidget(parent), length(l)
|
||||
{
|
||||
if (dir == "horizontal")
|
||||
vertical = false;
|
||||
else
|
||||
vertical = true;
|
||||
if (vertical) {
|
||||
resize(5, length);
|
||||
setMaximumSize(5, length);
|
||||
setMinimumSize(5, length);
|
||||
} else {
|
||||
resize(length, 5);
|
||||
setMaximumSize(length, 5);
|
||||
setMinimumSize(length, 5);
|
||||
}
|
||||
}
|
||||
|
||||
void Boundary::paintEvent(QPaintEvent *) {
|
||||
QPainter p(this);
|
||||
p.setPen(Qt::black);
|
||||
p.setBrush(Qt::black);
|
||||
if (vertical) {
|
||||
p.drawRect(0, 0, 5, length);
|
||||
} else {
|
||||
p.drawRect(0, 0, length, 5);
|
||||
}
|
||||
p.setPen(Qt::red);
|
||||
}
|
||||
Reference in new issue
Block a user