diff --git a/examples/collections/mainwindow.cpp b/examples/collections/mainwindow.cpp index 0be5165af..3f9a08de0 100644 --- a/examples/collections/mainwindow.cpp +++ b/examples/collections/mainwindow.cpp @@ -168,13 +168,18 @@ MainWindow::MainWindow(QWidget *parent) m_pStackedWidget = new QStackedWidget; m_pListViewModel = new QStandardItemModel(this); - m_pListView = new DListView(this); + QWidget *pw = new QWidget(this); + m_pListView = new DListView(pw); m_pListView->setFixedWidth(200); m_pListView->setItemSpacing(0); m_pListView->setModel(m_pListViewModel); + m_pListView->setViewportMargins(0, 0, 10, 0); - setSidebarWidget(m_pListView); - setSidebarWidth(200); + QHBoxLayout *hlay = new QHBoxLayout(pw); + hlay->setContentsMargins(10, 0, 10, 0); + hlay->addWidget(m_pListView); + setSidebarWidget(pw); + setSidebarWidth(210); // mainLayout->addWidget(m_pListView); diff --git a/src/widgets/daboutdialog.cpp b/src/widgets/daboutdialog.cpp index a2d0411fd..e593cd23d 100644 --- a/src/widgets/daboutdialog.cpp +++ b/src/widgets/daboutdialog.cpp @@ -32,7 +32,7 @@ DCORE_USE_NAMESPACE DWIDGET_BEGIN_NAMESPACE -const QString DAboutDialogPrivate::websiteLinkTemplate = "%2"; +const QString DAboutDialogPrivate::websiteLinkTemplate = "%2"; DRedPointLabel::DRedPointLabel(QWidget *parent) : QLabel(parent) @@ -62,25 +62,31 @@ void DAboutDialogPrivate::init() { D_Q(DAboutDialog); - q->setMaximumWidth(540); + q->setFixedSize(540, 290); // overwrite default info if distribution config file existed. loadDistributionInfo(); logoLabel = new QLabel(); logoLabel->setContentsMargins(0, 0, 0, 0); + logoLabel->setAlignment(Qt::AlignCenter); productNameLabel = new QLabel(); + productNameLabel->setForegroundRole(QPalette::BrightText); productNameLabel->setObjectName("ProductNameLabel"); + productNameLabel->setWordWrap(true); + productNameLabel->setAlignment(Qt::AlignCenter); DFontSizeManager *fontManager = DFontSizeManager::instance(); - fontManager->bind(productNameLabel, DFontSizeManager::T5, QFont::DemiBold); + fontManager->bind(productNameLabel, DFontSizeManager::T5, QFont::Medium); versionLabel = new QLabel(); versionLabel->setObjectName("VersionLabel"); - fontManager->bind(versionLabel, DFontSizeManager::T8, QFont::DemiBold); + versionLabel->setForegroundRole(QPalette::BrightText); + fontManager->bind(versionLabel, DFontSizeManager::T8, QFont::Medium); companyLogoLabel = new QLabel(); companyLogoLabel->setPixmap(loadPixmap(logoPath)); + companyLogoLabel->hide(); websiteLabel = new QLabel(); websiteLabel->setObjectName("WebsiteLabel"); @@ -89,24 +95,26 @@ void DAboutDialogPrivate::init() updateWebsiteLabel(); descriptionLabel = new QLabel(); + descriptionLabel->setForegroundRole(QPalette::BrightText); descriptionLabel->setFixedWidth(280); descriptionLabel->setObjectName("DescriptionLabel"); descriptionLabel->setAlignment(Qt::AlignLeft); descriptionLabel->setWordWrap(true); descriptionLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - fontManager->bind(descriptionLabel, DFontSizeManager::T8, QFont::DemiBold); + fontManager->bind(descriptionLabel, DFontSizeManager::T8, QFont::Medium); licenseLabel = new QLabel(); - licenseLabel->setFixedWidth(180); licenseLabel->setObjectName("LicenseLabel"); - licenseLabel->setAlignment(Qt::AlignHCenter); licenseLabel->setWordWrap(true); + licenseLabel->setForegroundRole(QPalette::BrightText); + licenseLabel->setFixedWidth(280); + licenseLabel->setAlignment(Qt::AlignLeft); licenseLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + fontManager->bind(licenseLabel, DFontSizeManager::T8, QFont::Medium); licenseLabel->hide(); - fontManager->bind(licenseLabel, DFontSizeManager::T10, QFont::Medium); QLabel *versionTipLabel = new QLabel(QObject::tr("Version")); - fontManager->bind(versionTipLabel, DFontSizeManager::T10, QFont::Normal); + fontManager->bind(versionTipLabel, DFontSizeManager::T10, QFont::Thin); featureLabel = new QLabel(websiteLinkTemplate.arg(websiteLink).arg(QObject::tr("Features"))); featureLabel->setContextMenuPolicy(Qt::NoContextMenu); featureLabel->setOpenExternalLinks(false); @@ -123,17 +131,22 @@ void DAboutDialogPrivate::init() vFeatureLayout->addWidget(redPointLabel, 0, Qt::AlignLeft); vFeatureLayout->addStretch(0); QLabel *homePageTipLabel = new QLabel(QObject::tr("Homepage")); - fontManager->bind(homePageTipLabel, DFontSizeManager::T10, QFont::Normal); + fontManager->bind(homePageTipLabel, DFontSizeManager::T10, QFont::Thin); QLabel *descriptionTipLabel = new QLabel(QObject::tr("Description")); - fontManager->bind(descriptionTipLabel, DFontSizeManager::T10, QFont::Normal); + fontManager->bind(descriptionTipLabel, DFontSizeManager::T10, QFont::Thin); acknowledgementTipLabel = new QLabel(QObject::tr("Acknowledgements")); - fontManager->bind(acknowledgementTipLabel, DFontSizeManager::T10, QFont::Normal); + fontManager->bind(acknowledgementTipLabel, DFontSizeManager::T10, QFont::Thin); + licenseTipLabel = new QLabel(QObject::tr("License")); + fontManager->bind(licenseTipLabel, DFontSizeManager::T10, QFont::Thin); + licenseTipLabel->hide(); + acknowledgementLabel = new QLabel(QObject::tr("Sincerely appreciate the open-source software used.")); + acknowledgementLabel->setForegroundRole(QPalette::BrightText); acknowledgementLabel->setFixedWidth(280); acknowledgementLabel->setWordWrap(true); acknowledgementLabel->setContextMenuPolicy(Qt::NoContextMenu); acknowledgementLabel->setOpenExternalLinks(false); - fontManager->bind(acknowledgementLabel, DFontSizeManager::T8, QFont::DemiBold); + fontManager->bind(acknowledgementLabel, DFontSizeManager::T8, QFont::Medium); q->connect(websiteLabel, SIGNAL(linkActivated(QString)), q, SLOT(_q_onLinkActivated(QString))); q->connect(featureLabel, SIGNAL(linkActivated(QString)), q, SLOT(_q_onFeatureActivated(QString))); @@ -141,19 +154,30 @@ void DAboutDialogPrivate::init() q->connect(licenseLabel, SIGNAL(linkActivated(QString)), q, SLOT(_q_onLinkActivated(QString))); q->connect(acknowledgementLabel, SIGNAL(linkActivated(QString)), q, SLOT(_q_onLicenseActivated(QString))); + QScrollArea *productNameScrollArea = new QScrollArea; + productNameScrollArea->setMaximumHeight(50); + productNameScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff); + productNameScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff); + QPalette scrollPalette; + + scrollPalette.setBrush(QPalette::Window, Qt::transparent); + productNameScrollArea->setFrameShape(QFrame::NoFrame); + productNameScrollArea->setWidget(productNameLabel); + productNameScrollArea->setWidgetResizable(true); + productNameScrollArea->setPalette(scrollPalette); + QVBoxLayout *leftVLayout = new QVBoxLayout; - leftVLayout->setContentsMargins(10, 3, 0, 10); - leftVLayout->setSpacing(0); - leftVLayout->addWidget(logoLabel, 0, Qt::AlignCenter); + leftVLayout->setContentsMargins(0, 10, 0, 0); + leftVLayout->addWidget(logoLabel); leftVLayout->addSpacing(8); - leftVLayout->addWidget(productNameLabel, 0, Qt::AlignCenter); - leftVLayout->addStretch(0); - leftVLayout->addWidget(companyLogoLabel, 0, Qt::AlignCenter); + leftVLayout->addWidget(productNameScrollArea); + leftVLayout->addSpacing(16); + leftVLayout->addWidget(companyLogoLabel); leftVLayout->addSpacing(3); - leftVLayout->addWidget(licenseLabel, 0, Qt::AlignHCenter); + leftVLayout->addStretch(0); QVBoxLayout *rightVLayout = new QVBoxLayout; - rightVLayout->setContentsMargins(0, 3, 20, 10); + rightVLayout->setContentsMargins(0, 0, 10, 0); rightVLayout->setSpacing(0); rightVLayout->addWidget(versionTipLabel, 0, Qt::AlignLeft); rightVLayout->addWidget(versionLabel, 0, Qt::AlignLeft); @@ -167,27 +191,35 @@ void DAboutDialogPrivate::init() rightVLayout->addSpacing(10); rightVLayout->addWidget(acknowledgementTipLabel, 0, Qt::AlignLeft); rightVLayout->addWidget(acknowledgementLabel, 0, Qt::AlignLeft); + rightVLayout->addSpacing(10); + rightVLayout->addWidget(licenseTipLabel, 0, Qt::AlignLeft); + rightVLayout->addWidget(licenseLabel, 0, Qt::AlignLeft); rightVLayout->addStretch(0); + QScrollArea *rightScrollArea = new QScrollArea; + rightScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff); + rightScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff); + QWidget *rightContent = new QWidget; + rightContent->setLayout(rightVLayout); + + rightScrollArea->setFrameShape(QFrame::NoFrame); + rightScrollArea->setWidget(rightContent); + rightScrollArea->setWidgetResizable(true); + rightScrollArea->setPalette(scrollPalette); + QHBoxLayout *mainLayout = new QHBoxLayout; - mainLayout->setSpacing(0); mainLayout->setContentsMargins(0, 0, 0, 0); - mainLayout->addLayout(leftVLayout); - mainLayout->addSpacing(29); - mainLayout->addLayout(rightVLayout); + mainLayout->setSpacing(0); + mainLayout->setMargin(0); + mainLayout->addLayout(leftVLayout, 2); + mainLayout->addSpacing(20); + mainLayout->addWidget(rightScrollArea, 3); - QScrollArea *mainScrollArea = new QScrollArea; QWidget *mainContent = new QWidget; - QPalette scrollPalette; - - scrollPalette.setBrush(QPalette::Window, Qt::transparent); - mainScrollArea->setFrameShape(QFrame::NoFrame); - mainScrollArea->setWidget(mainContent); - mainScrollArea->setWidgetResizable(true); - mainScrollArea->setPalette(scrollPalette); mainContent->setLayout(mainLayout); - q->addContent(mainScrollArea); + q->addContent(mainContent); + q->setContentsMargins(0, 0, 0, 10); DConfig config("org.deepin.dtk.preference"); bool isUpdated = config.value("featureUpdated", false).toBool(); @@ -540,6 +572,7 @@ void DAboutDialog::setLicense(const QString &license) d->licenseLabel->setText(license); d->licenseLabel->setVisible(!license.isEmpty()); + d->licenseTipLabel->setVisible(!license.isEmpty()); } void DAboutDialog::keyPressEvent(QKeyEvent *event) diff --git a/src/widgets/dblureffectwidget.cpp b/src/widgets/dblureffectwidget.cpp index 3f14fd20c..d08625c6d 100644 --- a/src/widgets/dblureffectwidget.cpp +++ b/src/widgets/dblureffectwidget.cpp @@ -134,7 +134,7 @@ QColor DBlurEffectWidgetPrivate::getMaskColor(const QColor &baseColor) const int maskAlpha = this->getMaskColorAlpha(); - if (!isBehindWindowBlendMode() || DWindowManagerHelper::instance()->hasComposite()) { + if (!isBehindWindowBlendMode() || DWindowManagerHelper::instance()->hasBlurWindow()) { color.setAlpha(maskAlpha); } else { return ct == DGuiApplicationHelper::DarkType ? "#202020" : "#D2D2D2"; @@ -158,7 +158,7 @@ void DBlurEffectWidgetPrivate::setMaskColor(const QColor &color) maskColor = color; if (isBehindWindowBlendMode()) { - maskColor.setAlpha(DWindowManagerHelper::instance()->hasComposite() ? getMaskColorAlpha() : MASK_COLOR_ALPHA_DEFAULT); + maskColor.setAlpha(DWindowManagerHelper::instance()->hasBlurWindow() ? getMaskColorAlpha() : MASK_COLOR_ALPHA_DEFAULT); } D_Q(DBlurEffectWidget); diff --git a/src/widgets/dlineedit.cpp b/src/widgets/dlineedit.cpp index ebb377e07..20bec0b79 100644 --- a/src/widgets/dlineedit.cpp +++ b/src/widgets/dlineedit.cpp @@ -341,6 +341,7 @@ void DLineEdit::setEchoMode(QLineEdit::EchoMode mode) { D_D(DLineEdit); d->lineEdit->setEchoMode(mode); + d->updateFont(); } /*! @@ -667,6 +668,8 @@ bool DLineEdit::eventFilter(QObject *watched, QEvent *event) event->accept(); pLineEdit->setFocus(); return true; + } else if (event->type() == QEvent::FontChange) { + d->updateFont(); } // if (d->frame) @@ -702,7 +705,22 @@ DLineEditPrivate::DLineEditPrivate(DLineEdit *q) void DLineEditPrivate::updateTooltipPos() { - //control->updateTooltipPos(); +} + +void DLineEditPrivate::updateFont() +{ + Q_Q(DLineEdit); + + if (lineEdit->echoMode() == QLineEdit::Password) { + QFont passwordFont = lineEdit->font(); + passwordFont.setPixelSize(6); + passwordFont.setLetterSpacing(passwordFont.letterSpacingType(), 200); + lineEdit->setFont(passwordFont); + qWarning() << "1111111111"; + } else { + lineEdit->setFont(q->font()); + qWarning() << "0000000000"; + } } void DLineEditPrivate::init() @@ -714,6 +732,7 @@ void DLineEditPrivate::init() q->setFocusProxy(lineEdit); // fix DlineEdit setFocut but lineEdit can not edit(without focus rect) q->setFocusPolicy(lineEdit->focusPolicy()); + control = new DAlertControl(lineEdit, q); q->connect(control, &DAlertControl::alertChanged, q, &DLineEdit::alertChanged); @@ -732,6 +751,8 @@ void DLineEditPrivate::init() q->connect(lineEdit, &QLineEdit::returnPressed, q, &DLineEdit::returnPressed); q->connect(lineEdit, &QLineEdit::editingFinished, q, &DLineEdit::editingFinished); q->connect(lineEdit, &QLineEdit::selectionChanged, q, &DLineEdit::selectionChanged); + + updateFont(); } DWIDGET_END_NAMESPACE diff --git a/src/widgets/dmainwindow.cpp b/src/widgets/dmainwindow.cpp index 7d638c2bc..1ea2bc8fb 100644 --- a/src/widgets/dmainwindow.cpp +++ b/src/widgets/dmainwindow.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #ifdef Q_OS_MAC @@ -148,11 +149,11 @@ void DMainWindowPrivate::_q_autoShowFeatureDialog() \class Dtk::Widget::DMainWindow \inmodule dtkwidget \brief The DMainWindow class provides a main application window. - + A main window provides a framework for building an application's user interface. DMainWindow has its own layout compared to QMainWindow, it has only title bar and content area, simpler and cleaner. - + Developers can provide customized title bar and content to make the application rich functional. */ @@ -203,28 +204,45 @@ void DMainWindow::setSidebarWidget(QWidget *widget) return; d->sidebarWidget = widget; - d->sidebarWidget->setAutoFillBackground(true); - d->sidebarWidget->setBackgroundRole(DPalette::Button); if (!d->sidebarHelper) { d->sidebarHelper = new DSidebarHelper(this); d->titlebar->setSidebarHelper(d->sidebarHelper); QToolBar *tb = new QToolBar(this); + d->sidebarSep = new DVerticalLine(this); + d->sidebarSep->setWindowFlag(Qt::WindowStaysOnTopHint); + d->sidebarSep->setLineWidth(1); + d->sidebarSep->raise(); + DAnchorsBase::setAnchor(d->sidebarSep, Qt::AnchorRight, tb, Qt::AnchorRight); + + tb->layout()->setMargin(0); tb->setMovable(false); - tb->setForegroundRole(QPalette::Base); auto *contentAction = tb->toggleViewAction(); contentAction->setVisible(false); addToolBar(Qt::LeftToolBarArea, tb); - widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - tb->addWidget(widget); - widget->resize(tb->size()); + d->sidebarWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + + setAttribute(Qt::WA_TranslucentBackground); + auto bgBlurWidget = new DBlurEffectWidget(this); + bgBlurWidget->setBlendMode(DBlurEffectWidget::BehindWindowBlend); + bgBlurWidget->setMaskColor(DBlurEffectWidget::AutoColor); + bgBlurWidget->setObjectName("sidebarBlurWidget"); + bgBlurWidget->setMaskAlpha(229); // 90% + + QVBoxLayout *vlay = new QVBoxLayout(bgBlurWidget); + vlay->setContentsMargins(0, 0, 0, 0); + vlay->addWidget(d->sidebarWidget); + tb->addWidget(bgBlurWidget); + d->sidebarWidget->resize(tb->size()); connect(d->sidebarHelper, &DSidebarHelper::widthChanged, tb, &QToolBar::setFixedWidth); connect(d->sidebarHelper, &DSidebarHelper::expandChanged, this, [tb, d] (bool expanded) { tb->setVisible(expanded); + d->sidebarSep->setVisible(expanded); d->updateTitleShadowGeometry(); }); connect(d->sidebarHelper, &DSidebarHelper::visibleChanged, tb, [tb, d] { tb->setVisible(d->sidebarHelper->sectionVisible()); + d->sidebarSep->setVisible(d->sidebarHelper->sectionVisible()); d->updateTitleShadowGeometry(); }); @@ -295,7 +313,7 @@ void DMainWindow::setSidebarExpanded(bool expended) /*! \brief DMainWindow::isDXcbWindow \return Whether this window is dxcb backended. - + Many features like blurred background and window clipping are supported only if the window is using the dxcb Qt platform plugin. */ @@ -399,10 +417,10 @@ QColor DMainWindow::shadowColor() const /*! \property DMainWindow::clipPath \brief This property holds the custom QPainterPath to be used to clip the window. - + By default DMainWindow is clipped as a corner-rounded rectangle, but you can supply a custom QPainterPath to do custom shaped window. - + \sa DMainWindow::frameMask */ QPainterPath DMainWindow::clipPath() const @@ -419,7 +437,7 @@ QPainterPath DMainWindow::clipPath() const /*! \property DMainWindow::frameMask \brief This property holds the mask to be applied on the window. - + For better clip quality, for example antialiasing, use property DMainWindow::clipPath instead. */ @@ -463,9 +481,9 @@ bool DMainWindow::translucentBackground() const /*! \brief DMainWindow::enableSystemResize \return This property holds whether the window can be resized by the user. - + The default value of this property is true. - + You can set this property to false and implement the resize polizy of this window by you self. */ @@ -483,9 +501,9 @@ bool DMainWindow::enableSystemResize() const /*! \property DMainWindow::enableSystemMove \brief This property holds whether the window can be moved by the user. - + The default value of this property is true. - + You can set this property to false and choose the effective area to drag and move. */ bool DMainWindow::enableSystemMove() const @@ -517,10 +535,10 @@ bool DMainWindow::enableBlurWindow() const /*! \property DMainWindow::autoInputMaskByClipPath \brief This property holds whether the user input is masked by the clip path. - + Sometimes you may want to handle events happening in the areas that are visually clipped by the setting DMainWindow::clipPath. - + The default value of this property is true. */ bool DMainWindow::autoInputMaskByClipPath() const @@ -818,6 +836,8 @@ void DMainWindow::resizeEvent(QResizeEvent *event) if (sidebarWidget()) { sidebarWidget()->resize(d->tb->size()); + d->sidebarSep->resize({1, rect().height()}); + d->sidebarSep->raise(); } return QMainWindow::resizeEvent(event); } diff --git a/src/widgets/dpasswordedit.cpp b/src/widgets/dpasswordedit.cpp index ba1b05d2a..fc740f475 100644 --- a/src/widgets/dpasswordedit.cpp +++ b/src/widgets/dpasswordedit.cpp @@ -127,7 +127,7 @@ void DPasswordEditPrivate::init() { D_Q(DPasswordEdit); - q->lineEdit()->setEchoMode(QLineEdit::Password); + q->DLineEdit::setEchoMode(QLineEdit::Password); q->lineEdit()->setAttribute(Qt::WA_InputMethodEnabled, false); QList list; diff --git a/src/widgets/dslider.cpp b/src/widgets/dslider.cpp index caad9b052..e0692ea41 100644 --- a/src/widgets/dslider.cpp +++ b/src/widgets/dslider.cpp @@ -820,6 +820,10 @@ void SliderStrip::paintEvent(QPaintEvent *event) if (scaleInfo.isEmpty()) return; + auto elidedText = [this](const QString &text, int width) { + return fontMetrics().elidedText(text, Qt::ElideRight, width); + }; + if (orient == Qt::Horizontal) { width -= 2 * offsetSize + margin * 2; startX += offsetSize + margin; @@ -837,7 +841,7 @@ void SliderStrip::paintEvent(QPaintEvent *event) pa.setPen(penLine); pa.drawLine(QPointF(startX, startY), QPointF(endX, endY)); pa.setPen(penNumber); - pa.drawText(QRectF(endX, textPos, width, height - tickSize), Qt::AlignLeft, scaleInfo[0]); + pa.drawText(QRectF(endX, textPos, width, height - tickSize), Qt::AlignLeft, elidedText(scaleInfo[0], width / paragraph)); for (int i = 1; i < paragraph - 1; i++) { startX += average; @@ -845,7 +849,7 @@ void SliderStrip::paintEvent(QPaintEvent *event) pa.setPen(penLine); pa.drawLine(QPointF(startX, startY), QPointF(endX, endY)); pa.setPen(penNumber); - pa.drawText(QRectF(endX - width / 2, textPos, width, height - tickSize), Qt::AlignHCenter, scaleInfo[i]); + pa.drawText(QRectF(endX - width / 2, textPos, width, height - tickSize), Qt::AlignHCenter, elidedText(scaleInfo[i], width / paragraph)); } if (paragraph > 1) { @@ -854,7 +858,7 @@ void SliderStrip::paintEvent(QPaintEvent *event) pa.setPen(penLine); pa.drawLine(QPointF(startX, startY), QPointF(endX, endY)); pa.setPen(penNumber); - pa.drawText(QRectF(endX - width, textPos, width, height - tickSize), Qt::AlignRight, scaleInfo[paragraph - 1]); + pa.drawText(QRectF(endX - width, textPos, width, height - tickSize), Qt::AlignRight, elidedText(scaleInfo[paragraph - 1], width / paragraph)); } } else { startY = offsetSize + margin; @@ -877,7 +881,7 @@ void SliderStrip::paintEvent(QPaintEvent *event) pa.setPen(penLine); pa.drawLine(QPointF(startX, startY), QPointF(endX, endY)); pa.setPen(penNumber); - pa.drawText(QRectF(textPos, endY - average / 2 + offsetSize / 2, width - tickSize, average), text_flags, scaleInfo[0]); + pa.drawText(QRectF(textPos, endY - average / 2 + offsetSize / 2, width - tickSize, average), text_flags, elidedText(scaleInfo[0], width - tickSize)); for (int i = 1; i < paragraph - 1; i++) { startY += average; @@ -885,7 +889,7 @@ void SliderStrip::paintEvent(QPaintEvent *event) pa.setPen(penLine); pa.drawLine(QPointF(startX, startY), QPointF(endX, endY)); pa.setPen(penNumber); - pa.drawText(QRectF(textPos, endY - average / 2, width - tickSize, average), text_flags, scaleInfo[i]); + pa.drawText(QRectF(textPos, endY - average / 2, width - tickSize, average), text_flags, elidedText(scaleInfo[i], width - tickSize)); } if (paragraph > 1) { @@ -894,7 +898,7 @@ void SliderStrip::paintEvent(QPaintEvent *event) pa.setPen(penLine); pa.drawLine(QPointF(startX, startY), QPointF(endX, endY)); pa.setPen(penNumber); - pa.drawText(QRectF(textPos, endY - average / 2 - offsetSize / 2, width - tickSize, average), text_flags, scaleInfo[paragraph - 1]); + pa.drawText(QRectF(textPos, endY - average / 2 - offsetSize / 2, width - tickSize, average), text_flags, elidedText(scaleInfo[paragraph - 1], width - tickSize)); } } } diff --git a/src/widgets/dstyle.cpp b/src/widgets/dstyle.cpp index be1059cb3..a3704478b 100644 --- a/src/widgets/dstyle.cpp +++ b/src/widgets/dstyle.cpp @@ -178,7 +178,7 @@ void DStyle::setShortcutUnderlineVisible(bool visible) static inline bool hasConfig(const QString &key, bool fallback = false) { - DConfig config("org.deepin.dtk.preference"); + static DConfig config("org.deepin.dtk.preference"); return config.value(key, fallback).toBool(); } diff --git a/src/widgets/dtitlebar.cpp b/src/widgets/dtitlebar.cpp index 7a17ed5ad..29f529f9f 100644 --- a/src/widgets/dtitlebar.cpp +++ b/src/widgets/dtitlebar.cpp @@ -1272,19 +1272,27 @@ void DTitlebar::setSidebarHelper(DSidebarHelper *helper) d->expandButton = new DIconButton(this); d->expandButton->setIcon(DDciIcon::fromTheme("window_sidebar")); d->expandButton->setIconSize(QSize(DefaultExpandButtonHeight(), DefaultExpandButtonHeight())); - d->expandButton->setCheckable(true); - d->expandButton->setChecked(true); d->expandButton->setFlat(true); d->sidebarBackgroundWidget = new QWidget(this); + QHBoxLayout *hlay = new QHBoxLayout(d->sidebarBackgroundWidget); + hlay->setMargin(0); + auto bgBlurWidget = new DBlurEffectWidget(d->sidebarBackgroundWidget); + bgBlurWidget->setObjectName("titlebarBlurWidget"); + bgBlurWidget->setBlendMode(DBlurEffectWidget::BehindWindowBlend); + bgBlurWidget->setMaskColor(DBlurEffectWidget::AutoColor); + bgBlurWidget->setMaskAlpha(229); // 90% + hlay->addWidget(bgBlurWidget); + d->sidebarBackgroundWidget->setAccessibleName("SidebarBackgroundWidget"); d->sidebarBackgroundWidget->setAutoFillBackground(true); d->sidebarBackgroundWidget->setBackgroundRole(DPalette::Button); d->sidebarBackgroundWidget->move(pos()); d->sidebarBackgroundWidget->lower(); d->leftLayout->addWidget(d->expandButton, 0, Qt::AlignLeft); - connect(d->expandButton, &DIconButton::clicked, [this, d] (bool isExpanded) { - d->sidebarHelper->setExpanded(isExpanded); + connect(d->expandButton, &DIconButton::clicked, [this, d] (bool) { + bool isExpanded = d->sidebarHelper->expanded(); + d->sidebarHelper->setExpanded(!isExpanded); int x = isExpanded ? d->sidebarHelper->width() : 0; d->separator->move(x, height() - d->separator->height()); }); diff --git a/src/widgets/private/daboutdialog_p.h b/src/widgets/private/daboutdialog_p.h index ff660d4b2..b0006c65a 100644 --- a/src/widgets/private/daboutdialog_p.h +++ b/src/widgets/private/daboutdialog_p.h @@ -41,6 +41,7 @@ class DAboutDialogPrivate : public DDialogPrivate QLabel *productNameLabel = nullptr; QLabel *versionLabel = nullptr; QLabel *descriptionLabel = nullptr; + QLabel *licenseTipLabel = nullptr; QLabel *licenseLabel = nullptr; QLabel *companyLogoLabel = nullptr; QLabel *websiteLabel = nullptr; diff --git a/src/widgets/private/dlineedit_p.h b/src/widgets/private/dlineedit_p.h index 7bf7c096b..8e8c87852 100644 --- a/src/widgets/private/dlineedit_p.h +++ b/src/widgets/private/dlineedit_p.h @@ -23,6 +23,7 @@ class DLineEditPrivate : public DTK_CORE_NAMESPACE::DObjectPrivate public: DLineEditPrivate(DLineEdit *q); void updateTooltipPos(); + void updateFont(); void init(); diff --git a/src/widgets/private/dmainwindow_p.h b/src/widgets/private/dmainwindow_p.h index f954dfd75..a56bd44aa 100644 --- a/src/widgets/private/dmainwindow_p.h +++ b/src/widgets/private/dmainwindow_p.h @@ -9,6 +9,7 @@ #include #include +#include #include class QShortcut; @@ -118,6 +119,7 @@ class DMainWindowPrivate : public DTK_CORE_NAMESPACE::DObjectPrivate DSidebarHelper *sidebarHelper = nullptr; QWidget *sidebarWidget = nullptr; QToolBar *tb = nullptr; + DVerticalLine *sidebarSep = nullptr; private: D_DECLARE_PUBLIC(DMainWindow)