Project

General

Profile

Bug #7748

WStringListModel does not support restoring of raw indexes.

Added by Andreas Frolov 18 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
10/06/2020
Due date:
% Done:

0%

Estimated time:

Description

Implementation of fromRawIndex/toRawIndex is missing in WStringListModel. This leads to unexpected and different results after sorting compared to e.g. WStandardItemModel.

`auto cb = std::make_uniqueWt::WComboBox();

// WComboBox has WStringListModel by default.
for (auto& t : { "c", "d", "b", "a" })
cb->addItem(t);

cb->setCurrentIndex(2);
auto text1 = cb->currentText(); // "b"
cb->model()->sort(0);
auto text2 = cb->currentText(); // "a"

assert(text1 == text2);

cb->setModel(std::make_sharedWt::WStandardItemModel());

for (auto& t : { "c", "d", "b", "a" })
cb->addItem(t);

cb->setCurrentIndex(2);
auto text3 = cb->currentText(); // "b"
cb->model()->sort(0);
auto text4 = cb->currentText(); // "b"

assert(text3 == text4);`

No data to display

Also available in: Atom PDF