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?

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.
  • M Offline
    M Offline
    msyasak
    wrote on 2 Apr 2021, 07:40 last edited by
    #1

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

    J 1 Reply Last reply 2 Apr 2021, 07:52
    0
    • M msyasak
      2 Apr 2021, 08:16

      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

      J Offline
      J Offline
      JonB
      wrote on 2 Apr 2021, 08:53 last edited by JonB 4 Feb 2021, 08:56
      #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())
      
      M 1 Reply Last reply 2 Apr 2021, 09:48
      1
      • M msyasak
        2 Apr 2021, 07:40

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

        J Offline
        J Offline
        JonB
        wrote on 2 Apr 2021, 07:52 last edited by JonB 4 Feb 2021, 07:53
        #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?

        M 1 Reply Last reply 2 Apr 2021, 08:03
        0
        • J JonB
          2 Apr 2021, 07:52

          @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?

          M Offline
          M Offline
          msyasak
          wrote on 2 Apr 2021, 08:03 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.

          J 1 Reply Last reply 2 Apr 2021, 08:08
          0
          • M msyasak
            2 Apr 2021, 08:03

            @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.

            J Offline
            J Offline
            JonB
            wrote on 2 Apr 2021, 08:08 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?

            M 1 Reply Last reply 2 Apr 2021, 08:16
            0
            • J JonB
              2 Apr 2021, 08:08

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

              M Offline
              M Offline
              msyasak
              wrote on 2 Apr 2021, 08:16 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

              J 1 Reply Last reply 2 Apr 2021, 08:53
              0
              • M msyasak
                2 Apr 2021, 08:16

                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

                J Offline
                J Offline
                JonB
                wrote on 2 Apr 2021, 08:53 last edited by JonB 4 Feb 2021, 08:56
                #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())
                
                M 1 Reply Last reply 2 Apr 2021, 09:48
                1
                • J JonB
                  2 Apr 2021, 08:53

                  @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())
                  
                  M Offline
                  M Offline
                  msyasak
                  wrote on 2 Apr 2021, 09:48 last edited by
                  #7

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

                  1 Reply Last reply
                  1

                  6/7

                  2 Apr 2021, 08:53

                  • Login

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