Project

General

Profile

Actions

Bug #5234

open

[wt-3.3.6] TreeView & WSortFilterProxyModel

Added by Стойчо Стефанов Stoycho Stefanov over 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
Start date:
09/02/2016
Due date:
% Done:

0%

Estimated time:

Description

Hey,

every time a change the regular expression of a WSortFilterProxyModel an existing connection (slot) of the corresponding view is duplicated (?). It sounds very odd. This is my test case:

    WTreeView *TheView = new WTreeView();
    Wt::WStandardItemModel *Model = new Wt::WStandardItemModel(TheView);
    Wt::WStandardItem *Item;
    for ( int var = 0; var < 5; ++var ) {
        Item = new Wt::WStandardItem("Item "+ std::to_string(var));
        Item->setData(var%2,Wt::UserRole);
        Model->appendRow(Item);
    }
    WSortFilterProxyModel *Filter = new WSortFilterProxyModel(TheView);
    Filter->setSourceModel(Model);
    Filter->setFilterRole(UserRole);
    Filter->setFilterRegExp("");
    TheView->setModel(Filter);
    TheView->clicked().connect(std::bind([](){
        cout <<  "tree view clicked" << endl;
    }));
    root()->addWidget(TheView);
    WContainerWidget *Wrapper = new WContainerWidget();
    WPushButton *Btn = new WPushButton("odd",Wrapper);
    Btn->clicked().connect(std::bind([=](){
        Filter->setFilterRegExp("1");
    }));
    Btn = new WPushButton("even",Wrapper);
    Btn->clicked().connect(std::bind([=](){
        Filter->setFilterRegExp("0");
    }));
    Btn = new WPushButton("all",Wrapper);
    Btn->clicked().connect(std::bind([=](){
        Filter->setFilterRegExp(".*");
    }));
    Btn = new WPushButton("any",Wrapper);
    Btn->clicked().connect(std::bind([=](){
        Filter->setFilterRegExp("");
    }));
    root()->addWidget(Wrapper);

The same happens with slots connecting to onMouseWentUp and probably with onMouseWentDoun, doubleClicked etc.

selectionChanged is not affected.

No data to display

Actions

Also available in: Atom PDF