pyqt5 multiple floating window easy implement in scroll area [closed]

折月煮酒 提交于 2020-06-23 08:25:51

问题


I want to float a window by signal with param in pyqt5. I used already QDockWidget but i can launch only one float window. I need multiple floating window by some pramas. is there any easy way to do this?

from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QWidget, \
QAction, QTabWidget,QVBoxLayout,QHBoxLayout,QGridLayout,QFrame,QLabel,QSlider,QScrollArea,QCheckBox,QSizePolicy,QFileDialog,QDockWidget, QDialog

class MainWindow(QWidget):

    def __init__(self):
        super(MainWindow, self).__init__()
        scrollarea = QScrollArea(self)
        frame1 = QWidget(self)
        frame1.setFixedSize(200,200)
        frame2 = QWidget(self)
        frame2.setFixedSize(200,200)
        frame3 = QWidget(self)
        frame3.setFixedSize(200,200)
        layout = QVBoxLayout(self)
        layout.addWidget(frame1)
        layout.addWidget(frame2)
        layout.addWidget(QPushButton(self))
        layout.addWidget(frame3)
        container = QFrame(self)
        container.setLayout(layout)
        # self.setLayout(layout)

        scrollarea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        scrollarea.setWidgetResizable(True)
        scrollarea.setWidget(container)
        self.setFixedSize(250,400)

if __name__ == "__main__":
    app = QApplication(sys.argv)
    mw = MainWindow()
    mw.show()
    sys.exit(app.exec_())

I want to float individual widget in scroll area.

来源:https://stackoverflow.com/questions/62412871/pyqt5-multiple-floating-window-easy-implement-in-scroll-area

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!