Compare commits

...

17 Commits

Author SHA1 Message Date
github-actions[bot] 05a48ef125 chore: New release 5.7.25
Log:
2025-10-30 14:01:08 +00:00
yeshanshan 81442f521c feat: add support for custom line edit icon margin
Added PM_LineEditIconMargin pixel metric handling to support custom
icon margins in line edit widgets. The implementation checks for a
"_d_dtk_lineeditIconMargin" property on the widget and returns the
custom margin value if valid. This allows applications to specify
precise icon spacing in line edit fields for better UI customization and
visual consistency.

Influence:
1. Test line edit widgets with custom icon margin property set
2. Verify default behavior when no custom margin is specified
3. Test with various valid margin values (positive integers)
4. Verify behavior with invalid margin values (negative numbers, invalid
types)
5. Check UI layout consistency with custom icon margins applied

feat: 添加支持自定义行编辑图标边距

添加了 PM_LineEditIconMargin 像素度量处理,以支持在行编辑部件中自定义图
标边距。该实现检查部件上的 "_d_dtk_lineeditIconMargin" 属性,如果有效则
返回自定义边距值。这允许应用程序为行编辑字段指定精确的图标间距,以实现更
好的 UI 定制和视觉一致性。

Influence:
1. 测试设置了自定义图标边距属性的行编辑部件
2. 验证未指定自定义边距时的默认行为
3. 使用各种有效边距值(正整数)进行测试
4. 验证无效边距值(负数、无效类型)时的行为
5. 检查应用自定义图标边距后的 UI 布局一致性

PMS: BUG-334965
2025-10-28 19:09:04 +08:00
yeshanshan 67dc851fd0 fix: improve dialog sizing and remove unused event filter
1. Enhanced dialog width calculation to respect maximum width constraint
2. Added dynamic height calculation based on layout's total height for
the given width
3. Removed unused event filter for title and message labels that handled
font changes
4. The event filter was unnecessary as Qt's layout system already
handles text wrapping properly

Influence:
1. Test dialog resizing with various content lengths
2. Verify dialog respects maximum width settings
3. Check that text wrapping works correctly in title and message labels
4. Test dialog appearance with different font sizes
5. Ensure dialog maintains minimum size requirements

fix: 改进对话框尺寸计算并移除未使用的事件过滤器

1. 增强对话框宽度计算以遵循最大宽度约束
2. 添加基于布局总高度的动态高度计算
3. 移除用于标题和消息标签字体变化的未使用事件过滤器
4. 该事件过滤器不再必要,因为Qt的布局系统已能正确处理文本换行

Influence:
1. 测试不同内容长度时的对话框调整大小
2. 验证对话框遵循最大宽度设置
3. 检查标题和消息标签中的文本换行是否正确工作
4. 测试不同字体大小下的对话框外观
5. 确保对话框保持最小尺寸要求

PMS: BUG-331061
2025-10-28 08:26:01 +00:00
yeshanshan 04913bf8b4 fix: adjust feature item widget height calculation
Changed setFixedHeight to setMinimumHeight for feature item widgets to
handle varying text content more flexibly. Previously used fixed height
could cause layout issues when description text required more vertical
space than the hardcoded values allowed.

This change ensures that feature items can expand vertically when needed
to accommodate longer descriptions while maintaining the minimum height
requirements for standard content.

Influence:
1. Test feature display dialog with short descriptions (should maintain
original height)
2. Test with longer descriptions that require more vertical space
(should expand properly)
3. Verify layout consistency across different description lengths
4. Check that the minimum height constraints are still respected

fix: 调整特性项目控件高度计算

将特性项目控件的高度设置从固定高度改为最小高度,以更灵活地处理不同长度
的文本内容。之前使用的固定高度在描述文本需要更多垂直空间时可能导致布局
问题。

此更改确保特性项目在需要显示较长描述时可以垂直扩展,同时为标准内容保持最
小高度要求。

Influence:
1. 测试特性显示对话框在短描述时的显示(应保持原有高度)
2. 测试需要更多垂直空间的长描述(应能正确扩展)
3. 验证不同描述长度下的布局一致性
4. 检查最小高度约束是否仍然有效

