diff --git a/LedOK/LedOK.pro b/LedOK/LedOK.pro index b4ff174..af729a2 100644 --- a/LedOK/LedOK.pro +++ b/LedOK/LedOK.pro @@ -42,7 +42,6 @@ SOURCES += \ LoQClass/locolorselector.cpp \ LoQClass/lodateselector.cpp \ LoQClass/loglwindow.cpp \ - LoQClass/loqgraphicsobject.cpp \ LoQClass/loqgraphicsvideoitem.cpp \ LoQClass/loqgraphicsview.cpp \ LoQClass/loqheaderviewcheckbox.cpp \ @@ -187,7 +186,6 @@ HEADERS += \ LoQClass/locolorselector.h \ LoQClass/lodateselector.h \ LoQClass/loglwindow.h \ - LoQClass/loqgraphicsobject.h \ LoQClass/loqgraphicsvideoitem.h \ LoQClass/loqgraphicsview.h \ LoQClass/loqheaderviewcheckbox.h \ @@ -401,6 +399,16 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target DISTFILES += \ + qss/00_Common.css \ + qss/01_Global.css \ + qss/10_MainWindow.css \ + qss/11_MainWindowTab.css \ + qss/20_DeviceManager.css \ + qss/21_DeviceSetting.css \ + qss/30_ProgramManager.css \ + qss/31_EditProgram.css \ + qss/32_PageAttr.css \ + qss/33_EWindow.css \ qss/MainWnd.css \ qss/MainTab.css \ qss/TabDeviceManager.css \ diff --git a/LedOK/LoQClass/loqgraphicsobject.cpp b/LedOK/LoQClass/loqgraphicsobject.cpp deleted file mode 100644 index be42b09..0000000 --- a/LedOK/LoQClass/loqgraphicsobject.cpp +++ /dev/null @@ -1,578 +0,0 @@ -#include "loqgraphicsobject.h" -#include "QCoreApplication" -LoQGraphicsObject::LoQGraphicsObject(InteractiveType type, QGraphicsItem *parent) : - QGraphicsObject(parent), - m_interactiveType(type), - m_movable(false), - m_handleLen(10), - m_rLimit(INVALID_RECT) -{ - setGeometry(0, 0, 100, 100); - init(); -} - -LoQGraphicsObject::LoQGraphicsObject(QRectF rect, InteractiveType type, QGraphicsItem *parent) : - QGraphicsObject(parent), - m_interactiveType(type), - m_movable(false), - m_handleLen(10), - m_rLimit(INVALID_RECT) -{ - setGeometry(rect); - init(); -} - -LoQGraphicsObject::LoQGraphicsObject(qreal x, qreal y, qreal w, qreal h, InteractiveType type, QGraphicsItem *parent) : - QGraphicsObject(parent), - m_interactiveType(type), - m_movable(false), - m_handleLen(10), - m_rLimit(INVALID_RECT) -{ - setGeometry(x, y, w, h); - init(); -} - -void LoQGraphicsObject::setInteractiveType(InteractiveType type) -{ - m_interactiveType = type; - GraphicsItemFlags flag = flags(); - if(Dynamic == m_interactiveType) { - flag |= ItemIsMovable; - flag |= ItemIsSelectable; - flag &= ~ItemIsFocusable; - } else { - flag &= ~ItemIsMovable; - flag &= ~ItemIsSelectable; - flag &= ~ItemIsFocusable; - } - setFlags(flag); -} - -void LoQGraphicsObject::init() -{ - setInteractiveType(m_interactiveType); - - m_handlePen.setBrush(QBrush(QColor::fromRgb(0, 255, 0))); - m_handlePen.setWidth(1); - - QVector dashes; - qreal space = 2; - qreal solid = 2; - dashes << solid << space << solid <save(); -//绘制边框 - QPen pen; // creates a default pen - -// pen.setStyle(Qt::DashDotLine); -// QLinearGradient svGradient(0, 0, 2, 0); -// svGradient.setColorAt(1, QColor("#00ff00")); -// svGradient.setColorAt(0, QColor("#ffffff")); -// QBrush myBrush(svGradient); - - QString qexeFullPath = QCoreApplication::applicationDirPath(); - QString qtBordImage=qexeFullPath+"/m/"+"M8_8.bmp"; - QPixmap aa(qtBordImage); - int iBordWidth=aa.height(); - pen.setWidth(iBordWidth); - QBrush myBrush(aa); - //myBrush.setTexture(aa); - pen.setBrush(myBrush); - pen.setCapStyle(Qt::RoundCap); - pen.setJoinStyle(Qt::RoundJoin); - - - QPainterPath path; - - path.moveTo(iBordWidth/2,iBordWidth/2); - path.lineTo(rect().right()-iBordWidth/2,iBordWidth/2); - path.lineTo(rect().right()-iBordWidth/2,rect().bottom()-iBordWidth/2); - path.lineTo(iBordWidth/2,rect().bottom()-iBordWidth/2); - path.lineTo(iBordWidth/2,iBordWidth/2); - painter->setPen(pen); - painter->drawPath(path); - - QMatrix matrix2; - matrix2.rotate(90); - QBrush myBrush2; - QPixmap bb=aa.transformed(matrix2, Qt::SmoothTransformation); - myBrush2.setTexture(bb); - QPen pen2; - pen2.setBrush(myBrush2); - QPainterPath path2; - path2.moveTo(rect().right()-iBordWidth/2,iBordWidth/2); - path2.lineTo(rect().right()-iBordWidth/2,rect().bottom()-iBordWidth/2); - painter->setPen(pen2); - painter->drawPath(path2); - - //QMatrix matrix3; - //matrix3.rotate(0); -// QBrush myBrush3; -// QPainterPath path3; -//// myBrush3.setTexture(aa); -//// pen.setBrush(myBrush); -//// painter->setPen(pen); -// path3.moveTo(rect().right()-iBordWidth/2,rect().bottom()-iBordWidth/2); -// path3.lineTo(iBordWidth/2,rect().bottom()-iBordWidth/2); -// painter->drawPath(path3); - -// QMatrix matrix4; -// matrix4.rotate(270); -// QBrush myBrush4; -// QPainterPath path4; -// myBrush4.setTexture(aa.transformed(matrix4, Qt::SmoothTransformation)); -// pen.setBrush(myBrush4); -// path4.moveTo(iBordWidth/2,rect().bottom()-iBordWidth/2); -// path4.lineTo(iBordWidth/2,iBordWidth/2); -// painter->drawPath(path4); - - if(isSelected()) { - QPainterPath pRect; - pRect.addRect(rect()); - m_borderPen.setBrush(QBrush(QColor::fromRgb(0, 255, 0))); - painter->setPen(m_borderPen); - painter->drawPath(pRect); - QPainterPath pHandle; - pHandle.addRect(m_rLT); - pHandle.addRect(m_rT); - pHandle.addRect(m_rRT); - pHandle.addRect(m_rL); - pHandle.addRect(m_rR); - pHandle.addRect(m_rLB); - pHandle.addRect(m_rB); - pHandle.addRect(m_rRB); - painter->setPen(m_handlePen); - painter->drawPath(pHandle); - } - else { - - m_borderPen.setBrush(QBrush(QColor::fromRgb(0, 125, 0))); - - QPainterPath pRect; - pRect.addRect(rect()); - painter->setPen(m_borderPen); - painter->drawPath(pRect); - - } - - //磁条吸附时两化吸附的边 - QPen CitiePen=QPen(QColor::fromRgb(0, 255, 0),1,Qt::SolidLine); - painter->setPen(CitiePen); - //if(bMousePress) - { - if (bLeftCitie) { - painter->setPen(CitiePen); - //painter->drawLine(QPointF(rect().x(),rect().y()-100),QPointF(rect().x(),rect().bottom()+100)); - painter->drawLine(QPointF(rect().topLeft()),QPointF(rect().bottomLeft())); - } - if (bTopCitie) { - painter->setPen(CitiePen); - painter->drawLine(QPointF(rect().topLeft()),QPointF(rect().topRight())); - } - if (bRightCitie) { - painter->setPen(CitiePen); - painter->drawLine(QPointF(rect().topRight()),QPointF(rect().bottomRight())); - } - if (bBottomCitie) { - painter->setPen(CitiePen); - painter->drawLine(QPointF(rect().bottomLeft()),QPointF(rect().bottomRight())); - } - - } - -// QPen(const QBrush &brush, -// qreal width, -// Qt::PenStyle style = Qt::SolidLine, -// Qt::PenCapStyle cap = Qt::SquareCap, -// Qt::PenJoinStyle join = Qt::BevelJoin); -// QPen pen(Qt::green, 3, Qt::DashDotLine, Qt::RoundCap, Qt::RoundJoin); - - - //painter->drawLine(QPointF(rect().bottomLeft()),QPointF(rect().bottomRight())); - painter->restore(); -} -void LoQGraphicsObject::setBrightBianLeft(bool b) -{ - //if(bMousePress) -// { -// bLeftCitie=b; - -// } -// else { -// bLeftCitie=false; -// } - bLeftCitie=b; - updateGeometry(); - -} -void LoQGraphicsObject::setBrightBianRight(bool b) -{ -// if(bMousePress) -// { -// bRightCitie=b; - -// } -// else { -// bRightCitie=false; -// } - bRightCitie=b; - updateGeometry(); - -} -void LoQGraphicsObject::setBrightBianTop(bool b) -{ -// if(bMousePress) -// { -// bTopCitie=b; - -// } -// else { -// bTopCitie=false; -// } - bTopCitie=b; - updateGeometry(); - -} -void LoQGraphicsObject::setBrightBianbottom(bool b) -{ -// if(bMousePress) -// { -// bBottomCitie=b; - -// } -// else { -// bBottomCitie=false; -// } - bBottomCitie=b; - updateGeometry(); - -} -void LoQGraphicsObject::mouseMoveEvent(QGraphicsSceneMouseEvent *event) -{ - // return; - if(false == m_movable) return; - - qreal cx, cy, cw, ch; - qreal mx, my, mw, mh; - QPointF ePos = pointToParent(event->pos()); - QPointF absoluteOfs = ePos - m_pOrg; - - mx = m_rOrg.x(); - my = m_rOrg.y(); - mw = m_w; - mh = m_h; - - if(m_hDir != NONE) { - prepareGeometryChange(); - - switch(m_hDir) { - case LT: - cx = m_rOrg.x() + absoluteOfs.x(); - cy = m_rOrg.y() + absoluteOfs.y(); - if(m_rOrg.right() - cx < m_handleLen) cx = m_rOrg.right() - m_handleLen; - if(m_rOrg.bottom() - cy < m_handleLen) cy = m_rOrg.bottom() - m_handleLen; - mx = cx; - my = cy; - if(m_rLimit != INVALID_RECT) { - if(mx < 0) mx = 0; - if(my < 0) my = 0; - } - mw = m_rOrg.right() - mx; - mh = m_rOrg.bottom() - my; - break; - - case T: - cy = m_rOrg.y() + absoluteOfs.y(); - if(m_rOrg.bottom() - cy < m_handleLen) cy = m_rOrg.bottom() - m_handleLen; - my = cy; - if(m_rLimit != INVALID_RECT) { - if(my < 0) my = 0; - } - mh = m_rOrg.bottom() - my; - break; - - case RT: - cy = m_rOrg.y() + absoluteOfs.y(); - cw = m_rOrg.width() + absoluteOfs.x(); - if(m_rOrg.bottom() - cy < m_handleLen) cy = m_rOrg.bottom() - m_handleLen; - if(cw < m_handleLen) cw = m_handleLen; - my = cy; - mw = cw; - if(m_rLimit != INVALID_RECT) { - if(my < 0) my = 0; - if(mx + mw > m_rLimit.width()) mw = m_rLimit.width() - mx; - } - mh = m_rOrg.bottom() - my; - break; - - case L: - cx = m_rOrg.x() + absoluteOfs.x(); - if(m_rOrg.right() - cx < m_handleLen) cx = m_rOrg.right() - m_handleLen; - mx = cx; - if(m_rLimit != INVALID_RECT) { - if(mx < 0) mx = 0; - } - mw = m_rOrg.right() - mx; - break; - - case R: - cw = m_rOrg.width() + absoluteOfs.x(); - if(cw < m_handleLen) cw = m_handleLen; - mw = cw; - if(m_rLimit != INVALID_RECT) { - if(mx + mw > m_rLimit.width()) mw = m_rLimit.width() - mx; - } - break; - - case LB: - cx = m_rOrg.x() + absoluteOfs.x(); - ch = m_rOrg.height() + absoluteOfs.y(); - if(m_rOrg.right() - cx < m_handleLen) cx = m_rOrg.right() - m_handleLen; - if(ch < m_handleLen) ch = m_handleLen; - mx = cx; - if(m_rLimit != INVALID_RECT) { - if(mx < 0) mx = 0; - } - mw = m_rOrg.right() - mx; - mh = ch; - if(m_rLimit != INVALID_RECT) { - if(my + mh > m_rLimit.height()) mh = m_rLimit.height() - my; - } - break; - - case B: - ch = m_rOrg.height() + absoluteOfs.y(); - if(ch < m_handleLen) ch = m_handleLen; - mh = ch; - if(m_rLimit != INVALID_RECT) { - if(my + mh > m_rLimit.height()) mh = m_rLimit.height() - my; - } - break; - - case RB: - cw = m_rOrg.width() + absoluteOfs.x(); - ch = m_rOrg.height() + absoluteOfs.y(); - if(cw < m_handleLen) cw = m_handleLen; - if(ch < m_handleLen) ch = m_handleLen; - mw = cw; - mh = ch; - if(m_rLimit != INVALID_RECT) { - if(mx + mw > m_rLimit.width()) mw = m_rLimit.width() - mx; - if(my + mh > m_rLimit.height()) mh = m_rLimit.height() - my; - } - break; - - default: - break; - } - - setPos(mx, my); - m_w = mw; - m_h = mh; - adjustHandle(); - updateGeometry(m_rOrg); - rectChanged(rect()); - } else { - mx = m_rOrg.x() + absoluteOfs.x(); - my = m_rOrg.y() + absoluteOfs.y(); - if(m_rLimit != INVALID_RECT) { - if(mx < 0) mx = 0; - if(my < 0) my = 0; - if(mx + mw > m_rLimit.width()) mx = m_rLimit.width() - mw; - if(my + mh > m_rLimit.height()) my = m_rLimit.height() - mh; - } - setPos(mx, my); - } - - geometryChanged(geometry()); - if(bMousePress) - { - - emit sigCiTie(true,m_hDir); - - } -} - -void LoQGraphicsObject::setRLimit(const QRectF &r) -{ - if(m_rLimit != INVALID_RECT) { - qreal mx, my, mw, mh; - qreal scale_w = r.width() / m_rLimit.width(); - qreal scale_h = r.height() / m_rLimit.height(); - mx = std::round(x() * scale_w); - my = std::round(y() * scale_h); - mw = std::round(m_w * scale_w); - mh = std::round(m_h * scale_h); - setPos(mx, my); - m_w = mw; - m_h = mh; - adjustHandle(); - geometryChanged(geometry()); - } - m_rLimit = r; -} - -void LoQGraphicsObject::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - if(Qt::LeftButton == event->button()) { - - m_hDir = handleDir(event->pos()); - m_pOrg = pointToParent(event->pos()); - m_rOrg = geometry(); - m_movable = true; - bMousePress=true; - - } - QGraphicsItem::mousePressEvent(event); -} - -void LoQGraphicsObject::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - bMousePress=false; - - if(Qt::LeftButton == event->button()) { - m_hDir = NONE; - m_movable = false; - bLeftCitie=false; - bRightCitie=false; - bTopCitie=false; - bBottomCitie=false; - m_keyPressId++; - emit sigCiTie(false,m_keyPressId); - - } - QGraphicsItem::mouseReleaseEvent(event); -} - -void LoQGraphicsObject::setGeometry(const QRectF &r) -{ - if(r != geometry()) { - prepareGeometryChange(); - setPos(r.x(), r.y()); - m_w = r.width(); - m_h = r.height(); - adjustHandle(); - emit rectChanged(rect()); - } -} - -void LoQGraphicsObject::updateGeometry() -{ - QRectF r = geometry(); - qreal x, y, w, h; - x = r.x() - m_handleLen; - y = r.y() - m_handleLen; - w = r.width() + m_handleLen * 2; - h = r.height() + m_handleLen * 2; - r = QRectF(x, y, w, h); - if(nullptr != scene()) { - scene()->update(r); - } - emit requestUpdate(r); -} - -void LoQGraphicsObject::updateGeometry(const QRectF &gC, const QRectF &gL) -{ - qreal x, y, w, h; - QRectF gCur, gLast; - x = gC.x() - m_handleLen; - y = gC.y() - m_handleLen; - w = gC.width() + m_handleLen * 2; - h = gC.height() + m_handleLen * 2; - gCur = QRectF(x, y, w, h); - x = gL.x() - m_handleLen; - y = gL.y() - m_handleLen; - w = gL.width() + m_handleLen * 2; - h = gL.height() + m_handleLen * 2; - gLast = QRectF(x, y, w, h); - qreal l = (gCur.left() < gLast.left()) ? gCur.left() : gLast.left(); - qreal t = (gCur.top() < gLast.top()) ? gCur.top() : gLast.top(); - qreal r = (gCur.right() > gLast.right()) ? gCur.right() : gLast.right(); - qreal b = (gCur.bottom() > gLast.bottom()) ? gCur.bottom() : gLast.bottom(); - QRectF gFlash = QRectF(QPointF(l, t), QPointF(r, b)); - if(nullptr != scene()) { - scene()->update(gFlash); - } - emit requestUpdate(gFlash); -} - -QPointF LoQGraphicsObject::pointToParent(const QPointF &p) -{ - qreal px, py; - px = p.x() + x(); - py = p.y() + y(); - return QPointF(px, py); -} - -LoQGraphicsObject::HANDLE_DIR LoQGraphicsObject::handleDir(const QPointF &p) -{ - HANDLE_DIR hDir = NONE; - if(isSelected()) { - if(m_rLT.contains(p)) hDir = LT; - else if(m_rT.contains(p)) hDir = T; - else if(m_rRT.contains(p)) hDir = RT; - else if(m_rL.contains(p)) hDir = L; - else if(m_rR.contains(p)) hDir = R; - else if(m_rLB.contains(p)) hDir = LB; - else if(m_rB.contains(p)) hDir = B; - else if(m_rRB.contains(p)) hDir = RB; - } - return hDir; -} -//拖拽的虚线矩形 -void LoQGraphicsObject::adjustHandle() -{ - const QRectF &r = rect(); - //左上角 - m_rLT = QRectF(r.left() - m_handleLen/2, - r.top() - m_handleLen/2, - m_handleLen, m_handleLen); - //上中 - m_rT = QRectF(r.center().x() - m_handleLen / 2, - r.top() - m_handleLen/2, - m_handleLen, m_handleLen); - //右上角 - m_rRT = QRectF(r.right()-m_handleLen/2, - r.top() - m_handleLen/2, - m_handleLen, m_handleLen); - //左中 - m_rL = QRectF(r.left() - m_handleLen/2, - r.center().y() - m_handleLen / 2, - m_handleLen, m_handleLen); - //右中 - m_rR = QRectF(r.right()-m_handleLen/2, - r.center().y() - m_handleLen / 2, - m_handleLen, m_handleLen); - //左下角 - m_rLB = QRectF(r.left() - m_handleLen/2, - r.bottom()-m_handleLen / 2, - m_handleLen, m_handleLen); - //中下 - m_rB = QRectF(r.center().x() - m_handleLen / 2, - r.bottom()-m_handleLen / 2, - m_handleLen, m_handleLen); - //右下角 - m_rRB = QRectF(r.right()-m_handleLen / 2, - r.bottom()-m_handleLen / 2, - m_handleLen, m_handleLen); -} diff --git a/LedOK/LoQClass/loqgraphicsobject.h b/LedOK/LoQClass/loqgraphicsobject.h deleted file mode 100644 index b78431a..0000000 --- a/LedOK/LoQClass/loqgraphicsobject.h +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef LOQGRAPHICSOBJECT_H -#define LOQGRAPHICSOBJECT_H - -#include -#include -#include -#include -#include -#include -#include - -#define INVALID_RECT QRect(-1, -5, -6, -8) - -class LoQGraphicsObject : public QGraphicsObject -{ - Q_OBJECT - - typedef enum { - NONE = 0, - LT, - T, - RT, - L, - R, - LB, - B, - RB - } HANDLE_DIR; - -public: - enum InteractiveType { - Dynamic = 0, - Static, - Custom - }; - -public: - explicit LoQGraphicsObject(InteractiveType type = Dynamic, QGraphicsItem *parent = nullptr); - LoQGraphicsObject(QRectF rect, InteractiveType type = Dynamic, QGraphicsItem *parent = nullptr); - LoQGraphicsObject(qreal x, qreal y, qreal w, qreal h, InteractiveType type = Dynamic, QGraphicsItem *parent = nullptr); - -private: - void init(); - -public: - virtual QRectF boundingRect() const override; - virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; - virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override; - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override; - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; - virtual void setInteractiveType(InteractiveType type = Dynamic); - -public: - InteractiveType interactiveType() const { return m_interactiveType; } - QRectF rect() const { return QRectF(0, 0, m_w, m_h); } - QRectF geometry() const { return QRectF(x(), y(), m_w, m_h); } - -public: - void setRLimit(const QRectF &r); - QRectF rLimit() const { return m_rLimit; } - -signals: - void requestUpdate(const QRectF &); - void geometryChanged(const QRectF &); - void rectChanged(const QRectF &); - - void sigCiTie(bool,int); -public slots: - void setGeometry (qreal x, qreal y, qreal w, qreal h) { setGeometry(QRectF(x, y, w, h)); } - void setGeometry (const QRectF &r); - void updateGeometry(); - void updateGeometry(const QRectF &gLast) { updateGeometry(geometry(), gLast); } - void updateGeometry(const QRectF &gCur, const QRectF &gLast); - void setBrightBianLeft(bool); - void setBrightBianTop(bool); - void setBrightBianRight(bool); - void setBrightBianbottom(bool); - -protected: - int handleLen() const { return m_handleLen; } - QPointF pointToParent(const QPointF &p); - HANDLE_DIR handleDir(const QPointF &p); - void adjustHandle(); - -private: - InteractiveType m_interactiveType; - bool m_movable; - int m_handleLen; - QPen m_handlePen; - QPen m_borderPen; - -private: - qreal m_w; - qreal m_h; - QRectF m_rLT; - QRectF m_rT; - - QRectF m_rRT; - QRectF m_rL; - QRectF m_rR; - QRectF m_rLB; - QRectF m_rB; - QRectF m_rRB; - QRectF m_rOrg; - QPointF m_pOrg; - HANDLE_DIR m_hDir; - QRectF m_rLimit; - bool bMousePress=false; - bool bLeftCitie=false; - bool bRightCitie=false; - bool bTopCitie=false; - bool bBottomCitie=false; - int m_keyPressId=0; - -}; - -#endif // LOQGRAPHICSOBJECT_H diff --git a/LedOK/LoQClass/loqheaderviewcheckbox.cpp b/LedOK/LoQClass/loqheaderviewcheckbox.cpp index 0a2ff5b..4bfad7c 100644 --- a/LedOK/LoQClass/loqheaderviewcheckbox.cpp +++ b/LedOK/LoQClass/loqheaderviewcheckbox.cpp @@ -23,19 +23,15 @@ void LoQHeaderViewCheckBox::HideHeaderCheckBox(bool b) } void LoQHeaderViewCheckBox::paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const { - qDebug() <<"paintSection -s"; QHeaderView::paintSection(painter, rect, logicalIndex); if (logicalIndex == 0) { m_checkBox->setGeometry(rect); } - qDebug() <<"paintSection -o"; } void LoQHeaderViewCheckBox::onAllChecked(bool f) { - qDebug() <<"onAllChecked -s"; m_checkBox->blockSignals(true); m_checkBox->setChecked(f); m_checkBox->blockSignals(false); - qDebug() <<"onAllChecked -o"; } diff --git a/LedOK/images.qrc b/LedOK/images.qrc index 303e99e..9e29767 100644 --- a/LedOK/images.qrc +++ b/LedOK/images.qrc @@ -1,5 +1,79 @@ res/splash.png + res/borders/M1_0.bmp + res/borders/M1_1.bmp + res/borders/M1_2.bmp + res/borders/M1_3.bmp + res/borders/M1_4.bmp + res/borders/M1_5.bmp + res/borders/M1_6.bmp + res/borders/M1_7.bmp + res/borders/M1_8.bmp + res/borders/M2_0.bmp + res/borders/M2_1.bmp + res/borders/M2_2.bmp + res/borders/M2_3.bmp + res/borders/M2_4.bmp + res/borders/M2_5.bmp + res/borders/M2_6.bmp + res/borders/M2_7.bmp + res/borders/M2_8.bmp + res/borders/M3_0.bmp + res/borders/M3_1.bmp + res/borders/M3_2.bmp + res/borders/M3_3.bmp + res/borders/M3_4.bmp + res/borders/M3_5.bmp + res/borders/M3_6.bmp + res/borders/M3_7.bmp + res/borders/M3_8.bmp + res/borders/M4_0.bmp + res/borders/M4_1.bmp + res/borders/M4_2.bmp + res/borders/M4_3.bmp + res/borders/M4_4.bmp + res/borders/M4_5.bmp + res/borders/M4_6.bmp + res/borders/M4_7.bmp + res/borders/M4_8.bmp + res/borders/M5_0.bmp + res/borders/M5_1.bmp + res/borders/M5_2.bmp + res/borders/M5_3.bmp + res/borders/M5_4.bmp + res/borders/M5_5.bmp + res/borders/M5_6.bmp + res/borders/M5_7.bmp + res/borders/M5_8.bmp + res/borders/M6_0.bmp + res/borders/M6_1.bmp + res/borders/M6_2.bmp + res/borders/M6_3.bmp + res/borders/M6_4.bmp + res/borders/M6_5.bmp + res/borders/M6_6.bmp + res/borders/M6_7.bmp + res/borders/M6_8.bmp + res/borders/M6_9.bmp + res/borders/M7_0.bmp + res/borders/M7_1.bmp + res/borders/M7_2.bmp + res/borders/M7_3.bmp + res/borders/M7_4.bmp + res/borders/M7_5.bmp + res/borders/M7_6.bmp + res/borders/M7_7.bmp + res/borders/M7_8.bmp + res/borders/M8_0.bmp + res/borders/M8_1.bmp + res/borders/M8_2.bmp + res/borders/M8_3.bmp + res/borders/M8_4.bmp + res/borders/M8_5.bmp + res/borders/M8_6.bmp + res/borders/M8_7.bmp + res/borders/M8_8.bmp + res/borders/M9_0.bmp diff --git a/LedOK/res/borders/M1_0.bmp b/LedOK/res/borders/M1_0.bmp new file mode 100644 index 0000000..5b563c3 Binary files /dev/null and b/LedOK/res/borders/M1_0.bmp differ diff --git a/LedOK/res/borders/M1_1.bmp b/LedOK/res/borders/M1_1.bmp new file mode 100644 index 0000000..c5f69cd Binary files /dev/null and b/LedOK/res/borders/M1_1.bmp differ diff --git a/LedOK/res/borders/M1_2.bmp b/LedOK/res/borders/M1_2.bmp new file mode 100644 index 0000000..aea8d57 Binary files /dev/null and b/LedOK/res/borders/M1_2.bmp differ diff --git a/LedOK/res/borders/M1_3.bmp b/LedOK/res/borders/M1_3.bmp new file mode 100644 index 0000000..c83e43c Binary files /dev/null and b/LedOK/res/borders/M1_3.bmp differ diff --git a/LedOK/res/borders/M1_4.bmp b/LedOK/res/borders/M1_4.bmp new file mode 100644 index 0000000..d00bdd0 Binary files /dev/null and b/LedOK/res/borders/M1_4.bmp differ diff --git a/LedOK/res/borders/M1_5.bmp b/LedOK/res/borders/M1_5.bmp new file mode 100644 index 0000000..99dc3ff Binary files /dev/null and b/LedOK/res/borders/M1_5.bmp differ diff --git a/LedOK/res/borders/M1_6.bmp b/LedOK/res/borders/M1_6.bmp new file mode 100644 index 0000000..261fdd0 Binary files /dev/null and b/LedOK/res/borders/M1_6.bmp differ diff --git a/LedOK/res/borders/M1_7.bmp b/LedOK/res/borders/M1_7.bmp new file mode 100644 index 0000000..ef8a886 Binary files /dev/null and b/LedOK/res/borders/M1_7.bmp differ diff --git a/LedOK/res/borders/M1_8.bmp b/LedOK/res/borders/M1_8.bmp new file mode 100644 index 0000000..26be2d0 Binary files /dev/null and b/LedOK/res/borders/M1_8.bmp differ diff --git a/LedOK/res/borders/M2_0.bmp b/LedOK/res/borders/M2_0.bmp new file mode 100644 index 0000000..bb9aecb Binary files /dev/null and b/LedOK/res/borders/M2_0.bmp differ diff --git a/LedOK/res/borders/M2_1.bmp b/LedOK/res/borders/M2_1.bmp new file mode 100644 index 0000000..c884856 Binary files /dev/null and b/LedOK/res/borders/M2_1.bmp differ diff --git a/LedOK/res/borders/M2_2.bmp b/LedOK/res/borders/M2_2.bmp new file mode 100644 index 0000000..36b7917 Binary files /dev/null and b/LedOK/res/borders/M2_2.bmp differ diff --git a/LedOK/res/borders/M2_3.bmp b/LedOK/res/borders/M2_3.bmp new file mode 100644 index 0000000..bb9aecb Binary files /dev/null and b/LedOK/res/borders/M2_3.bmp differ diff --git a/LedOK/res/borders/M2_4.bmp b/LedOK/res/borders/M2_4.bmp new file mode 100644 index 0000000..c884856 Binary files /dev/null and b/LedOK/res/borders/M2_4.bmp differ diff --git a/LedOK/res/borders/M2_5.bmp b/LedOK/res/borders/M2_5.bmp new file mode 100644 index 0000000..defde50 Binary files /dev/null and b/LedOK/res/borders/M2_5.bmp differ diff --git a/LedOK/res/borders/M2_6.bmp b/LedOK/res/borders/M2_6.bmp new file mode 100644 index 0000000..c23bacb Binary files /dev/null and b/LedOK/res/borders/M2_6.bmp differ diff --git a/LedOK/res/borders/M2_7.bmp b/LedOK/res/borders/M2_7.bmp new file mode 100644 index 0000000..51bcb7f Binary files /dev/null and b/LedOK/res/borders/M2_7.bmp differ diff --git a/LedOK/res/borders/M2_8.bmp b/LedOK/res/borders/M2_8.bmp new file mode 100644 index 0000000..698e1a1 Binary files /dev/null and b/LedOK/res/borders/M2_8.bmp differ diff --git a/LedOK/res/borders/M3_0.bmp b/LedOK/res/borders/M3_0.bmp new file mode 100644 index 0000000..cb7aa6a Binary files /dev/null and b/LedOK/res/borders/M3_0.bmp differ diff --git a/LedOK/res/borders/M3_1.bmp b/LedOK/res/borders/M3_1.bmp new file mode 100644 index 0000000..abe2b3c Binary files /dev/null and b/LedOK/res/borders/M3_1.bmp differ diff --git a/LedOK/res/borders/M3_2.bmp b/LedOK/res/borders/M3_2.bmp new file mode 100644 index 0000000..eab1e58 Binary files /dev/null and b/LedOK/res/borders/M3_2.bmp differ diff --git a/LedOK/res/borders/M3_3.bmp b/LedOK/res/borders/M3_3.bmp new file mode 100644 index 0000000..967e5ed Binary files /dev/null and b/LedOK/res/borders/M3_3.bmp differ diff --git a/LedOK/res/borders/M3_4.bmp b/LedOK/res/borders/M3_4.bmp new file mode 100644 index 0000000..87efd70 Binary files /dev/null and b/LedOK/res/borders/M3_4.bmp differ diff --git a/LedOK/res/borders/M3_5.bmp b/LedOK/res/borders/M3_5.bmp new file mode 100644 index 0000000..6cc9f6c Binary files /dev/null and b/LedOK/res/borders/M3_5.bmp differ diff --git a/LedOK/res/borders/M3_6.bmp b/LedOK/res/borders/M3_6.bmp new file mode 100644 index 0000000..aa83e04 Binary files /dev/null and b/LedOK/res/borders/M3_6.bmp differ diff --git a/LedOK/res/borders/M3_7.bmp b/LedOK/res/borders/M3_7.bmp new file mode 100644 index 0000000..25f97ff Binary files /dev/null and b/LedOK/res/borders/M3_7.bmp differ diff --git a/LedOK/res/borders/M3_8.bmp b/LedOK/res/borders/M3_8.bmp new file mode 100644 index 0000000..adb17c4 Binary files /dev/null and b/LedOK/res/borders/M3_8.bmp differ diff --git a/LedOK/res/borders/M4_0.bmp b/LedOK/res/borders/M4_0.bmp new file mode 100644 index 0000000..3b9d912 Binary files /dev/null and b/LedOK/res/borders/M4_0.bmp differ diff --git a/LedOK/res/borders/M4_1.bmp b/LedOK/res/borders/M4_1.bmp new file mode 100644 index 0000000..9779d5f Binary files /dev/null and b/LedOK/res/borders/M4_1.bmp differ diff --git a/LedOK/res/borders/M4_2.bmp b/LedOK/res/borders/M4_2.bmp new file mode 100644 index 0000000..f9b41fd Binary files /dev/null and b/LedOK/res/borders/M4_2.bmp differ diff --git a/LedOK/res/borders/M4_3.bmp b/LedOK/res/borders/M4_3.bmp new file mode 100644 index 0000000..4eba06f Binary files /dev/null and b/LedOK/res/borders/M4_3.bmp differ diff --git a/LedOK/res/borders/M4_4.bmp b/LedOK/res/borders/M4_4.bmp new file mode 100644 index 0000000..c3fa2f7 Binary files /dev/null and b/LedOK/res/borders/M4_4.bmp differ diff --git a/LedOK/res/borders/M4_5.bmp b/LedOK/res/borders/M4_5.bmp new file mode 100644 index 0000000..e5d0b0a Binary files /dev/null and b/LedOK/res/borders/M4_5.bmp differ diff --git a/LedOK/res/borders/M4_6.bmp b/LedOK/res/borders/M4_6.bmp new file mode 100644 index 0000000..82b4070 Binary files /dev/null and b/LedOK/res/borders/M4_6.bmp differ diff --git a/LedOK/res/borders/M4_7.bmp b/LedOK/res/borders/M4_7.bmp new file mode 100644 index 0000000..00461c4 Binary files /dev/null and b/LedOK/res/borders/M4_7.bmp differ diff --git a/LedOK/res/borders/M4_8.bmp b/LedOK/res/borders/M4_8.bmp new file mode 100644 index 0000000..e98c4a9 Binary files /dev/null and b/LedOK/res/borders/M4_8.bmp differ diff --git a/LedOK/res/borders/M5_0.bmp b/LedOK/res/borders/M5_0.bmp new file mode 100644 index 0000000..9d8a022 Binary files /dev/null and b/LedOK/res/borders/M5_0.bmp differ diff --git a/LedOK/res/borders/M5_1.bmp b/LedOK/res/borders/M5_1.bmp new file mode 100644 index 0000000..4374e49 Binary files /dev/null and b/LedOK/res/borders/M5_1.bmp differ diff --git a/LedOK/res/borders/M5_2.bmp b/LedOK/res/borders/M5_2.bmp new file mode 100644 index 0000000..af415ff Binary files /dev/null and b/LedOK/res/borders/M5_2.bmp differ diff --git a/LedOK/res/borders/M5_3.bmp b/LedOK/res/borders/M5_3.bmp new file mode 100644 index 0000000..8cbed7f Binary files /dev/null and b/LedOK/res/borders/M5_3.bmp differ diff --git a/LedOK/res/borders/M5_4.bmp b/LedOK/res/borders/M5_4.bmp new file mode 100644 index 0000000..bdbd88c Binary files /dev/null and b/LedOK/res/borders/M5_4.bmp differ diff --git a/LedOK/res/borders/M5_5.bmp b/LedOK/res/borders/M5_5.bmp new file mode 100644 index 0000000..3169cfd Binary files /dev/null and b/LedOK/res/borders/M5_5.bmp differ diff --git a/LedOK/res/borders/M5_6.bmp b/LedOK/res/borders/M5_6.bmp new file mode 100644 index 0000000..6662e6d Binary files /dev/null and b/LedOK/res/borders/M5_6.bmp differ diff --git a/LedOK/res/borders/M5_7.bmp b/LedOK/res/borders/M5_7.bmp new file mode 100644 index 0000000..bd38895 Binary files /dev/null and b/LedOK/res/borders/M5_7.bmp differ diff --git a/LedOK/res/borders/M5_8.bmp b/LedOK/res/borders/M5_8.bmp new file mode 100644 index 0000000..0f36ecc Binary files /dev/null and b/LedOK/res/borders/M5_8.bmp differ diff --git a/LedOK/res/borders/M6_0.bmp b/LedOK/res/borders/M6_0.bmp new file mode 100644 index 0000000..51f87f9 Binary files /dev/null and b/LedOK/res/borders/M6_0.bmp differ diff --git a/LedOK/res/borders/M6_1.bmp b/LedOK/res/borders/M6_1.bmp new file mode 100644 index 0000000..cec24bf Binary files /dev/null and b/LedOK/res/borders/M6_1.bmp differ diff --git a/LedOK/res/borders/M6_2.bmp b/LedOK/res/borders/M6_2.bmp new file mode 100644 index 0000000..7244b66 Binary files /dev/null and b/LedOK/res/borders/M6_2.bmp differ diff --git a/LedOK/res/borders/M6_3.bmp b/LedOK/res/borders/M6_3.bmp new file mode 100644 index 0000000..66510b1 Binary files /dev/null and b/LedOK/res/borders/M6_3.bmp differ diff --git a/LedOK/res/borders/M6_4.bmp b/LedOK/res/borders/M6_4.bmp new file mode 100644 index 0000000..61f93a1 Binary files /dev/null and b/LedOK/res/borders/M6_4.bmp differ diff --git a/LedOK/res/borders/M6_5.bmp b/LedOK/res/borders/M6_5.bmp new file mode 100644 index 0000000..cc494f8 Binary files /dev/null and b/LedOK/res/borders/M6_5.bmp differ diff --git a/LedOK/res/borders/M6_6.bmp b/LedOK/res/borders/M6_6.bmp new file mode 100644 index 0000000..ad01471 Binary files /dev/null and b/LedOK/res/borders/M6_6.bmp differ diff --git a/LedOK/res/borders/M6_7.bmp b/LedOK/res/borders/M6_7.bmp new file mode 100644 index 0000000..72a5c83 Binary files /dev/null and b/LedOK/res/borders/M6_7.bmp differ diff --git a/LedOK/res/borders/M6_8.bmp b/LedOK/res/borders/M6_8.bmp new file mode 100644 index 0000000..1110c00 Binary files /dev/null and b/LedOK/res/borders/M6_8.bmp differ diff --git a/LedOK/res/borders/M6_9.bmp b/LedOK/res/borders/M6_9.bmp new file mode 100644 index 0000000..8762b36 Binary files /dev/null and b/LedOK/res/borders/M6_9.bmp differ diff --git a/LedOK/res/borders/M7_0.bmp b/LedOK/res/borders/M7_0.bmp new file mode 100644 index 0000000..59213c3 Binary files /dev/null and b/LedOK/res/borders/M7_0.bmp differ diff --git a/LedOK/res/borders/M7_1.bmp b/LedOK/res/borders/M7_1.bmp new file mode 100644 index 0000000..d6325c2 Binary files /dev/null and b/LedOK/res/borders/M7_1.bmp differ diff --git a/LedOK/res/borders/M7_2.bmp b/LedOK/res/borders/M7_2.bmp new file mode 100644 index 0000000..f568820 Binary files /dev/null and b/LedOK/res/borders/M7_2.bmp differ diff --git a/LedOK/res/borders/M7_3.bmp b/LedOK/res/borders/M7_3.bmp new file mode 100644 index 0000000..08f5c2a Binary files /dev/null and b/LedOK/res/borders/M7_3.bmp differ diff --git a/LedOK/res/borders/M7_4.bmp b/LedOK/res/borders/M7_4.bmp new file mode 100644 index 0000000..56f0214 Binary files /dev/null and b/LedOK/res/borders/M7_4.bmp differ diff --git a/LedOK/res/borders/M7_5.bmp b/LedOK/res/borders/M7_5.bmp new file mode 100644 index 0000000..7836237 Binary files /dev/null and b/LedOK/res/borders/M7_5.bmp differ diff --git a/LedOK/res/borders/M7_6.bmp b/LedOK/res/borders/M7_6.bmp new file mode 100644 index 0000000..79abdf9 Binary files /dev/null and b/LedOK/res/borders/M7_6.bmp differ diff --git a/LedOK/res/borders/M7_7.bmp b/LedOK/res/borders/M7_7.bmp new file mode 100644 index 0000000..06e0b7d Binary files /dev/null and b/LedOK/res/borders/M7_7.bmp differ diff --git a/LedOK/res/borders/M7_8.bmp b/LedOK/res/borders/M7_8.bmp new file mode 100644 index 0000000..355c560 Binary files /dev/null and b/LedOK/res/borders/M7_8.bmp differ diff --git a/LedOK/res/borders/M8_0.bmp b/LedOK/res/borders/M8_0.bmp new file mode 100644 index 0000000..11174ae Binary files /dev/null and b/LedOK/res/borders/M8_0.bmp differ diff --git a/LedOK/res/borders/M8_1.bmp b/LedOK/res/borders/M8_1.bmp new file mode 100644 index 0000000..f71144e Binary files /dev/null and b/LedOK/res/borders/M8_1.bmp differ diff --git a/LedOK/res/borders/M8_2.bmp b/LedOK/res/borders/M8_2.bmp new file mode 100644 index 0000000..8ba72bf Binary files /dev/null and b/LedOK/res/borders/M8_2.bmp differ diff --git a/LedOK/res/borders/M8_3.bmp b/LedOK/res/borders/M8_3.bmp new file mode 100644 index 0000000..3124724 Binary files /dev/null and b/LedOK/res/borders/M8_3.bmp differ diff --git a/LedOK/res/borders/M8_4.bmp b/LedOK/res/borders/M8_4.bmp new file mode 100644 index 0000000..d2c650b Binary files /dev/null and b/LedOK/res/borders/M8_4.bmp differ diff --git a/LedOK/res/borders/M8_5.bmp b/LedOK/res/borders/M8_5.bmp new file mode 100644 index 0000000..ab22dd4 Binary files /dev/null and b/LedOK/res/borders/M8_5.bmp differ diff --git a/LedOK/res/borders/M8_6.bmp b/LedOK/res/borders/M8_6.bmp new file mode 100644 index 0000000..84ecbed Binary files /dev/null and b/LedOK/res/borders/M8_6.bmp differ diff --git a/LedOK/res/borders/M8_7.bmp b/LedOK/res/borders/M8_7.bmp new file mode 100644 index 0000000..10394a6 Binary files /dev/null and b/LedOK/res/borders/M8_7.bmp differ diff --git a/LedOK/res/borders/M8_8.bmp b/LedOK/res/borders/M8_8.bmp new file mode 100644 index 0000000..ad4da27 Binary files /dev/null and b/LedOK/res/borders/M8_8.bmp differ diff --git a/LedOK/res/borders/M9_0.bmp b/LedOK/res/borders/M9_0.bmp new file mode 100644 index 0000000..1fe9698 Binary files /dev/null and b/LedOK/res/borders/M9_0.bmp differ diff --git a/LedOK/wDevicesManager/wdevicesitem.cpp b/LedOK/wDevicesManager/wdevicesitem.cpp index 44c052a..3652d05 100644 --- a/LedOK/wDevicesManager/wdevicesitem.cpp +++ b/LedOK/wDevicesManager/wdevicesitem.cpp @@ -137,9 +137,7 @@ void wDevicesItem::DeviceItemHttpPost() HttpPostByTypeJsonObject(json8); } -void wDevicesItem::onSendHeartbeat() -{ - qDebug() <<"wDevicesItem::onSendHeartbeat()"; +void wDevicesItem::onSendHeartbeat(){ m_HeartbeatCount++; // qDebug()<< "m_HeartbeatCount="< -eObject::eObject(InteractiveType type, QGraphicsItem *parent) : - LoQGraphicsObject(type, parent) -{ +eObject::eObject(InteractiveType type, QGraphicsItem *parent) : QGraphicsObject(parent), + m_interactiveType(type), + m_movable(false), + m_handleLen(10), + m_rLimit(INVALID_RECT) { + setGeometry(0, 0, 100, 100); init(); } -eObject::eObject(QRectF rect, InteractiveType type, QGraphicsItem *parent) : - LoQGraphicsObject(rect, type, parent) -{ +eObject::eObject(QRectF rect, InteractiveType type, QGraphicsItem *parent) : QGraphicsObject(parent), + m_interactiveType(type), + m_movable(false), + m_handleLen(10), + m_rLimit(INVALID_RECT) { setGeometry(rect); init(); } -eObject::eObject(const QJsonObject &json, InteractiveType type, QGraphicsItem *parent) : - LoQGraphicsObject(type, parent) -{ - setZValue(json["order"].toInt());//toDouble()); - // setGeometry(QRectF(json["x"].toDouble(), json["y"].toDouble(), - // json["w"].toDouble(), json["h"].toDouble())); +eObject::eObject(const QJsonObject &json, InteractiveType type, QGraphicsItem *parent) : QGraphicsObject(parent), + m_interactiveType(type), + m_movable(false), + m_handleLen(10), + m_rLimit(INVALID_RECT) { + setZValue(json["order"].toInt()); setGeometry(QRectF(json["x"].toInt(), json["y"].toInt(), json["w"].toInt(), json["h"].toInt())); init(); } -void eObject::init() -{ +void eObject::init(){ + qDebug()<<"eObject::init()"; + setInteractiveType(m_interactiveType); + + m_handlePen.setBrush(QBrush(QColor::fromRgb(0, 255, 0))); + m_handlePen.setWidth(1); + + QVector dashes; + qreal space = 2; + qreal solid = 2; + dashes << solid << space << solid <borderFd, currentIndexChanged, this, [this](int idx){ + //m_wAttr->borderFd->itemIcon(idx).data_ptr().; + }); + return m_wAttr; } -QJsonObject eObject::elementJson() const -{ +QJsonObject eObject::elementJson() const { + qDebug()<<"eObject::elementJson()"; QJsonObject oRoot; QRectF r = geometry(); oRoot["order"] = zValue(); @@ -58,39 +91,496 @@ QJsonObject eObject::elementJson() const return oRoot; } -void eObject::setRLimit(const QRectF r) -{ - if(isSelected()) - m_wAttr->setRLimit(r); - LoQGraphicsObject::setRLimit(r); +void eObject::setRLimit(const QRectF &r) { + qDebug()<<"eObject::setRLimit(QRectF)"; + if(isSelected()) m_wAttr->setRLimit(r); + + if(m_rLimit != INVALID_RECT) { + qreal mx, my, mw, mh; + qreal scale_w = r.width() / m_rLimit.width(); + qreal scale_h = r.height() / m_rLimit.height(); + mx = std::round(x() * scale_w); + my = std::round(y() * scale_h); + mw = std::round(m_w * scale_w); + mh = std::round(m_h * scale_h); + setPos(mx, my); + m_w = mw; + m_h = mh; + adjustHandle(); + geometryChanged(geometry()); + } + m_rLimit = r; } -void eObject::onAttrChanged(const eObject::Data &data) -{ - setGeometry(data.x, data.y, data.w, data.h); +void eObject::onAttrChanged(const QRectF &rect){ + qDebug()<<"eObject::onAttrChanged(QRectF)"; + setGeometry(rect); } -void eObject::onAttrSetting(const QRectF &r) -{ - eObject::Data data; - data.x = r.x(); - data.y = r.y(); - data.w = r.width(); - data.h = r.height(); - emit sAttrSetting(data); + +QRectF eObject::boundingRect() const { + int m2 = m_handleLen * 2; + return QRectF(-m_handleLen, -m_handleLen, m_w+m2, m_h+m2); } -//QString eObject::getFileMd5(QString filePath) -//{ -// QFile theFile(filePath); -// theFile.open(QIODevice::ReadOnly); -// QByteArray ba = QCryptographicHash::hash(theFile.readAll(), QCryptographicHash::Md5); -// theFile.close(); -// QString strRes=""; -// strRes.append(ba.toHex()); -// return strRes; -//} -QString eObject::getFileMd5(QString filePath) -{ +//绘制选中和未选中的区域边框 +void eObject::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){ + //qDebug()<<"eObject::paint(QPainter, QStyleOptionGraphicsItem)"; + Q_UNUSED(option); + Q_UNUSED(widget); + painter->save(); + //绘制边框 + QPixmap img("borders/M8_8.bmp"); + int borderWidth = img.height(); + QBrush brush(img); + + QPainterPath path(QPointF(0, 0)); + path.lineTo(m_w, 0); + path.lineTo(m_w - borderWidth, borderWidth); + path.lineTo(borderWidth, borderWidth); + path.closeSubpath(); + painter->fillPath(path, brush); + + QTransform transform; + transform.rotate(90); + brush.setTransform(transform); + path = QPainterPath(QPointF(m_w, 0)); + path.lineTo(m_w, m_h); + path.lineTo(m_w - borderWidth, m_h - borderWidth); + path.lineTo(m_w - borderWidth, borderWidth); + path.closeSubpath(); + painter->fillPath(path, brush); + + transform.rotate(90); + brush.setTransform(transform); + path = QPainterPath(QPointF(m_w, m_h)); + path.lineTo(0, m_h); + path.lineTo(borderWidth, m_h - borderWidth); + path.lineTo(m_w - borderWidth, m_h - borderWidth); + path.closeSubpath(); + painter->fillPath(path, brush); + + transform.rotate(90); + brush.setTransform(transform); + path = QPainterPath(QPointF(0, m_h)); + path.lineTo(0, 0); + path.lineTo(borderWidth, borderWidth); + path.lineTo(borderWidth, m_h - borderWidth); + path.closeSubpath(); + painter->fillPath(path, brush); + + + if(isSelected()) { + QPainterPath pRect; + pRect.addRect(rect()); + m_borderPen.setBrush(QBrush(QColor::fromRgb(0, 255, 0))); + painter->setPen(m_borderPen); + painter->drawPath(pRect); + QPainterPath pHandle; + pHandle.addRect(m_rLT); + pHandle.addRect(m_rT); + pHandle.addRect(m_rRT); + pHandle.addRect(m_rL); + pHandle.addRect(m_rR); + pHandle.addRect(m_rLB); + pHandle.addRect(m_rB); + pHandle.addRect(m_rRB); + painter->setPen(m_handlePen); + painter->drawPath(pHandle); + } else { + m_borderPen.setBrush(QBrush(QColor::fromRgb(0, 125, 0))); + QPainterPath pRect; + pRect.addRect(rect()); + painter->setPen(m_borderPen); + painter->drawPath(pRect); + } + + //磁条吸附时两化吸附的边 + QPen CitiePen=QPen(QColor::fromRgb(0, 255, 0),1,Qt::SolidLine); + painter->setPen(CitiePen); + //if(bMousePress) + { + if (bLeftCitie) { + painter->setPen(CitiePen); + //painter->drawLine(QPointF(rect().x(),rect().y()-100),QPointF(rect().x(),rect().bottom()+100)); + painter->drawLine(QPointF(rect().topLeft()),QPointF(rect().bottomLeft())); + } + if (bTopCitie) { + painter->setPen(CitiePen); + painter->drawLine(QPointF(rect().topLeft()),QPointF(rect().topRight())); + } + if (bRightCitie) { + painter->setPen(CitiePen); + painter->drawLine(QPointF(rect().topRight()),QPointF(rect().bottomRight())); + } + if (bBottomCitie) { + painter->setPen(CitiePen); + painter->drawLine(QPointF(rect().bottomLeft()),QPointF(rect().bottomRight())); + } + } +// QPen(const QBrush &brush, +// qreal width, +// Qt::PenStyle style = Qt::SolidLine, +// Qt::PenCapStyle cap = Qt::SquareCap, +// Qt::PenJoinStyle join = Qt::BevelJoin); +// QPen pen(Qt::green, 3, Qt::DashDotLine, Qt::RoundCap, Qt::RoundJoin); + + + //painter->drawLine(QPointF(rect().bottomLeft()),QPointF(rect().bottomRight())); + painter->restore(); +} + +void eObject::mousePressEvent(QGraphicsSceneMouseEvent *event){ + if(Qt::LeftButton == event->button()) { + + m_hDir = handleDir(event->pos()); + m_pOrg = pointToParent(event->pos()); + m_rOrg = geometry(); + m_movable = true; + bMousePress=true; + + } + QGraphicsItem::mousePressEvent(event); +} + +void eObject::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){ + bMousePress=false; + + if(Qt::LeftButton == event->button()) { + m_hDir = NONE; + m_movable = false; + bLeftCitie=false; + bRightCitie=false; + bTopCitie=false; + bBottomCitie=false; + m_keyPressId++; + emit sigCiTie(false,m_keyPressId); + + } + QGraphicsItem::mouseReleaseEvent(event); +} + +void eObject::mouseMoveEvent(QGraphicsSceneMouseEvent *event){ + if(false == m_movable) return; + + qreal cx, cy, cw, ch; + qreal mx, my, mw, mh; + QPointF ePos = pointToParent(event->pos()); + QPointF absoluteOfs = ePos - m_pOrg; + + mx = m_rOrg.x(); + my = m_rOrg.y(); + mw = m_w; + mh = m_h; + + if(m_hDir != NONE) { + prepareGeometryChange(); + + switch(m_hDir) { + case LT: + cx = m_rOrg.x() + absoluteOfs.x(); + cy = m_rOrg.y() + absoluteOfs.y(); + if(m_rOrg.right() - cx < m_handleLen) cx = m_rOrg.right() - m_handleLen; + if(m_rOrg.bottom() - cy < m_handleLen) cy = m_rOrg.bottom() - m_handleLen; + mx = cx; + my = cy; + if(m_rLimit != INVALID_RECT) { + if(mx < 0) mx = 0; + if(my < 0) my = 0; + } + mw = m_rOrg.right() - mx; + mh = m_rOrg.bottom() - my; + break; + + case T: + cy = m_rOrg.y() + absoluteOfs.y(); + if(m_rOrg.bottom() - cy < m_handleLen) cy = m_rOrg.bottom() - m_handleLen; + my = cy; + if(m_rLimit != INVALID_RECT) { + if(my < 0) my = 0; + } + mh = m_rOrg.bottom() - my; + break; + + case RT: + cy = m_rOrg.y() + absoluteOfs.y(); + cw = m_rOrg.width() + absoluteOfs.x(); + if(m_rOrg.bottom() - cy < m_handleLen) cy = m_rOrg.bottom() - m_handleLen; + if(cw < m_handleLen) cw = m_handleLen; + my = cy; + mw = cw; + if(m_rLimit != INVALID_RECT) { + if(my < 0) my = 0; + if(mx + mw > m_rLimit.width()) mw = m_rLimit.width() - mx; + } + mh = m_rOrg.bottom() - my; + break; + + case L: + cx = m_rOrg.x() + absoluteOfs.x(); + if(m_rOrg.right() - cx < m_handleLen) cx = m_rOrg.right() - m_handleLen; + mx = cx; + if(m_rLimit != INVALID_RECT) { + if(mx < 0) mx = 0; + } + mw = m_rOrg.right() - mx; + break; + + case R: + cw = m_rOrg.width() + absoluteOfs.x(); + if(cw < m_handleLen) cw = m_handleLen; + mw = cw; + if(m_rLimit != INVALID_RECT) { + if(mx + mw > m_rLimit.width()) mw = m_rLimit.width() - mx; + } + break; + + case LB: + cx = m_rOrg.x() + absoluteOfs.x(); + ch = m_rOrg.height() + absoluteOfs.y(); + if(m_rOrg.right() - cx < m_handleLen) cx = m_rOrg.right() - m_handleLen; + if(ch < m_handleLen) ch = m_handleLen; + mx = cx; + if(m_rLimit != INVALID_RECT) { + if(mx < 0) mx = 0; + } + mw = m_rOrg.right() - mx; + mh = ch; + if(m_rLimit != INVALID_RECT) { + if(my + mh > m_rLimit.height()) mh = m_rLimit.height() - my; + } + break; + + case B: + ch = m_rOrg.height() + absoluteOfs.y(); + if(ch < m_handleLen) ch = m_handleLen; + mh = ch; + if(m_rLimit != INVALID_RECT) { + if(my + mh > m_rLimit.height()) mh = m_rLimit.height() - my; + } + break; + + case RB: + cw = m_rOrg.width() + absoluteOfs.x(); + ch = m_rOrg.height() + absoluteOfs.y(); + if(cw < m_handleLen) cw = m_handleLen; + if(ch < m_handleLen) ch = m_handleLen; + mw = cw; + mh = ch; + if(m_rLimit != INVALID_RECT) { + if(mx + mw > m_rLimit.width()) mw = m_rLimit.width() - mx; + if(my + mh > m_rLimit.height()) mh = m_rLimit.height() - my; + } + break; + + default: + break; + } + + setPos(mx, my); + m_w = mw; + m_h = mh; + adjustHandle(); + updateGeometry(m_rOrg); + rectChanged(rect()); + } else { + mx = m_rOrg.x() + absoluteOfs.x(); + my = m_rOrg.y() + absoluteOfs.y(); + if(m_rLimit != INVALID_RECT) { + if(mx < 0) mx = 0; + if(my < 0) my = 0; + if(mx + mw > m_rLimit.width()) mx = m_rLimit.width() - mw; + if(my + mh > m_rLimit.height()) my = m_rLimit.height() - mh; + } + setPos(mx, my); + } + + geometryChanged(geometry()); + if(bMousePress) + { + + emit sigCiTie(true,m_hDir); + + } +} + +void eObject::setBrightBianLeft(bool b){ +qDebug()<<"eObject::setBrightBianLeft(bool)"; + //if(bMousePress) +// { +// bLeftCitie=b; + +// } +// else { +// bLeftCitie=false; +// } + bLeftCitie=b; + updateGeometry(); + +} +void eObject::setBrightBianRight(bool b){ +qDebug()<<"eObject::setBrightBianRight(bool)"; +// if(bMousePress) +// { +// bRightCitie=b; + +// } +// else { +// bRightCitie=false; +// } + bRightCitie=b; + updateGeometry(); + +} +void eObject::setBrightBianTop(bool b){ +qDebug()<<"eObject::setBrightBianTop(bool)"; +// if(bMousePress) +// { +// bTopCitie=b; + +// } +// else { +// bTopCitie=false; +// } + bTopCitie=b; + updateGeometry(); + +} +void eObject::setBrightBianbottom(bool b){ +qDebug()<<"eObject::setBrightBianbottom(bool)"; +// if(bMousePress) +// { +// bBottomCitie=b; + +// } +// else { +// bBottomCitie=false; +// } + bBottomCitie=b; + updateGeometry(); + +} + + + + + + +void eObject::setGeometry(const QRectF &r){ + qDebug()<<"eObject::setGeometry(QRectF)"; + if(r != geometry()) { + prepareGeometryChange(); + setPos(r.x(), r.y()); + m_w = r.width(); + m_h = r.height(); + adjustHandle(); + emit rectChanged(rect()); + } +} + +void eObject::updateGeometry(){ + qDebug()<<"eObject::updateGeometry()"; + QRectF r = geometry(); + qreal x, y, w, h; + x = r.x() - m_handleLen; + y = r.y() - m_handleLen; + w = r.width() + m_handleLen * 2; + h = r.height() + m_handleLen * 2; + r = QRectF(x, y, w, h); + if(nullptr != scene()) { + scene()->update(r); + } + emit requestUpdate(r); +} + +void eObject::updateGeometry(const QRectF &gC, const QRectF &gL){ + qDebug()<<"eObject::updateGeometry(QRectF,QRectF)"; + qreal x, y, w, h; + QRectF gCur, gLast; + x = gC.x() - m_handleLen; + y = gC.y() - m_handleLen; + w = gC.width() + m_handleLen * 2; + h = gC.height() + m_handleLen * 2; + gCur = QRectF(x, y, w, h); + x = gL.x() - m_handleLen; + y = gL.y() - m_handleLen; + w = gL.width() + m_handleLen * 2; + h = gL.height() + m_handleLen * 2; + gLast = QRectF(x, y, w, h); + qreal l = (gCur.left() < gLast.left()) ? gCur.left() : gLast.left(); + qreal t = (gCur.top() < gLast.top()) ? gCur.top() : gLast.top(); + qreal r = (gCur.right() > gLast.right()) ? gCur.right() : gLast.right(); + qreal b = (gCur.bottom() > gLast.bottom()) ? gCur.bottom() : gLast.bottom(); + QRectF gFlash = QRectF(QPointF(l, t), QPointF(r, b)); + if(nullptr != scene()) { + scene()->update(gFlash); + } + emit requestUpdate(gFlash); +} + +QPointF eObject::pointToParent(const QPointF &p){ + qDebug()<<"eObject::pointToParent(QPointF)"; + qreal px, py; + px = p.x() + x(); + py = p.y() + y(); + return QPointF(px, py); +} + +eObject::HANDLE_DIR eObject::handleDir(const QPointF &p){ + qDebug()<<"eObject::handleDir(QPointF)"; + HANDLE_DIR hDir = NONE; + if(isSelected()) { + if(m_rLT.contains(p)) hDir = LT; + else if(m_rT.contains(p)) hDir = T; + else if(m_rRT.contains(p)) hDir = RT; + else if(m_rL.contains(p)) hDir = L; + else if(m_rR.contains(p)) hDir = R; + else if(m_rLB.contains(p)) hDir = LB; + else if(m_rB.contains(p)) hDir = B; + else if(m_rRB.contains(p)) hDir = RB; + } + return hDir; +} +//拖拽的虚线矩形 +void eObject::adjustHandle(){ + qDebug()<<"eObject::adjustHandle()"; + const QRectF &r = rect(); + //左上角 + m_rLT = QRectF(r.left() - m_handleLen/2, + r.top() - m_handleLen/2, + m_handleLen, m_handleLen); + //上中 + m_rT = QRectF(r.center().x() - m_handleLen / 2, + r.top() - m_handleLen/2, + m_handleLen, m_handleLen); + //右上角 + m_rRT = QRectF(r.right()-m_handleLen/2, + r.top() - m_handleLen/2, + m_handleLen, m_handleLen); + //左中 + m_rL = QRectF(r.left() - m_handleLen/2, + r.center().y() - m_handleLen / 2, + m_handleLen, m_handleLen); + //右中 + m_rR = QRectF(r.right()-m_handleLen/2, + r.center().y() - m_handleLen / 2, + m_handleLen, m_handleLen); + //左下角 + m_rLB = QRectF(r.left() - m_handleLen/2, + r.bottom()-m_handleLen / 2, + m_handleLen, m_handleLen); + //中下 + m_rB = QRectF(r.center().x() - m_handleLen / 2, + r.bottom()-m_handleLen / 2, + m_handleLen, m_handleLen); + //右下角 + m_rRB = QRectF(r.right()-m_handleLen / 2, + r.bottom()-m_handleLen / 2, + m_handleLen, m_handleLen); +} + + +QString eObject::getFileMd5(QString filePath){ + qDebug()<<"eObject::getFileMd5(QString)"; QFile localFile(filePath); if (!localFile.open(QFile::ReadOnly)) diff --git a/LedOK/wProgramManager/wEditProgram/wElement/eobject.h b/LedOK/wProgramManager/wEditProgram/wElement/eobject.h index 15cd0d9..7f300be 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/eobject.h +++ b/LedOK/wProgramManager/wEditProgram/wElement/eobject.h @@ -1,9 +1,13 @@ #ifndef EOBJECT_H #define EOBJECT_H - +#include "loappconfig.h" +#include "loapptools.h" +#include "globaldefine.h" #include +#include +#include + #include -#include #include #include #include @@ -16,17 +20,32 @@ #include #include #include -#include "loappconfig.h" -#include "loapptools.h" -#include "globaldefine.h" #define MACRO_DEFAULT_PLAYDURATION 10 +#define INVALID_RECT QRect(-1, -5, -6, -8) class eObjectAttr; -class eObject : public LoQGraphicsObject -{ +class eObject : public QGraphicsObject { Q_OBJECT public: + typedef enum { + NONE = 0, + LT, + T, + RT, + L, + R, + LB, + B, + RB + } HANDLE_DIR; + + enum InteractiveType { + Dynamic = 0, + Static, + Custom + }; + enum ElementType { Text = QGraphicsItem::UserType + 1, Photo, @@ -44,51 +63,95 @@ public: Window }; - struct Data { - qreal x; - qreal y; - qreal w; - qreal h; - }; - -public: explicit eObject(InteractiveType type = Dynamic, QGraphicsItem *parent = nullptr); explicit eObject(QRectF rect, InteractiveType type = Dynamic, QGraphicsItem *parent = nullptr); explicit eObject(const QJsonObject &json, InteractiveType type = Dynamic, QGraphicsItem *parent = nullptr); int m_iType=-1; -private: - void init(); - -public: - virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override { Q_UNUSED(event); } - -public: + virtual QRectF boundingRect() const override; + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override; + virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override; + virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; + virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *) override{}; + virtual void setInteractiveType(InteractiveType type = Dynamic); virtual QJsonObject save(const QString &pRoot) = 0; virtual QWidget* wAttrElement() = 0; -public: virtual QWidget* wAttr(); virtual QStringList filesList() const { return QStringList(); } virtual QJsonObject elementJson() const; -public: - void setRLimit(const QRectF r); + void setRLimit(const QRectF &r); + QRectF rLimit() const { return m_rLimit; } + InteractiveType interactiveType() const { return m_interactiveType; } + QRectF rect() const { return QRectF(0, 0, m_w, m_h); } + QRectF geometry() const { return QRectF(x(), y(), m_w, m_h); } + + QString getFileMd5(QString filePath); signals: // Qt::BlockingQueuedConnection + void requestUpdate(const QRectF &); + void geometryChanged(const QRectF &); + void rectChanged(const QRectF &); + void sigCiTie(bool,int); + void sPlayBQ(); void sStopBQ(); - void sAttrSetting(const eObject::Data &); public slots: + void setGeometry (qreal x, qreal y, qreal w, qreal h) { setGeometry(QRectF(x, y, w, h)); } + void setGeometry (const QRectF &r); + void updateGeometry(); + void updateGeometry(const QRectF &gLast) { updateGeometry(geometry(), gLast); } + void updateGeometry(const QRectF &gCur, const QRectF &gLast); + void setBrightBianLeft(bool); + void setBrightBianTop(bool); + void setBrightBianRight(bool); + void setBrightBianbottom(bool); + virtual void playElectment() {} virtual void stopElectment() {} - void onAttrChanged(const eObject::Data &data); - void onAttrSetting(const QRectF &r); + void onAttrChanged(const QRectF &); + + +protected: + int handleLen() const { return m_handleLen; } + QPointF pointToParent(const QPointF &p); + HANDLE_DIR handleDir(const QPointF &p); + void adjustHandle(); + + InteractiveType m_interactiveType; + bool m_movable; + int m_handleLen; + QPen m_handlePen; + QPen m_borderPen; + + qreal m_w; + qreal m_h; + QRectF m_rLT; + QRectF m_rT; + + QRectF m_rRT; + QRectF m_rL; + QRectF m_rR; + QRectF m_rLB; + QRectF m_rB; + QRectF m_rRB; + QRectF m_rOrg; + QPointF m_pOrg; + HANDLE_DIR m_hDir; + QRectF m_rLimit; + bool bMousePress=false; + bool bLeftCitie=false; + bool bRightCitie=false; + bool bTopCitie=false; + bool bBottomCitie=false; + int m_keyPressId=0; -private: eObjectAttr *m_wAttr; + void init(); }; #endif // EOBJECT_H diff --git a/LedOK/wProgramManager/wEditProgram/wElement/eobjectattr.cpp b/LedOK/wProgramManager/wEditProgram/wElement/eobjectattr.cpp index 036ed74..29888e6 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/eobjectattr.cpp +++ b/LedOK/wProgramManager/wEditProgram/wElement/eobjectattr.cpp @@ -1,7 +1,8 @@ #include "eobjectattr.h" #include "ui_eobjectattr.h" +#include -eObjectAttr::eObjectAttr(const eObject::Data &data, const QRectF &rLimit, QWidget *parent) : +eObjectAttr::eObjectAttr(const QRectF &data, const QRectF &rLimit, QWidget *parent) : QGroupBox(parent), ui(new Ui::eObjectAttr) { @@ -11,10 +12,10 @@ eObjectAttr::eObjectAttr(const eObject::Data &data, const QRectF &rLimit, QWidge m_rLimit.setHeight(rLimit.height()); ui->setupUi(this); - ui->wX->setValue(static_cast(data.x)); - ui->wY->setValue(static_cast(data.y)); - ui->wW->setValue(static_cast(data.w)); - ui->wH->setValue(static_cast(data.h)); + ui->wX->setValue(static_cast(data.x())); + ui->wY->setValue(static_cast(data.y())); + ui->wW->setValue(static_cast(data.width())); + ui->wH->setValue(static_cast(data.height())); connect(ui->wX, SIGNAL(valueChanged(int)), this, SLOT(onXChanged(int))); connect(ui->wY, SIGNAL(valueChanged(int)), this, SLOT(onYChanged(int))); connect(ui->wW, SIGNAL(valueChanged(int)), this, SLOT(onWChanged(int))); @@ -23,6 +24,31 @@ eObjectAttr::eObjectAttr(const eObject::Data &data, const QRectF &rLimit, QWidge QHBoxLayout *hBox = new QHBoxLayout(); ui->verticalLayout->addLayout(hBox); hBox->addWidget(new QLabel("边框:")); + borderFd = new QComboBox(); + borderFd->setStyleSheet("QComboBox{padding-left:4px; padding-right:4px;}"); + hBox->addWidget(borderFd); + QDirIterator it(":res/borders/", QDirIterator::Subdirectories); + int maxImgWidth = 0; + while(it.hasNext()) { + QString path = it.next(); + QPixmap img(path); + if(img.width()>maxImgWidth) maxImgWidth = img.width(); + borderFd->addItem(QIcon(img), QString::number(img.height())); + } + borderFd->setIconSize(QSize(maxImgWidth, 24)); + connect(borderFd, SIGNAL(currentIndexChanged(int)), this, SLOT(onHChanged(int))); + + hBox->addWidget(new QLabel("特效:")); + borderEffFd = new QComboBox(); + borderEffFd->setStyleSheet("QComboBox{padding-left:4px; padding-right:4px}"); + borderEffFd->addItem("静止"); + borderEffFd->addItem("旋转"); + borderEffFd->addItem("闪烁"); + hBox->addWidget(borderEffFd); + + hBox->addStretch(); + ui->verticalLayout->addStretch(); + } eObjectAttr::~eObjectAttr() @@ -32,6 +58,7 @@ eObjectAttr::~eObjectAttr() void eObjectAttr::onXChanged(int n) { + qDebug()<<"eObjectAttr::onXChanged(int)"; if(m_rLimit != INVALID_RECT) { int mx = n; int mw = ui->wW->value(); @@ -47,6 +74,7 @@ void eObjectAttr::onXChanged(int n) void eObjectAttr::onYChanged(int n) { + qDebug()<<"eObjectAttr::onYChanged(int)"; if(m_rLimit != INVALID_RECT) { int my = n; int mh = ui->wH->value(); @@ -62,6 +90,7 @@ void eObjectAttr::onYChanged(int n) void eObjectAttr::onWChanged(int n) { + qDebug()<<"eObjectAttr::onWChanged(int)"; if(m_rLimit != INVALID_RECT) { int mx = ui->wX->value(); int mw = n; @@ -77,6 +106,7 @@ void eObjectAttr::onWChanged(int n) void eObjectAttr::onHChanged(int n) { + qDebug()<<"eObjectAttr::onHChanged(int)"; if(m_rLimit != INVALID_RECT) { int my = ui->wY->value(); int mh = n; @@ -92,18 +122,16 @@ void eObjectAttr::onHChanged(int n) void eObjectAttr::onAttrChanged() { - eObject::Data data; - data.x = ui->wX->value(); - data.y = ui->wY->value(); - data.w = ui->wW->value(); - data.h = ui->wH->value(); - emit sAttrChanged(data); + qDebug()<<"eObjectAttr::onAttrChanged()"; + QRectF rect(ui->wX->value(), ui->wY->value(), ui->wW->value(), ui->wH->value()); + emit sAttrChanged(rect); } -void eObjectAttr::onAttrSetting(const eObject::Data &data) +void eObjectAttr::onAttrSetting(const QRectF &rect) { - ui->wX->setValue(static_cast(data.x)); - ui->wY->setValue(static_cast(data.y)); - ui->wW->setValue(static_cast(data.w)); - ui->wH->setValue(static_cast(data.h)); + qDebug()<<"eObjectAttr::onAttrSetting(QRectF)"; + ui->wX->setValue(static_cast(rect.x())); + ui->wY->setValue(static_cast(rect.y())); + ui->wW->setValue(static_cast(rect.width())); + ui->wH->setValue(static_cast(rect.height())); } diff --git a/LedOK/wProgramManager/wEditProgram/wElement/eobjectattr.h b/LedOK/wProgramManager/wEditProgram/wElement/eobjectattr.h index 102ae04..12852a9 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/eobjectattr.h +++ b/LedOK/wProgramManager/wEditProgram/wElement/eobjectattr.h @@ -1,10 +1,11 @@ #ifndef EOBJECTATTR_H #define EOBJECTATTR_H +#include "eobject.h" #include #include #include -#include "eobject.h" +#include namespace Ui { class eObjectAttr; @@ -14,9 +15,12 @@ class eObjectAttr : public QGroupBox { Q_OBJECT public: - explicit eObjectAttr(const eObject::Data &data, const QRectF &rLimit, QWidget *parent = nullptr); + explicit eObjectAttr(const QRectF &, const QRectF &, QWidget *parent = nullptr); ~eObjectAttr(); + QComboBox* borderFd; + QComboBox* borderEffFd; + public: void setRLimit(const QRectF r) { @@ -28,11 +32,11 @@ public: } signals: - void sAttrChanged(const eObject::Data &); + void sAttrChanged(const QRectF &); public slots: void onAttrChanged(); - void onAttrSetting(const eObject::Data &); + void onAttrSetting(const QRectF &); protected slots: void onXChanged(int n); diff --git a/LedOK/wProgramManager/wEditProgram/wElement/eobjectattr.ui b/LedOK/wProgramManager/wEditProgram/wElement/eobjectattr.ui index 96e1b4b..4d3f80b 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/eobjectattr.ui +++ b/LedOK/wProgramManager/wEditProgram/wElement/eobjectattr.ui @@ -6,20 +6,20 @@ 0 0 - 302 - 90 + 249 + 110 0 - 90 + 110 16777215 - 90 + 120 diff --git a/LedOK/wProgramManager/wEditProgram/wElement/ephoto.cpp b/LedOK/wProgramManager/wEditProgram/wElement/ephoto.cpp index ed1c1b0..9898192 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/ephoto.cpp +++ b/LedOK/wProgramManager/wEditProgram/wElement/ephoto.cpp @@ -124,7 +124,7 @@ void ePhoto::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QW painter->save(); painter->drawImage(rect(), m_photo); painter->restore(); - LoQGraphicsObject::paint(painter, option, widget); + eObject::paint(painter, option, widget); } void ePhoto:: deleteContent() { diff --git a/LedOK/wProgramManager/wEditProgram/wElement/etext.cpp b/LedOK/wProgramManager/wEditProgram/wElement/etext.cpp index 1cb4b32..4aba95f 100644 --- a/LedOK/wProgramManager/wEditProgram/wElement/etext.cpp +++ b/LedOK/wProgramManager/wEditProgram/wElement/etext.cpp @@ -358,7 +358,7 @@ void eText::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWi painter->restore(); - LoQGraphicsObject::paint(painter, option, widget); + eObject::paint(painter, option, widget); } //void eText::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) diff --git a/LedOK/wProgramManager/wEditProgram/wdrawingboard.cpp b/LedOK/wProgramManager/wEditProgram/wdrawingboard.cpp index 60e4f41..d4d1448 100644 --- a/LedOK/wProgramManager/wEditProgram/wdrawingboard.cpp +++ b/LedOK/wProgramManager/wEditProgram/wdrawingboard.cpp @@ -287,7 +287,7 @@ void wDrawingBoard::onCreatElement(int type) } if(nullptr != element1) { - connect(static_cast(element1),SIGNAL(sigCiTie(bool,int)),this,SLOT(OnCiTieProcess(bool,int))); + connect(element1,SIGNAL(sigCiTie(bool,int)),this,SLOT(OnCiTieProcess(bool,int))); } } @@ -339,7 +339,7 @@ void wDrawingBoard::onCreatElement(int type) } if(nullptr != element1) { - connect(static_cast(element1),SIGNAL(sigCiTie(bool,int)),this,SLOT(OnCiTieProcess(bool,int))); + connect(element1,SIGNAL(sigCiTie(bool,int)),this,SLOT(OnCiTieProcess(bool,int))); } } @@ -444,7 +444,7 @@ void wDrawingBoard::onCreatElement(int type) } if(nullptr != element) { - connect(static_cast(element),SIGNAL(sigCiTie(bool,int)),this,SLOT(OnCiTieProcess(bool,int))); + connect(element,SIGNAL(sigCiTie(bool,int)),this,SLOT(OnCiTieProcess(bool,int))); } } diff --git a/LedOK/wProgramManager/wEditProgram/wpageitem.cpp b/LedOK/wProgramManager/wEditProgram/wpageitem.cpp index 79cba57..e059e4f 100644 --- a/LedOK/wProgramManager/wEditProgram/wpageitem.cpp +++ b/LedOK/wProgramManager/wEditProgram/wpageitem.cpp @@ -160,7 +160,7 @@ void wPageItem::connectCiTieSignal(wDrawingBoard *drawingboard) eObject *element = static_cast(item); if(element!=nullptr) { - connect(static_cast(element),SIGNAL(sigCiTie(bool,int)),drawingboard,SLOT(OnCiTieProcess(bool,int))); + connect(element,SIGNAL(sigCiTie(bool,int)),drawingboard,SLOT(OnCiTieProcess(bool,int))); } } } @@ -175,7 +175,7 @@ void wPageItem::disconnectCiTieSignal(wDrawingBoard *drawingboard) eObject *element = static_cast(item); if(element!=nullptr) { - disconnect(static_cast(element),SIGNAL(sigCiTie(bool,int)),drawingboard,SLOT(OnCiTieProcess(bool,int))); + disconnect(element,SIGNAL(sigCiTie(bool,int)),drawingboard,SLOT(OnCiTieProcess(bool,int))); } } }