summaryrefslogtreecommitdiff
path: root/cui/source/tabpages/chardlg.cxx
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2025-02-23 01:58:50 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2025-02-23 10:15:52 +0100
commit7bec65cca52f297b39b909182cff544285e0969d (patch)
treeb75956e1d260b9845c35a2b4d7419f39cbdd6edb /cui/source/tabpages/chardlg.cxx
parent5c94c294299a1c21462b55c5983f22f94f33e029 (diff)
tdf#130857 qt weld: Implement QtInstanceAssistant::set_page_index HEADmaster
As already mentioned in Change-Id: I91b44da40736f6e61c64167d00305a1d7ba06b45 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Sat Feb 22 18:30:30 2025 +0100 tdf#130857 qt weld: Introduce QtInstanceAssistant , the page id that QWizard uses does not conceptually match the page index that weld::Assistant uses: weld::Assistant uses two ways to refer to specific pages: 1) an int page index 2) an OUString identifier QWizard uses an int id to refer to pages. This concept of an id does not match the index concept that weld::Assistang uses. (The id generally does not match an index in the range between 0 and the number of pages - 1.) Introduce a new property PROPERTY_PAGE_INDEX that gets set on the QWizardPage objects and contains the page index as used in the weld::Assistant API and 2 helper methods QtInstanceAssistant::pageIndex and QtInstanceAssistant::setPageIndex to get/set the page index property for a page as well as a helper method QtInstanceAssistant::page that returns the page for a given page index. Update existing code to no longer assume that the QWizard page ID and the weld::Assistant page index are the same. Implement QtInstanceAssistant::set_page_index that moves an existing page to a new position/index. Given that the IDs used in QWizard don't match the page indices, use a vector to sort by page index instead and reassign the new index property to all pages at the end. In a previous attempt trying to keep the QWizard page ID and the weld::Assistant page index in sync, I ran into the problem that the ID for a page cannot simply be changed, and removing and reinserting a page with a new ID had the side-effect that it triggered events. (And the current page can change when pages are removed from QWizard.) While the default QWizard logic that decides what page to switch to when pressing e.g. the "Next" button would switch to the page with the lowest ID greater than the current page (see [1], [2]) in which case the page IDs would be relevant. However, the approach taken in LO is that the logic of switching pages is handled "manually" inside LO instead, using callbacks that get triggered on button click, etc. [1] https://doc.qt.io/qt-6/qwizard.html#nextId [2] https://doc.qt.io/qt-6/qwizardpage.html#nextId Change-Id: Idd94676e850cabca75763645cb1e102999b80b64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182047 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
Diffstat (limited to 'cui/source/tabpages/chardlg.cxx')
0 files changed, 0 insertions, 0 deletions