Permalink
Browse files

Fix the button tree widget not reacting to loosing focus properly.

  • Loading branch information...
1 parent 7a75237 commit 971df9544ce1fa6657cca99a5cdaeca8d0d31a6e Paul Harrison committed Dec 31, 2010
Showing with 17 additions and 0 deletions.
  1. +15 −0 mythtv/libs/libmythui/mythuibuttontree.cpp
  2. +2 −0 mythtv/libs/libmythui/mythuibuttontree.h
@@ -30,6 +30,9 @@ MythUIButtonTree::MythUIButtonTree(MythUIType *parent, const QString &name)
m_listTemplate = NULL;
SetCanTakeFocus(true);
+
+ connect(this, SIGNAL(TakingFocus()), this, SLOT(Select()));
+ connect(this, SIGNAL(LosingFocus()), this, SLOT(Deselect()));
}
MythUIButtonTree::~MythUIButtonTree()
@@ -405,6 +408,17 @@ void MythUIButtonTree::SetActive(bool active)
SetTreeState();
}
+void MythUIButtonTree::Select()
+{
+ SetActive(true);
+}
+
+void MythUIButtonTree::Deselect()
+{
+ SetActive(false);
+}
+
+
/*!
* \brief Move from list, or one level of the tree, to another
*
@@ -474,6 +488,7 @@ void MythUIButtonTree::handleSelect(MythUIButtonListItem *item)
m_activeListID = name.section(' ',2,2).toInt();
m_activeList = list;
+
MythGenericTree *node = qVariantValue<MythGenericTree*> (item->GetData());
SetCurrentNode(node);
SetTreeState();
@@ -40,6 +40,8 @@ class MPUBLIC MythUIButtonTree : public MythUIType
void handleSelect(MythUIButtonListItem* item);
void handleClick(MythUIButtonListItem* item);
void handleVisible(MythUIButtonListItem* item);
+ void Select();
+ void Deselect();
signals:
void itemSelected(MythUIButtonListItem* item);

0 comments on commit 971df95

Please sign in to comment.