PMS: BUG-311285
2025-10-23 09:12:25 +00:00
yeshanshan 431d8244b9 fix: handle font change events in dialog
Fix dialog size not updating when system font changes
Add font change event handling to recalculate dialog size
Ensure proper layout when font size or family changes

Influence:
1. Test dialog appearance when system font settings change
2. Verify dialog size adapts correctly to different font sizes
3. Check layout integrity after font changes
4. Test with various font families and sizes

fix: 处理对话框中的字体变更事件

修复系统字体变更时对话框大小不更新的问题
添加字体变更事件处理以重新计算对话框大小
确保字体大小或字体家族变更时的正确布局

Influence:
1. 测试系统字体设置变更时对话框的显示效果
2. 验证对话框大小是否正确适应不同的字体大小
3. 检查字体变更后的布局完整性
4. 测试不同字体家族和大小的显示效果

PMS: BUG-331061
2025-10-23 17:09:31 +08:00
yeshanshan 731810a0b2 fix: correct button order in settings dialog
Fixed incorrect button order in the settings dialog by changing
insertButton index from 1 to 0 for cancel button. This ensures the
cancel button is placed at the correct position in the button layout,
preventing potential UI issues and improving user interface consistency.

Influence:
1. Verify settings dialog button layout is correct
2. Test cancel button functionality in settings dialog
3. Check button accessibility names are properly set
4. Confirm dialog interaction flows work as expected

fix: 修复设置对话框中按钮顺序问题

修复了设置对话框中按钮顺序错误的问题,将取消按钮的insertButton索引从1改
为0。这确保了取消按钮在按钮布局中处于正确位置,防止了潜在的UI问题并提高
了用户界面的一致性。

Influence:
1. 验证设置对话框按钮布局是否正确
2. 测试设置对话框中取消按钮的功能
3. 检查按钮的可访问性名称是否正确设置
4. 确认对话框交互流程正常工作

PMS: BUG-338153
2025-10-23 08:41:46 +00:00
yeshanshan ce163f1bd0 feat: improve navigation widget styling
1. Removed manual palette setting for item background transparency
2. Added item spacing configuration with zero spacing
3. Set background type with rounded background and no normal state
4. These changes simplify the styling approach and use DStyle's built-
in capabilities

Log: Improved navigation widget visual appearance with better spacing
and background styling

Influence:
1. Verify navigation items display correctly with proper spacing
2. Check background rendering in different states (hover, selected)
3. Test navigation selection behavior remains consistent
4. Verify visual consistency with other UI components
5. Test navigation widget in different themes

feat: 改进导航部件样式

1. 移除了手动设置项目背景透明度的调色板配置
2. 添加了零间距的项目间距配置
3. 设置了圆角背景且无正常状态的背景类型
4. 这些更改简化了样式方法,使用 DStyle 的内置功能

Log: 改进了导航部件的视觉外观,具有更好的间距和背景样式

Influence:
1. 验证导航项目是否正确显示,间距合适
2. 检查不同状态(悬停、选中)下的背景渲染
3. 测试导航选择行为是否保持一致
4. 验证与其他UI组件的视觉一致性
5. 测试不同主题下的导航部件显示

PMS: BUG-310829
2025-10-20 02:49:36 +00:00
github-actions[bot] 65ff769712 chore: New release 5.7.24
Log:
2025-10-16 12:12:37 +00:00
transifex-integration[bot] 7676ee45c3 i18n: Translate dtkwidget.ts in sq
100% translated source file: 'dtkwidget.ts'
on 'sq'.
2025-10-16 11:38:17 +00:00
Robertkill 13e07788c3 fix: clear DCi icon state when setting other icon types
Fixed an issue where DCi icon state was not properly cleared
when setting other icon types (QIcon, QStyle::StandardPixmap,
DStyle::StandardPixmap). This could cause incorrect icon rendering when
switching between different icon types.

The changes ensure that when setting a non-DCi icon, the DCi icon state
is properly reset to avoid conflicts between different icon systems.
When setting a DCi icon, the QAbstractButton icon is cleared to prevent
interference.

Log: Fixed icon display issues when switching between different icon
types

Influence:
1. Test switching between QIcon, standard pixmap icons, and DCi icons
2. Verify icons display correctly after type changes
3. Test button appearance in different states (normal, hover, pressed)
4. Check icon rendering consistency across different button types

