修改边框样式显示,重绘边框,隐藏tablewidget的边框,调整显示效果。

This commit is contained in:
DESKTOP-450PEFP\mainc 2026-04-10 10:24:31 +08:00
parent 5eb1b2bfcc
commit 5d054c35db
19 changed files with 360 additions and 34 deletions

16
common/common.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef LOG_COMMON_H
#define LOG_COMMON_H
#include <QObject>
// 定义一个枚举,方便位操作(可选)
enum BorderFlag {
NoBorder = 0,
TopBorder = 1 << 0,
BottomBorder = 1 << 1,
LeftBorder = 1 << 2,
RightBorder = 1 << 3
};
Q_DECLARE_FLAGS(BorderFlags, BorderFlag)
#endif // LOG_COMMON_H

View File

@ -0,0 +1,64 @@
#pragma once
#include <QPainter>
#include <QTableWidgetItem>
#include <QStyledItemDelegate>
#include "common.h"
#pragma execution_character_set("utf-8")
// 设置某个单元格的边框状态
void setItemBorderFlags(QTableWidgetItem *item, BorderFlags flags) {
item->setData(Qt::UserRole, static_cast<int>(flags));
}
// 获取边框状态
BorderFlags getItemBorderFlags(const QTableWidgetItem *item) {
return static_cast<BorderFlags>(item->data(Qt::UserRole).toInt());
}
class ItemBorderDelegate : public QStyledItemDelegate {
public:
using QStyledItemDelegate::QStyledItemDelegate;
void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const override {
// 1. 绘制默认内容(文本、图标等)
QStyledItemDelegate::paint(painter, option, index);
const QTableWidget* ptabWgt = qobject_cast<QTableWidget*>(const_cast<QWidget*>(option.widget));
if (!ptabWgt) return;
// 2. 获取该单元格存储的边框标志
QTableWidgetItem *item = ptabWgt->item(index.row(), index.column());
if (!item) return;
BorderFlags flags = getItemBorderFlags(item);
if (flags == NoBorder) return;
// 3. 准备绘制边框
painter->save();
painter->setPen(QPen(Qt::black, 2)); // 颜色、宽度可自定义
QRect rect = option.rect;
rect.setLeft(rect.left() + 1);
rect.setTop(rect.top() + 1);
// 上边框
if (flags & TopBorder) {
painter->drawLine(rect.topLeft(), rect.topRight());
}
// 下边框
if (flags & BottomBorder) {
painter->drawLine(rect.bottomLeft(), rect.bottomRight());
}
// 左边框
if (flags & LeftBorder) {
painter->drawLine(rect.topLeft(), rect.bottomLeft());
}
// 右边框
if (flags & RightBorder) {
painter->drawLine(rect.topRight(), rect.bottomRight());
}
painter->restore();
}
};

View File

