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. My QObjectPicker won't behave
QtWS25 Last Chance

My QObjectPicker won't behave

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 462 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.
  • H Offline
    H Offline
    hhughe11
    wrote on last edited by
    #1

    Someone please help me! I am displaying objects in a Qt3DWindow and I'm trying to select them with QObjectPicker. I create the ObjectPicker as follows:

    Qt3DRender::QObjectPicker *MeshGraphics::createObjectPicker()
    {
        Qt3DRender::QObjectPicker *picker = new Qt3DRender::QObjectPicker();
    
        if(QObject::connect(picker, SIGNAL(pressed(Qt3DRender::QPickEvent*)), 
                    this, SLOT(pickMesh(Qt3DRender::QPickEvent*))))
        {
            qDebug() << "signal successfully connected";
    
            return picker;
        }
    
        else
        {
            qDebug() << "connect() failed";
    
            return nullptr;
        }
    }
    

    and I add it to my entity like this:

    entity->addComponent(createObjectPicker());
    

    When I have my renderSettings as:

    Qt3DRender::QPickingSettings *settings = m_window->renderSettings()->pickingSettings();
    
    settings->setFaceOrientationPickingMode(Qt3DRender::QPickingSettings::FrontAndBackFace);
    
    settings->setPickMethod(Qt3DRender::QPickingSettings::TrianglePicking);
            
    settings->setPickResultMode(Qt3DRender::QPickingSettings::NearestPick);
    

    my "pickMesh" slot is never called, and the application outputs "signal successfully connected".
    If I turn off TriangePicking in my settings:

    Qt3DRender::QPickingSettings *settings = m_window->renderSettings()->pickingSettings();
            
    settings->setFaceOrientationPickingMode(Qt3DRender::QPickingSettings::FrontAndBackFace);
            
    //settings->setPickMethod(Qt3DRender::QPickingSettings::TrianglePicking);
            
    settings->setPickResultMode(Qt3DRender::QPickingSettings::NearestPick);
    

    Then my slot is called when I click next to my cube mesh without actually clicking on it. There are no error messages or compiler warnings. This is a serious issue, it needs to only call the slot if I click on the viewable surface. Someone please help me! Thank you.

    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