fix: 设置其他图标类型时正确清除 DCi 图标状态

修复了在设置其他图标类型(QIcon、QStyle::StandardPixmap、
DStyle::StandardPixmap)时未正确清除 DCi 图标状态的问题。这可能导致在不
同图标类型之间切换时出现错误的图标渲染。

这些更改确保在设置非 DCi 图标时,DCi 图标状态被正确重置,以避免不同图
标系统之间的冲突。当设置 DCi 图标时,QAbstractButton 图标被清除以防止
干扰。

Log: 修复在不同图标类型之间切换时的图标显示问题

Influence:
1. 测试在 QIcon、标准像素图标和 DCi 图标之间的切换
2. 验证类型更改后图标正确显示
3. 测试按钮在不同状态(正常、悬停、按下)下的外观
4. 检查不同按钮类型之间的图标渲染一致性

PMS: BUG-337027
2025-10-16 16:02:46 +08:00
ComixHe 93b3065760 feat: support Qt 6.10
Signed-off-by: ComixHe <heyuming@deepin.org>
2025-10-13 14:28:15 +08:00
github-actions[bot] e627358800 chore: New release 5.7.23
Log:
2025-09-25 17:43:26 +08:00
yeshanshan f3907549c0 feat: enhance window effect support detection
Added supportWindowEffect() function to check for both compositing and
blur window capabilities
Updated color picker button enable state to require both composite and
blur window support
Added connection to handle hasBlurWindowChanged signal for dynamic
enable state updates

This change ensures the color picker button is only enabled when both
compositing and blur window effects are supported by the window manager,
providing better user experience by preventing the button from being
enabled in environments where the picker functionality wouldn't work
properly due to missing window effects.

Log: Color picker button now requires both compositing and blur window
support to be enabled

Influence:
1. Test color picker button enable/disable state when changing window
manager compositing settings
2. Verify button state when blur window support is enabled/disabled
3. Test in environments with different window manager capabilities
4. Verify picker functionality works correctly when button is enabled

feat: 增强窗口效果支持检测

新增 supportWindowEffect() 函数检查合成和模糊窗口支持能力
更新颜色选择器按钮启用状态,要求同时具备合成和模糊窗口支持
添加处理 hasBlurWindowChanged 信号的连接,实现动态启用状态更新

此更改确保颜色选择器按钮仅在窗口管理器同时支持合成和模糊窗口效果时启用,
提供更好的用户体验,防止在缺少窗口效果的环境中启用按钮而导致功能无法正常
工作。

Log: 颜色选择器按钮现在需要同时支持合成和模糊窗口效果才能启用

Influence:
1. 测试更改窗口管理器合成设置时颜色选择器按钮的启用/禁用状态
2. 验证模糊窗口支持启用/禁用时的按钮状态
3. 在不同窗口管理器能力的环境中进行测试
4. 验证按钮启用时选择器功能正常工作

PMS: BUG-329555
2025-09-16 19:45:26 +08:00
yeshanshan d08e74d508 fix: fix search icon color inconsistency in DSearchEdit
The search icon button in DSearchEdit had inconsistent foreground
colors because the action button was drawn by Qt without using the
control's palette foreground color. This change replaces QAction with
QWidgetAction to ensure the search icon inherits the correct palette
colors from the parent widget.

Changed QAction to QWidgetAction and created a DIconButton widget as the
default widget for the action. This allows the search icon to properly
inherit the palette foreground color from DSearchEdit instead of using
Qt's default styling. Also updated all visibility control calls to use
defaultWidget()->setVisible() instead of action->setVisible().

Log: Fixed search icon color inconsistency in search edit controls

Influence:
1. Test search edit control in different themes to verify icon color
consistency
2. Verify search icon visibility transitions during focus changes
3. Test search functionality remains unchanged
4. Check accessibility name is preserved for the icon button
5. Verify placeholder text behavior during mode transitions

fix: 修复DSearchEdit中搜索图标颜色不一致问题

DSearchEdit中的搜索图标按钮存在前景色不一致的问题,因为操作按钮由Qt绘
制,没有使用控件的调色板前景色。本次修改将QAction替换为QWidgetAction,确
保搜索图标正确继承父部件的调色板颜色。

