提交代码:

1、修改样式
2、实现输出到窗口
This commit is contained in:
halliday2023 2024-02-11 21:08:12 +08:00
parent 2768b29c70
commit ebeca8f6f4
4 changed files with 90 additions and 14 deletions

View File

@ -1,13 +1,14 @@
# -*- coding:utf-8 -*-
import sys
from pathlib import Path
from PySide6.QtWidgets import QApplication, QMessageBox
from PySide6.QtUiTools import loadUiType
from PySide6 import QtWidgets,QtCore
# 定义公共路径
path = Path(__file__)
ui_dir = path.parent.parent / "ui"
ui_file_patch = ui_dir / "ui_main.ui"
ui_file_patch = path.parent.parent / "ui" / "ui_main.ui"
# 从文件中加载UI定义
formType, baseType = loadUiType(str(ui_file_patch))
@ -18,7 +19,25 @@ class Window(formType, baseType):
super(Window, self).__init__()
self.setupUi(self)
# 输出设置
self.Log_Output.document().setMaximumBlockCount(100)
self.Log_Output.ensureCursorVisible()
@QtCore.Slot()
def start(self):
self.Log_Output.append('点击了开始按钮')
@QtCore.Slot()
def stop(self):
self.Log_Output.append('点击了停止按钮')
@QtCore.Slot()
def conntest(self):
self.Log_Output.append('点击了测试连接按钮')
def handleCalc(self):
pass

View File

@ -4,10 +4,14 @@ import sys
from GUIWindows import Window
from PySide6.QtWidgets import QApplication
from PySide6 import QtWidgets
if __name__ == '__main__':
app = QApplication([])
app.setStyle("Fusion")
# 样式
# print(QtWidgets.QStyleFactory.keys())
# print(app.style().name())
win = Window()
win.show()
sys.exit(app.exec())

View File

@ -3,4 +3,4 @@ faker==19.12.0
schedule==1.2.1
JPype1==1.4.1
JayDeBeApi==1.2.3
pyside6==6.6.1

View File

@ -24,7 +24,7 @@
</rect>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="file_tab">
<attribute name="title">
@ -50,7 +50,7 @@
<property name="geometry">
<rect>
<x>90</x>
<y>70</y>
<y>80</y>
<width>201</width>
<height>31</height>
</rect>
@ -60,7 +60,7 @@
<property name="geometry">
<rect>
<x>90</x>
<y>110</y>
<y>130</y>
<width>201</width>
<height>31</height>
</rect>
@ -83,8 +83,8 @@
<property name="geometry">
<rect>
<x>20</x>
<y>70</y>
<width>81</width>
<y>80</y>
<width>61</width>
<height>31</height>
</rect>
</property>
@ -96,8 +96,8 @@
<property name="geometry">
<rect>
<x>20</x>
<y>110</y>
<width>81</width>
<y>130</y>
<width>61</width>
<height>31</height>
</rect>
</property>
@ -589,5 +589,58 @@
</hint>
</hints>
</connection>
<connection>
<sender>startButton</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>start()</slot>
<hints>
<hint type="sourcelabel">
<x>98</x>
<y>526</y>
</hint>
<hint type="destinationlabel">
<x>153</x>
<y>523</y>
</hint>
</hints>
</connection>
<connection>
<sender>stopButton</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>stop()</slot>
<hints>
<hint type="sourcelabel">
<x>431</x>
<y>531</y>
</hint>
<hint type="destinationlabel">
<x>492</x>
<y>515</y>
</hint>
</hints>
</connection>
<connection>
<sender>conn_Button</sender>
<signal>clicked()</signal>
<receiver>MainWindow</receiver>
<slot>conntest()</slot>
<hints>
<hint type="sourcelabel">
<x>82</x>
<y>269</y>
</hint>
<hint type="destinationlabel">
<x>287</x>
<y>528</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>start()</slot>
<slot>stop()</slot>
<slot>conntest()</slot>
</slots>
</ui>