Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.6k Posts
  • Access original imagedata captured by Android QML camera

    Unsolved
    3
    0 Votes
    3 Posts
    1k Views
    C
    @xargs1 thanks for your response. is it also possible to access the image data before the saving process?
  • This topic is deleted!

    Unsolved
    4
    0 Votes
    4 Posts
    80 Views
  • Loader active versus source

    Unsolved
    1
    0 Votes
    1 Posts
    473 Views
    No one has replied
  • Photo gallery in iOS and Android

    10
    0 Votes
    10 Posts
    6k Views
    guidupasG
    Solved Here is the code to get the full image path from android gallery using java equivalent code written with Qt: #include "imagepickerandroid.h" imagePickerAndroid::imagePickerAndroid() { } void imagePickerAndroid::buscaImagem() { QAndroidJniObject ACTION_PICK = QAndroidJniObject::getStaticObjectField("android/content/Intent", "ACTION_PICK", "Ljava/lang/String;"); QAndroidJniObject EXTERNAL_CONTENT_URI = QAndroidJniObject::getStaticObjectField("android/provider/MediaStore$Images$Media", "EXTERNAL_CONTENT_URI", "Landroid/net/Uri;"); QAndroidJniObject intent=QAndroidJniObject("android/content/Intent", "(Ljava/lang/String;Landroid/net/Uri;)V", ACTION_PICK.object<jstring>(), EXTERNAL_CONTENT_URI.object<jobject>()); if (ACTION_PICK.isValid() && intent.isValid()) { intent.callObjectMethod("setType", "(Ljava/lang/String;)Landroid/content/Intent;", QAndroidJniObject::fromString("image/*").object<jstring>()); QtAndroid::startActivity(intent.object<jobject>(), 101, this); qDebug() << "OK"; } else { qDebug() << "ERRO"; } } void imagePickerAndroid::handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data) { jint RESULT_OK = QAndroidJniObject::getStaticField<jint>("android/app/Activity", "RESULT_OK"); if (receiverRequestCode == 101 && resultCode == RESULT_OK) { QAndroidJniObject uri = data.callObjectMethod("getData", "()Landroid/net/Uri;"); QAndroidJniObject dadosAndroid = QAndroidJniObject::getStaticObjectField("android/provider/MediaStore$MediaColumns", "DATA", "Ljava/lang/String;"); QAndroidJniEnvironment env; jobjectArray projecao = (jobjectArray)env->NewObjectArray(1, env->FindClass("java/lang/String"), NULL); jobject projacaoDadosAndroid = env->NewStringUTF(dadosAndroid.toString().toStdString().c_str()); env->SetObjectArrayElement(projecao, 0, projacaoDadosAndroid); QAndroidJniObject contentResolver = QtAndroid::androidActivity().callObjectMethod("getContentResolver", "()Landroid/content/ContentResolver;"); QAndroidJniObject cursor = contentResolver.callObjectMethod("query", "(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;", uri.object<jobject>(), projecao, NULL, NULL, NULL); jint columnIndex = cursor.callMethod<jint>("getColumnIndex", "(Ljava/lang/String;)I", dadosAndroid.object<jstring>()); cursor.callMethod<jboolean>("moveToFirst", "()Z"); QAndroidJniObject resultado = cursor.callObjectMethod("getString", "(I)Ljava/lang/String;", columnIndex); QString imagemCaminho = "file://" + resultado.toString(); emit imagemCaminhoSignal(imagemCaminho); } else { qDebug() << "Caminho errado"; } }
  • Qml ListView full page smooth transition

    Unsolved
    1
    0 Votes
    1 Posts
    828 Views
    No one has replied
  • Context property function calls and threading

    Solved
    4
    0 Votes
    4 Posts
    2k Views
    MonomixM
    Thanks for the responses - really good info. Think I'll investigate the QML worker thread option.
  • 0 Votes
    3 Posts
    4k Views
    johngodJ
    One of the tricks I use is to set all dimensions in milimeters instead of pixels, something like this: property real mm: Screen.pixelDensity property real btnSize: 8 * mm Rectangle { width: btnSize height: btnSize } This, in a perfect world, would give you a rectangle with the same size in devices with different pixel density. But please note that Screen.pixelDensity is the QML version of the c++ QScreen.physicalDotsPerInch, wich according the docs: "This value represents the pixel density on the screen's display. Depending on what information the underlying system provides the value might not be entirely accurate". My experience shows that in laptops and screen monitors que values are very good, you can measure the screen with a ruler and check that the rectangle is 8mm, however I have had bad experiences in mobile android devices, probably because of poor screen/drivers quality. So I usually in my applications I do something like: property real calibrationFactor: 1.0 property real mm: Screen.pixelDensity * calibrationFactor where calibrationFactor is a value that the user can change in some Settins menu to "calibrate" the overall size of the buttons/elements of the app. Also there's more than this to do a one size fits all screens app. Usually there's a all lot of tricks like trying to find the screen dimension and loading different UI's at run time, or using flickable elements and listview elements that can scale up more or less ok with different screen sizes. ALso check this very interesting video https://www.youtube.com/watch?v=nNyhsdX6BsI&list=PLizsthdRd0YwgXOHoXxBrIEgBdzACclcg&index=3
  • QQmlListProperty append function called with incomplete object

    Unsolved qml listproperty
    1
    0 Votes
    1 Posts
    458 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • Why the type NumberAnimation on x don't work when i change it?

    Solved
    2
    0 Votes
    2 Posts
    569 Views
    stackprogramerS
    i concluded that we should define a property like fg in NumberAnimation and we have property int fg:menuspiral.width/3 in type Window now it works. NumberAnimation on x { property int fg duration:2000 loops: Animation.Infinite running:true from: 0; to:fg }
  • PinchArea and dragging

    Unsolved
    2
    0 Votes
    2 Posts
    577 Views
    N
    Okay, so nobody knows what are the drag and minimumXY properties are for in the PinchArea... but does somebody know where to get more information on how to use them?! Thanks nx7z
  • 0 Votes
    11 Posts
    5k Views
    R
    @SGaist OS X 10.10 and Win 10
  • QQuickitemLayer and textureProvider

    Unsolved
    1
    0 Votes
    1 Posts
    497 Views
    No one has replied
  • Trying to use FontMetrics in own Item

    Unsolved
    7
    0 Votes
    7 Posts
    1k Views
    speqtrS
    Sorry for misunderstanding. Can you try this one as a MyField? TextInput { id: myField width: (maximumLength + 1) * fm.averageCharacterWidth height: fm.height + 4 maximumLength: 10 selectByMouse: true clip: true FontMetrics { id: fm font: myField.font } } In this case setting font.pixelSize should work perfectly fine. MyField { font.pixelSize: 14 } Sorry for misleading you in a first place.
  • This topic is deleted!

    Unsolved
    2
    0 Votes
    2 Posts
    43 Views
    No one has replied
  • Poor performance problem

    Unsolved
    2
    0 Votes
    2 Posts
    830 Views
    SGaistS
    Hi, Why not use QFileSystemModel ? It's designed to browse a file system and is threaded to avoid blocking the GUI thread.
  • WebView on OS X

    Unsolved
    5
    0 Votes
    5 Posts
    2k Views
    SGaistS
    Hi, It's the QtWebView module that offers a wrapper around OS X, iOS and Android web views.
  • Why can't I use ternary operator with onClicked

    Unsolved qml quick
    3
    0 Votes
    3 Posts
    6k Views
    SGaistS
    Hi, There's a conversion done when you set the color property thus currently what you are doing is comparing a color with a string. The solution is: background.color = Qt.colorEqual(background.color, "steelblue") ? "purple" : "steel blue"
  • On-the-fly font substitution is awesome! How to turn it off?

    Unsolved
    1
    0 Votes
    1 Posts
    644 Views
    No one has replied
  • Error: module “QtQuick” is not installed in Android

    Solved
    2
    0 Votes
    2 Posts
    611 Views
    A
    It is solved with Qt 5.5. I do not found this issue in Qt 5.5