logplus/logPlus/BorderPreView.h
2026-06-24 15:33:12 +08:00

64 lines
1.2 KiB
C++

#ifndef BORDERPREVIEW_H
#define BORDERPREVIEW_H
#include <QWidget>
#include <QMap>
#include <QRect>
#include "formtableitem.h"
#pragma execution_character_set("utf-8")
class BorderPreView : public QWidget
{
Q_OBJECT
enum BorderDirect
{
None=-1,
CellTop=1,
CellLeft=2,
CellRight=3,
CellBottom=4
};
public:
explicit BorderPreView(QWidget *parent=NULL);
~BorderPreView();
protected:
void paintEvent(QPaintEvent *event);
public:
void SetCellObject(FormTableItem *pCell);
void SetBorderStyle(int width,int style);
private slots:
void slotSelectLineStyleChanged(int style,int lineWidth);
private:
void DrawBackgroundHorn(QPainter *paint);
void DrawBorderLines(QPainter *paint);
void BuildBorderLines();
void BuidlClickEventAreas();
virtual void mouseReleaseEvent(QMouseEvent *);
virtual void resizeEvent(QResizeEvent *);
void ClickBorder(QPointF point);
void BindBorderStates();
private:
QLineF m_LeftLine,m_TopLine,m_RightLine,m_BottomLine;
bool m_TopState,m_RightState,m_BottomState,m_LeftState;
QMap<BorderDirect,QRectF> m_AreaEventHandler;
FormTableItem* m_pCelll;
int m_selectCurrentStyle;
int m_selectCurrentLineWidth;
//
bool m_isBorderStyle;
bool m_ResetArea;
};
#endif // BORDERPREVIEW_H