根据它包含的Qtwebview更改Qtabwidget文本

时间:2018-01-05 00:03:44

标签: python-3.x pyqt5 qtwebengine qtabwidget

我有Qtabwiget每次加载另一个标签时,它都会加载一个Qtwebengineview类的实例。我需要的是当qtwebengine的每个实例完成加载它改变它的父选项卡而不是我改变当前打开的选项卡。这是代码:

class Ui_MainWindow(QMainWindow):
    def setupUi(self, MainWindow):
        self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
        self.tabWidget.setGeometry(QtCore.QRect(0, 75, self.sizeObject.width(), self.sizeObject.height() - 120))
        self.tabWidget.setObjectName("tabWidget")

    def loadFinished(self, ok):
        self.progressBar.hide()
        >>>I want here to be able to change parent qtabwidget text to the title of the qtwebengineview child<<<


class HtmlView(QWebEngineView):
    def __init__(self, parent):
        super(HtmlView, self).__init__(parent)
        self.parent = parent
        self.loadFinished.connect(self.parent.loadFinished)

0 个答案:

没有答案