-
Notifications
You must be signed in to change notification settings - Fork 60
fix(notification): improve combobox width calculation and styling #1449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. | ||
| // SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd. | ||
| // | ||
| // SPDX-License-Identifier: GPL-3.0-or-later | ||
|
|
||
|
|
@@ -141,12 +141,35 @@ Control { | |
| Layout.maximumWidth: 200 | ||
| Layout.alignment: Qt.AlignHCenter | ||
| sourceComponent: ComboBox { | ||
| id: comboBox | ||
| padding: 0 | ||
| rightPadding: 4 | ||
| property var expandActions: actions.slice(1) | ||
| textRole: "text" | ||
| implicitHeight: 30 | ||
| implicitWidth: 160 | ||
| model: expandActions | ||
| activeFocusOnTab: false | ||
|
|
||
| TextMetrics { | ||
| id: textMetrics | ||
| font: comboBox.font | ||
| text: comboBox.displayText | ||
| } | ||
|
|
||
| implicitWidth: Math.min(200, textMetrics.width + comboBox.padding + comboBox.rightPadding + 28) | ||
|
|
||
| indicator: DciIcon { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dtk的样式不适用这里的么?我看bug单子上说样式不一样,主要是背景吧,这里是主要修指示器? |
||
| x: comboBox.width - width - comboBox.rightPadding | ||
|
Comment on lines
+161
to
+162
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue: Indicator positioning may not respect layout mirroring / RTL setups. The manual |
||
| y: comboBox.topPadding + (comboBox.availableHeight - height) / 2 | ||
| sourceSize.width: DS.Style.comboBox.iconSize | ||
| sourceSize.height: DS.Style.comboBox.iconSize | ||
| palette: DTK.makeIconPalette(comboBox.palette) | ||
| name: "arrow_ordinary_down" | ||
| mode: comboBox.D.ColorSelector.controlState | ||
| theme: comboBox.D.ColorSelector.controlTheme | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comboBox.D.ColorSelector.controlTheme |
||
| fallbackToQIcon: false | ||
| } | ||
|
|
||
| Keys.onBacktabPressed: function(event) { | ||
| // Go back to first action button | ||
| if (firstActionBtn.enabled) { | ||
|
|
@@ -164,6 +187,7 @@ Control { | |
| } | ||
| delegate: NotifyActionButton { | ||
| required property int index | ||
| padding: 0 | ||
| width: parent.width | ||
| actionData: expandActions[index] | ||
| activeFocusOnTab: false | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TextMetrics 可以设置最大显示宽度吧,