chore: 格式化ElaWidgetTools代码
This commit is contained in:
@@ -10,9 +10,7 @@
|
||||
#include <QTimer>
|
||||
#include <QVBoxLayout>
|
||||
Q_TAKEOVER_NATIVEEVENT_CPP(ElaDialog, d_func()->_appBar);
|
||||
ElaDialog::ElaDialog(QWidget* parent)
|
||||
: QDialog{parent}, d_ptr(new ElaDialogPrivate())
|
||||
{
|
||||
ElaDialog::ElaDialog(QWidget *parent) : QDialog{parent}, d_ptr(new ElaDialogPrivate()) {
|
||||
Q_D(ElaDialog);
|
||||
d->q_ptr = this;
|
||||
resize(500, 500); // 默认宽高
|
||||
@@ -27,7 +25,8 @@ ElaDialog::ElaDialog(QWidget* parent)
|
||||
// 自定义AppBar
|
||||
d->_appBar = new ElaAppBar(this);
|
||||
d->_appBar->setIsStayTop(true);
|
||||
d->_appBar->setWindowButtonFlags(ElaAppBarType::StayTopButtonHint | ElaAppBarType::MinimizeButtonHint | ElaAppBarType::MaximizeButtonHint | ElaAppBarType::CloseButtonHint);
|
||||
d->_appBar->setWindowButtonFlags(ElaAppBarType::StayTopButtonHint | ElaAppBarType::MinimizeButtonHint | ElaAppBarType::MaximizeButtonHint |
|
||||
ElaAppBarType::CloseButtonHint);
|
||||
connect(d->_appBar, &ElaAppBar::routeBackButtonClicked, this, &ElaDialog::routeBackButtonClicked);
|
||||
connect(d->_appBar, &ElaAppBar::navigationButtonClicked, this, &ElaDialog::navigationButtonClicked);
|
||||
connect(d->_appBar, &ElaAppBar::themeChangeButtonClicked, this, &ElaDialog::themeChangeButtonClicked);
|
||||
@@ -48,63 +47,46 @@ ElaDialog::ElaDialog(QWidget* parent)
|
||||
eApp->syncWindowDisplayMode(this);
|
||||
}
|
||||
|
||||
ElaDialog::~ElaDialog()
|
||||
{
|
||||
eApp->syncWindowDisplayMode(this, false);
|
||||
}
|
||||
ElaDialog::~ElaDialog() { eApp->syncWindowDisplayMode(this, false); }
|
||||
|
||||
void ElaDialog::setIsStayTop(bool isStayTop)
|
||||
{
|
||||
void ElaDialog::setIsStayTop(bool isStayTop) {
|
||||
Q_D(ElaDialog);
|
||||
d->_appBar->setIsStayTop(isStayTop);
|
||||
}
|
||||
|
||||
bool ElaDialog::getIsStayTop() const
|
||||
{
|
||||
return d_ptr->_appBar->getIsStayTop();
|
||||
}
|
||||
bool ElaDialog::getIsStayTop() const { return d_ptr->_appBar->getIsStayTop(); }
|
||||
|
||||
void ElaDialog::setIsFixedSize(bool isFixedSize)
|
||||
{
|
||||
void ElaDialog::setIsFixedSize(bool isFixedSize) {
|
||||
Q_D(ElaDialog);
|
||||
d->_appBar->setIsFixedSize(isFixedSize);
|
||||
}
|
||||
|
||||
bool ElaDialog::getIsFixedSize() const
|
||||
{
|
||||
return d_ptr->_appBar->getIsFixedSize();
|
||||
}
|
||||
bool ElaDialog::getIsFixedSize() const { return d_ptr->_appBar->getIsFixedSize(); }
|
||||
|
||||
void ElaDialog::setIsDefaultClosed(bool isDefaultClosed)
|
||||
{
|
||||
void ElaDialog::setIsDefaultClosed(bool isDefaultClosed) {
|
||||
Q_D(ElaDialog);
|
||||
d->_appBar->setIsDefaultClosed(isDefaultClosed);
|
||||
Q_EMIT pIsDefaultClosedChanged();
|
||||
}
|
||||
|
||||
bool ElaDialog::getIsDefaultClosed() const
|
||||
{
|
||||
bool ElaDialog::getIsDefaultClosed() const {
|
||||
Q_D(const ElaDialog);
|
||||
return d->_appBar->getIsDefaultClosed();
|
||||
}
|
||||
|
||||
void ElaDialog::setAppBarHeight(int appBarHeight)
|
||||
{
|
||||
void ElaDialog::setAppBarHeight(int appBarHeight) {
|
||||
Q_D(ElaDialog);
|
||||
d->_appBar->setAppBarHeight(appBarHeight);
|
||||
Q_EMIT pAppBarHeightChanged();
|
||||
}
|
||||
|
||||
int ElaDialog::getAppBarHeight() const
|
||||
{
|
||||
int ElaDialog::getAppBarHeight() const {
|
||||
Q_D(const ElaDialog);
|
||||
return d->_appBar->getAppBarHeight();
|
||||
}
|
||||
|
||||
void ElaDialog::moveToCenter()
|
||||
{
|
||||
if (isMaximized() || isFullScreen())
|
||||
{
|
||||
void ElaDialog::moveToCenter() {
|
||||
if (isMaximized() || isFullScreen()) {
|
||||
return;
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
@@ -115,25 +97,19 @@ void ElaDialog::moveToCenter()
|
||||
setGeometry((geometry.left() + geometry.right() - width()) / 2, (geometry.top() + geometry.bottom() - height()) / 2, width(), height());
|
||||
}
|
||||
|
||||
void ElaDialog::setWindowButtonFlag(ElaAppBarType::ButtonType buttonFlag, bool isEnable)
|
||||
{
|
||||
void ElaDialog::setWindowButtonFlag(ElaAppBarType::ButtonType buttonFlag, bool isEnable) {
|
||||
Q_D(ElaDialog);
|
||||
d->_appBar->setWindowButtonFlag(buttonFlag, isEnable);
|
||||
}
|
||||
|
||||
void ElaDialog::setWindowButtonFlags(ElaAppBarType::ButtonFlags buttonFlags)
|
||||
{
|
||||
void ElaDialog::setWindowButtonFlags(ElaAppBarType::ButtonFlags buttonFlags) {
|
||||
Q_D(ElaDialog);
|
||||
d->_appBar->setWindowButtonFlags(buttonFlags);
|
||||
}
|
||||
|
||||
ElaAppBarType::ButtonFlags ElaDialog::getWindowButtonFlags() const
|
||||
{
|
||||
return d_ptr->_appBar->getWindowButtonFlags();
|
||||
}
|
||||
ElaAppBarType::ButtonFlags ElaDialog::getWindowButtonFlags() const { return d_ptr->_appBar->getWindowButtonFlags(); }
|
||||
|
||||
void ElaDialog::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
void ElaDialog::paintEvent(QPaintEvent *event) {
|
||||
Q_D(ElaDialog);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 3) && QT_VERSION <= QT_VERSION_CHECK(6, 6, 1))
|
||||
if (d->_windowDisplayMode != ElaApplicationType::WindowDisplayMode::ElaMica)
|
||||
|
||||
Reference in New Issue
Block a user