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. Problem with QObjectPicker and Qt 5.9
Forum Update on Monday, May 27th 2025

Problem with QObjectPicker and Qt 5.9

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 1.1k 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.
  • G Offline
    G Offline
    gonssoruiz
    wrote on 5 Jul 2017, 15:47 last edited by gonssoruiz 7 Jun 2017, 06:27
    #1

    Hi everyone,

    First time posting. Please forgive my mistakes.

    Until last week, I was using Qt 5.8. In a function I had this code:

    Qt3DRender::QObjectPicker *picker1 = new Qt3DRender::QObjectPicker(m_planetEarth);
    picker1->setHoverEnabled(false);
    picker1->setEnabled(true);
    connect(picker1, &Qt3DRender::QObjectPicker::pressed, this, &Q3DMapWidget::onPressed);
    connect(picker1, &Qt3DRender::QObjectPicker::released, this, &Q3DMapWidget::onReleased);
    m_planetEarth->addComponent(picker1);
    

    It worked fine, and I was able to control my entity with the picker.

    Three days ago I updated to 5.9, and the slots are not working anymore. I try to press on the picker object but there's no response.

    Any ideas?

    Thanks everyone in advance for your time and help.

    J 1 Reply Last reply 6 Jul 2017, 04:32
    0
    • G Offline
      G Offline
      gonssoruiz
      wrote on 16 Aug 2017, 14:36 last edited by
      #4

      It was solved using:

      Qt3DRender::QRenderSettings *settings = (Qt3DRender::QRenderSettings*) activeFrameGraph()->parent();
      if (settings)
          settings->pickingSettings()->setPickMethod(Qt3DRender::QPickingSettings::TrianglePicking);
      
      1 Reply Last reply
      0
      • G gonssoruiz
        5 Jul 2017, 15:47

        Hi everyone,

        First time posting. Please forgive my mistakes.

        Until last week, I was using Qt 5.8. In a function I had this code:

        Qt3DRender::QObjectPicker *picker1 = new Qt3DRender::QObjectPicker(m_planetEarth);
        picker1->setHoverEnabled(false);
        picker1->setEnabled(true);
        connect(picker1, &Qt3DRender::QObjectPicker::pressed, this, &Q3DMapWidget::onPressed);
        connect(picker1, &Qt3DRender::QObjectPicker::released, this, &Q3DMapWidget::onReleased);
        m_planetEarth->addComponent(picker1);
        

        It worked fine, and I was able to control my entity with the picker.

        Three days ago I updated to 5.9, and the slots are not working anymore. I try to press on the picker object but there's no response.

        Any ideas?

        Thanks everyone in advance for your time and help.

        J Online
        J Online
        jsulm
        Lifetime Qt Champion
        wrote on 6 Jul 2017, 04:32 last edited by
        #2

        @gonssoruiz Do you mean the slots are not called? Did you verify connect() succeeded? Like

        qDebug() << connect(picker1, &Qt3DRender::QObjectPicker::pressed, this,
        &Q3DMapWidget::onPressed);
        

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        G 1 Reply Last reply 6 Jul 2017, 05:57
        0
        • J jsulm
          6 Jul 2017, 04:32

          @gonssoruiz Do you mean the slots are not called? Did you verify connect() succeeded? Like

          qDebug() << connect(picker1, &Qt3DRender::QObjectPicker::pressed, this,
          &Q3DMapWidget::onPressed);
          
          G Offline
          G Offline
          gonssoruiz
          wrote on 6 Jul 2017, 05:57 last edited by
          #3

          @jsulm said in Problem with QObjectPicker and Qt 5.9:

          qDebug

          Hi,

          Yes, it shows true.

          The problem revealed itself when I changed from 5.8 to 5.9.

          Thanks anyway.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            gonssoruiz
            wrote on 16 Aug 2017, 14:36 last edited by
            #4

            It was solved using:

            Qt3DRender::QRenderSettings *settings = (Qt3DRender::QRenderSettings*) activeFrameGraph()->parent();
            if (settings)
                settings->pickingSettings()->setPickMethod(Qt3DRender::QPickingSettings::TrianglePicking);
            
            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