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. Do I need the private libraries in order to make a custom QGraphicsLayout?
Forum Updated to NodeBB v4.3 + New Features

Do I need the private libraries in order to make a custom QGraphicsLayout?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 182 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.
  • Kill-AnimalsK Offline
    Kill-AnimalsK Offline
    Kill-Animals
    wrote on last edited by
    #1

    First off; here is what I am trying to do:

    • Horizontal layout for Cards
    • Duplicate Cards are not drawn. Instead, a number representing how many are in the layout is written onto the first card.
    • If crowded, cards will overlap each other.
    • If you click a card, it will animate a fly from one layout to another.

    The documentation is kind of vague on what I should be doing here. It says

    You can use QGraphicsLayout as a base to write your own custom layout (e.g., a flowlayout), but it is more common to use one of its subclasses instead - QGraphicsLinearLayout or QGraphicsGridLayout.

    • To subclass the subclass, or to just use the subclass?

    Well I tried the former, by subclassing QGraphicsLayout, but found that I could not make anything work without the private classes, because Q_D is relied on quite a bit. I tried importing the private module but I had difficulty with it, because the source files for the private classes were not being detected causing vtable errors, and so I had to manually impliment them, which made a unworkable mess.

    I am not sure why. This was the line I was using in qbs.

    		Depends { name: "Qt.widgets-private"       }
    

    And so I tried subclassing QGraphicsLinearLayout, but I found that I could not change its behaviour really in any way. It again would appear from looking at its own implimentation, that I need the private classes.

    Anyways, all in all, my question is, do I need to be using the private libraries here, or am I way off track on what I am trying to do? And if so, is there a good place to familiarize myself with working with Qt's private libraries? I can't find documentation on things like the d_func pointer, or really what the purpose of having the private libraries in the first place is.

    Thanks.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      @Kill-Animals said in Do I need the private libraries in order to make a custom QGraphicsLayout?:

      do I need to be using the private libraries here

      No. They are private to the Qt library itself for a reason.

      The subclasses that already exist layout items in non-overlapping areas (horizontally, vertically, or both). It sounds like you want something far more complex than that. If you want to handle this as a layout manager then you really have no choice but to subclass QGraphicsLayout.

      When you do that your subclass needs to implement its own logic for all of the pure virtual members and develop its own mechanisms for actually laying out the contained items. It should not need to reach into the private workings of the abstract QGraphicsLayout to achieve this.

      1 Reply Last reply
      2

      • Login

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