mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-22 19:02:17 +08:00
用stackedWidget实现导航栏
This commit is contained in:
parent
2472d3bce2
commit
5275a6aa91
@ -4,12 +4,12 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="update readme">
|
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="重构一些class,删除一些不必要的文件">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/app/DataBase/data.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/DataBase/data.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/app/Ui/mainview.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/mainview.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/app/Ui/MyComponents/Contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/MyComponents/Contact.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/app/Ui/mainwindow.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/mainwindow.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contact.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/app/Ui/mainwindow.ui" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/mainwindow.ui" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/app/person.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/person.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/main.spec" beforeDir="false" afterPath="$PROJECT_DIR$/main.spec" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -445,7 +445,14 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1698681328723</updated>
|
<updated>1698681328723</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="36" />
|
<task id="LOCAL-00036" summary="重构一些class,删除一些不必要的文件">
|
||||||
|
<created>1698765961025</created>
|
||||||
|
<option name="number" value="00036" />
|
||||||
|
<option name="presentableId" value="LOCAL-00036" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1698765961025</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="37" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="UnknownFeatures">
|
<component name="UnknownFeatures">
|
||||||
@ -500,7 +507,8 @@
|
|||||||
<MESSAGE value="增加几个图标" />
|
<MESSAGE value="增加几个图标" />
|
||||||
<MESSAGE value="修改部分UI" />
|
<MESSAGE value="修改部分UI" />
|
||||||
<MESSAGE value="update readme" />
|
<MESSAGE value="update readme" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="update readme" />
|
<MESSAGE value="重构一些class,删除一些不必要的文件" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="重构一些class,删除一些不必要的文件" />
|
||||||
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
|
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
|
||||||
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
|
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
|
||||||
</component>
|
</component>
|
||||||
|
@ -33,21 +33,15 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
self.setAttribute(Qt.WA_AttributeCount)
|
self.setAttribute(Qt.WA_AttributeCount)
|
||||||
|
|
||||||
self.chatView = chat.ChatController(self.Me, parent=None)
|
self.chatView = chat.ChatController(self.Me, parent=None)
|
||||||
self.chatView.setVisible(False)
|
|
||||||
# self.chatView.setLayout()
|
|
||||||
self.lay = QHBoxLayout()
|
self.lay = QHBoxLayout()
|
||||||
self.frame_main.setLayout(self.lay)
|
self.page_chat.setLayout(self.lay)
|
||||||
self.lay.addWidget(self.chatView)
|
self.lay.addWidget(self.chatView)
|
||||||
# self.frame_main.setLayout(self.chatView)
|
|
||||||
# self.frame_main.setLayout()
|
|
||||||
self.contactView = contact.ContactController(self.Me, parent=None)
|
|
||||||
self.contactView.setVisible(False)
|
|
||||||
self.lay0 = QHBoxLayout()
|
|
||||||
self.frame_main.setLayout(self.lay0)
|
|
||||||
self.lay.addWidget(self.contactView)
|
|
||||||
|
|
||||||
# self.myinfoView = userinfo.MyinfoController(self.Me, parent=self.frame_main)
|
self.contactView = contact.ContactController(self.Me, parent=None)
|
||||||
# self.myinfoView.setVisible(False)
|
self.lay0 = QHBoxLayout()
|
||||||
|
self.page_contact.setLayout(self.lay0)
|
||||||
|
self.lay0.addWidget(self.contactView)
|
||||||
|
|
||||||
self.btn_chat.clicked.connect(self.chat_view) # 聊天按钮
|
self.btn_chat.clicked.connect(self.chat_view) # 聊天按钮
|
||||||
self.btn_contact.clicked.connect(self.contact_view)
|
self.btn_contact.clicked.connect(self.contact_view)
|
||||||
# self.btn_myinfo.clicked.connect(self.myInfo)
|
# self.btn_myinfo.clicked.connect(self.myInfo)
|
||||||
@ -58,7 +52,6 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
self.last_btn = None
|
self.last_btn = None
|
||||||
self.lastView = None
|
self.lastView = None
|
||||||
self.show_avatar()
|
self.show_avatar()
|
||||||
|
|
||||||
# 创建右键菜单函数
|
# 创建右键菜单函数
|
||||||
|
|
||||||
def create_rightmenu(self):
|
def create_rightmenu(self):
|
||||||
@ -82,7 +75,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
avatar = data.get_avator(self.Me.username)
|
avatar = data.get_avator(self.Me.username)
|
||||||
if not os.path.exists(avatar):
|
if not os.path.exists(avatar):
|
||||||
avatar = './app/data/icons/default_avatar.svg'
|
avatar = './app/data/icons/default_avatar.svg'
|
||||||
pixmap = QPixmap(avatar).scaled(80, 80) # 按指定路径找到图片
|
pixmap = QPixmap(avatar).scaled(60, 60) # 按指定路径找到图片
|
||||||
self.myavatar.setPixmap(pixmap) # 在label上显示图片
|
self.myavatar.setPixmap(pixmap) # 在label上显示图片
|
||||||
|
|
||||||
def chat_view(self):
|
def chat_view(self):
|
||||||
@ -96,7 +89,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
self.last_btn.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}"
|
self.last_btn.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}"
|
||||||
"QPushButton:hover{background-color: rgb(209,209,209);}\n")
|
"QPushButton:hover{background-color: rgb(209,209,209);}\n")
|
||||||
self.last_btn = self.btn_chat
|
self.last_btn = self.btn_chat
|
||||||
self.setviewVisible(self.chatView)
|
self.stackedWidget.setCurrentIndex(0)
|
||||||
self.chatView.showChat()
|
self.chatView.showChat()
|
||||||
|
|
||||||
def contact_view(self):
|
def contact_view(self):
|
||||||
@ -110,7 +103,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
self.last_btn.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}"
|
self.last_btn.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}"
|
||||||
"QPushButton:hover{background-color: rgb(209,209,209);}\n")
|
"QPushButton:hover{background-color: rgb(209,209,209);}\n")
|
||||||
self.last_btn = self.btn_contact
|
self.last_btn = self.btn_contact
|
||||||
self.setviewVisible(self.contactView)
|
self.stackedWidget.setCurrentIndex(1)
|
||||||
self.contactView.showContact()
|
self.contactView.showContact()
|
||||||
|
|
||||||
def myInfo(self):
|
def myInfo(self):
|
||||||
@ -124,7 +117,6 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
self.last_btn.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}"
|
self.last_btn.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}"
|
||||||
"QPushButton:hover{background-color: rgb(209,209,209);}\n")
|
"QPushButton:hover{background-color: rgb(209,209,209);}\n")
|
||||||
self.last_btn = self.now_btn
|
self.last_btn = self.now_btn
|
||||||
self.setviewVisible(self.myinfoView)
|
|
||||||
|
|
||||||
def about(self):
|
def about(self):
|
||||||
"""
|
"""
|
||||||
@ -133,12 +125,3 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
QMessageBox.about(self, "关于",
|
QMessageBox.about(self, "关于",
|
||||||
"关于作者\n姓名:周帅康\n邮箱:lc863854@mail.nwpu.edu.cn"
|
"关于作者\n姓名:周帅康\n邮箱:lc863854@mail.nwpu.edu.cn"
|
||||||
)
|
)
|
||||||
|
|
||||||
def setviewVisible(self, view):
|
|
||||||
"""
|
|
||||||
设置窗口可见性
|
|
||||||
"""
|
|
||||||
view.setVisible(True)
|
|
||||||
if view != self.lastView and self.lastView:
|
|
||||||
self.lastView.setVisible(False)
|
|
||||||
self.lastView = view
|
|
||||||
|
@ -29,7 +29,7 @@ class Ui_MainWindow(object):
|
|||||||
self.frame_info.setFrameShadow(QtWidgets.QFrame.Sunken)
|
self.frame_info.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
self.frame_info.setObjectName("frame_info")
|
self.frame_info.setObjectName("frame_info")
|
||||||
self.verticalLayoutWidget = QtWidgets.QWidget(self.frame_info)
|
self.verticalLayoutWidget = QtWidgets.QWidget(self.frame_info)
|
||||||
self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 190, 61, 271))
|
self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 190, 77, 271))
|
||||||
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
|
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
|
||||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
|
||||||
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
|
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||||
@ -68,16 +68,30 @@ class Ui_MainWindow(object):
|
|||||||
self.verticalLayout_2.setStretch(2, 1)
|
self.verticalLayout_2.setStretch(2, 1)
|
||||||
self.verticalLayout_2.setStretch(3, 1)
|
self.verticalLayout_2.setStretch(3, 1)
|
||||||
self.myavatar = QtWidgets.QLabel(self.frame_info)
|
self.myavatar = QtWidgets.QLabel(self.frame_info)
|
||||||
self.myavatar.setGeometry(QtCore.QRect(5, 40, 70, 70))
|
self.myavatar.setGeometry(QtCore.QRect(10, 40, 60, 60))
|
||||||
self.myavatar.setObjectName("myavatar")
|
self.myavatar.setObjectName("myavatar")
|
||||||
self.horizontalLayout.addWidget(self.frame_info)
|
self.horizontalLayout.addWidget(self.frame_info)
|
||||||
self.frame_main = QtWidgets.QFrame(self.centralwidget)
|
self.stackedWidget = QtWidgets.QStackedWidget(self.centralwidget)
|
||||||
self.frame_main.setMinimumSize(QtCore.QSize(1120, 720))
|
self.stackedWidget.setObjectName("stackedWidget")
|
||||||
self.frame_main.setLayoutDirection(QtCore.Qt.LeftToRight)
|
self.page_chat = QtWidgets.QWidget()
|
||||||
self.frame_main.setFrameShape(QtWidgets.QFrame.Box)
|
self.page_chat.setObjectName("page_chat")
|
||||||
self.frame_main.setFrameShadow(QtWidgets.QFrame.Raised)
|
self.pushButton = QtWidgets.QPushButton(self.page_chat)
|
||||||
self.frame_main.setObjectName("frame_main")
|
self.pushButton.setGeometry(QtCore.QRect(250, 150, 75, 23))
|
||||||
self.horizontalLayout.addWidget(self.frame_main)
|
self.pushButton.setObjectName("pushButton")
|
||||||
|
self.stackedWidget.addWidget(self.page_chat)
|
||||||
|
self.page_contact = QtWidgets.QWidget()
|
||||||
|
self.page_contact.setObjectName("page_contact")
|
||||||
|
self.toolButton = QtWidgets.QToolButton(self.page_contact)
|
||||||
|
self.toolButton.setGeometry(QtCore.QRect(340, 250, 37, 18))
|
||||||
|
self.toolButton.setObjectName("toolButton")
|
||||||
|
self.stackedWidget.addWidget(self.page_contact)
|
||||||
|
self.page_myinfo = QtWidgets.QWidget()
|
||||||
|
self.page_myinfo.setObjectName("page_myinfo")
|
||||||
|
self.stackedWidget.addWidget(self.page_myinfo)
|
||||||
|
self.page_2 = QtWidgets.QWidget()
|
||||||
|
self.page_2.setObjectName("page_2")
|
||||||
|
self.stackedWidget.addWidget(self.page_2)
|
||||||
|
self.horizontalLayout.addWidget(self.stackedWidget)
|
||||||
MainWindow.setCentralWidget(self.centralwidget)
|
MainWindow.setCentralWidget(self.centralwidget)
|
||||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 1280, 23))
|
self.menubar.setGeometry(QtCore.QRect(0, 0, 1280, 23))
|
||||||
@ -118,6 +132,8 @@ class Ui_MainWindow(object):
|
|||||||
self.btn_myinfo.setText(_translate("MainWindow", "我的"))
|
self.btn_myinfo.setText(_translate("MainWindow", "我的"))
|
||||||
self.btn_about.setText(_translate("MainWindow", "关于"))
|
self.btn_about.setText(_translate("MainWindow", "关于"))
|
||||||
self.myavatar.setText(_translate("MainWindow", "avatar"))
|
self.myavatar.setText(_translate("MainWindow", "avatar"))
|
||||||
|
self.pushButton.setText(_translate("MainWindow", "PushButton"))
|
||||||
|
self.toolButton.setText(_translate("MainWindow", "..."))
|
||||||
self.menu_F.setTitle(_translate("MainWindow", "文件(F)"))
|
self.menu_F.setTitle(_translate("MainWindow", "文件(F)"))
|
||||||
self.menu.setTitle(_translate("MainWindow", "编辑"))
|
self.menu.setTitle(_translate("MainWindow", "编辑"))
|
||||||
self.menu_2.setTitle(_translate("MainWindow", "帮助"))
|
self.menu_2.setTitle(_translate("MainWindow", "帮助"))
|
||||||
|
@ -56,9 +56,9 @@
|
|||||||
<widget class="QWidget" name="verticalLayoutWidget">
|
<widget class="QWidget" name="verticalLayoutWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>0</x>
|
||||||
<y>190</y>
|
<y>190</y>
|
||||||
<width>61</width>
|
<width>77</width>
|
||||||
<height>271</height>
|
<height>271</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -143,10 +143,10 @@
|
|||||||
<widget class="QLabel" name="myavatar">
|
<widget class="QLabel" name="myavatar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>5</x>
|
<x>10</x>
|
||||||
<y>40</y>
|
<y>40</y>
|
||||||
<width>70</width>
|
<width>60</width>
|
||||||
<height>70</height>
|
<height>60</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -156,23 +156,40 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="frame_main">
|
<widget class="QStackedWidget" name="stackedWidget">
|
||||||
<property name="minimumSize">
|
<widget class="QWidget" name="page_chat">
|
||||||
<size>
|
<widget class="QPushButton" name="pushButton">
|
||||||
<width>1120</width>
|
<property name="geometry">
|
||||||
<height>720</height>
|
<rect>
|
||||||
</size>
|
<x>250</x>
|
||||||
|
<y>150</y>
|
||||||
|
<width>75</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="layoutDirection">
|
<property name="text">
|
||||||
<enum>Qt::LeftToRight</enum>
|
<string>PushButton</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShape">
|
</widget>
|
||||||
<enum>QFrame::Box</enum>
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_contact">
|
||||||
|
<widget class="QToolButton" name="toolButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>340</x>
|
||||||
|
<y>250</y>
|
||||||
|
<width>37</width>
|
||||||
|
<height>18</height>
|
||||||
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="text">
|
||||||
<enum>QFrame::Raised</enum>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_myinfo"/>
|
||||||
|
<widget class="QWidget" name="page_2"/>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -26,6 +26,9 @@ a = Analysis(
|
|||||||
'./app/Ui/contact/userinfo/userinfoUi.py',
|
'./app/Ui/contact/userinfo/userinfoUi.py',
|
||||||
'./app/Ui/decrypt/decrypt.py','./app/Ui/decrypt/decryptUi.py',
|
'./app/Ui/decrypt/decrypt.py','./app/Ui/decrypt/decryptUi.py',
|
||||||
'./app/Ui/userinfo/userinfo.py','./app/Ui/userinfo/userinfoUi.py',
|
'./app/Ui/userinfo/userinfo.py','./app/Ui/userinfo/userinfoUi.py',
|
||||||
|
'./app/person.py',
|
||||||
|
'./app/Ui/ICON.py',
|
||||||
|
'./app/Ui/MyComponents/Contact.py'
|
||||||
],
|
],
|
||||||
pathex=[],
|
pathex=[],
|
||||||
binaries=[],
|
binaries=[],
|
||||||
|
Loading…
Reference in New Issue
Block a user