Project

General

Profile

Bug #7707

Toggling visibility for WTreeView on column 0 breaks webserver

Added by Ulf Johnsson about 2 months ago. Updated about 1 month ago.

Status:
New
Priority:
Low
Assignee:
-
Target version:
-
Start date:
09/07/2020
Due date:
% Done:

0%

Estimated time:

Description

Press button twice to reproduce.

Environment: Window10, FireFox, Wt4.3.1

Example:

class Application : public Wt::WApplication
{
public:
    Application(const Wt::WEnvironment& enviorment) : Wt::WApplication(enviorment) {}

    class Tree : public Wt::WTreeView
    {
    public:
        Tree() {}

        void toggle()
        {
            setColumnHidden(0, !isColumnHidden(0));
        }
    };

    /***************************************************************/
    void initialize()
    {
        WApplication::initialize();

        auto tree = root()->addNew<Tree>();
        tree->resize(500, 500);
        Wt::WStringListModel* m = new Wt::WStringListModel;
        std::vector<Wt::WString> ss;
        ss.push_back("a");
        ss.push_back("b");
        ss.push_back("c");
        ss.push_back("d");
        m->setStringList(ss);
        tree->setModel(std::unique_ptr<Wt::WStringListModel>(m));

        auto btn = root()->addNew<Wt::WPushButton>();
        btn->resize(100, 100);
        btn->clicked().connect(tree, &Tree::toggle);
    }
}

Files

qt_treeview_0_hidden.png (1.42 KB) qt_treeview_0_hidden.png Ulf Johnsson, 09/15/2020 10:52 AM
qt_treeview_0_visible.png (2.27 KB) qt_treeview_0_visible.png Ulf Johnsson, 09/15/2020 10:52 AM
#1

Updated by Roel Standaert about 1 month ago

Weird thing to do but it indeed causes a JavaScript error (doesn't break the web server, just that one instance of WApplication).

#2

Updated by Roel Standaert about 1 month ago

  • Priority changed from Normal to Low
#3

Updated by Ulf Johnsson about 1 month ago

Yes, my bad, thats what I meant, its breaks the connection to current session.

It is indeed a weird thing to do in the example above, but I think the issue was present even when having more columns?

And in that case it is not a strange thing to do. If I have, for example, 5 columns it is not unheard of to hide column at position 0.

#4

Updated by Roel Standaert about 1 month ago

Well, it's a WTreeView, so then you'd be hiding the tree, so I wouldn't know what it should do. I don't know what you think it should do. It can be a no-op, we can throw an exception, we could preserve the tree structure from column zero but not show the data from column 0, but something tells me the current implementation won't make that easy.

#5

Updated by Ulf Johnsson about 1 month ago

Taking inspiration from Qt, they simple hide the graphical part of the column and leave the other column as is (expanded children and parents).

Visible column 0

Hidden column 0

Also available in: Atom PDF