#include "FormBase.h" #include "formwell.h" #include "CallManage.h" #include #include #include #include #include #include "PropertyWidget.h" // FormBase::FormBase(QWidget *parent, QString strSlfName, QString strWellName) : QWidget(parent) { m_pFormWell = qobject_cast(parent); m_strSlfName = strSlfName; m_strWellName = strWellName; m_Color = Qt::black; } FormBase::~FormBase() { } void FormBase::setBorderFlags(BorderFlags flags) { m_BorderFlags = flags; } void FormBase::paintEvent(QPaintEvent* event) { QPainter painter(this); QRect rect = this->rect(); //背景透明 painter.fillRect(rect.left(), rect.top(), rect.width(), rect.height(), QColor(0, 0, 0, 0)); //QColor(67, 67, 67, 100) int nbw = m_pFormWell->getBorderGridProperty().m_nWidth; painter.setPen(QPen(m_pFormWell->getBorderGridProperty().m_clor, nbw, (Qt::PenStyle)m_pFormWell->getBorderGridProperty().m_nType)); int t = rect.top(); int b = rect.bottom(); int l = rect.left(); int r = rect.right(); // 上边框 if (m_BorderFlags & TopBorder) { painter.drawLine(l, t + nbw / 2, r, t + nbw / 2); } // 下边框 if (m_BorderFlags & BottomBorder) { painter.drawLine(l, b - nbw / 2, r, b - nbw / 2); } // 左边框 if (m_BorderFlags & LeftBorder) { painter.drawLine(l + nbw / 2, t, l + nbw / 2, b); } // 右边框 if (m_BorderFlags & RightBorder) { painter.drawLine(r, t, r, b); } QWidget::paintEvent(event); }