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
QtWS25 Last Chance

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 last edited by gonssoruiz
    #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.

    jsulmJ 1 Reply Last reply
    0
    • G Offline
      G Offline
      gonssoruiz
      wrote on 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

        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.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on 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
        0
        • jsulmJ jsulm

          @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 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 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