Opened 15 years ago
Closed 15 years ago
#10078 closed Patch - Bug Fix (fixed)
MythUIButtonTree emit itemSelected too early
| Reported by: | Owned by: | paulh | |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.25 |
| Component: | MythTV - User Interface Library | Version: | Master Head |
| Severity: | medium | Keywords: | mythuibuttontree |
| Cc: | Ticket locked: | no |
Description
I believe the itemSelected signal is emitted too early, it should be emitted after the currentNode have been set.
My use case: I have a MythUIScreen with a m_title (MythUIText) I also have m_buttonTree (MythUIButtonTree) I connected itemSelected from the buttonTree to a itemSelected slot of my MythUIScreen:
void MyScreen::itemSelected(MythUIButtonListItem *item)
{
MythGenericTree * node = m_buttonTree->GetCurrentNode();
if (node)
{
MythGenericTree * parentNode = node->getParent();
if (parentNode)
m_title->SetText(parentNode->GetText());
}
}
because the signal is emitted before the current node is actually updated, I get the parent's name of the previous current node instead of the parent's name of the current node. This patch emit itemSelected after the currentNode is updated
Attachments (1)
Change History (4)
by , 15 years ago
| Attachment: | mythuibuttontree.diff added |
|---|
comment:1 by , 15 years ago
comment:2 by , 15 years ago
| Milestone: | unknown → 0.25 |
|---|---|
| Owner: | changed from to |
| Status: | new → assigned |
comment:3 by , 15 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
MythUIButtonTree: Update the current node before emitting the itemSelected signal.
Fixes #10078.
Signed-off-by: Paul Harrison <pharrison@…>
Branch: master Changeset: 3ad823656021a65dd5cffc4bb39f9ad5f4538965

While what you say is true it's usual to get the node from the MythUIListButtonItem like this