mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-07-30 04:38:37 +00:00
优化tool窗口
This commit is contained in:
parent
d4401756a5
commit
373d5b72ed
2 changed files with 7 additions and 3 deletions
|
@ -8,7 +8,7 @@ ToolForm::ToolForm(QWidget* adsorbWidget, AdsorbPositions adsorbPos)
|
||||||
, ui(new Ui::ToolForm)
|
, ui(new Ui::ToolForm)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowFlags(Qt::FramelessWindowHint);
|
setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolForm::~ToolForm()
|
ToolForm::~ToolForm()
|
||||||
|
|
|
@ -11,9 +11,9 @@ MagneticWidget::MagneticWidget(QWidget* adsorbWidget, AdsorbPositions adsorbPos)
|
||||||
, m_adsorbWidget(adsorbWidget)
|
, m_adsorbWidget(adsorbWidget)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_adsorbWidget);
|
Q_ASSERT(m_adsorbWidget);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setParent(m_adsorbWidget);
|
||||||
|
setWindowFlags(windowFlags() | Qt::Tool);
|
||||||
|
|
||||||
connect(m_adsorbWidget, &QWidget::destroyed, this, &QWidget::close);
|
|
||||||
m_adsorbWidget->installEventFilter(this);
|
m_adsorbWidget->installEventFilter(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,10 @@ bool MagneticWidget::eventFilter(QObject *watched, QEvent *event)
|
||||||
if (m_adsorbed && QEvent::Move == event->type()) {
|
if (m_adsorbed && QEvent::Move == event->type()) {
|
||||||
move(m_adsorbWidget->pos() - m_relativePos);
|
move(m_adsorbWidget->pos() - m_relativePos);
|
||||||
}
|
}
|
||||||
|
if (m_adsorbed && (QEvent::Show == event->type() || QEvent::FocusIn == event->type())) {
|
||||||
|
show();
|
||||||
|
raise();
|
||||||
|
}
|
||||||
if (m_adsorbed && QEvent::Resize == event->type()) {
|
if (m_adsorbed && QEvent::Resize == event->type()) {
|
||||||
QRect parentRect;
|
QRect parentRect;
|
||||||
QRect targetRect;
|
QRect targetRect;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue