Results 1 to 2 of 2

Thread: [qt] How do I display comboboxes in a listview?

  1. #1
    Join Date
    Mar 2006
    Beans
    837

    [qt] How do I display comboboxes in a listview?

    I am coming from a Gtk background in which I am quite fluent. But I want to contribute something to a project that uses qt and I need to present the data to the user in a certain way.

    I want a listview with, let's say, 3 columns. I want the last column to display a combobox in each row, that lets the user select between different values.

    In Gtk I would use a GtkCellRendererCombo for that column. What is the equivalent in Qt? Does it have an entirely different approach on how to construct a listview?


    (I tried to follow/read the docs, but I got lost. Google doesn't return anything useful for my question.)

  2. #2
    Join Date
    Mar 2006
    Beans
    837

    Re: [qt] How do I display comboboxes in a listview?

    I found my answer. I wanted a QTableView not a ListView. Also one should read the Model/View Programmingtutorial. It model/view approach of Qt has some differences from the one Gtk+ uses.

    Roughly, the equivalent of the GtkCellRenderer mechanism is the "delegate" mechanism in which you can use any appropriate widget.

    QTableView with combobox as delegate example:
    1. http://programmingexamples.net/wiki/...mboBoxDelegate
    2. https://qt-project.org/wiki/Combo_Boxes_in_Item_Views

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •