Skip to content

Commit

Permalink
feat(tabs): Support disabled tabs
Browse files Browse the repository at this point in the history
- Closes papyros#299
  • Loading branch information
Jordan Neidlinger authored and iBelieve committed Nov 18, 2015
1 parent cd55046 commit e915cac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions demo/SubPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,10 @@ TabbedPage {

Rectangle { color: Palette.colors.orange["200"] }
}

Tab {
title: "Disabled Tab"
enabled: false
Rectangle { color: Palette.colors.purple["200"] }
}
}
6 changes: 3 additions & 3 deletions modules/Material/TabBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Item {

Ink {
anchors.fill: parent

enabled: tab.enabled
onClicked: tabBar.selectedIndex = index
}

Expand All @@ -156,7 +156,7 @@ Item {
? "icon://" + tabItem.tab.iconName : ""
color: tabItem.selected
? darkBackground ? Theme.dark.iconColor : Theme.light.accentColor
: darkBackground ? Theme.dark.shade(0.6) : Theme.light.shade(0.6)
: darkBackground ? Theme.dark.shade(tab.enabled ? 0.6 : 0.2) : Theme.light.shade(tab.enabled ? 0.6 : 0.2)

visible: source != "" && source != "icon://"

Expand All @@ -172,7 +172,7 @@ Item {
? tabItem.tab : tabItem.tab.title
color: tabItem.selected
? darkBackground ? Theme.dark.textColor : Theme.light.accentColor
: darkBackground ? Theme.dark.shade(0.6) : Theme.light.shade(0.6)
: darkBackground ? Theme.dark.shade(tab.enabled ? 0.6 : 0.2) : Theme.light.shade(tab.enabled ? 0.6 : 0.2)

style: "body2"
font.capitalization: Font.AllUppercase
Expand Down

0 comments on commit e915cac

Please sign in to comment.