Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add dbus window visible property and changed signal #167

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions dde-clipboard/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,4 +423,16 @@ void MainWindow::paintEvent(QPaintEvent *e)
pen.setColor(innerBorderNewColor);
p.setPen(pen);
p.drawRoundedRect(rect(), m_cornerRadius, m_cornerRadius);
}

void MainWindow::showEvent(QShowEvent *event)
{
Q_EMIT clipboardVisibleChanged(true);
QWidget::showEvent(event);
}

void MainWindow::hideEvent(QHideEvent *event)
{
Q_EMIT clipboardVisibleChanged(false);
QWidget::hideEvent(event);
}
7 changes: 7 additions & 0 deletions dde-clipboard/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public Q_SLOTS:
void Show();
void Hide();

Q_SIGNALS: // SIGNALS
void clipboardVisibleChanged(bool visible);

private Q_SLOTS:
/*!
* \~chinese \name geometryChanged
Expand All @@ -104,6 +107,8 @@ private Q_SLOTS:

void registerMonitor();

bool clipboardVisible() const { return isVisible(); }

private:
/*!
* \~chinese \name initUI
Expand Down Expand Up @@ -140,6 +145,8 @@ private Q_SLOTS:
* \~chinese \brief 重写mouseMoveEvent事件禁止窗口被移动
*/
virtual void mouseMoveEvent(QMouseEvent *event) override;
void showEvent(QShowEvent *event) override;
void hideEvent(QHideEvent *event) override;

private:
DBusDisplay *m_displayInter;
Expand Down
5 changes: 5 additions & 0 deletions dde-clipboard/org.deepin.dde.Clipboard1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
</method>
<method name="Hide">
</method>
<property name="clipboardVisible" access="read" type="b">
</property>
<signal name="clipboardVisibleChanged">
<arg type="b" name="visible"/>
</signal>
</interface>
</node>
Loading