将QAction改为QWidgetAction,并创建DIconButton小部件作为操作的
默认小部件。这使得搜索图标能够正确从DSearchEdit继承调色板前景
色,而不是使用Qt的默认样式。同时更新了所有可见性控制调用,使用
defaultWidget()->setVisible()代替action->setVisible()。

Log: 修复搜索编辑控件中搜索图标颜色不一致问题

Influence:
1. 在不同主题下测试搜索编辑控件,验证图标颜色一致性
2. 验证焦点变化时搜索图标可见性转换
3. 测试搜索功能保持不变
4. 检查图标按钮的无障碍名称是否保留
5. 验证模式转换时的占位符文本行为

PMS: BUG-315583
2025-09-11 09:41:42 +08:00
github-actions[bot] 6caffc027f chore: New release 5.7.22
Log:
2025-09-04 20:06:20 +08:00
yeshanshan 5ca6b4261c fix: prevent potential tab index out of bounds crash
Added safety checks to prevent accessing invalid tab indices
1. Added Q_ASSERT(tab) in layoutTab to ensure tab pointer is valid
2. Added d->validIndex(selected) check in paintEvent before accessing
selected tab
3. Prevents crashes when tab index might be out of bounds during layout
or painting operations

fix: 修复标签索引越界可能导致的崩溃问题

添加安全检查防止访问无效的标签索引
1. 在layoutTab中添加Q_ASSERT(tab)确保标签指针有效
2. 在paintEvent中添加d->validIndex(selected)检查,确保在访问选中标签前索
引有效
3. 防止在布局或绘制操作中因标签索引越界而导致崩溃

