Skip to content
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

fix: placeholder text horizontalAlignment not work #402

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kegechen
Copy link
Contributor

@kegechen kegechen commented Oct 8, 2024

remove loader

deepin-ci-robot added a commit to linuxdeepin/dtk6declarative that referenced this pull request Oct 8, 2024
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#402
Copy link
Member

@zccrs zccrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有看到哪里有使用 horizontalAlignment

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Oct 8, 2024

Doc Check bot
🟢 Document Coverage Check Passed!

@kegechen
Copy link
Contributor Author

kegechen commented Oct 9, 2024

没有看到哪里有使用 horizontalAlignment

主要是 placeholdertext updateAlignment时 parentitem转换失败。不需要单独设置这个 textfield 里面设置就可以。

TextField {
            placeholderText: qsTr("test here")
            horizontalAlignment: Text.AlignHCenter 
        }
void QQuickPlaceholderText::updateAlignment()
{
    if (QQuickTextInput *input = qobject_cast<QQuickTextInput *>(parentItem())) {  // QQuickLoader
        if (QQuickTextInputPrivate::get(input)->hAlignImplicit)
            resetHAlign();
        else
            setHAlign(static_cast<HAlignment>(input->hAlign()));
    } else if (QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(parentItem())) { // QQuickLoader
        if (QQuickTextEditPrivate::get(edit)->hAlignImplicit)
            resetHAlign();
        else
            setHAlign(static_cast<HAlignment>(edit->hAlign()));
    } else {
        resetHAlign();
    }
}

18202781743
18202781743 previously approved these changes Oct 9, 2024
@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kegechen

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1 similar comment
@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kegechen

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

deepin-ci-robot added a commit to linuxdeepin/dtk6declarative that referenced this pull request Oct 9, 2024
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#402
@deepin-ci-robot
Copy link
Contributor

deepin pr auto review

关键摘要:

  • 移除了Loader组件,改为使用PlaceholderText,这可能会影响性能,需要确认是否有必要。
  • 移除了signal effectiveHorizontalAlignmentChanged,需要确认这一改动是否会影响其他依赖此信号的代码部分。
  • 修改了PlaceholderText组件的visible属性,这可能会影响用户界面,需要确保这是预期的行为。

是否建议立即修改:

  • 是,需要确保性能和依赖关系的改动不会引入新的问题。
  • 是,如果移除signal effectiveHorizontalAlignmentChanged会影响其他代码部分,应该立即修复。
  • 是,如果PlaceholderText组件的visible属性改动未经过充分测试,应该立即进行测试以确保用户界面的正确性。

deepin-ci-robot added a commit to linuxdeepin/dtk6declarative that referenced this pull request Oct 9, 2024
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#402
@@ -30,22 +30,20 @@ T.TextField {
verticalAlignment: TextInput.AlignVCenter
onEffectiveHorizontalAlignmentChanged: placeholder.effectiveHorizontalAlignmentChanged()

Loader {
// use loader will cause placeholdertext horizontalAlignment not work
// see QQuickPlaceholderText::updateAlignment()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里可以写清楚,QQuickPlaceholderText 会假定他的 parent item 是 QQuickText,用了 Loader 会影响它的 parentItem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants