Project

General

Profile

Actions

Improvements #11868

closed

Define a signal for when the content of `WStackedWidget` changes

Added by Matthias Van Ceulebroeck over 1 year ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
08/09/2023
Due date:
% Done:

100%

Estimated time:

Description

A WStackedWidget can be used to define a stack of widgets. A widget can then be selected as the "active" one (using setCurrentIndex() or setCurrentWidget()).
The item/index that is then selected will be explicitly called, ensuring that the developer is fully aware of the content changing.

However, a WMenu uses a WStackedWidget to display its content. One can listen to the itemSelected() signal to retrieve that item that was selected. However, it is possible that in a structure with nested menus, the current selected menu item doesn't change, but the displayed widget in the stack does change. For example, if there is a tree of menus of depth 2.

  • Item 1 (Menu)
    • SubItem 1 (*)
    • SubItem 2
  • Item 2 (Menu)
    • SubItem 3 (*)
    • SubItem 4

Say we have visited SubItem 1, and SubItem 3 already. Currently we are looking at SubItem 1. If we switch to SubItem 3 again, the contents of the stack change. However, the itemSelected() of the main menu is called, but not that of the submenu (Item 2 itself).

This may require custom logic from developers to find the current selected item. As such, a signal can be added to WStackedWidget (something like currentWidgetChanged()) to ensure that this change can be noticed.

Actions #1

Updated by Matthias Van Ceulebroeck 6 months ago

  • Assignee set to Romain Mardulyn
  • Target version changed from 4.11.0 to 4.11.1
Actions #2

Updated by Romain Mardulyn 5 months ago

  • Status changed from New to InProgress
Actions #3

Updated by Romain Mardulyn 5 months ago

  • Status changed from InProgress to Review
Actions #4

Updated by Romain Mardulyn 5 months ago

  • Assignee deleted (Romain Mardulyn)
Actions #5

Updated by Matthias Van Ceulebroeck 3 months ago

  • Assignee set to Matthias Van Ceulebroeck
Actions #6

Updated by Matthias Van Ceulebroeck about 2 months ago

  • Status changed from Review to Implemented @Emweb
  • Assignee changed from Matthias Van Ceulebroeck to Romain Mardulyn
  • % Done changed from 0 to 100
Actions #7

Updated by Matthias Van Ceulebroeck about 2 months ago

  • Status changed from Implemented @Emweb to Implemented @Test
Actions #8

Updated by Matthias Van Ceulebroeck about 2 months ago

  • Status changed from Implemented @Test to Closed
Actions

Also available in: Atom PDF