PMS: BUG-331085
2025-09-02 11:35:08 +08:00
transifex-integration[bot] 26f2baf371
i18n: [dtkwidget] Updates for project Deepin Tool Kit (#681)
* i18n: Translate dtkwidget.ts in ja

70% of minimum 10% translated source file: 'dtkwidget.ts'
on 'ja'.

Sync of partially translated files: 
untranslated content is included with an empty translation 
or source language content depending on file format

* i18n: Translate dtkwidget.ts in pt_BR

100% translated source file: 'dtkwidget.ts'
on 'pt_BR'.

---------

Log:
2025-08-21 16:39:10 +08:00
21 changed files with 162 additions and 48 deletions

View File

@ -5,6 +5,57 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [5.7.25] - 2025-10-30
### Added
- Add support for custom line edit icon margin
### Changed
- Improve navigation widget styling
### Fixed
- Correct button order in settings dialog
- Handle font change events in dialog
- Adjust feature item widget height calculation
- Improve dialog sizing and remove unused event filter
## [5.7.24] - 2025-10-16
### Added
- Support Qt 6.10
### Changed
- Translate dtkwidget.ts in sq
### Fixed
- Clear DCi icon state when setting other icon types
## [5.7.23] - 2025-09-25
### Changed
- Enhance window effect support detection
### Fixed
- Fix search icon color inconsistency in DSearchEdit
## [5.7.22] - 2025-09-04
### Changed
- I18n: [dtkwidget] Updates for project Deepin Tool Kit (#681)
### Fixed
- Prevent potential tab index out of bounds crash
## [5.7.21] - 2025-08-14
### Changed

View File

@ -1 +1 @@
5.7.21
5.7.25

View File

@ -1,6 +1,6 @@
# Maintainer: justforlxz <justforlxz@gmail.com>
pkgname=dtkwidget-git
pkgver=5.7.21
pkgver=5.7.25
pkgrel=1
sourcename=dtkwidget
sourcetars=("$sourcename"_"$pkgver".tar.xz)

24
debian/changelog vendored
View File

@ -1,3 +1,27 @@
dtkwidget (5.7.25) unstable; urgency=medium
* Release 5.7.25
-- yeshanshan <yeshanshan@uniontech.com> Thu, 30 Oct 2025 21:45:45 +0800
dtkwidget (5.7.24) unstable; urgency=medium
* Release 5.7.24
-- yeshanshan <yeshanshan@uniontech.com> Thu, 16 Oct 2025 19:45:32 +0800
dtkwidget (5.7.23) unstable; urgency=medium
* Release 5.7.23
-- yeshanshan <packages@deepin.org> Thu, 25 Sep 2025 16:49:19 +0800
dtkwidget (5.7.22) unstable; urgency=medium
* Release 5.7.22
-- yeshanshan <yeshanshan@uniontech.com> Thu, 04 Sep 2025 19:27:01 +0800
dtkwidget (5.7.21) unstable; urgency=medium
* Release 5.7.21

View File

@ -49,6 +49,13 @@ find_package(PkgConfig REQUIRED)
if("${QT_VERSION_MAJOR}" STREQUAL "5")
find_package(Qt5 REQUIRED COMPONENTS X11Extras)
elseif("${QT_VERSION_MAJOR}" STREQUAL "6")
if (${Qt6Core_VERSION} VERSION_GREATER_EQUAL "6.10.0")
set(QT_NO_PRIVATE_MODULE_WARNING ON)
find_package(Qt6 REQUIRED COMPONENTS GuiPrivate WidgetsPrivate PrintSupportPrivate)
endif()
else()
message(FATAL_ERROR "Unsupported Qt Version: ${QT_VERSION_MAJOR}")
endif()
file(GLOB D_HEADERS "${PROJECT_SOURCE_DIR}/include/DWidget/*")

View File

@ -239,6 +239,7 @@ public:
static void setFrameRadius(QWidget *widget, int radius);
static void setUncheckedItemIndicatorVisible(QWidget *widget, bool visible);
static void setRedPointVisible(QObject *object, bool visible);
static void setLineEditIconMargin(QObject *object, int margin);
static void setShortcutUnderlineVisible(bool visible);
static bool shortcutUnderlineVisible();

View File

@ -1,5 +1,5 @@
Name: dtkwidget
Version: 5.7.21
Version: 5.7.25
Release: 1%{?dist}
Summary: Deepin tool kit widget modules
License: LGPLv3+

View File

@ -659,12 +659,12 @@ SPDX-License-Identifier: LGPL-3.0-or-later
<message>
<location filename="../widgets/dlineedit.cpp" line="526"/>
<source>&amp;Copy</source>
<translation type="unfinished"/>
<translation>(&amp;C)</translation>
</message>
<message>
<location filename="../widgets/dlineedit.cpp" line="529"/>
<source>Cu&amp;t</source>
<translation type="unfinished"/>
<translation>(&amp;T)</translation>
</message>
<message>
<location filename="../widgets/dlineedit.cpp" line="534"/>

View File

@ -659,12 +659,12 @@ SPDX-License-Identifier: LGPL-3.0-or-later
<message>
<location filename="../widgets/dlineedit.cpp" line="526"/>
<source>&amp;Copy</source>
<translation>&amp;Copiar</translation>
<translation>Copiar</translation>
</message>
<message>
<location filename="../widgets/dlineedit.cpp" line="529"/>
<source>Cu&amp;t</source>
<translation>Recor&amp;tar</translation>
<translation>Recortar</translation>
</message>
<message>
<location filename="../widgets/dlineedit.cpp" line="534"/>

View File

@ -506,7 +506,7 @@ SPDX-License-Identifier: LGPL-3.0-or-later
<message>
<location filename="../widgets/dprintpreviewdialog.cpp" line="1470"/>
<source>Input page numbers like this: 1,3,5-7,11-15,18,21</source>
<translation>Numrat e faqeve jepni kështu: 1,3,5-7,11-15,18,21</translation>
<translation>Numrat e faqeve jepini kështu: 1,3,5-7,11-15,18,21</translation>
</message>
<message>
<location filename="../widgets/dprintpreviewdialog.cpp" line="1700"/>

View File

@ -125,6 +125,7 @@ void DButtonBoxButton::setIcon(const QIcon &icon)
D_D(DButtonBoxButton);
d->iconType = -1;
d->dciIcon = DDciIcon();
QAbstractButton::setIcon(icon);
}
@ -140,6 +141,7 @@ void DButtonBoxButton::setIcon(QStyle::StandardPixmap iconType)
D_D(DButtonBoxButton);
d->iconType = iconType;
d->dciIcon = DDciIcon();
QAbstractButton::setIcon(style()->standardIcon(iconType, nullptr, this));
}
@ -154,6 +156,7 @@ void DButtonBoxButton::setIcon(DStyle::StandardPixmap iconType)
{
D_D(DButtonBoxButton);
d->dciIcon = DDciIcon();
d->iconType = iconType;
QAbstractButton::setIcon(DStyleHelper(style()).standardIcon(iconType, nullptr, this));
}
@ -163,6 +166,7 @@ void DButtonBoxButton::setIcon(const DDciIcon &icon)
D_D(DButtonBoxButton);
d->dciIcon = icon;
QAbstractButton::setIcon(QIcon());
}
DDciIcon DButtonBoxButton::dciIcon() const

