Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.6 kB
2
Indexable
Never
/// globale Position bestimmen
            *globalPos = event->pos();
            qDebug() << "Globales X " + QString::number(globalPos->x());
            qDebug() << "Globales Y " + QString::number(globalPos->y());

            /// lokale Position bestimmen
            *localPos3D = ui->label_3Dimage->mapFromParent(*globalPos)+QPoint(-30+ui->scrollArea->horizontalScrollBar()->value(),-30+ui->scrollArea->verticalScrollBar()->value());
            *localPos2D = ui->label_Image->mapFromParent(*globalPos)+QPoint(-30+ui->scrollArea->horizontalScrollBar()->value(),-30+ui->scrollArea->verticalScrollBar()->value());
            qDebug() << "Lokales X 2D " + QString::number(localPos2D->x());
            qDebug() << "Lokales Y 2D " + QString::number(localPos2D->y());

            /// Koordinaten bei Klick in 3D Bild berechnen
            if (ui->label_3Dimage->rect().contains(*localPos3D)){
                ui->label_mauskoordinateX->setText("x   " + QString::number(localPos3D->x()));
                *regionX=localPos3D->x();
                ui->label_mauskoordinateZ->setText("z   " + QString::number(localPos3D->y()));
                *regionZ=*bildHoehe-localPos3D->y()-1;
                ui->label_mauskoordinateY->setText("y   " + QString::number(*bildBreite-dataset.getDepthBuffer(localPos3D->x(),localPos3D->y())));
                *regionY=*bildBreite-dataset.getDepthBuffer(localPos3D->x(),localPos3D->y());
                ui->pushButton_RegionGrowing->show();
                *localPos = ui->label_Image->mapFromParent(*globalPos);
            }