Project

General

Profile

Actions

Bug #7707

open

Toggling visibility for WTreeView on column 0 breaks webserver

Added by Ulf Johnsson over 3 years ago. Updated over 3 years 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
Actions #1

Updated by Roel Standaert over 3 years ago

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

Actions #2

Updated by Roel Standaert over 3 years ago

  • Priority changed from Normal to Low
Actions #3

Updated by Ulf Johnsson over 3 years 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.

Actions #4

Updated by Roel Standaert over 3 years 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.

Updated by Ulf Johnsson over 3 years 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

Actions

Also available in: Atom PDF