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. Line crossing widgets
Forum Updated to NodeBB v4.3 + New Features

Line crossing widgets

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.0k Views 1 Watching
  • 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.
  • BlackMambaB Offline
    BlackMambaB Offline
    BlackMamba
    wrote on last edited by
    #1

    Hello all,

    Here is my issue. I have a QTreeWidget with widgets as children something like this :

    |>Parent
    Child Widget1
    Child Widget2
    Child Widget3

    |>Parent2
    Child Widget1
    Child Widget2
    Child Widget3

    etc, ... These children widgets contain some graphics like a rectangle (XXXXXX here)

    so, it looks like that :

    |>Parent
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    |>Parent2
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    I need a vertical line to cross all this TreeWidget and the children widgets, something like that :

    |>Parent
    XXXXXXXXXXXX | XXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXX | XXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXX | XXXXXXXXXXXXXXXXXXXXXXX

    |>Parent2
    XXXXXXXXXXXX | XXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXX | XXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXX | XXXXXXXXXXXXXXXXXXXXXXX

    I have no idea how to achieve that. Does anybody have an idea? That would be very helpful.
    Cheers,

    1 Reply Last reply
    0
    • P Offline
      P Offline
      poorBob
      wrote on last edited by
      #2

      Hmmm,

      seems like You will need to subclass "QItemDelegate":http://qt-project.org/doc/qt-4.8/qitemdelegate.html to achieve this. Here You have an example how to sublass and use it: "Star delegate example.":http://harmattan-dev.nokia.com/docs/platform-api-reference/xml/daily-docs/libqt4/itemviews-stardelegate.html .

      Maybe You will also need to show Your children data in 2 columns? To achieve this Your model's "columnCount":http://qt-project.org/doc/qt-5.0/qtcore/qabstractitemmodel.html#columnCount should return 2 and Your "data":http://qt-project.org/doc/qt-5.0/qtcore/ qabstractitemmodel.html#data method should return proper content.

      I hope this will help. In case of any doubts just ask here :).

      Robert

      1 Reply Last reply
      0
      • BlackMambaB Offline
        BlackMambaB Offline
        BlackMamba
        wrote on last edited by
        #3

        Hello Bob,
        Thannks for your help.
        I dont want to split the widget, I just want to draw a QGraphicsItem (here the line) on the widget.
        I was able to draw a simple QlineF line on the widget by reimplementing paintEvent() on the widget but this doesn't look to work for a QGraphicsItem...

        1 Reply Last reply
        0
        • P Offline
          P Offline
          poorBob
          wrote on last edited by
          #4

          Hmmm,

          can You place here a little example code what You are trying to do?

          Robert

          1 Reply Last reply
          0

          • Login

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