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 designer graphicview and qwidget
Qt 6.11 is out! See what's new in the release blog

qt designer graphicview and qwidget

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 844 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.
  • S Offline
    S Offline
    s002wjh
    wrote on last edited by s002wjh
    #1

    using qt designer i create qwidget which include a graphicview box. how do i add item such as rect etc to this view in c++?

    also anyway to auto resize the graphicview inside teh qwidget when i expand/shrink the main window?

    mrjjM 1 Reply Last reply
    0
    • S s002wjh

      using qt designer i create qwidget which include a graphicview box. how do i add item such as rect etc to this view in c++?

      also anyway to auto resize the graphicview inside teh qwidget when i expand/shrink the main window?

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @s002wjh
      Hi
      You can access the graphicview via the UI variable if a normal Creator/Designer
      created form.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        s002wjh
        wrote on last edited by s002wjh
        #3

        somethign like
        ui->graphviewname->

        but how would i add rect? i usually use scene->additem(rect) but since graphicview is part of widget now. so i guess i use qpaint to draw rect in graphicview?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Just as usual, create a scene and set it on your ui->graphviewname.

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

          S 1 Reply Last reply
          2
          • SGaistS SGaist

            Hi,

            Just as usual, create a scene and set it on your ui->graphviewname.

            S Offline
            S Offline
            s002wjh
            wrote on last edited by
            #5

            @SGaist

            thanks i made a stupid mistake by
            setScene before ui->setupUI(this), so it crash.

            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