Skip to content

Commit

Permalink
sync: from linuxdeepin/dtkwidget
Browse files Browse the repository at this point in the history
Synchronize source files from linuxdeepin/dtkwidget.

Source-pull-request: linuxdeepin/dtkwidget#584
  • Loading branch information
deepin-ci-robot committed Jul 1, 2024
1 parent c0fd6fd commit b9f8517
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
5 changes: 5 additions & 0 deletions src/widgets/dabstractdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ void DAbstractDialogPrivate::init(bool blurIfPossible)
q->setAttribute(Qt::WA_TranslucentBackground, blurIfPossible);
} else if (noTitlebarEnabled()) {
handle = new DPlatformWindowHandle(q, q);

if (!handle->enableBlurWindow()) {
handle->setEnableBlurWindow(true);
}

// fix wayland no titlebar
//q->setWindowFlags(q->windowFlags() | Qt::FramelessWindowHint);
}
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/ddialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,14 @@ void DDialogPrivate::init()
spacer = new QSpacerItem(1, 0);

// MainLayout--TopLayout
mainLayout->setSpacing(0);
mainLayout->addWidget(titleBar, 0, Qt::AlignTop);
mainLayout->addWidget(contentWidget);
mainLayout->setContentsMargins(QMargins(0, 0, 0, 0));

// MainLayout--ButtonLayout
buttonLayout = new QHBoxLayout;
buttonLayout->setSpacing(5);
buttonLayout->setContentsMargins(DIALOG::BUTTON_LAYOUT_LEFT_MARGIN,
DIALOG::BUTTON_LAYOUT_TOP_MARGIN,
DIALOG::BUTTON_LAYOUT_RIGHT_MARGIN,
Expand Down
20 changes: 12 additions & 8 deletions src/widgets/dmessagemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,21 @@ template<typename IconType>
static void sendMessage_helper(DMessageManager *manager, QWidget *par, IconType icon, const QString &message)
{
QWidget *content = par->findChild<QWidget *>(D_MESSAGE_MANAGER_CONTENT, Qt::FindDirectChildrenOnly);
int text_message_count = 0;

for (DFloatingMessage *message : content->findChildren<DFloatingMessage*>(QString(), Qt::FindDirectChildrenOnly)) {
if (message->messageType() == DFloatingMessage::TransientType) {
++text_message_count;
if (content) {
int text_message_count = 0;

for (DFloatingMessage *message : content->findChildren<DFloatingMessage *>(QString(), Qt::FindDirectChildrenOnly)) {
if (message->messageType() == DFloatingMessage::TransientType) {
++text_message_count;
}
}
}

// TransientType 类型的通知消息,最多只允许同时显示三个
if (text_message_count >= 3)
return;
// TransientType 类型的通知消息,最多只允许同时显示三个
if (text_message_count >= 3) {
return;
}
}

DFloatingMessage *floMsg = new DFloatingMessage(DFloatingMessage::TransientType);
floMsg->setAttribute(Qt::WA_DeleteOnClose);
Expand Down

0 comments on commit b9f8517

Please sign in to comment.