更新拖拽时的鼠标形状为小手或箭头
This commit is contained in:
parent
9538a549f6
commit
c95c843a43
|
|
@ -773,8 +773,38 @@ void TransparentDraggableGeoLith::onMousePress(QMouseEvent *event)
|
|||
|
||||
}
|
||||
|
||||
int TransparentDraggableGeoLith::getCursor()
|
||||
{
|
||||
if (m_bMoveRect)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
if (m_bArrow)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TransparentDraggableGeoLith::onMouseMove(QMouseEvent *event)
|
||||
{
|
||||
if (mDragMode == DragRect)
|
||||
{
|
||||
m_bMoveRect = true;
|
||||
}
|
||||
else if (mLeftHandle->selectTest(event->pos(), false) < 5
|
||||
|| mRightHandle->selectTest(event->pos(), false) < 5)
|
||||
{
|
||||
m_bArrow = true;
|
||||
m_bMoveRect = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bArrow = false;
|
||||
m_bMoveRect = false;
|
||||
}
|
||||
|
||||
//--------------------
|
||||
if(mDragMode == DragNone) return;
|
||||
|
||||
event->accept();
|
||||
|
|
|
|||
|
|
@ -102,7 +102,12 @@ public:
|
|||
QCPRange mDragStartRange;
|
||||
|
||||
// 添加最小宽度成员变量
|
||||
double mMinWidth;
|
||||
double mMinWidth;
|
||||
|
||||
//鼠标形状
|
||||
bool m_bArrow = false;
|
||||
bool m_bMoveRect = false;
|
||||
int getCursor();
|
||||
};
|
||||
|
||||
#endif // TRANSPARENTDRAGGABLEGEOLITH_H
|
||||
|
|
|
|||
|
|
@ -498,8 +498,38 @@ void TransparentDraggableGujing::onMousePress(QMouseEvent *event)
|
|||
|
||||
}
|
||||
|
||||
int TransparentDraggableGujing::getCursor()
|
||||
{
|
||||
if (m_bMoveRect)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
if (m_bArrow)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TransparentDraggableGujing::onMouseMove(QMouseEvent *event)
|
||||
{
|
||||
if (mDragMode == DragRect)
|
||||
{
|
||||
m_bMoveRect = true;
|
||||
}
|
||||
else if (mLeftHandle->selectTest(event->pos(), false) < 5
|
||||
|| mRightHandle->selectTest(event->pos(), false) < 5)
|
||||
{
|
||||
m_bArrow = true;
|
||||
m_bMoveRect = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bArrow = false;
|
||||
m_bMoveRect = false;
|
||||
}
|
||||
|
||||
//--------------------
|
||||
if(mDragMode == DragNone) return;
|
||||
|
||||
event->accept();
|
||||
|
|
|
|||
|
|
@ -88,6 +88,10 @@ public:
|
|||
// 添加最小宽度成员变量
|
||||
double mMinWidth;
|
||||
|
||||
//鼠标形状
|
||||
bool m_bArrow = false;
|
||||
bool m_bMoveRect = false;
|
||||
int getCursor();
|
||||
};
|
||||
|
||||
#endif // TRANSPARENTDRAGGABLEGUJING_H
|
||||
|
|
|
|||
|
|
@ -301,8 +301,38 @@ void TransparentDraggableJiegutext::onMousePress(QMouseEvent *event)
|
|||
|
||||
}
|
||||
|
||||
int TransparentDraggableJiegutext::getCursor()
|
||||
{
|
||||
if (m_bMoveRect)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
if (m_bArrow)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TransparentDraggableJiegutext::onMouseMove(QMouseEvent *event)
|
||||
{
|
||||
if (mDragMode == DragRect)
|
||||
{
|
||||
m_bMoveRect = true;
|
||||
}
|
||||
else if (mLeftHandle->selectTest(event->pos(), false) < 5
|
||||
|| mRightHandle->selectTest(event->pos(), false) < 5)
|
||||
{
|
||||
m_bArrow = true;
|
||||
m_bMoveRect = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bArrow = false;
|
||||
m_bMoveRect = false;
|
||||
}
|
||||
|
||||
//--------------------
|
||||
if(mDragMode == DragNone) return;
|
||||
|
||||
event->accept();
|
||||
|
|
|
|||
|
|
@ -72,6 +72,11 @@ public:
|
|||
|
||||
// 添加最小宽度成员变量
|
||||
double mMinWidth;
|
||||
|
||||
//鼠标形状
|
||||
bool m_bArrow = false;
|
||||
bool m_bMoveRect = false;
|
||||
int getCursor();
|
||||
};
|
||||
|
||||
#endif // TRANSPARENTDRAGGABLEJIEGUTEXT_H
|
||||
|
|
|
|||
|
|
@ -435,8 +435,38 @@ void TransparentDraggableLayer::onMousePress(QMouseEvent *event)
|
|||
|
||||
}
|
||||
|
||||
int TransparentDraggableLayer::getCursor()
|
||||
{
|
||||
if (m_bMoveRect)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
if (m_bArrow)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TransparentDraggableLayer::onMouseMove(QMouseEvent *event)
|
||||
{
|
||||
if (mDragMode == DragRect)
|
||||
{
|
||||
m_bMoveRect = true;
|
||||
}
|
||||
else if (mLeftHandle->selectTest(event->pos(), false) < 5
|
||||
|| mRightHandle->selectTest(event->pos(), false) < 5)
|
||||
{
|
||||
m_bArrow = true;
|
||||
m_bMoveRect = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bArrow = false;
|
||||
m_bMoveRect = false;
|
||||
}
|
||||
|
||||
//--------------------
|
||||
if(mDragMode == DragNone) return;
|
||||
|
||||
event->accept();
|
||||
|
|
|
|||
|
|
@ -100,6 +100,11 @@ public:
|
|||
|
||||
// 添加最小宽度成员变量
|
||||
double mMinWidth;
|
||||
|
||||
//鼠标形状
|
||||
bool m_bArrow = false;
|
||||
bool m_bMoveRect = false;
|
||||
int getCursor();
|
||||
};
|
||||
|
||||
#endif // TRANSPARENTDRAGGABLELAYER_H
|
||||
|
|
|
|||
|
|
@ -321,8 +321,38 @@ void TransparentDraggableRect::onMousePress(QMouseEvent *event)
|
|||
|
||||
}
|
||||
|
||||
int TransparentDraggableRect::getCursor()
|
||||
{
|
||||
if (m_bMoveRect)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
if (m_bArrow)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TransparentDraggableRect::onMouseMove(QMouseEvent *event)
|
||||
{
|
||||
if (mDragMode == DragRect)
|
||||
{
|
||||
m_bMoveRect = true;
|
||||
}
|
||||
else if (mLeftHandle->selectTest(event->pos(), false) < 5
|
||||
|| mRightHandle->selectTest(event->pos(), false) < 5)
|
||||
{
|
||||
m_bArrow = true;
|
||||
m_bMoveRect = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bArrow = false;
|
||||
m_bMoveRect = false;
|
||||
}
|
||||
|
||||
//--------------------
|
||||
if(mDragMode == DragNone) return;
|
||||
|
||||
event->accept();
|
||||
|
|
|
|||
|
|
@ -92,6 +92,11 @@ public:
|
|||
|
||||
// 添加最小宽度成员变量
|
||||
double mMinWidth;
|
||||
|
||||
//鼠标形状
|
||||
bool m_bArrow = false;
|
||||
bool m_bMoveRect = false;
|
||||
int getCursor();
|
||||
};
|
||||
|
||||
#endif // TRANSPARENTDRAGGABLERECT_H
|
||||
|
|
|
|||
|
|
@ -524,11 +524,34 @@ void TransparentDraggableSwallCore::onMousePress(QMouseEvent *event)
|
|||
//mDragStartX = x;
|
||||
mDragStartY = y;
|
||||
mDragStartRange = currentRange;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void TransparentDraggableSwallCore::onMouseMove(QMouseEvent *event)
|
||||
int TransparentDraggableSwallCore::getCursor()
|
||||
{
|
||||
if (m_bMoveRect)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
if (m_bArrow)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TransparentDraggableSwallCore::onMouseMove(QMouseEvent *event)
|
||||
{
|
||||
if (mDragMode == DragRect)
|
||||
{
|
||||
m_bMoveRect = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bArrow = false;
|
||||
m_bMoveRect = false;
|
||||
}
|
||||
|
||||
//--------------------
|
||||
if(mDragMode == DragNone) return;
|
||||
|
||||
event->accept();
|
||||
|
|
|
|||
|
|
@ -105,6 +105,11 @@ public:
|
|||
float m_fImageHeight=20;//图片高度(需要根据高度宏定义,重新计算)
|
||||
//
|
||||
float m_fColorWordLen=40;//颜色文字长度
|
||||
|
||||
//鼠标形状
|
||||
bool m_bArrow = false;
|
||||
bool m_bMoveRect = false;
|
||||
int getCursor();
|
||||
};
|
||||
|
||||
#endif // TRANSPARENTDRAGGABLESWALLCORE_H
|
||||
|
|
|
|||
|
|
@ -779,31 +779,111 @@ void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event)
|
|||
{
|
||||
QCustomPlot::mouseMoveEvent(event);
|
||||
|
||||
int nmaxCursor = 0;
|
||||
QObjectList objList = m_mapDragGroup.values();
|
||||
for( int i = 0; i< objList.size(); i++)
|
||||
{
|
||||
TransparentGroupResult* group = qobject_cast<TransparentGroupResult*>(objList.at(i));
|
||||
if (group)
|
||||
{
|
||||
if (group->getCursor() > nmaxCursor)
|
||||
{
|
||||
nmaxCursor = group->getCursor();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nmaxCursor == 2)
|
||||
{
|
||||
this->setCursor(Qt::ClosedHandCursor);
|
||||
}
|
||||
else if (nmaxCursor == 1)
|
||||
{
|
||||
this->setCursor(Qt::SizeVerCursor);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setCursor(Qt::ArrowCursor);
|
||||
}
|
||||
int nmaxCursor = 0;
|
||||
//解释结论
|
||||
QObjectList objList = m_mapDragGroup.values();
|
||||
for( int i = 0; i< objList.size(); i++)
|
||||
{
|
||||
TransparentGroupResult* group = qobject_cast<TransparentGroupResult*>(objList.at(i));
|
||||
if (group)
|
||||
{
|
||||
if (group->getCursor() > nmaxCursor)
|
||||
{
|
||||
nmaxCursor = group->getCursor();
|
||||
}
|
||||
}
|
||||
}
|
||||
//固井结论
|
||||
QObjectList objList_Gujing = m_mapDraggable_Gujing.values();
|
||||
for( int i = 0; i< objList_Gujing.size(); i++)
|
||||
{
|
||||
TransparentDraggableGujing* tdGujing = qobject_cast<TransparentDraggableGujing*>(objList_Gujing.at(i));
|
||||
if (tdGujing)
|
||||
{
|
||||
if (tdGujing->getCursor() > nmaxCursor)
|
||||
{
|
||||
nmaxCursor = tdGujing->getCursor();
|
||||
}
|
||||
}
|
||||
}
|
||||
//文字结论
|
||||
QObjectList objList_Rect = m_mapDraggable_Rect.values();
|
||||
for( int i = 0; i< objList_Rect.size(); i++)
|
||||
{
|
||||
TransparentDraggableRect* tdRect = qobject_cast<TransparentDraggableRect*>(objList_Rect.at(i));
|
||||
if (tdRect)
|
||||
{
|
||||
if (tdRect->getCursor() > nmaxCursor)
|
||||
{
|
||||
nmaxCursor = tdRect->getCursor();
|
||||
}
|
||||
}
|
||||
}
|
||||
//地质分层
|
||||
QObjectList objList_Layer = m_mapDraggable_Layer.values();
|
||||
for( int i = 0; i< objList_Layer.size(); i++)
|
||||
{
|
||||
TransparentDraggableLayer* tdLayer = qobject_cast<TransparentDraggableLayer*>(objList_Layer.at(i));
|
||||
if (tdLayer)
|
||||
{
|
||||
if (tdLayer->getCursor() > nmaxCursor)
|
||||
{
|
||||
nmaxCursor = tdLayer->getCursor();
|
||||
}
|
||||
}
|
||||
}
|
||||
//录井剖面
|
||||
QObjectList objList_GeoLith = m_mapDraggable_GeoLith.values();
|
||||
for( int i = 0; i< objList_GeoLith.size(); i++)
|
||||
{
|
||||
TransparentDraggableGeoLith* tdGeoLith = qobject_cast<TransparentDraggableGeoLith*>(objList_GeoLith.at(i));
|
||||
if (tdGeoLith)
|
||||
{
|
||||
if (tdGeoLith->getCursor() > nmaxCursor)
|
||||
{
|
||||
nmaxCursor = tdGeoLith->getCursor();
|
||||
}
|
||||
}
|
||||
}
|
||||
//井壁取心
|
||||
QObjectList objList_SwallCore = m_mapDraggable_SwallCore.values();
|
||||
for( int i = 0; i< objList_SwallCore.size(); i++)
|
||||
{
|
||||
TransparentDraggableSwallCore* tdSwallCore = qobject_cast<TransparentDraggableSwallCore*>(objList_SwallCore.at(i));
|
||||
if (tdSwallCore)
|
||||
{
|
||||
if (tdSwallCore->getCursor() > nmaxCursor)
|
||||
{
|
||||
nmaxCursor = tdSwallCore->getCursor();
|
||||
}
|
||||
}
|
||||
}
|
||||
//气测-管柱-文本-FMT-射孔
|
||||
QObjectList objList_Jiegutext = m_mapDraggable_Jiegutext.values();
|
||||
for( int i = 0; i< objList_Jiegutext.size(); i++)
|
||||
{
|
||||
TransparentDraggableJiegutext* tdJiegutext = qobject_cast<TransparentDraggableJiegutext*>(objList_Jiegutext.at(i));
|
||||
if (tdJiegutext)
|
||||
{
|
||||
if (tdJiegutext->getCursor() > nmaxCursor)
|
||||
{
|
||||
nmaxCursor = tdJiegutext->getCursor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nmaxCursor == 2)
|
||||
{
|
||||
this->setCursor(Qt::ClosedHandCursor);
|
||||
}
|
||||
else if (nmaxCursor == 1)
|
||||
{
|
||||
this->setCursor(Qt::SizeVerCursor);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setCursor(Qt::ArrowCursor);
|
||||
}
|
||||
// if (mMousePress) {
|
||||
// auto items = selectedItems();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user