@ -176,7 +176,7 @@ void TransparentDraggableGujing::setRange(double left_Low, double right_Hight, b
if(left_Low >= right_Hight) return;
double lY1 = mPlot->yAxis->range().lower;//+10
double lY2 = mPlot->yAxis->range().upper;
double lY2 = mPlot->yAxis->range().upper-3;
mRect->topLeft->setCoords(left_Low, lY1);
mRect->bottomRight->setCoords(right_Hight, lY2);

View File

@ -2677,15 +2677,39 @@ void FormDraw::crossTrackSetting()
}
void FormDraw::setBorderFlags(BorderFlags flags)
{
m_BorderFlags = flags;
}
void FormDraw::paintEvent(QPaintEvent*)
{
//if (m_listLineName.size() > 0 && m_listLineName.at(0) == "AC")
//{
// QPainter painter(this);
// QRect rect = this->rect();
// //背景透明
// painter.fillRect(rect.left(), rect.top(), rect.width(), rect.height(), QColor(200, 0, 0)); //QColor(67, 67, 67, 100)
//}
QPainter painter(this);
QRect rect = this->rect();
rect.setLeft(rect.left() + 1);
rect.setTop(rect.top() + 1);
// 3. 准备绘制边框
painter.save();
painter.setPen(QPen(Qt::black, 2)); // 颜色、宽度可自定义
// 上边框
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();
}
@ -3677,6 +3701,10 @@ void FormDraw::s_addGanZuangTu(QString strUuid, QString strSlfName, QString strW
curv->yAxis->setTicks(false);
curv->xAxis2->setTicks(false);
curv->yAxis2->setTicks(false);
curv->xAxis->setVisible(false);
curv->xAxis2->setVisible(false);
curv->yAxis->setVisible(false);
curv->yAxis2->setVisible(false);
//蝌蚪图
// curv->mKedou = true;
//隐藏网格
@ -4140,6 +4168,10 @@ void FormDraw::s_addJiegutext(QString strUuid, QString strSlfName, QString strWe
curv->yAxis->setTicks(false);
curv->xAxis2->setTicks(false);
curv->yAxis2->setTicks(false);
curv->xAxis->setVisible(false);
curv->xAxis2->setVisible(false);
curv->yAxis->setVisible(false);
curv->yAxis2->setVisible(false);
QColor newlineColor=QColor(0,0,0);
QString strAliasName = "气测-FMT-射孔-文本";
@ -4538,6 +4570,10 @@ void FormDraw::s_addTubingstring(QString strUuid, QString strSlfName, QString st
curv->yAxis->setTicks(false);
curv->xAxis2->setTicks(false);
curv->yAxis2->setTicks(false);
curv->xAxis->setVisible(false);
curv->xAxis2->setVisible(false);
curv->yAxis->setVisible(false);
curv->yAxis2->setVisible(false);
//套管组件
//QString strWaveName = "TUBTOOLS";
@ -4741,6 +4777,11 @@ void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLi
widget->xAxis->ticker()->setTickCount(10);//x个主刻度
widget->yAxis->ticker()->setTickCount(60);//y个主刻度
widget->xAxis->setVisible(false);
widget->xAxis2->setVisible(false);
widget->yAxis->setVisible(false);
widget->yAxis2->setVisible(false);
//对调XY轴在最前面设置
QCPAxis *yAxis = widget->yAxis;
QCPAxis *xAxis = widget->xAxis;
@ -5409,6 +5450,10 @@ void FormDraw::initTableLine(QMyCustomPlot *widget, QString strSlfName, QString
widget->yAxis->setTicks(false);
widget->xAxis2->setTicks(false);
widget->yAxis2->setTicks(false);
widget->xAxis->setVisible(false);
widget->xAxis2->setVisible(false);
widget->yAxis->setVisible(false);
widget->yAxis2->setVisible(false);
//
if (m_bTableData)
{
@ -5460,6 +5505,10 @@ void FormDraw::initWords(QMyCustomPlot *widget, QString strSlfName, QString strL
widget->yAxis->setTicks(false);
widget->xAxis2->setTicks(false);
widget->yAxis2->setTicks(false);
widget->xAxis->setVisible(false);
widget->xAxis2->setVisible(false);
widget->yAxis->setVisible(false);
widget->yAxis2->setVisible(false);
//
widget->LoadFromSLF_Text(strSlfName, strLineName);
@ -5506,6 +5555,10 @@ void FormDraw::initLayer(QMyCustomPlot *widget, QString strSlfName, QString strL
widget->yAxis->setTicks(false);
widget->xAxis2->setTicks(false);
widget->yAxis2->setTicks(false);
widget->xAxis->setVisible(false);
widget->xAxis2->setVisible(false);
widget->yAxis->setVisible(false);
widget->yAxis2->setVisible(false);
//地质层位道
widget->LoadFromSLF_Layer(strSlfName, strLineName);
@ -5555,6 +5608,10 @@ void FormDraw::initIMAGE_DATA(QMyCustomPlot *widget, QString strSlfName, QString
widget->yAxis->setTicks(false);
widget->xAxis2->setTicks(false);
widget->yAxis2->setTicks(false);
widget->xAxis->setVisible(false);
widget->xAxis2->setVisible(false);
widget->yAxis->setVisible(false);
widget->yAxis2->setVisible(false);
//
widget->LoadFromIMAGE_SLF(strSlfName, strLineName);
//显示文本
@ -5666,6 +5723,10 @@ void FormDraw::initResult(QMyCustomPlot *widget, QString strSlfName, QString str
widget->yAxis->setTickLabels(false);
widget->xAxis2->setTickLabels(false);
widget->xAxis2->setTickLabels(false);
widget->xAxis->setVisible(false);
widget->xAxis2->setVisible(false);
widget->yAxis->setVisible(false);
widget->yAxis2->setVisible(false);
//
LoadFromSLF_Result(widget, strSlfName, strLineName);
@ -5760,6 +5821,10 @@ void FormDraw::initGeoLith(QMyCustomPlot *widget, QString strSlfName, QString st
widget->yAxis->setTicks(false);
widget->xAxis2->setTicks(false);
widget->yAxis2->setTicks(false);
widget->xAxis->setVisible(false);
widget->xAxis2->setVisible(false);
widget->yAxis->setVisible(false);
widget->yAxis2->setVisible(false);
//含油占比
if(listOtherProperty.size()>=12)
@ -5870,6 +5935,10 @@ void FormDraw::initSwallCore(QMyCustomPlot *widget, QString strSlfName, QString
widget->yAxis->setTicks(false);
widget->xAxis2->setTicks(false);
widget->yAxis2->setTicks(false);
widget->xAxis->setVisible(false);
widget->xAxis2->setVisible(false);
widget->yAxis->setVisible(false);
widget->yAxis2->setVisible(false);
//
widget->LoadFromSLF_SwallCore(strSlfName, strLineName);
@ -5917,6 +5986,10 @@ void FormDraw::initGujing(QMyCustomPlot *widget, QString strSlfName, QString str
widget->yAxis->setTicks(false);
widget->xAxis2->setTicks(false);
widget->yAxis2->setTicks(false);
widget->xAxis->setVisible(false);
widget->xAxis2->setVisible(false);
widget->yAxis->setVisible(false);
widget->yAxis2->setVisible(false);
//
widget->LoadFromSLF_Gujing(strSlfName, strLineName);
@ -6793,6 +6866,10 @@ void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QStrin
widget->yAxis->setTicks(false);
widget->xAxis2->setTicks(false);
widget->yAxis2->setTicks(false);
widget->xAxis->setVisible(false);
widget->xAxis2->setVisible(false);
widget->yAxis->setVisible(false);
widget->yAxis2->setVisible(false);
QVector<double> x, y;
@ -7039,6 +7116,10 @@ void FormDraw::DrawJykt(QMyCustomPlot *widget, QString strSlfName)
widget->yAxis->setTicks(false);
widget->xAxis2->setTicks(false);
widget->yAxis2->setTicks(false);
widget->xAxis->setVisible(false);
widget->xAxis2->setVisible(false);
widget->yAxis->setVisible(false);
widget->yAxis2->setVisible(false);
//-------------
float tempf,flVal;
@ -7165,6 +7246,10 @@ void FormDraw::DrawDenv(QMyCustomPlot *widget, QString strSlfName)
widget->yAxis->setTicks(false);
widget->xAxis2->setTicks(false);
widget->yAxis2->setTicks(false);
widget->xAxis->setVisible(false);
widget->xAxis2->setVisible(false);
widget->yAxis->setVisible(false);
widget->yAxis2->setVisible(false);
//
QPen pPen(m_TailColor,m_nTailWidth);

View File

@ -10,6 +10,7 @@
#include "LogIO.h"
#include "MemRdWt.h"
#include "FormLine.h"
#include "common.h"
#pragma execution_character_set("utf-8")
@ -86,6 +87,8 @@ public:
// 跨道设置
void crossTrackSetting();
void setBorderFlags(BorderFlags flags);
private:
Ui::FormDraw *ui;
@ -126,6 +129,8 @@ public:
QStringList m_listWaveName;
QStringList m_listTableName;
BorderFlags m_BorderFlags;
//X坐标
float m_vmax;
float m_vmin;

View File

@ -715,7 +715,7 @@ void FormInfo::paintEvent(QPaintEvent* event)
QRect rectRound(rect.left()+2,rect.top()+4, rect.width()-4, rect.height()-8);
painter.setPen(QPen(m_lineColor, m_dWidth, m_lineStyle));
//painter.drawRoundRect(rectRound);//利用画刷(颜色/岩性图片),画框
painter.drawRect(rectRound);
//painter.drawRect(rectRound);
QString strShowTxt = "";
painter.setBrush(Qt::NoBrush); // 确保文字不被填充色遮挡

View File

@ -171,6 +171,44 @@ 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(Qt::black, 2)); // 颜色、宽度可自定义
// 上边框
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)
// {

View File

@ -4,6 +4,7 @@
#include <QWidget>
#include "forminfo.h"
#include <QStyledItemDelegate>
#include "common.h"
#pragma execution_character_set("utf-8")
@ -56,9 +57,14 @@ public:
FormInfo* getFormInfoByParameters(QString strUuid, QString strWellName,
QString strTrackName, QString strLineName);
void setBorderFlags(BorderFlags flags);
private:
Ui::FormTrack *ui;
protected:
void paintEvent(QPaintEvent *event);
public:
QString m_strUuid;
// 道ID
@ -69,7 +75,7 @@ public:
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={});

View File

@ -15,16 +15,16 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
<number>2</number>
</property>
<property name="topMargin">
<number>0</number>
<number>2</number>
</property>
<property name="rightMargin">
<number>0</number>
<number>2</number>
</property>
<property name="bottomMargin">
<number>0</number>
<number>2</number>
</property>
<item row="0" column="0">
<widget class="PreQTableWidget" name="tableWidget"/>

View File

@ -30,6 +30,11 @@ FormTrackTop::~FormTrackTop()
delete ui;
}
void FormTrackTop::setBorderFlags(BorderFlags flags)
{
m_BorderFlags = flags;
}
void FormTrackTop::setTrackTopPropert(QJsonObject topObj)
{
if (topObj.contains("Font"))
@ -60,6 +65,8 @@ QJsonObject FormTrackTop::makeJson()
void FormTrackTop::paintEvent(QPaintEvent* event)
{
QWidget::paintEvent(event);
QPainter painter(this);
QRect rect = this->rect();
//背景透明
@ -70,7 +77,33 @@ void FormTrackTop::paintEvent(QPaintEvent* event)
painter.setPen(m_fontColor); // fontColor QColor(220, 220, 220)
painter.drawText(rect.left(), rect.top(), rect.width(), rect.height(), Qt::AlignCenter, m_strTrackName);
QWidget::paintEvent(event);
rect.setLeft(rect.left() + 1);
rect.setTop(rect.top() + 1);
// 3. 准备绘制边框
painter.save();
painter.setPen(QPen(Qt::black, 2)); // 颜色、宽度可自定义
// 上边框
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 FormTrackTop::dragEnterEvent(QDragEnterEvent* event)

View File

@ -8,6 +8,7 @@
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include "common.h"
#pragma execution_character_set("utf-8")
@ -23,6 +24,8 @@ public:
explicit FormTrackTop(QWidget *parent = nullptr, 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;
@ -50,6 +53,7 @@ public:
QFont m_font;
QColor m_fontColor;//颜色
BorderFlags m_BorderFlags;
public:

View File

@ -23,17 +23,15 @@ FormWell::FormWell(QWidget *parent, QString strWellName) :
//
ui->tableWidget->verticalHeader()->hide(); //行
//ui->tableWidget->horizontalHeader()->hide();//列
ui->tableWidget->horizontalHeader()->hide();//列
int rowcount = 3; //总行数
ui->tableWidget->setRowCount(rowcount); //动态设置行数
//ui->tableWidget->verticalHeader()->setFixedWidth(3);//标题栏宽度
ui->tableWidget->horizontalHeader()->setFixedHeight(3);
//左右边框隐藏
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;}");
//"QTableView::item:selected {color:#57595B; background:#E4E4E4;}"
ui->tableWidget->setShowGrid(false);
ui->tableWidget->setStyleSheet("QTableView {border: 0px solid black;} QTableView::item {border: 0px solid black;} \
QTableView::item:selected {color:#57595B; background:#E4E4E4;}");
// 假设你的类中有一个槽函数onTableRowsInserted(QModelIndex parent, int first, int last)
//connect(ui->tableWidget->model(), &QAbstractItemModel::columnsInserted,
@ -189,6 +187,7 @@ QVector<QWidget *> FormWell::new_track(QStringList listdt, QString strTrackName)
ui->tableWidget->setRowHeight(i, 100);
//
FormTrackTop* trackTop= new FormTrackTop(this, strSlfName, strWellName, strTrackName);
trackTop->setBorderFlags(BorderFlags(BottomBorder | RightBorder));
// if ("curveObject" == strType)
// trackTop->setFixedWidth(nW/2);
vec << trackTop;
@ -203,6 +202,7 @@ QVector<QWidget *> FormWell::new_track(QStringList listdt, QString strTrackName)
//曲线名称栏
formTrack = new FormTrack(this, strWellName, strTrackName);
formTrack->setBorderFlags(BorderFlags(BottomBorder | RightBorder));
// if ("curveObject" == strType)
// formTrack->setFixedWidth(nW / 2);
vec << formTrack;
@ -228,6 +228,7 @@ QVector<QWidget *> FormWell::new_track(QStringList listdt, QString strTrackName)
ui->tableWidget->setRowHeight(i, (int)dHight);//7582
//曲线绘制栏
FormDraw *formDraw = new FormDraw(this, strWellName, strTrackName);
formDraw->setBorderFlags(BorderFlags(BottomBorder | RightBorder));
vec << formDraw;
formDraw->m_iY1 = m_iY1;
formDraw->m_iY2 = m_iY2;
@ -244,6 +245,11 @@ QVector<QWidget *> FormWell::new_track(QStringList listdt, QString strTrackName)
return vec;
}
void FormWell::setBorderFlags(BorderFlags flags)
{
m_BorderFlags = flags;
}
int FormWell::getTableWidgetColumn(QString strTrackUuid)
{
int nret = -1;
@ -260,6 +266,36 @@ int FormWell::getTableWidgetColumn(QString strTrackUuid)
return nret;
}
void FormWell::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
QRect rect = this->rect();
rect.setLeft(rect.left() + 1);
rect.setTop(rect.top() + 1);
// 3. 准备绘制边框
painter.save();
painter.setPen(QPen(Qt::black, 2)); // 颜色、宽度可自定义
// 上边框
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 FormWell::s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iTableType, QString strFormInfoType)
{
if(m_strUuid == strUuid &&

View File

@ -5,6 +5,7 @@
#include "formtrack.h"
#include "formdraw.h"
#include "formtracktop.h"
#include "common.h"
#pragma execution_character_set("utf-8")
@ -25,9 +26,12 @@ public:
QVector<QWidget*> new_track(QStringList listdt, QString strTrackName = "");
void setBorderFlags(BorderFlags flags);
// 根据道ID获取列索引
int getTableWidgetColumn(QString strTrackUuid);
protected:
void paintEvent(QPaintEvent *event);
private:
Ui::FormWell *ui;
@ -43,6 +47,8 @@ public:
// 道图形
QMap<QString, QVector<QWidget*>> m_mapFormDraw;
BorderFlags m_BorderFlags;
public:
QJsonObject makeJson();
QStringList getLineList(QString strWellName, QString strTrackName);

View File

@ -15,16 +15,16 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
<number>2</number>
</property>
<property name="topMargin">
<number>0</number>
<number>2</number>
</property>
<property name="rightMargin">
<number>0</number>
<number>2</number>
</property>
<property name="bottomMargin">
<number>0</number>
<number>2</number>
</property>
<item row="0" column="0">
<widget class="QMyTableWidget" name="tableWidget"/>

View File

@ -20,6 +20,7 @@
<QtMoc Include="transparentdraggableSelectRect.h" />
<QtMoc Include="..\CallManage\CallManage.h" />
<QtMoc Include="..\common\dropdownbutton.h" />
<ClInclude Include="..\common\common.h" />
<ClInclude Include="..\common\geometryutils.h" />
<ClInclude Include="3rd_qcustomplot\smoothcurve.h" />
<QtMoc Include="3rd_qcustomplot\v2_1\qcustomplot.h" />
@ -35,6 +36,7 @@
<ClInclude Include="GeoIndicatorGenerator.h" />
<ClInclude Include="Gradient.h" />
<QtMoc Include="mainwindowsplitter.h" />
<ClInclude Include="ItemBorderDelegate.h" />
<ClInclude Include="ObjectArchive.h" />
<QtMoc Include="ViewInfo.h" />
<QtMoc Include="variantmanager.h" />

View File

@ -68,6 +68,12 @@
<ClInclude Include="..\common\geometryutils.h">
<Filter>common</Filter>
</ClInclude>
<ClInclude Include="ItemBorderDelegate.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\common\common.h">
<Filter>common</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<QtMoc Include="ConsoleOutputWidget.h">

View File

@ -17,6 +17,7 @@
#include "selectwelldialog.h"
#include "mainwindow.h"
#include <QSvgGenerator>
#include "ItemBorderDelegate.h"
//主窗口为了方便获取tab当前页
extern MainWindow *g_mainWindow;
@ -66,17 +67,19 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) :
ui->toolBar_3->hide();
ui->toolBar_plugin->hide();
//加载样式
loadStyle(":/qrc/qss/flatgray.css");
//loadStyle(":/qrc/qss/flatgray.css");
//this->setStyleSheet("QWidget{border: 1px solid black;}");
//ui->centralwidget->setVisible(false);
//ui->tableWidget_2->setVisible(false);
//-------------------------------------
//ui->tableWidget_2->setFrameShape(QFrame::NoFrame); //设置无边框
//隐藏网格线
ui->tableWidget_2->setShowGrid(false);
//设置样式表,只显示竖直边框
ui->tableWidget_2->setStyleSheet( "QTableView::item {border-left: 1px solid black;} \
QTableView::item:selected {border-left: 1px solid black; color:#57595B; background:#E4E4E4;}\
QTableView::item {border-right: 1px solid black;} \
QTableView::item:selected {border-right: 1px solid black;}");
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;}");
ui->tableWidget_2->verticalHeader()->hide(); //行
@ -2904,6 +2907,7 @@ void MainWindowCurve::s_NewWell(QString strWellName, QString strSlfName)
ui->tableWidget_2->setRowHeight(i, 100);
//
QTableWidgetItem* item = new QTableWidgetItem(strWellName);
setItemBorderFlags(item, BorderFlags(TopBorder | BottomBorder | LeftBorder | RightBorder));
item->setData(Qt::UserRole + 1, strSlfName);
item->setFlags(item->flags() & (~Qt::ItemIsEditable));
item->setTextAlignment(Qt::AlignCenter); //设置文本居中
@ -2928,6 +2932,7 @@ void MainWindowCurve::s_NewWell(QString strWellName, QString strSlfName)
ui->tableWidget_2->setRowHeight(i, (int)dHight);//8020
//
FormWell *widgetWell = new FormWell(this, strWellName);
widgetWell->setBorderFlags(BorderFlags(BottomBorder | LeftBorder | RightBorder));
widgetWell->m_iY1 = m_iY1;
widgetWell->m_iY2 = m_iY2;
widgetWell->m_strUuid = m_strUuid;

View File

@ -15,14 +15,26 @@
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>3</number>
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTableWidget" name="tableWidget_2"/>
</item>
<item>
<widget class="QWidget" name="widget" native="true"/>
</item>
</layout>
</item>
</layout>

View File

@ -73,6 +73,10 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel
yAxis->setTickLabels(false);
xAxis2->setTickLabels(false);
xAxis2->setTickLabels(false);
xAxis->setVisible(false);
xAxis2->setVisible(false);
yAxis->setVisible(false);
yAxis2->setVisible(false);
xAxis->grid()->setVisible(false);
yAxis->grid()->setVisible(false);
@ -358,6 +362,10 @@ void QMyCustomPlot::initWave(QString strSlfName, QString strWaveName)
widget->yAxis->setTickLabels(false);
widget->xAxis2->setTickLabels(false);
widget->xAxis2->setTickLabels(false);
widget->xAxis->setVisible(false);
widget->xAxis2->setVisible(false);
widget->yAxis->setVisible(false);
widget->yAxis2->setVisible(false);
//对调XY轴在最前面设置
QCPAxis *yAxis = widget->yAxis;