Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-65927

Shift the coordinates under Android when I use QML + c++.

    XMLWordPrintable

Details

    • Android
    • 06b0b2be160e6122d1a80e7c37916512429cd145 (qt/qtbase/dev) 6152d2cb3f715782106f26e1870453a1bb89b87a (qt/tqtc-qtbase/5.15)

    Description

      Hi,

      I'm making a Qt 5.10 application for Windows, Linux, MacOS etc...
      I use in particular dialog boxes written in QML that I display using c++.

      for example this box:

       

      The C++ part:

      component_aideQML = new QQmlComponent (engine_configuration);
      component_aideQML->loadUrl (QUrl ("qrc: ///qml/help. qml");
      
      helpQML =qobject_cast<QQuickWindow*> component_aideQML->create ();
      
      helpQML->setWidth (450);
      
      helpQML->setHeight (300);
      helpQML->setPosition (0.0,0.0.0);
      
      helpQML->setFlags (Qt:: WindowStaysOnTopHint | Qt:: FramelessWindowHint);
      
      helpQML->showNormal ();
      

       

       the QML part :

      import QtQuick 2.9
      import QtQuick.Window 2.3
      import QtQuick.Controls 2.2
      import QtQuick.Controls.Material 2.2
      import MyLib 1.0
      
      Window {
         id: main2
      
         property double trans: anchoraide.Trans 
         property double coef: anchoraide.Coef
         property string texte: anchoraide.texte
      
         Material.theme: Material.Dark
         Material.accent: Material.Red
      
         modality: Qt.NonModal
      
         //visibility: Window.Windowed
      
         width: 450
         height: 300
      
         color: "#333333"
      
         opacity: trans
      
         Image {
              id: image_fermer
              width: 34
              height: 34
              anchors.top: parent.top
              anchors.topMargin: 0
              anchors.right: parent.right
              anchors.rightMargin: 0
              source: "../res/icons/fermer.png"
      
              MouseArea{
                    anchors.fill: image_fermer
      
                    onClicked:
                    {
                           anchoraide.checkPost_command("exit")
                    }
              }
           } 
       }
      
      Component.onCompleted:
      {
          visible = true
      }
      }
      

      Everything works fine if I use setPosition (0.0,0.0.0);
      when I press the red button, the checkPost_command ("exit") function in the MouseArea sends the "exit" text to the c++ part that allow to close the window...

      On the other hand, everything changes if I use setPosition (0.0,200.0) for example.
      Clicking on the red button no longer sends the signal, but strangely enough, clicking 200 pixels below the red picture will close the window!
      It is as if the MouseArea had been translated by 200 + 200 pixels on the y-axis (see location of the black circle).

       

      Everything works normally on Windows, Linux and MacOS. The problem only appears with Android...

      How do can fix that?

      With my thanks,

      Francky033

      Attachments

        1. qtbug65927.zip
          3 kB
        2. qtbug65927-simplified.zip
          2 kB
        3. Sans titre.png
          Sans titre.png
          29 kB
        4. Sans titre2.png
          Sans titre2.png
          28 kB
        5. Screenshot_20210318-154447.jpg
          Screenshot_20210318-154447.jpg
          437 kB
        6. setPosition (0.0,0.0).mov
          184 kB
        7. setPosition (0.0,200.0).mov
          207 kB

        Activity

          People

            bartlomiejmoskal Bartlomiej Moskal
            francky033 Franck RICHARD
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: