Opened 8 years ago

Closed 8 years ago

#10078 closed Patch - Bug Fix (fixed)

MythUIButtonTree emit itemSelected too early

Reported by: Xavier Hervy <xavier.hervy@…> 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)

mythuibuttontree.diff (572 bytes) - added by Xavier Hervy <xavier.hervy@…> 8 years ago.

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by Xavier Hervy <xavier.hervy@…>

Attachment: mythuibuttontree.diff added

comment:1 Changed 8 years ago by paulh

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

MythGenericTree *node = qVariantValue<MythGenericTree*> (item->GetData());

comment:2 Changed 8 years ago by paulh

Milestone: unknown0.25
Owner: changed from stuartm to paulh
Status: newassigned

comment:3 Changed 8 years ago by Github

Resolution: fixed
Status: assignedclosed

MythUIButtonTree: Update the current node before emitting the itemSelected signal.

Fixes #10078.

Signed-off-by: Paul Harrison <pharrison@…>

Branch: master Changeset: 3ad823656021a65dd5cffc4bb39f9ad5f4538965

Note: See TracTickets for help on using tickets.