How can I add button inside treewidget/view?

  • Hi everyone,
    I wanna do a thing like the below image. A button (tool button) and text have to be in one cell. How can I do this? Which widget should I use Treewidget or treeview?

    alt text

  • Hi! The image-upload feature on our forum is broken, you might see the images you uploaded but other users don't. Please upload your images to an image hoster of your choice, e.g., and embed them here with the following markup: ![alternate text](url).

  • @VRonin I guess it can be seen now?

  • Treewidget is just a treeview with an embedded model.

    What you need is a delegate, see

  • @VRonin It is a very complicated example, I really don't understand anything.

  • Ok, let's start from the overview of the framework:

  • Qt Champions 2016

    Sadly the model & view concept in Qt is not super easy to get started with.

    The delegate is then a helper class to change how the View display data.
    I like the info here

    Delegates are the way to do it as they offer far better performance.

    However, there is also poor mans way using a
    Treewidget and

    which allows to insert normal widget into a cell
    This get heavy fast if not on Desktop pc.

    So its better to spend some days reading about views and delegates than a fast hax.

  • @mrjj thank you. I did it easily after read your shared links. They're really good documents to get started with.

Log in to reply