Qt Designer 或关联的 Qt 工具是否具有 xml 格式的 *.ui 文件的全局查找和替换功能?
Does Qt Designer or associated Qt tool have a global find-and-replace functionality for the xml formatted *.ui files?
我现在的具体问题与我在 Qt Designer 中创建的大约 4,800 行 .ui
文件有关,我需要在其中进行一些基本的重构(重命名小部件)。我通过 pyside-uic
将 .ui
文件转换为 python 文件。我已经仔细阅读了 Qt Designer 文档,足以让自己以 95% 的把握确信不可能对小部件名称或部分名称进行全局查找和替换,来自 Qt Designer 本身。例如:
Step 1) Find 'pushButton'
Step 2) Replace with 'btn'
Step 3) Result is, i.e., 'pushButtonFooBarFooBar' gets renamed 'btnFooBarFooBar'
我的第一个希望在于我对 Qt Designer 的文档搜索中剩下的 5% 的不确定性。如果我错过了提供此功能的东西,我会很高兴。我将放弃使用脚本 and/or 文本编辑器寻找更精细的解决方案。总的来说,如果我在大约 4,800 行代码之前更好地计划我的命名方案,我现在就不会遇到这个问题了。
所以我的问题简单来说就是:
Is there a global find-and-replace functionality within Qt Designer or
associated Qt tools, and if so how is it invoked?
Is there a global find-and-replace functionality within Qt Designer or associated Qt tools, and if so how is it invoked?
没有。但由于 XML 是一个文本文件,我们非常欢迎您在自己喜欢的编辑器中编辑文本 search-and-replace。例如。使用正则表达式将 "pushButton([a-zA-Z0-9_$]*)"
替换为 "btn"
.
不幸的是,Qt Creator 不提供正则表达式捕获替换功能,但其他编辑器肯定有。
我现在的具体问题与我在 Qt Designer 中创建的大约 4,800 行 .ui
文件有关,我需要在其中进行一些基本的重构(重命名小部件)。我通过 pyside-uic
将 .ui
文件转换为 python 文件。我已经仔细阅读了 Qt Designer 文档,足以让自己以 95% 的把握确信不可能对小部件名称或部分名称进行全局查找和替换,来自 Qt Designer 本身。例如:
Step 1) Find 'pushButton'
Step 2) Replace with 'btn'
Step 3) Result is, i.e., 'pushButtonFooBarFooBar' gets renamed 'btnFooBarFooBar'
我的第一个希望在于我对 Qt Designer 的文档搜索中剩下的 5% 的不确定性。如果我错过了提供此功能的东西,我会很高兴。我将放弃使用脚本 and/or 文本编辑器寻找更精细的解决方案。总的来说,如果我在大约 4,800 行代码之前更好地计划我的命名方案,我现在就不会遇到这个问题了。
所以我的问题简单来说就是:
Is there a global find-and-replace functionality within Qt Designer or associated Qt tools, and if so how is it invoked?
Is there a global find-and-replace functionality within Qt Designer or associated Qt tools, and if so how is it invoked?
没有。但由于 XML 是一个文本文件,我们非常欢迎您在自己喜欢的编辑器中编辑文本 search-and-replace。例如。使用正则表达式将 "pushButton([a-zA-Z0-9_$]*)"
替换为 "btn"
.
不幸的是,Qt Creator 不提供正则表达式捕获替换功能,但其他编辑器肯定有。