View File

@ -218,7 +218,10 @@ void DDialogPrivate::updateSize()
if (!q->testAttribute(Qt::WA_Resized)) {
QSize size = q->sizeHint();
size.setWidth(qMax(size.width(), DIALOG::DEFAULT_WIDTH));
size.setWidth(qMin(q->maximumWidth(), qMax(size.width(), DIALOG::DEFAULT_WIDTH)));
if (auto layout = q->layout()) {
size.setHeight(layout->totalHeightForWidth(size.width()));
}
size.setHeight(qMax(size.height(), DIALOG::DEFAULT_HEIGHT));
q->resize(size);
@ -1191,22 +1194,6 @@ void DDialog::keyPressEvent(QKeyEvent *event)
bool DDialog::eventFilter(QObject *watched, QEvent *event)
{
Q_D(DDialog);
if (watched == d->messageLabel || watched == d->titleLabel) {
if (event->type() == QEvent::FontChange) {
QLabel *label = qobject_cast<QLabel *>(watched);
if (label && !label->text().isEmpty() && label->wordWrap()) {
QSize sz = style()->itemTextRect(label->fontMetrics(), label->rect(), Qt::TextWordWrap, false, label->text()).size();
label->setMinimumHeight(qMax(sz.height(), label->sizeHint().height()));
}
}
return false;
}
return DAbstractDialog::eventFilter(watched, event);
}
@ -1220,6 +1207,8 @@ void DDialog::changeEvent(QEvent *event)
}
}
d->updateSize();
} else if (event->type() == QEvent::FontChange) {
d->updateSize();
}
return DAbstractDialog::changeEvent(event);
}

View File

@ -58,7 +58,7 @@ DFeatureItemWidget::DFeatureItemWidget(const QIcon &icon, const QString &name,
setMinimumWidth(360);
auto fontMetrics = m_featureDescriptionLabel->fontMetrics();
auto size = fontMetrics.size(Qt::TextShowMnemonic, description);
setFixedHeight(size.width() <= DefaultTextLineWidth ? 66 : 86);
setMinimumHeight(size.width() <= DefaultTextLineWidth ? 66 : 86);
}
DFeatureItemWidget::~DFeatureItemWidget()

View File

@ -69,6 +69,7 @@ void DIconButton::setIcon(const QIcon &icon)
{
D_D(DIconButton);
d->dciIcon = DDciIcon();
d->iconType = -1;
QAbstractButton::setIcon(icon);
}
@ -82,6 +83,7 @@ void DIconButton::setIcon(QStyle::StandardPixmap iconType)
{
D_D(DIconButton);
d->dciIcon = DDciIcon();
d->iconType = iconType;
QAbstractButton::setIcon(style()->standardIcon(iconType, nullptr, this));
}
@ -95,6 +97,7 @@ void DIconButton::setIcon(DStyle::StandardPixmap iconType)
{
D_D(DIconButton);
d->dciIcon = DDciIcon();
d->iconType = iconType;
QAbstractButton::setIcon(DStyleHelper(style()).standardIcon(iconType, nullptr, this));
}
@ -105,6 +108,7 @@ void DIconButton::setIcon(const DDciIcon &icon)
d->iconType = -1;
d->dciIcon = icon;
QAbstractButton::setIcon(QIcon());
this->update();
this->updateGeometry();
}

View File

@ -66,6 +66,10 @@ void ColorButton::paintEvent(QPaintEvent *)
}
}
static bool supportWindowEffect()
{
return DWindowManagerHelper::instance()->hasComposite() && DWindowManagerHelper::instance()->hasBlurWindow();
}
DPrintPickColorWidget::DPrintPickColorWidget(QWidget *parent)
: DWidget(parent)
, pinterface(nullptr)
@ -115,7 +119,7 @@ void DPrintPickColorWidget::initUI()
pickColorBtn->setFixedSize(55, 36);
pickColorBtn->setIcon(DIconTheme::findQIcon("dorpper_normal"));
pickColorBtn->setIconSize(QSize(32, 32));
pickColorBtn->setEnabled(DWindowManagerHelper::instance()->hasComposite());
pickColorBtn->setEnabled(supportWindowEffect());
rgbPickColorLayout->addWidget(rgbLabel);
rgbPickColorLayout->addWidget(rEdit);
rgbPickColorLayout->addWidget(gEdit);
@ -162,7 +166,10 @@ void DPrintPickColorWidget::initConnection()
connect(valueLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotEditColor(QString)));
connect(DWindowManagerHelper::instance(), &DWindowManagerHelper::hasCompositeChanged, this, [this]() {
this->pickColorBtn->setEnabled(DWindowManagerHelper::instance()->hasComposite());
this->pickColorBtn->setEnabled(supportWindowEffect());
});
connect(DWindowManagerHelper::instance(), &DWindowManagerHelper::hasBlurWindowChanged, this, [this]() {
this->pickColorBtn->setEnabled(supportWindowEffect());
});
}

View File

