0

I have Qtabwiget And everytime I load another tab it loads an instance of an Qtwebengineview class. What I need is when the every instance of qtwebengine finish loading it change the parent tab of it instead what i have which changes the current opened tab. here is the code:

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)
Maxwe11
  • 97
  • 1
  • 1
  • 9
  • 2
    `self.tabWidget.setCurrentWidget(self.sender())`. – ekhumoro Jan 05 '18 at 01:02
  • If you dont mind, Can you explain more about what happens with this code? because I guess you misunderstood me because I wasn't so clear. what i want is to set the tab text to the qwebengine title of the current page that is inside this tab. – Maxwe11 Jan 05 '18 at 09:16
  • I have something like this now which doesn't work. `def loadFinished(self, ok): self.tabWidget.setCurrentWidget(self.sender()) self.progressBar.hide() self.tabWidget.setTabText(self.tabWidget.currentWidget().parent(), self.tabWidget.currentWidget().title())` – Maxwe11 Jan 05 '18 at 09:49
  • Solved, with the help of your comment i solved my issue :). – Maxwe11 Jan 05 '18 at 13:31

0 Answers0