Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. How to disable a tab of tabWidget?

How to disable a tab of tabWidget?

Scheduled Pinned Locked Moved Unsolved Qt for Python
4 Posts 2 Posters 2.1k 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.
  • L Offline
    L Offline
    LT-K101
    wrote on last edited by
    #1

    Hi,

    I want to disable the second tab when my application run, so I did the following but it is not working I would be very grateful if i get help. Below is my code I tried.

    
    self.ui.tabWidget_4.cureentIndex(2).setEnabled(True)
    
    
    1 Reply Last reply
    0
    • Axel SpoerlA Offline
      Axel SpoerlA Offline
      Axel Spoerl
      Moderators
      wrote on last edited by
      #2

      Assuming that setEnabled() is called on the right object: You are setting the property to true, which means the tab is enabled false disables it.

      Software Engineer
      The Qt Company, Oslo

      L 1 Reply Last reply
      1
      • Axel SpoerlA Axel Spoerl

        Assuming that setEnabled() is called on the right object: You are setting the property to true, which means the tab is enabled false disables it.

        L Offline
        L Offline
        LT-K101
        wrote on last edited by
        #3

        @Axel-Spoerl Thanks for the correction, but this code does not disable the tab with Index 2 self.ui.tabWidget_4.currentIndex(2).setEnabled(False).But self.ui.tabWidget_4.setEnabled(False) disables the whole tabWidget

        1 Reply Last reply
        0
        • Axel SpoerlA Offline
          Axel SpoerlA Offline
          Axel Spoerl
          Moderators
          wrote on last edited by
          #4

          That’s why I said: Provided that you code points to the right object. Your setEnabled() call goes to the index. Do you want to disable anything there? Or do you just want the tab to be greyed out and inaccessible? In that case, pls look what the documentation says. setTabEnabled() should be your friend.

          Software Engineer
          The Qt Company, Oslo

          1 Reply Last reply
          3

          • Login

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