@ -20,6 +20,7 @@
#endif
#include <QAction>
#include <QWidgetAction>
#include <QPainter>
#include <QDebug>
#include <QLabel>
@ -292,21 +293,27 @@ void DSearchEditPrivate::init()
{
D_Q(DSearchEdit);
label = new QLabel;
DIconButton *iconbtn = new DIconButton(DStyle::SP_IndicatorSearch);
iconbtn->setFlat(true);
iconbtn->setFocusPolicy(Qt::NoFocus);
iconbtn->setAttribute(Qt::WA_TransparentForMouseEvents);
iconbtn->setAccessibleName("DSearchEditIconButton");
auto createSearchIconButton = []() {
DIconButton *iconbtn = new DIconButton(DStyle::SP_IndicatorSearch);
iconbtn->setFlat(true);
iconbtn->setFocusPolicy(Qt::NoFocus);
iconbtn->setAttribute(Qt::WA_TransparentForMouseEvents);
iconbtn->setAccessibleName("DSearchEditIconButton");
iconbtn->setIconSize(QSize(20, 20));
return iconbtn;
};
auto iconbtn = createSearchIconButton();
placeHolder = qApp->translate("DSearchEdit", "Search");
action = new QAction(q);
action = new QWidgetAction(q);
action->setObjectName("_d_search_leftAction");
action->setIcon(DIconTheme::findQIcon("search_indicator"));
auto iconAction = createSearchIconButton();
action->setDefaultWidget(iconAction);
q->lineEdit()->addAction(action, QLineEdit::LeadingPosition);
action->setVisible(false);
iconbtn->setIconSize(QSize(20, 20));
action->defaultWidget()->setVisible(false);
DPalette pe;
QStyleOption opt;
@ -405,7 +412,7 @@ void DSearchEditPrivate::_q_toEditMode(bool focus)
q->lineEdit()->setTextMargins(textMargins);
if (animation->direction() == QPropertyAnimation::Direction::Forward) {
iconWidget->setVisible(false);
action->setVisible(true);
action->defaultWidget()->setVisible(true);
lineEdit->setPlaceholderText(placeholderText);
} else {
iconWidget->setVisible(true);
@ -420,7 +427,7 @@ void DSearchEditPrivate::_q_toEditMode(bool focus)
if (focus) {
animation->setDirection(QPropertyAnimation::Direction::Forward);
} else {
action->setVisible(false);
action->defaultWidget()->setVisible(false);
animation->setDirection(QPropertyAnimation::Direction::Backward);
}
@ -429,11 +436,11 @@ void DSearchEditPrivate::_q_toEditMode(bool focus)
animation->start();
} else {
if (focus || !q->lineEdit()->text().isEmpty()) {
action->setVisible(true);
action->defaultWidget()->setVisible(true);
iconWidget->setVisible(false);
lineEdit->setPlaceholderText(placeholderText);
} else {
action->setVisible(false);
action->defaultWidget()->setVisible(false);
iconWidget->setVisible(true);
lineEdit->setPlaceholderText(QString());
}

View File

@ -70,7 +70,7 @@ public:
setMessage(str);
cancel->setAccessibleName("ChangeDDialogCancelButton");
replace->setAccessibleName("ChangeDDialogReplaceButton");
insertButton(1, cancel);
insertButton(0, cancel);
insertButton(1, replace);
connect(replace, &DSuggestButton::clicked, [ = ] { //替换
auto value = shortcutMap.value(key);

View File

@ -171,6 +171,11 @@ void DStyle::setRedPointVisible(QObject *object, bool visible)
object->setProperty("_d_menu_item_redpoint", visible);
}
void DStyle::setLineEditIconMargin(QObject *object, int margin)
{
object->setProperty("_d_dtk_lineeditIconMargin", margin);
}
void DStyle::setShortcutUnderlineVisible(bool visible)
{
qApp->setProperty("_d_menu_underlineshortcut", visible);
@ -2255,6 +2260,20 @@ int DStyle::pixelMetric(QStyle::PixelMetric m, const QStyleOption *opt, const QW
return 16;
case PM_MenuButtonIndicator:
return DSizeModeHelper::element(8, QCommonStyle::pixelMetric(m, opt, widget));
// since Qt 6.3 or applied patch Add-setting-thc-ICON-size-attribute-in-lineedit-to-the-style-plugin.patch( uos or deepin).
case PM_LineEditIconMargin: {
if (widget) {
const QVariant &margin_value = widget->property("_d_dtk_lineeditIconMargin");
if (margin_value.isValid()) {
bool ok = false;
int margin = margin_value.toInt(&ok);
if (ok && margin >= 0) {
return margin;
}
}
}
Q_FALLTHROUGH();
}
case PM_FloatingButtonFrameMargin:
return 3;
default:

View File

@ -687,6 +687,7 @@ void DTabBarPrivate::layoutTab(int index)
Q_ASSERT(index >= 0);
QTabBarPrivate *d = reinterpret_cast<QTabBarPrivate *>(qGetPtrHelper(d_ptr));
QTabBarPrivate::Tab *tab = d->at(index);
Q_ASSERT(tab);
bool vertical = dtk_verticalTabs(d->shape);
if (!(tab->leftWidget || tab->rightWidget))
@ -1279,7 +1280,7 @@ void DTabBarPrivate::paintEvent(QPaintEvent *e)
}
// Draw the selected tab last to get it "on top"
if (selected >= 0) {
if (selected >= 0 && d->validIndex(selected)) {
QStyleOptionTab tab;
initStyleOption(&tab, selected);
// 强制让文本居中

View File

@ -13,6 +13,7 @@
QT_BEGIN_NAMESPACE
class QAudioInput;
class QWidgetAction;
QT_END_NAMESPACE
DWIDGET_BEGIN_NAMESPACE
@ -32,7 +33,7 @@ public:
void _q_clearFocus();
public:
QAction *action;
QWidgetAction *action;
QString placeHolder;
QString placeholderText;

View File

@ -78,10 +78,6 @@ Navigation::Navigation(QWidget *parent) :
d->navbar->setContentsMargins(0, 0, 0, 0);
d->navbar->setAutoFillBackground(true);
d->navbar->setViewportMargins(10, 0, 10, 0);
DPalette pa = DPaletteHelper::instance()->palette(d->navbar);
pa.setBrush(DPalette::ItemBackground, Qt::transparent);
DPaletteHelper::instance()->setPalette(d->navbar, pa);
d->navbar->setSelectionMode(QListView::SingleSelection);
d->navbar->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@ -92,6 +88,9 @@ Navigation::Navigation(QWidget *parent) :
d->navbar->setEditTriggers(QAbstractItemView::NoEditTriggers);
d->navbar->setItemDelegate(new NavigationDelegate(d->navbar));
d->navbar->setItemSpacing(0);
d->navbar->setBackgroundType(static_cast<DStyledItemDelegate::BackgroundType>(DStyledItemDelegate::RoundedBackground | DStyledItemDelegate::NoNormalState));
layout->addWidget(d->navbar);
connect(d->navbar->selectionModel(), &QItemSelectionModel::currentChanged, this, [=] (const QModelIndex &current) {