Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Layout for qquickitem in C++
Forum Updated to NodeBB v4.3 + New Features

Layout for qquickitem in C++

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 831 Views 2 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.
  • T Offline
    T Offline
    Trian
    wrote on last edited by
    #1

    Hi, I am looking for a way to lay out my c++ components that inherit from qquickitem. In qml, Item is equivalent to QQuickItem in c++. Are there c++ class for Row, Column, RowLayout, and ColumnLayout in qml ?
    Thanks

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Ray Gray
      wrote on last edited by Ray Gray
      #2

      Although there are such c++ classes (QQuickLinearLayout for RowLayout, for example), they are not meant to be used directly (they are not 'public'). In my humble opinion, if you need an entire qml item to be an instance of a c++ class, there is something wrong with your approach. I suspect you're trying to do things imperative in a declarative land...

      1 Reply Last reply
      1
      • SeeLookS Offline
        SeeLookS Offline
        SeeLook
        wrote on last edited by
        #3

        There could be many reasons to use QQuickItem from C++, but definitely, layout should be done on QML side.
        So @Ray-Gray mentioned about imperative (C++ mostly) and declarative (QML) approaches, but also we may thinking: QML -> visible, C++ -> invisible. Personally, it helps me to distinguish which technique shall I use for which part of an app.
        But if the app is simple, maybe it is no need for C++ at all.

        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