Giter Club home page Giter Club logo

qmltreeview's People

Contributors

daguerreo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

qmltreeview's Issues

Properties to add

  • Expose font property
  • Define a rowHeight property to allow to change row size modifying selection item and hover item without reimplement the delegate
  • rowPadding: how much space a child node is shifted from the parent
  • rowSpacing: distance between indicator and contentItem
  • Update the sample to show the properties

Mnimal example cannot work

When adds the first new item here

// main.cpp
void populateModel(TreeModel& model)
{
   auto america = new TreeItem("America");
   auto asia = new TreeItem("Asia");
   auto europe = new TreeItem("Europe");
   auto oceania = new TreeItem("Oceania");

   auto brazil = new TreeItem("Brazil");
   auto canada = new TreeItem("Canada");
   auto mexico = new TreeItem("Mexico");
   auto usa = new TreeItem("USA");

   auto italy = new TreeItem("Italy");
   auto france = new TreeItem("France");
   auto portugal = new TreeItem("Portugal");
   auto spain = new TreeItem("Spain");

   model.addTopLevelItem(america); // <--- assertion failed here
...

an assertion failure will be triggered due to parent.childrenCount() - 1 == -1

// tree_model.h
void TreeModel::addItem(TreeItem* parent, TreeItem* child) {
    if (!child || !parent) {
        return;
    }

    emit layoutAboutToBeChanged();

    if (child->parentItem()) {
        beginRemoveRows(QModelIndex(), child->parentItem()->childCount() - 1, child->parentItem()->childCount());
        child->parentItem()->removeChild(child);
        endRemoveRows();
    }

    beginInsertRows(QModelIndex(), parent->childCount() - 1, parent->childCount() - 1); // bug
    child->setParentItem(parent);
    parent->appendChild(child);
    endInsertRows();

    emit layoutChanged();
}

Support roles

TreeModel supports only the DisplayMode role. Implement the support for the other roles, standard and custom. Could be nice adding an example using different roles.

Improve node addition

Build the tree from the TreeItem, than set directly the root item with a dedicated method

Qt6: incorrect render in example

In Qt6, a render error occurs when a child element is deleted and another row is present in manipulator example.

image

Does not happens in Qt5

Qt6 compatibility error in examples

All the examples have these warnings in Qt6 but not in Qt5

qrc:/modules/QMLTreeView/TreeView.qml:83:5: QML TreeViewItem: Binding loop detected for property "handleColor"
qrc:/modules/QMLTreeView/TreeView.qml:83:5: QML TreeViewItem: Binding loop detected for property "selectedItemColor"
qrc:/modules/QMLTreeView/TreeViewItem.qml:108:4: QML ColumnLayout: Qt Quick Layouts: Polish loop detected. Aborting after two iterations.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.