Skip to content

Commit

Permalink
feat: add window title
Browse files Browse the repository at this point in the history
Change-Id: Id6fa05e97f61c81cb6b020e089f5adb27f196dc7
  • Loading branch information
Iceyer authored and deepin-gerrit committed Jan 17, 2018
1 parent 779d620 commit e7cffb0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/widgets/dabstractdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
#include <QScreen>
#include <QPainter>
#include <QWidget>
#include <QLabel>
#include <QDebug>

#include "anchors.h"
#include "dialog_constants.h"
#include "dabstractdialog.h"
#include "private/dabstractdialogprivate_p.h"
Expand Down Expand Up @@ -61,6 +63,13 @@ void DAbstractDialogPrivate::init()
// });
}

windowTitle = new QLabel(q);
windowTitle->setAlignment(Qt::AlignCenter);
AnchorsBase::setAnchor(windowTitle, Qt::AnchorHorizontalCenter, q, Qt::AnchorHorizontalCenter);
q->connect(q,&QWidget::windowTitleChanged, windowTitle,[=](const QString &title){
windowTitle->setText(title);
});

q->setWindowFlags(q->windowFlags() | Qt::FramelessWindowHint | Qt::WindowCloseButtonHint);

q->setAttribute(Qt::WA_TranslucentBackground);
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/private/dabstractdialogprivate_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <DObjectPrivate>

class QLabel;
class QBoxLayout;

DWIDGET_BEGIN_NAMESPACE
Expand All @@ -48,6 +49,7 @@ class DAbstractDialogPrivate : public DTK_CORE_NAMESPACE::DObjectPrivate
QColor borderColor;
DAbstractDialog::DisplayPosition displayPosition = DAbstractDialog::Center;

QLabel* windowTitle = Q_NULLPTR;
DPlatformWindowHandle *handle = Q_NULLPTR;
DBlurEffectWidget *bgBlurWidget = Q_NULLPTR;

Expand Down

0 comments on commit e7cffb0

Please sign in to comment.