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. Command like "Qtab Clicked Connect" that can call a function?
QtWS25 Last Chance

Command like "Qtab Clicked Connect" that can call a function?

Scheduled Pinned Locked Moved Solved General and Desktop
qtabwidgetclickedconnect
7 Posts 2 Posters 2.7k Views
  • 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.
  • msyasakM Offline
    msyasakM Offline
    msyasak
    wrote on last edited by
    #1

    Is there any python command when clicked any tab that provides connect a function?

    JonBJ 1 Reply Last reply
    0
    • msyasakM msyasak

      Hi @JonB, thank for your attention. I am talking about QTabWidget.

      Following picture has two tabs. For example, when i click the "Process" tab, i need the connect to a function. So, is there any command that providing this.

      Ekran görüntüsü 2021-04-02 110820.png

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #6

      @msyasak
      If you are using a QTabWidget, then the signal is on that, not on the "tab widgets` themselves. In Python it will be:

      self.qtabwidget.currentChanged.connect(self.tabChanged)
      
      def tabChanged(index: int):
          print(index)
          print(self.qtabwidget.widget(index))
          print(self.qtabwidget.currentWidget())
      
      msyasakM 1 Reply Last reply
      1
      • msyasakM msyasak

        Is there any python command when clicked any tab that provides connect a function?

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #2

        @msyasak
        In principle there is the connect() method and signals/slots. But there is no such Qt class as QTab, so what are you actually referring to?

        msyasakM 1 Reply Last reply
        0
        • JonBJ JonB

          @msyasak
          In principle there is the connect() method and signals/slots. But there is no such Qt class as QTab, so what are you actually referring to?

          msyasakM Offline
          msyasakM Offline
          msyasak
          wrote on last edited by
          #3

          @JonB actually, I need the call a function when clicked a tab.

          For instance, in button circumstance - there is a connect() function as you mentioned that is

          self.qt_button.clicked.connect(self.function)
          

          But, I need such as above command that provide clicked a tab.

          JonBJ 1 Reply Last reply
          0
          • msyasakM msyasak

            @JonB actually, I need the call a function when clicked a tab.

            For instance, in button circumstance - there is a connect() function as you mentioned that is

            self.qt_button.clicked.connect(self.function)
            

            But, I need such as above command that provide clicked a tab.

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #4

            @msyasak
            As I already said, I do not know what you mean by "a tab". What Qt class are you talking about?

            msyasakM 1 Reply Last reply
            0
            • JonBJ JonB

              @msyasak
              As I already said, I do not know what you mean by "a tab". What Qt class are you talking about?

              msyasakM Offline
              msyasakM Offline
              msyasak
              wrote on last edited by
              #5

              Hi @JonB, thank for your attention. I am talking about QTabWidget.

              Following picture has two tabs. For example, when i click the "Process" tab, i need the connect to a function. So, is there any command that providing this.

              Ekran görüntüsü 2021-04-02 110820.png

              JonBJ 1 Reply Last reply
              0
              • msyasakM msyasak

                Hi @JonB, thank for your attention. I am talking about QTabWidget.

                Following picture has two tabs. For example, when i click the "Process" tab, i need the connect to a function. So, is there any command that providing this.

                Ekran görüntüsü 2021-04-02 110820.png

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #6

                @msyasak
                If you are using a QTabWidget, then the signal is on that, not on the "tab widgets` themselves. In Python it will be:

                self.qtabwidget.currentChanged.connect(self.tabChanged)
                
                def tabChanged(index: int):
                    print(index)
                    print(self.qtabwidget.widget(index))
                    print(self.qtabwidget.currentWidget())
                
                msyasakM 1 Reply Last reply
                1
                • JonBJ JonB

                  @msyasak
                  If you are using a QTabWidget, then the signal is on that, not on the "tab widgets` themselves. In Python it will be:

                  self.qtabwidget.currentChanged.connect(self.tabChanged)
                  
                  def tabChanged(index: int):
                      print(index)
                      print(self.qtabwidget.widget(index))
                      print(self.qtabwidget.currentWidget())
                  
                  msyasakM Offline
                  msyasakM Offline
                  msyasak
                  wrote on last edited by
                  #7

                  Thank you @JonB, "currentChanged.connect" is worked.

                  1 Reply Last reply
                  1

                  • Login

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