我现在的具体问题与我在 Qt Designer 中创建的大约 4,800 行 .ui
文件有关,我需要在其中进行一些基本的重构(重命名小部件)。我通过 pyside-uic 将 .ui 文件转换为 python 文件。我已经仔细阅读了 Qt Designer 文档,足以以 95% 的把握说服自己,不可能从 < em>Qt Designer 本身。例如:
Step 1) Find 'pushButton'
Step 2) Replace with 'btn'
Step 3) Result is, i.e., 'pushButtonFooBarFooBar' gets renamed 'btnFooBarFooBar'
我的第一个希望在于 Qt Designer 文档搜索中剩余 5% 的不确定性。如果我错过了提供此功能的东西,我会很高兴。我将放弃使用脚本和/或文本编辑器寻找更复杂的解决方案。从大局来看,如果我在大约 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 是一个文本文件,因此非常欢迎您在您喜欢的编辑器中进行文本搜索和替换。例如。使用正则表达式将 "pushButton([a-zA-Z0-9_$]*)"
替换为 "btn$1"
。
不幸的是,Qt Creator 不提供正则表达式捕获替换功能,但其他编辑器肯定提供。
关于python - Qt Designer 或关联的 Qt 工具是否具有针对 xml 格式的 *.ui 文件的全局查找和替换功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41627591/