添加dashboard拖拽时目标位置的高亮提示
This commit is contained in:
parent
8526de90b8
commit
19c381c1df
|
|
@ -41,6 +41,7 @@ public:
|
|||
Dashboard* getDashboard(const QString&);
|
||||
Dashboard* takeDashboard(const QString&);
|
||||
DashboardFrame* getDashboardFrame(const QString&);
|
||||
void setDashboardAreaHighlight(bool);
|
||||
void moveDashboardToNewDVIEWindow(const QString&, QPoint);
|
||||
|
||||
protected:
|
||||
|
|
@ -84,6 +85,7 @@ private:
|
|||
dashboardFrame::frameType m_type;
|
||||
QWidget* m_pParentWindow;
|
||||
TransparentMask* m_pTransparentMask;
|
||||
QWidget* m_pDashboardHighlight;
|
||||
MessageDialog* m_pMessageDialog;
|
||||
CustomTabBar* m_pDashboardTabBar;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ DashboardFrame::DashboardFrame(const QString& strName, dashboardFrame::frameType
|
|||
, ui(new Ui::dashboardFrame)
|
||||
, m_pParentWindow(nullptr)
|
||||
, m_pTransparentMask(nullptr)
|
||||
, m_pDashboardHighlight(nullptr)
|
||||
, m_pMessageDialog(nullptr)
|
||||
, m_pDashboardTabBar(nullptr)
|
||||
, m_pDashboardNamingDialog(nullptr)
|
||||
|
|
@ -86,6 +87,7 @@ void DashboardFrame::dragEnterEvent(QDragEnterEvent* event)
|
|||
if( mimeData->hasFormat("dragData/customTab") )
|
||||
{
|
||||
event->acceptProposedAction();
|
||||
setDashboardAreaHighlight(true);
|
||||
//qDebug() << "dragEnterEvent-frame";
|
||||
}
|
||||
else
|
||||
|
|
@ -93,11 +95,13 @@ void DashboardFrame::dragEnterEvent(QDragEnterEvent* event)
|
|||
}
|
||||
void DashboardFrame::dragLeaveEvent(QDragLeaveEvent* event)
|
||||
{
|
||||
setDashboardAreaHighlight(false);
|
||||
//qDebug() << "dragLeaveEvent-frame";
|
||||
}
|
||||
void DashboardFrame::dropEvent(QDropEvent* event)
|
||||
{
|
||||
//qDebug() << "dropEvent-frame";
|
||||
setDashboardAreaHighlight(false);
|
||||
event->setDropAction(Qt::MoveAction);
|
||||
event->accept();
|
||||
|
||||
|
|
@ -344,6 +348,23 @@ void DashboardFrame::setCurrentDashboard(const QString& strName)
|
|||
}
|
||||
}
|
||||
|
||||
void DashboardFrame::setDashboardAreaHighlight(bool bVisible)
|
||||
{
|
||||
if(m_pDashboardHighlight == nullptr)
|
||||
{
|
||||
m_pDashboardHighlight = new QWidget(this);
|
||||
m_pDashboardHighlight->setStyleSheet("background-color: rgba(0, 141, 212, 85);");
|
||||
}
|
||||
|
||||
if(bVisible)
|
||||
{
|
||||
m_pDashboardHighlight->setGeometry(ui->mainStack->geometry());
|
||||
m_pDashboardHighlight->show();
|
||||
}
|
||||
else
|
||||
m_pDashboardHighlight->hide();
|
||||
}
|
||||
|
||||
void DashboardFrame::moveDashboardToNewDVIEWindow(const QString& strDashboard, QPoint pos)
|
||||
{
|
||||
Dashboard* dashboard = takeDashboard(strDashboard);
|
||||
|
|
|
|||
Loading…
Reference in New Issue