不久前,我在编写程序时开始学习PyQt,并面临一个问题:
如何制作活动文件或项目的列表?
当您打开PyCharm、Sublime Text甚至Notepad时,您可以在顶部看到当前打开工作的文件列表。
是否可以使用PyQt来实现这一点?如果可以,如何实现?
这样的小部件应该打开、关闭和显示其内部的任何程序元素
更新:
我们目前拥有的:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>Dynamic Software, Dynamic Aerospace</author>
<class>IIC</class>
<widget class="QMainWindow" name="IIC">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>IIC - (демо версия)</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="File">
<property name="title">
<string>Файл</string>
</property>
<addaction name="New"/>
<addaction name="Open"/>
<addaction name="RecentFile"/>
<addaction name="separator"/>
<addaction name="Close"/>
<addaction name="CloseAll"/>
<addaction name="separator"/>
<addaction name="Save"/>
<addaction name="SaveAs"/>
<addaction name="Export"/>
<addaction name="separator"/>
<addaction name="Preview"/>
<addaction name="Print"/>
<addaction name="separator"/>
<addaction name="Send"/>
<addaction name="separator"/>
<addaction name="InformationDocument"/>
<addaction name="separator"/>
<addaction name="Exit"/>
</widget>
<widget class="QMenu" name="Edit">
<property name="title">
<string>Правка</string>
</property>
<addaction name="Undo"/>
<addaction name="Redo"/>
<addaction name="separator"/>
<addaction name="RepeatLastCommand"/>
<addaction name="separator"/>
<addaction name="Cut"/>
<addaction name="Copy"/>
<addaction name="Paste"/>
<addaction name="Delete"/>
<addaction name="separator"/>
<addaction name="Scale"/>
</widget>
<widget class="QMenu" name="Settings">
<property name="title">
<string>Настройки</string>
</property>
<addaction name="RestoreLicenses"/>
<addaction name="ReceiveLicensesIIC"/>
<addaction name="separator"/>
<addaction name="Parameters"/>
<addaction name="LoadParameters"/>
<addaction name="SaveParameters"/>
</widget>
<widget class="QMenu" name="Apps">
<property name="title">
<string>Приложения</string>
</property>
<addaction name="AddApps"/>
<addaction name="Configurator"/>
</widget>
<widget class="QMenu" name="Window">
<property name="title">
<string>Окно</string>
</property>
<addaction name="CloseCurrentWindow"/>
</widget>
<widget class="QMenu" name="Help">
<property name="title">
<string>Справка</string>
</property>
<addaction name="Content"/>
<addaction name="separator"/>
<addaction name="TrainingMaterials"/>
<addaction name="separator"/>
<addaction name="IICOnInternet"/>
<addaction name="separator"/>
<addaction name="LicenseAgreement"/>
<addaction name="AboutProgram"/>
</widget>
<widget class="QMenu" name="Decoration">
<property name="title">
<string>Оформление</string>
</property>
<addaction name="StyleLibrary"/>
<addaction name="separator"/>
<addaction name="CreateReport"/>
<addaction name="EditTemplateReport"/>
<addaction name="CreateTemplateReport"/>
</widget>
<widget class="QMenu" name="Analysis">
<property name="title">
<string>Анализ</string>
</property>
<addaction name="AnalysisInjector"/>
<addaction name="OptimizationInjector"/>
<addaction name="separator"/>
<addaction name="CustomExpressions"/>
</widget>
<addaction name="File"/>
<addaction name="Edit"/>
<addaction name="Analysis"/>
<addaction name="Decoration"/>
<addaction name="Settings"/>
<addaction name="Apps"/>
<addaction name="Window"/>
<addaction name="Help"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="New">
<property name="text">
<string>Новый</string>
</property>
</action>
<action name="Open">
<property name="text">
<string>Открыть</string>
</property>
</action>
<action name="RecentFile">
<property name="text">
<string>Последние файлы</string>
</property>
</action>
<action name="Save">
<property name="text">
<string>Сохранить</string>
</property>
</action>
<action name="SaveAs">
<property name="text">
<string>Сохранить как</string>
</property>
</action>
<action name="action_PDF">
<property name="text">
<string>.PDF</string>
</property>
</action>
<action name="action_TXT">
<property name="text">
<string>.TXT</string>
</property>
</action>
<action name="Export">
<property name="text">
<string>Экспортировать</string>
</property>
</action>
<action name="Print">
<property name="text">
<string>Печать</string>
</property>
</action>
<action name="Exit">
<property name="text">
<string>Выход</string>
</property>
</action>
<action name="Undo">
<property name="text">
<string>Отменить</string>
</property>
</action>
<action name="Redo">
<property name="text">
<string>Повторить</string>
</property>
</action>
<action name="Cut">
<property name="text">
<string>Вырезать</string>
</property>
</action>
<action name="Copy">
<property name="text">
<string>Копировать</string>
</property>
</action>
<action name="Paste">
<property name="text">
<string>Вставить</string>
</property>
</action>
<action name="action_6">
<property name="text">
<string>Дублировать</string>
</property>
</action>
<action name="Delete">
<property name="text">
<string>Удалить</string>
</property>
</action>
<action name="Scale">
<property name="text">
<string>Масштабировать</string>
</property>
</action>
<action name="RestoreLicenses">
<property name="text">
<string>Восстановить лицензии</string>
</property>
</action>
<action name="ReceiveLicensesIIC">
<property name="text">
<string>Получить лицензию на IIC</string>
</property>
</action>
<action name="Parameters">
<property name="text">
<string>Параметры</string>
</property>
</action>
<action name="LoadParameters">
<property name="text">
<string>Загрузить параметры</string>
</property>
</action>
<action name="SaveParameters">
<property name="text">
<string>Сохранить параметры</string>
</property>
</action>
<action name="AddApps">
<property name="text">
<string>Добавить приложение</string>
</property>
</action>
<action name="Configurator">
<property name="text">
<string>Конфигуратор</string>
</property>
</action>
<action name="CloseCurrentWindow">
<property name="text">
<string>Закрыть текущую вкладку</string>
</property>
</action>
<action name="Content">
<property name="text">
<string>Содержание</string>
</property>
</action>
<action name="TrainingMaterials">
<property name="text">
<string>Обучающие материалы</string>
</property>
</action>
<action name="IICOnInternet">
<property name="text">
<string>IIC в интернете</string>
</property>
</action>
<action name="LicenseAgreement">
<property name="text">
<string>Лицензионное соглашение</string>
</property>
</action>
<action name="AboutProgram">
<property name="text">
<string>О программе</string>
</property>
</action>
<action name="InformationDocument">
<property name="text">
<string>Информация о документе</string>
</property>
</action>
<action name="Send">
<property name="text">
<string>Отправить</string>
</property>
</action>
<action name="Close">
<property name="text">
<string>Закрыть</string>
</property>
</action>
<action name="CloseAll">
<property name="text">
<string>Закрыть все документы</string>
</property>
</action>
<action name="Preview">
<property name="text">
<string>Предварительный просмотр</string>
</property>
</action>
<action name="RepeatLastCommand">
<property name="text">
<string>Повторить последнюю команду</string>
</property>
</action>
<action name="StyleLibrary">
<property name="text">
<string>Библиотека стилей</string>
</property>
</action>
<action name="CreateReport">
<property name="text">
<string>Создать отчет</string>
</property>
</action>
<action name="EditTemplateReport">
<property name="text">
<string>Редактировать шаблон отчета</string>
</property>
</action>
<action name="CreateTemplateReport">
<property name="text">
<string>Создать шаблон отчета</string>
</property>
</action>
<action name="AnalysisInjector">
<property name="text">
<string>Анализ форсунки</string>
</property>
</action>
<action name="OptimizationInjector">
<property name="text">
<string>Оптимизация форсунки</string>
</property>
</action>
<action name="CustomExpressions">
<property name="text">
<string>Пользовательские выражения</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>
为了清晰起见,截图:


我不太确定我是否正确理解了你的意思,但尝试检查一个可能的选项:
将您的.ui表单转换为.py:
pyuic5 q1592407.ui -o q1592407_ui.py -x执行main.py:
。