Skip to content
  • 0 Votes
    6 Posts
    989 Views
    L
    My sampleColor function was called from the QScrollArea::mouseMoveEvent and the QPoint mousePos was pass in from the mouseEvent there. What I'm suspecting is that when the image was loaded, the default alignment AlignTop & AlignLeft kicked in, then the mouseMoveEvent followed and the sampleColor function somehow took a snapshot of the imageLabel, before the AlignCenter setting in the constructor. That's why my mouse was still seeing the image at the pre-aligncenter position in the snapshot.
  • Items' pos return wrong position

    Unsolved QML and Qt Quick custom widget draw lines qlabel position
    5
    0 Votes
    5 Posts
    2k Views
    raven-worxR
    @mghqt i assume CWidget class is the main widget (window)? How do you compose/layout the form items? Are you using sub-widgets containers? Anyways you should do like you did for pos4 if you want to map a child to a parent. QPoint childPos=ui->label_2->mapTo(this, ui->label_2->pos());