完成窗口在x11下缩放和移动时子窗口的位置同步问题
This commit is contained in:
parent
2c4a54738b
commit
62f8b197f1
|
|
@ -46,6 +46,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject*, QEvent*) override;
|
bool eventFilter(QObject*, QEvent*) override;
|
||||||
|
void resizeEvent(QResizeEvent*) override;
|
||||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||||
//void dragMoveEvent(QDragMoveEvent* event) override;
|
//void dragMoveEvent(QDragMoveEvent* event) override;
|
||||||
void dragLeaveEvent(QDragLeaveEvent* event) override;
|
void dragLeaveEvent(QDragLeaveEvent* event) override;
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,9 @@ public:
|
||||||
void creatSecondaryWindowAndAddDashboard(QPoint, Dashboard*);
|
void creatSecondaryWindowAndAddDashboard(QPoint, Dashboard*);
|
||||||
void removeSecondartWindow(QString&);
|
void removeSecondartWindow(QString&);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void resizeEvent(QResizeEvent*) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::dvieMainWindow* ui;
|
Ui::dvieMainWindow* ui;
|
||||||
TransparentMask* m_pTransparentMask;
|
TransparentMask* m_pTransparentMask;
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent(QCloseEvent*) override;
|
virtual void closeEvent(QCloseEvent*) override;
|
||||||
|
virtual void resizeEvent(QResizeEvent*) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::dvieSecondaryWindow* ui;
|
Ui::dvieSecondaryWindow* ui;
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,28 @@ bool DashboardFrame::eventFilter(QObject* obj, QEvent* event)
|
||||||
return QObject::eventFilter(obj, event);
|
return QObject::eventFilter(obj, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DashboardFrame::resizeEvent(QResizeEvent* event)
|
||||||
|
{
|
||||||
|
if(m_pTransparentMask && m_pTransparentMask->isVisible())
|
||||||
|
m_pTransparentMask->setGeometry(0, 0, this->width(), this->height());
|
||||||
|
|
||||||
|
if(m_pMessageDialog && m_pMessageDialog->isVisible())
|
||||||
|
{
|
||||||
|
int nX = (ui->navigationPanel->width() - m_pMessageDialog->width()) * 0.5;
|
||||||
|
int nY = ui->navigationPanel->y() + ui->navigationPanel->height() * 0.5;
|
||||||
|
m_pMessageDialog->move(nX, nY);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_pDashboardNamingDialog && m_pDashboardNamingDialog->isVisible())
|
||||||
|
{
|
||||||
|
int nX = (ui->navigationPanel->width() - m_pDashboardNamingDialog->width()) * 0.5;
|
||||||
|
int nY = ui->navigationPanel->y() + ui->navigationPanel->height() * 0.5;
|
||||||
|
m_pDashboardNamingDialog->move(nX, nY);
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget::resizeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
void DashboardFrame::dragEnterEvent(QDragEnterEvent* event)
|
void DashboardFrame::dragEnterEvent(QDragEnterEvent* event)
|
||||||
{
|
{
|
||||||
const QMimeData* mimeData = event->mimeData();
|
const QMimeData* mimeData = event->mimeData();
|
||||||
|
|
@ -172,7 +194,7 @@ void DashboardFrame::hideTransparentMask()
|
||||||
dvieWindow->hideTransparentMask();
|
dvieWindow->hideTransparentMask();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_pTransparentMask != nullptr && m_pTransparentMask->isVisible())
|
if(m_pTransparentMask && m_pTransparentMask->isVisible())
|
||||||
m_pTransparentMask->hide();
|
m_pTransparentMask->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -188,7 +210,7 @@ void DashboardFrame::showMessageDialog(MessageDialogType type,const QString& str
|
||||||
m_pMessageDialog->setMessage(type, strTitle, strContent);
|
m_pMessageDialog->setMessage(type, strTitle, strContent);
|
||||||
int nX = (ui->navigationPanel->width() - m_pMessageDialog->width()) * 0.5;
|
int nX = (ui->navigationPanel->width() - m_pMessageDialog->width()) * 0.5;
|
||||||
int nY = ui->navigationPanel->y() + ui->navigationPanel->height() * 0.5;
|
int nY = ui->navigationPanel->y() + ui->navigationPanel->height() * 0.5;
|
||||||
m_pMessageDialog->setGeometry(nX, nY, m_pMessageDialog->width(), m_pMessageDialog->height());
|
m_pMessageDialog->move(nX, nY);
|
||||||
m_pMessageDialog->raise();
|
m_pMessageDialog->raise();
|
||||||
if(type == type_question)
|
if(type == type_question)
|
||||||
m_pMessageDialog->exec();
|
m_pMessageDialog->exec();
|
||||||
|
|
@ -416,7 +438,7 @@ void DashboardFrame::onBtnClicked_addDashboard()
|
||||||
showTransparentMask();
|
showTransparentMask();
|
||||||
int nX = (ui->navigationPanel->width() - m_pDashboardNamingDialog->width()) * 0.5;
|
int nX = (ui->navigationPanel->width() - m_pDashboardNamingDialog->width()) * 0.5;
|
||||||
int nY = ui->navigationPanel->y() + ui->navigationPanel->height() * 0.5;
|
int nY = ui->navigationPanel->y() + ui->navigationPanel->height() * 0.5;
|
||||||
m_pDashboardNamingDialog->setGeometry(nX, nY, m_pDashboardNamingDialog->width(), m_pDashboardNamingDialog->height());
|
m_pDashboardNamingDialog->move(nX, nY);
|
||||||
m_pDashboardNamingDialog->showUsedForCreat();
|
m_pDashboardNamingDialog->showUsedForCreat();
|
||||||
m_pDashboardNamingDialog->raise();
|
m_pDashboardNamingDialog->raise();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,14 @@ DvieMainWindow::~DvieMainWindow()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DvieMainWindow::resizeEvent(QResizeEvent* event)
|
||||||
|
{
|
||||||
|
if(m_pTransparentMask && m_pTransparentMask->isVisible())
|
||||||
|
m_pTransparentMask->setGeometry(ui->topWidget->geometry());
|
||||||
|
|
||||||
|
QMainWindow::resizeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
void DvieMainWindow::showTransparentMask()
|
void DvieMainWindow::showTransparentMask()
|
||||||
{
|
{
|
||||||
if(m_pTransparentMask == nullptr)
|
if(m_pTransparentMask == nullptr)
|
||||||
|
|
@ -34,7 +42,7 @@ void DvieMainWindow::showTransparentMask()
|
||||||
}
|
}
|
||||||
void DvieMainWindow::hideTransparentMask()
|
void DvieMainWindow::hideTransparentMask()
|
||||||
{
|
{
|
||||||
if(m_pTransparentMask != nullptr && m_pTransparentMask->isVisible())
|
if(m_pTransparentMask && m_pTransparentMask->isVisible())
|
||||||
m_pTransparentMask->hide();
|
m_pTransparentMask->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,22 @@ DvieSecondaryWindow::~DvieSecondaryWindow()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DvieSecondaryWindow::closeEvent(QCloseEvent* e)
|
||||||
|
{
|
||||||
|
if(m_pMainWindow)
|
||||||
|
m_pMainWindow->removeSecondartWindow(m_strName);
|
||||||
|
else
|
||||||
|
QMainWindow::closeEvent(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DvieSecondaryWindow::resizeEvent(QResizeEvent* event)
|
||||||
|
{
|
||||||
|
if(m_pTransparentMask && m_pTransparentMask->isVisible())
|
||||||
|
m_pTransparentMask->setGeometry(ui->topWidget->geometry());
|
||||||
|
|
||||||
|
QMainWindow::resizeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
void DvieSecondaryWindow::showTransparentMask()
|
void DvieSecondaryWindow::showTransparentMask()
|
||||||
{
|
{
|
||||||
if(m_pTransparentMask == nullptr)
|
if(m_pTransparentMask == nullptr)
|
||||||
|
|
@ -38,18 +54,10 @@ void DvieSecondaryWindow::showTransparentMask()
|
||||||
}
|
}
|
||||||
void DvieSecondaryWindow::hideTransparentMask()
|
void DvieSecondaryWindow::hideTransparentMask()
|
||||||
{
|
{
|
||||||
if(m_pTransparentMask != nullptr && m_pTransparentMask->isVisible())
|
if(m_pTransparentMask && m_pTransparentMask->isVisible())
|
||||||
m_pTransparentMask->hide();
|
m_pTransparentMask->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DvieSecondaryWindow::closeEvent(QCloseEvent* e)
|
|
||||||
{
|
|
||||||
if(m_pMainWindow)
|
|
||||||
m_pMainWindow->removeSecondartWindow(m_strName);
|
|
||||||
else
|
|
||||||
QMainWindow::closeEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString DvieSecondaryWindow::name()
|
QString DvieSecondaryWindow::name()
|
||||||
{
|
{
|
||||||
return m_strName;
|
return m_strName;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue