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. Graphic view and ProxyWidget ... signal problem?
Forum Updated to NodeBB v4.3 + New Features

Graphic view and ProxyWidget ... signal problem?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.2k 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.
  • G Offline
    G Offline
    giordi
    wrote on last edited by
    #1

    Hi everyone.
    I am working on a UI which needs a lot of freedom in the layout. The way I decided to do so is basically to use a grapich view and then control the grapich view items positions manually with
    a layout I will write. If needed I can go in more detail in what I want to achieve.
    Now every Item is basically a sub UI , so I use a ProxyWidget to feed a widget I want in the item.
    It works fine but I get several problem.

    !http://s22.postimg.org/wwb57rd35/image.jpg(demo)!

    The drag doesnt work (of course the item is set as draggable) and I cannot interact with any of the
    inner widgets of the item, like the line edit.

    I might guess this is a signal related problem of the grapich view consuming the events or viceversa?
    Anyone got an idea about that?
    Cheers
    M.

    PS I can provide snipped of code if needed even tho for now is just a really rough test.

    Coding is powaaaaa

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

      Hi,

      You should also add which combo of Qt/OS you are using.

      The code snippet is a good idea, it will help people spot something

      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
      • G Offline
        G Offline
        giordi
        wrote on last edited by
        #3

        HI man you are totally right. I also forgot to mention that this is actually pyside and not qt stand alone.
        Reguarding the os I got same exact problem in both Win 7 and Linux (CentOs) also same problem with standalone pyside and the pyside shipped with Autodesk Maya.
        I removed the maya widget stuff and create quickly a test widget , still I cannot use the internal widgets
        !http://s1.postimg.org/66g3rzh4v/ui_Problem.jpg(problem)!

        Here is the code, it is super standard, the test widgets it s translated in python by pyside-uic and the test win is super simple like in the exampples.
        So i am just creating the proxy and give it to the scene thats it

        @##### TEST WIDGET ########
        class TestWidget(QtGui.QWidget) :
        def init(self , parent = None) :
        QtGui.QWidget.init(self,parent)
        self.setObjectName("Form")
        self.resize(270, 149)
        self.verticalLayout = QtGui.QVBoxLayout(self)
        self.verticalLayout.setObjectName("verticalLayout")
        self.groupBox = QtGui.QGroupBox(self)
        self.groupBox.setObjectName("groupBox")
        self.horizontalLayout = QtGui.QHBoxLayout(self.groupBox)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.pushButton = QtGui.QPushButton(self.groupBox)
        self.pushButton.setObjectName("pushButton")
        self.horizontalLayout.addWidget(self.pushButton)
        self.lineEdit = QtGui.QLineEdit(self.groupBox)
        self.lineEdit.setObjectName("lineEdit")
        self.horizontalLayout.addWidget(self.lineEdit)
        self.verticalLayout.addWidget(self.groupBox)

        self.retranslateUi()
        QtCore.QMetaObject.connectSlotsByName(self)

        self.pushButton.clicked.connect(self.clickedMe)

        def retranslateUi(self):
        self.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
        self.groupBox.setTitle(QtGui.QApplication.translate("Form", "GroupBox", None, QtGui.QApplication.UnicodeUTF8))
        self.pushButton.setText(QtGui.QApplication.translate("Form", "PushButton", None, QtGui.QApplication.UnicodeUTF8))

        def clickedMe(self):

        print "cliked me"

        ############ GRAPHIC VIEW ###############

        class TestWin2(QtGui.QWidget) :
        def init(self , parent = None , modules = None) :
        QtGui.QWidget.init(self,parent)

        self.modules = modules
        self.lay = QtGui.QVBoxLayout(self)
        self.setLayout(self.lay)
        self.view = QtGui.QGraphicsView(self)
        self.scene = QtGui.QGraphicsScene(self)
        self.view.setScene(self.scene)
        self.lay.addWidget(self.view)

        self.proxy = self.scene.addWidget(TestWidget())
        self.proxy.setFlags(QtGui.QGraphicsItem.ItemIsMovable)
        self.proxy.setFlag(QtGui.QGraphicsItem.ItemIsSelectable)

        ########### RUN IT ########################
        def main() :
        app = QtGui.QApplication([])
        temp = TestWin2()
        temp.show()
        app.exec_()

        main()
        @

        Looks like the push button is working, i can click it but I cannot type in the line edit and cannot drag the guy around.
        Even tho if I set the item in window mode then I can grab it and move it around.
        That s what brought me thinking is something to do with singals going wrong. Maybe I need a custom event filter?

        Thanks a lot for your help man

        Coding is powaaaaa

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giordi
          wrote on last edited by
          #4

          anyone got an Idea? cheers

          Coding is powaaaaa

          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