Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Reload specific tab PYQT5
Qt 6.11 is out! See what's new in the release blog

Reload specific tab PYQT5

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 747 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GDPpy
    wrote on last edited by
    #1

    I've created a web browser with tabs on pyqt, i have a json with urls inside and the tabs are create dynamically, it work perfectly but i want to each tab reload it own url by itself every 10 seconds

    here's my code

    with open('impresores.json') as data_file:    
            data = json.load(data_file)
            for value in data.values():
                self.add_new_tab_with_reload(QUrl(value['URL']), label=value['TITULO'])
    
    def add_new_tab_with_reload(self, qurl=QtCore.QUrl(), label='Blank'):
        view = WebView()
        view.setUrl(qurl)
        index = self.tab_widget.addTab(view, label)
        self.tab_widget.setTabIcon(index, view.icon())
        view.iconChanged.connect(lambda icon, view=view: self.tab_widget.update_icon(view, icon))
        self.tab_widget.setCurrentWidget(view)
        self.tab_widget.tabCloseRequested.connect(self.close_current_tab)
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You can use a QTimer to reload all your tabs or if you want them to be independent, create one QTimer per tab.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • G Offline
        G Offline
        GDPpy
        wrote on last edited by
        #3

        Thanks for your reply, do you have any example? Because i dont know how to reload a specific tab

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Which approach do you want to use ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved