Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt - C++ - QListView - Custom Shape
Forum Update on Monday, May 27th 2025

Qt - C++ - QListView - Custom Shape

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 194 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vildnex
    wrote on 8 Oct 2020, 14:58 last edited by
    #1

    I'm trying to create a QListView with a polygon shape. Or in other words, I would like that my list will look something like this:

    enter image description here

    which at this moment looks like this:

    enter image description here

    WHAT I KNOW or TRYED ALREADY:

    • I know about the paintEvent(QPaintEvent *e) function where I can change the shape of a widget, but I don't know how can I change the shape of the actual box which contains the items of that list.
    • I've also tried already with QStyledItemDelegate and I've overridden the 2 functions paint and sizeHint. But with those, I can only change the elements within the list, not the actual list shape.

    In other words, the first option with paintEvent it's going to change my shape of the widget(the BLACK part from the image), not the container which holds the elements. The second option it's going to change just looks of elements from the list, not the container which holds them.

    In short, is there any way in which I can change the shape of that container?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 8 Oct 2020, 18:23 last edited by
      #2

      Hi,

      One thing worth trying is the Qt Graphics View Framework. You might be able to apply the transforms you want on the item but I can't guarantee it.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      1/2

      8 Oct 2020, 14:58

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved