绘制边框属性添加到基类FormBase
This commit is contained in:
parent
0f92921893
commit
deb8fdfe2c
64
logPlus/FormBase.cpp
Normal file
64
logPlus/FormBase.cpp
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
#include "FormBase.h"
|
||||
#include "formwell.h"
|
||||
#include "CallManage.h"
|
||||
#include <QDebug>
|
||||
#include <QMimeData>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
#include <QMenu>
|
||||
#include "PropertyWidget.h"
|
||||
|
||||
//
|
||||
FormBase::FormBase(QWidget *parent, QString strSlfName, QString strWellName) :
|
||||
QWidget(parent)
|
||||
{
|
||||
m_pFormWell = qobject_cast<FormWell*>(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);
|
||||
}
|
||||
|
||||
42
logPlus/FormBase.h
Normal file
42
logPlus/FormBase.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef FORMBASE_H
|
||||
#define FORMBASE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPainter>
|
||||
#include <QPaintEvent>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
class FormWell;
|
||||
class FormBase : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FormBase(QWidget *parent = nullptr, QString strSlfName="", QString strWellName="");
|
||||
~FormBase();
|
||||
|
||||
void setBorderFlags(BorderFlags flags);
|
||||
private:
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
public slots:
|
||||
public:
|
||||
QString m_strUuid;
|
||||
QString m_strSlfName;
|
||||
QString m_strWellName;
|
||||
|
||||
QFont m_Font = QFont("微软雅黑", 14); //显示名称字体
|
||||
QColor m_Color; //颜色
|
||||
bool m_press;//判断鼠标是否按下
|
||||
BorderFlags m_BorderFlags;
|
||||
FormWell* m_pFormWell = NULL;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // FORMBASE_H
|
||||
|
|
@ -33,16 +33,13 @@ extern int g_iSupport3D;
|
|||
extern void AppendConsole(Priority priority, const QString &output);
|
||||
|
||||
//曲线绘制(多个)
|
||||
FormDraw::FormDraw(QWidget *parent, QString strWellName, QString strTrackName) :
|
||||
QWidget(parent),
|
||||
FormDraw::FormDraw(QWidget *parent, QString strSlfName, QString strWellName, QString strTrackName) :
|
||||
FormBase(parent, strSlfName, strWellName),
|
||||
ui(new Ui::FormDraw)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setAcceptDrops(true);
|
||||
|
||||
m_pFWell = qobject_cast<FormWell*>(parent);
|
||||
|
||||
m_strWellName = strWellName;
|
||||
m_strTrackName = strTrackName;
|
||||
m_nSltk=15.0;//杆状图长度
|
||||
|
||||
|
|
@ -2714,11 +2711,6 @@ void FormDraw::crossTrackSetting(bool bcross)
|
|||
|
||||
}
|
||||
|
||||
void FormDraw::setBorderFlags(BorderFlags flags)
|
||||
{
|
||||
m_BorderFlags = flags;
|
||||
}
|
||||
|
||||
void FormDraw::addCusPlot(QMyCustomPlot* plot)
|
||||
{
|
||||
m_vecCurv.push_back(plot);
|
||||
|
|
@ -2792,43 +2784,6 @@ void FormDraw::changeGridProperty(QString strGroup, int nInv, int nWidth, QColor
|
|||
}
|
||||
}
|
||||
|
||||
void FormDraw::paintEvent(QPaintEvent*)
|
||||
{
|
||||
QPainter painter(this);
|
||||
QRect rect = this->rect();
|
||||
rect.setLeft(rect.left() + 1);
|
||||
rect.setTop(rect.top() + 1);
|
||||
// 3. 准备绘制边框
|
||||
painter.save();
|
||||
painter.setPen(QPen(m_pFWell->getBorderGridProperty().m_clor, m_pFWell->getBorderGridProperty().m_nWidth)); // 颜色、宽度可自定义
|
||||
|
||||
// 上边框
|
||||
if (m_BorderFlags & TopBorder) {
|
||||
painter.drawLine(rect.topLeft(), rect.topRight());
|
||||
}
|
||||
// 下边框
|
||||
if (m_BorderFlags & BottomBorder) {
|
||||
painter.drawLine(rect.bottomLeft(), rect.bottomRight());
|
||||
}
|
||||
// 左边框
|
||||
if (m_BorderFlags & LeftBorder) {
|
||||
painter.drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
}
|
||||
// 右边框
|
||||
if (m_BorderFlags & RightBorder) {
|
||||
QPoint pt = rect.topLeft();
|
||||
QPoint pt2 = rect.bottomRight();
|
||||
// 此处右边界根据道宽绘制
|
||||
int ntx = (m_nLeftDao*m_nTrackW * g_dPixelPerCm)+1 + m_nTrackW * g_dPixelPerCm - 2;
|
||||
pt.setX(ntx);
|
||||
pt2.setX(ntx);
|
||||
painter.drawLine(pt, pt2);
|
||||
}
|
||||
|
||||
painter.restore();
|
||||
|
||||
}
|
||||
|
||||
QMyCustomPlot* FormDraw::addTableLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QStringList listOtherProperty)
|
||||
{
|
||||
if (strLineName == "FRAC_HOLE.TABLE" || strLineName == "WORDS_RELUST" || strLineName == "RESULT"
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@
|
|||
#include "LogIO.h"
|
||||
#include "MemRdWt.h"
|
||||
#include "FormLine.h"
|
||||
#include "common.h"
|
||||
#include "formwell.h"
|
||||
#include "FormBase.h"
|
||||
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
|
|
@ -21,12 +20,12 @@ namespace Ui {
|
|||
class FormDraw;
|
||||
}
|
||||
|
||||
class FormDraw : public QWidget
|
||||
class FormDraw : public FormBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FormDraw(QWidget *parent = nullptr, QString m_strWellName="", QString strTrackName="");
|
||||
explicit FormDraw(QWidget *parent, QString strSlfName, QString m_strWellName="", QString strTrackName="");
|
||||
~FormDraw();
|
||||
|
||||
void setDrawData(QStringList slist, QJsonObject objInfo);
|
||||
|
|
@ -65,7 +64,6 @@ public:
|
|||
// 跨道设置
|
||||
void crossTrackSetting(bool bcross = false);
|
||||
|
||||
void setBorderFlags(BorderFlags flags);
|
||||
// 添加绘图
|
||||
void addCusPlot(QMyCustomPlot* plot);
|
||||
// 绘图是否有显示横线格子;
|
||||
|
|
@ -85,9 +83,8 @@ public:
|
|||
|
||||
private:
|
||||
Ui::FormDraw *ui;
|
||||
FormWell* m_pFWell = NULL;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
QMyCustomPlot* addTableLine(QString strUuid, QString strSlfName, QString strWellName,
|
||||
QString strTrackName, QString strLineName, QStringList listOtherProperty={});
|
||||
|
|
@ -103,9 +100,6 @@ public slots:
|
|||
void setColWidth(float fNewWidth);
|
||||
|
||||
public:
|
||||
QString m_strUuid;
|
||||
QString m_strSlfName = "";
|
||||
QString m_strWellName;
|
||||
QString m_strTrackName;
|
||||
double m_nTrackW = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,27 +8,28 @@
|
|||
extern int g_iOneWidth; //道宽
|
||||
|
||||
//曲线名称栏(表格)
|
||||
FormTrack::FormTrack(QWidget *parent, QString strWellName, QString strTrackName) :
|
||||
QWidget(parent),
|
||||
FormTrack::FormTrack(QWidget *parent, QString strSlfName, QString strWellName, QString strTrackName) :
|
||||
FormBase(parent, strSlfName, strWellName),
|
||||
ui(new Ui::FormTrack)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_pFWell = qobject_cast<FormWell*>(parent);
|
||||
|
||||
m_strTrackUuid = getUUid();
|
||||
m_strWellName = strWellName;
|
||||
m_strTrackName = strTrackName;
|
||||
|
||||
//单元格委托
|
||||
//m_delegate = new NoLRBorderDelegate();
|
||||
//隐藏网格线
|
||||
//ui->tableWidget->setVisible(false);
|
||||
ui->tableWidget->setShowGrid(false);
|
||||
//设置样式表,竖直边框宽度为0,隐藏
|
||||
ui->tableWidget->setStyleSheet( "QTableView::item {border-left: 0px solid black;} \
|
||||
QTableView::item:selected {border-left: 0px solid black; color:#57595B; background:#E4E4E4;}\
|
||||
QTableView::item {border-right: 0px solid black;} \
|
||||
QTableView::item:selected {border-right: 0px solid black;}");
|
||||
|
||||
ui->tableWidget->setStyleSheet("QTableView {border: 0px solid black;} QTableView::item {border: 0px solid black;} \
|
||||
QTableView::item:selected {color:#57595B; background:#E4E4E4;}");
|
||||
// ui->tableWidget->setStyleSheet( "QTableView::item {border-left: 0px solid black;} \
|
||||
// QTableView::item:selected {border-left: 0px solid black; color:#57595B; background:#E4E4E4;}\
|
||||
// QTableView::item {border-right: 0px solid black;} \
|
||||
// QTableView::item:selected {border-right: 0px solid black;}");
|
||||
|
||||
//表格绑定井名,道名
|
||||
ui->tableWidget->m_strWellName = strWellName;
|
||||
|
|
@ -175,43 +176,41 @@ FormInfo* FormTrack::getFormInfoByParameters(QString strUuid, QString strWellNam
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void FormTrack::setBorderFlags(BorderFlags flags)
|
||||
{
|
||||
m_BorderFlags = flags;
|
||||
}
|
||||
|
||||
void FormTrack::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QWidget::paintEvent(event);
|
||||
|
||||
QPainter painter(this);
|
||||
QRect rect = this->rect();
|
||||
|
||||
rect.setLeft(rect.left() + 1);
|
||||
rect.setTop(rect.top() + 1);
|
||||
// 绘制边框
|
||||
painter.save();
|
||||
painter.setPen(QPen(m_pFWell->getBorderGridProperty().m_clor, m_pFWell->getBorderGridProperty().m_nWidth)); // 颜色、宽度可自定义
|
||||
|
||||
// 上边框
|
||||
if (m_BorderFlags & TopBorder) {
|
||||
painter.drawLine(rect.topLeft(), rect.topRight());
|
||||
}
|
||||
// 下边框
|
||||
if (m_BorderFlags & BottomBorder) {
|
||||
painter.drawLine(rect.bottomLeft(), rect.bottomRight());
|
||||
}
|
||||
// 左边框
|
||||
if (m_BorderFlags & LeftBorder) {
|
||||
painter.drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
}
|
||||
// 右边框
|
||||
if (m_BorderFlags & RightBorder) {
|
||||
painter.drawLine(rect.topRight(), rect.bottomRight());
|
||||
}
|
||||
|
||||
painter.restore();
|
||||
}
|
||||
//
|
||||
//void FormTrack::paintEvent(QPaintEvent *event)
|
||||
//{
|
||||
// QWidget::paintEvent(event);
|
||||
//
|
||||
// QPainter painter(this);
|
||||
// QRect rect = this->rect();
|
||||
//
|
||||
// rect.setLeft(rect.left() + 1);
|
||||
// rect.setTop(rect.top() + 1);
|
||||
// // 绘制边框
|
||||
// painter.save();
|
||||
// painter.setPen(QPen(m_pFWell->getBorderGridProperty().m_clor,
|
||||
// m_pFWell->getBorderGridProperty().m_nWidth,
|
||||
// (Qt::PenStyle)m_pFWell->getBorderGridProperty().m_nType)); // 颜色、宽度可自定义
|
||||
//
|
||||
// // 上边框
|
||||
// if (m_BorderFlags & TopBorder) {
|
||||
// painter.drawLine(rect.topLeft(), rect.topRight());
|
||||
// }
|
||||
// // 下边框
|
||||
// if (m_BorderFlags & BottomBorder) {
|
||||
// painter.drawLine(rect.bottomLeft(), rect.bottomRight());
|
||||
// }
|
||||
// // 左边框
|
||||
// if (m_BorderFlags & LeftBorder) {
|
||||
// painter.drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
// }
|
||||
// // 右边框
|
||||
// if (m_BorderFlags & RightBorder) {
|
||||
// painter.drawLine(rect.topRight(), rect.bottomRight());
|
||||
// }
|
||||
//
|
||||
// painter.restore();
|
||||
//}
|
||||
|
||||
//
|
||||
// void FormTrack::setTrackPropert(QJsonObject trackObj)
|
||||
|
|
|
|||
|
|
@ -4,50 +4,20 @@
|
|||
#include <QWidget>
|
||||
#include "forminfo.h"
|
||||
#include <QStyledItemDelegate>
|
||||
#include "common.h"
|
||||
#include "FormBase.h"
|
||||
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
namespace Ui {
|
||||
class FormTrack;
|
||||
}
|
||||
class FormWell;
|
||||
//class NoLRBorderDelegate : public QStyledItemDelegate
|
||||
//{
|
||||
//public:
|
||||
// void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
|
||||
// {
|
||||
// // 获取原始矩形大小
|
||||
// QRect rect = option.rect;
|
||||
|
||||
// // 修改矩形大小,去除左右边框
|
||||
// rect.setX(rect.x()+3);
|
||||
// rect.setWidth(rect.width()-4);
|
||||
// //rect.setWidth(0);
|
||||
// rect.setY(rect.y()+4);
|
||||
// rect.setHeight(rect.height()-7);
|
||||
|
||||
|
||||
// // 构造新的选项
|
||||
// QStyleOptionViewItem newOption(option);
|
||||
// newOption.rect = rect;
|
||||
|
||||
// // 绘制单元格内部内容
|
||||
// QStyledItemDelegate::paint(painter, newOption, index);
|
||||
|
||||
// // 绘制上下边框线
|
||||
//// painter->setPen(QPen(Qt::gray));
|
||||
//// painter->drawLine(option.rect.topLeft(), option.rect.topRight());
|
||||
//// painter->drawLine(option.rect.bottomLeft(), option.rect.bottomRight());
|
||||
// }
|
||||
//};
|
||||
|
||||
class FormTrack : public QWidget
|
||||
class FormTrack : public FormBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FormTrack(QWidget *parent = nullptr, QString strWellName="", QString strTrackName="");
|
||||
explicit FormTrack(QWidget *parent, QString strSlfName = "", QString strWellName="", QString strTrackName="");
|
||||
~FormTrack();
|
||||
|
||||
FormInfo* getFormInfo();
|
||||
|
|
@ -57,25 +27,21 @@ public:
|
|||
FormInfo* getFormInfoByParameters(QString strUuid, QString strWellName,
|
||||
QString strTrackName, QString strLineName);
|
||||
|
||||
void setBorderFlags(BorderFlags flags);
|
||||
|
||||
private:
|
||||
Ui::FormTrack *ui;
|
||||
FormWell* m_pFWell = NULL;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
//void paintEvent(QPaintEvent *event);
|
||||
|
||||
public:
|
||||
QString m_strUuid;
|
||||
// 道ID
|
||||
QString m_strTrackUuid = "";
|
||||
QString m_strWellName;
|
||||
QString m_strTrackName;
|
||||
|
||||
FormInfo *m_formInfo = NULL;
|
||||
// 创建自定义单元格委托
|
||||
//NoLRBorderDelegate *m_delegate;
|
||||
BorderFlags m_BorderFlags;
|
||||
|
||||
public:
|
||||
void Add(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strAliasName, QString strUnit, QColor lineColor, double dWidth, float vmax, float vmin, QString strScaleType, QString strType, QStringList listOtherProperty={});
|
||||
|
||||
|
|
|
|||
|
|
@ -11,17 +11,17 @@
|
|||
|
||||
//曲线名称(单个)
|
||||
FormTrackTop::FormTrackTop(QWidget *parent, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QColor lineColor) :
|
||||
QWidget(parent),
|
||||
FormBase(parent, strSlfName, strWellName),
|
||||
ui(new Ui::FormTrackTop)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
//
|
||||
setAcceptDrops(true);
|
||||
|
||||
m_pFWell = qobject_cast<FormWell*>(parent);
|
||||
//m_pFWell = qobject_cast<FormWell*>(parent);
|
||||
|
||||
m_strSlfName = strSlfName;
|
||||
m_strWellName = strWellName;
|
||||
//m_strSlfName = strSlfName;
|
||||
//m_strWellName = strWellName;
|
||||
m_strTrackName = strTrackName;
|
||||
|
||||
m_font = QFont("微软雅黑", 10);
|
||||
|
|
@ -33,10 +33,10 @@ FormTrackTop::~FormTrackTop()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
void FormTrackTop::setBorderFlags(BorderFlags flags)
|
||||
{
|
||||
m_BorderFlags = flags;
|
||||
}
|
||||
// void FormTrackTop::setBorderFlags(BorderFlags flags)
|
||||
// {
|
||||
// m_BorderFlags = flags;
|
||||
// }
|
||||
|
||||
void FormTrackTop::setTrackTopPropert(QJsonObject topObj)
|
||||
{
|
||||
|
|
@ -68,7 +68,7 @@ QJsonObject FormTrackTop::makeJson()
|
|||
|
||||
void FormTrackTop::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
QWidget::paintEvent(event);
|
||||
FormBase::paintEvent(event);
|
||||
|
||||
QPainter painter(this);
|
||||
QRect rect = this->rect();
|
||||
|
|
@ -96,30 +96,32 @@ void FormTrackTop::paintEvent(QPaintEvent* event)
|
|||
}
|
||||
painter.drawText(rect.left(), rect.top(), rect.width(), rect.height(), Qt::AlignCenter, text);
|
||||
|
||||
rect.setLeft(rect.left() + 1);
|
||||
rect.setTop(rect.top() + 1);
|
||||
// 3. 准备绘制边框
|
||||
painter.save();
|
||||
painter.setPen(QPen(m_pFWell->getBorderGridProperty().m_clor, m_pFWell->getBorderGridProperty().m_nWidth)); // 颜色、宽度可自定义
|
||||
//rect.setLeft(rect.left() + 1);
|
||||
//rect.setTop(rect.top() + 1);
|
||||
//// 3. 准备绘制边框
|
||||
//painter.save();
|
||||
//painter.setPen(QPen(m_pFWell->getBorderGridProperty().m_clor,
|
||||
// m_pFWell->getBorderGridProperty().m_nWidth,
|
||||
// (Qt::PenStyle)m_pFWell->getBorderGridProperty().m_nType)); // 颜色、宽度可自定义
|
||||
|
||||
// 上边框
|
||||
if (m_BorderFlags & TopBorder) {
|
||||
painter.drawLine(rect.topLeft(), rect.topRight());
|
||||
}
|
||||
// 下边框
|
||||
if (m_BorderFlags & BottomBorder) {
|
||||
painter.drawLine(rect.bottomLeft(), rect.bottomRight());
|
||||
}
|
||||
// 左边框
|
||||
if (m_BorderFlags & LeftBorder) {
|
||||
painter.drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
}
|
||||
// 右边框
|
||||
if (m_BorderFlags & RightBorder) {
|
||||
painter.drawLine(rect.topRight(), rect.bottomRight());
|
||||
}
|
||||
//// 上边框
|
||||
//if (m_BorderFlags & TopBorder) {
|
||||
// painter.drawLine(rect.topLeft(), rect.topRight());
|
||||
//}
|
||||
//// 下边框
|
||||
//if (m_BorderFlags & BottomBorder) {
|
||||
// painter.drawLine(rect.bottomLeft(), rect.bottomRight());
|
||||
//}
|
||||
//// 左边框
|
||||
//if (m_BorderFlags & LeftBorder) {
|
||||
// painter.drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
//}
|
||||
//// 右边框
|
||||
//if (m_BorderFlags & RightBorder) {
|
||||
// painter.drawLine(rect.topRight(), rect.bottomRight());
|
||||
//}
|
||||
|
||||
painter.restore();
|
||||
//painter.restore();
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,24 +8,22 @@
|
|||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
#include "common.h"
|
||||
#include "FormBase.h"
|
||||
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
namespace Ui {
|
||||
class FormTrackTop;
|
||||
}
|
||||
class FormWell;
|
||||
class FormTrackTop : public QWidget
|
||||
|
||||
class FormTrackTop : public FormBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FormTrackTop(QWidget *parent = nullptr, QString strSlfName="", QString strWellName="", QString strTrackName="", QString strLineName="", QColor lineColor=QColor(255,0,0));
|
||||
explicit FormTrackTop(QWidget*, QString strSlfName="", QString strWellName="", QString strTrackName="", QString strLineName="", QColor lineColor=QColor(255,0,0));
|
||||
~FormTrackTop();
|
||||
|
||||
void setBorderFlags(BorderFlags flags);
|
||||
|
||||
void setTrackTopPropert(QJsonObject topObj);
|
||||
private:
|
||||
Ui::FormTrackTop *ui;
|
||||
|
|
@ -41,9 +39,6 @@ public slots:
|
|||
|
||||
|
||||
public:
|
||||
QString m_strUuid;
|
||||
QString m_strSlfName;
|
||||
QString m_strWellName;
|
||||
QString m_strTrackName;
|
||||
QString m_strLineName;
|
||||
|
||||
|
|
@ -53,8 +48,6 @@ public:
|
|||
QFont m_font;
|
||||
QColor m_fontColor;//颜色
|
||||
|
||||
BorderFlags m_BorderFlags;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
|
@ -64,7 +57,6 @@ public:
|
|||
private:
|
||||
QPoint startPosition;
|
||||
|
||||
FormWell* m_pFWell = NULL;
|
||||
};
|
||||
|
||||
#endif // FormTrackTop_H
|
||||
|
|
|
|||
|
|
@ -232,8 +232,8 @@ QVector<QWidget *> FormWell::new_track(QStringList listdt, QString strTrackName)
|
|||
ui->tableWidget->setRowHeight(i, m_nObjLyrH);
|
||||
|
||||
//曲线名称栏
|
||||
formTrack = new FormTrack(this, strWellName, strTrackName);
|
||||
formTrack->setBorderFlags(BorderFlags(BottomBorder |RightBorder));
|
||||
formTrack = new FormTrack(this, strSlfName, strWellName, strTrackName);
|
||||
formTrack->setBorderFlags(BorderFlags(BottomBorder | RightBorder));
|
||||
formTrack->setFixedWidth(dW * g_dPixelPerCm);
|
||||
// if ("curveObject" == strType)
|
||||
//formTrack->setFixedWidth(20);
|
||||
|
|
@ -275,7 +275,7 @@ QVector<QWidget *> FormWell::new_track(QStringList listdt, QString strTrackName)
|
|||
ui->tableWidget->setRowHeight(i, (int)iHeightOfScreen);
|
||||
|
||||
//曲线绘制栏
|
||||
FormDraw *formDraw = new FormDraw(this, strWellName, strTrackName);
|
||||
FormDraw *formDraw = new FormDraw(this, strSlfName, strWellName, strTrackName);
|
||||
formDraw->setBorderFlags(BorderFlags(BottomBorder | RightBorder));
|
||||
vec << formDraw;
|
||||
//
|
||||
|
|
@ -346,7 +346,9 @@ void FormWell::paintEvent(QPaintEvent *event)
|
|||
rect.setTop(rect.top() + 1);
|
||||
// 3. 准备绘制边框
|
||||
painter.save();
|
||||
painter.setPen(QPen(m_borderProperty.m_clor, m_borderProperty.m_nWidth)); // 颜色、宽度可自定义
|
||||
painter.setPen(QPen(m_borderProperty.m_clor,
|
||||
m_borderProperty.m_nWidth,
|
||||
(Qt::PenStyle)m_borderProperty.m_nType)); // 颜色、宽度可自定义
|
||||
|
||||
// 上边框
|
||||
if (m_BorderFlags & TopBorder) {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ SOURCES += \
|
|||
DepPairs.cpp \
|
||||
DrawNrad.cpp \
|
||||
DrawTvd.cpp \
|
||||
FormBase.cpp \
|
||||
GeoIndicatorGenerator.cpp \
|
||||
Gradient.cpp \
|
||||
InDefTableDlg.cpp \
|
||||
|
|
@ -90,7 +91,8 @@ SOURCES += \
|
|||
transparentdraggableSelectRect.cpp \
|
||||
transparentdraggableimage.cpp \
|
||||
variantfactory.cpp \
|
||||
variantmanager.cpp
|
||||
variantmanager.cpp \
|
||||
wellheader.cpp
|
||||
|
||||
HEADERS += \
|
||||
../CallManage/CallManage.h \
|
||||
|
|
@ -102,6 +104,7 @@ HEADERS += \
|
|||
DraggablePixmap.h \
|
||||
DrawNrad.h \
|
||||
DrawTvd.h \
|
||||
FormBase.h \
|
||||
GeoIndicatorGenerator.h \
|
||||
Gradient.h \
|
||||
InDefTableDlg.h \
|
||||
|
|
@ -156,7 +159,8 @@ HEADERS += \
|
|||
transparentdraggableSelectRect.h \
|
||||
transparentdraggableimage.h \
|
||||
variantfactory.h \
|
||||
variantmanager.h
|
||||
variantmanager.h \
|
||||
wellheader.h
|
||||
|
||||
FORMS += \
|
||||
InDefTable.ui \
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
<QtMoc Include="formhead.h" />
|
||||
<QtMoc Include="formmultiheads.h" />
|
||||
<QtMoc Include="fracsel.h" />
|
||||
<QtMoc Include="FormBase.h" />
|
||||
<ClInclude Include="GeoIndicatorGenerator.h" />
|
||||
<ClInclude Include="Gradient.h" />
|
||||
<QtMoc Include="mainwindowsplitter.h" />
|
||||
|
|
@ -162,6 +163,7 @@
|
|||
<ClCompile Include="DrawTvd.cpp" />
|
||||
<ClCompile Include="fileedit.cpp" />
|
||||
<ClCompile Include="fileopenthread.cpp" />
|
||||
<ClCompile Include="FormBase.cpp" />
|
||||
<ClCompile Include="formdraw.cpp" />
|
||||
<ClCompile Include="formhead.cpp" />
|
||||
<ClCompile Include="forminfo.cpp" />
|
||||
|
|
|
|||
|
|
@ -319,6 +319,9 @@
|
|||
<QtMoc Include="wellheader.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="FormBase.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="backgrounddelegate.cpp">
|
||||
|
|
@ -666,6 +669,9 @@
|
|||
<ClCompile Include="wellheader.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FormBase.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="logplus.qrc">
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) :
|
|||
//ui->tableWidget_2->setFrameShape(QFrame::NoFrame); //设置无边框
|
||||
//隐藏网格线
|
||||
ui->tableWidget_2->setShowGrid(false);
|
||||
ui->tableWidget_2->setItemDelegate(new ItemBorderDelegate(ui->tableWidget_2));
|
||||
//ui->tableWidget_2->setItemDelegate(new ItemBorderDelegate(ui->tableWidget_2));
|
||||
|
||||
ui->tableWidget_2->setStyleSheet("QTableView {border: 0px solid black;} QTableView::item {border: 0px solid black;} \
|
||||
QTableView::item:selected {color:#57595B; background:#E4E4E4;}");
|
||||
|
|
|
|||
|
|
@ -10,13 +10,8 @@
|
|||
|
||||
//曲线名称(单个)
|
||||
WellHeader::WellHeader(QWidget *parent, QString strSlfName, QString strWellName) :
|
||||
QWidget(parent)
|
||||
FormBase(parent, strSlfName, strWellName)
|
||||
{
|
||||
|
||||
m_strSlfName = strSlfName;
|
||||
m_strWellName = strWellName;
|
||||
|
||||
m_Color = Qt::black;
|
||||
}
|
||||
|
||||
WellHeader::~WellHeader()
|
||||
|
|
@ -33,48 +28,21 @@ QJsonObject WellHeader::makeJson()
|
|||
QJsonObject rootObj;
|
||||
return rootObj;
|
||||
}
|
||||
void WellHeader::setBorderFlags(BorderFlags flags)
|
||||
{
|
||||
m_BorderFlags = flags;
|
||||
}
|
||||
void WellHeader::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)
|
||||
|
||||
QString strShowTxt = "";
|
||||
painter.setBrush(Qt::NoBrush); // 确保文字不被填充色遮挡
|
||||
painter.setFont(m_Font);
|
||||
painter.setPen(m_Color); // fontColor QColor(220, 220, 220)
|
||||
void WellHeader::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
FormBase::paintEvent(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)
|
||||
|
||||
QString strShowTxt = "";
|
||||
painter.setBrush(Qt::NoBrush); // 确保文字不被填充色遮挡
|
||||
painter.setFont(m_Font);
|
||||
painter.setPen(m_Color); // fontColor QColor(220, 220, 220)
|
||||
painter.drawText(rect, Qt::AlignCenter, m_strWellName);
|
||||
|
||||
int nbw = m_pFormWell->getBorderGridProperty().m_nWidth;
|
||||
painter.setPen(QPen(m_pFormWell->getBorderGridProperty().m_clor, nbw));
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void WellHeader::mousePressEvent(QMouseEvent *event)
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
#include <QPainter>
|
||||
#include <QPaintEvent>
|
||||
|
||||
#include "common.h"
|
||||
#include "FormBase.h"
|
||||
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
class FormWell;
|
||||
class WellHeader : public QWidget
|
||||
class WellHeader : public FormBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
|
@ -21,7 +21,6 @@ public:
|
|||
void initProperty(QJsonObject obj);
|
||||
QJsonObject makeJson();
|
||||
|
||||
void setBorderFlags(BorderFlags flags);
|
||||
private:
|
||||
|
||||
protected:
|
||||
|
|
@ -32,14 +31,10 @@ protected:
|
|||
public slots:
|
||||
public:
|
||||
QString m_strUuid;
|
||||
QString m_strSlfName;
|
||||
QString m_strWellName;
|
||||
|
||||
QFont m_Font = QFont("微软雅黑", 14); //显示名称字体
|
||||
QColor m_Color; //颜色
|
||||
bool m_press;//判断鼠标是否按下
|
||||
BorderFlags m_BorderFlags;
|
||||
FormWell* m_pFormWell = NULL;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user