I would like to select an image from existing files in an app written in Qt 5.9 (using Qt Quick and some c++). I tried to use FileDialog from QML (official example here) but when I run it in the emulator, it looks like this:
I did read this blogpost http://amin-ahmadi.com/2015/12/08/how-to-open-android-image-gallery-in-qt/ which explains how to use native code for gallery chooser though I am wondering if meanwhile Qt progressed to make such task readily available in a more straightforward manner.
EDIT: A hint is that FileDialog.shortcut documented here says:
The directory containing the user's pictures or photos. It is always a
kind of file: URL; but on some platforms, it will be specialized, such
that the FileDialog will be realized as a gallery browser dialog.
Better late than never:
Your application probably uses high DPI scaling, which automatically scales the QtQuick.Controls 2 on displays with higher DPI. In main.cpp:
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
Basically the px sizes in your app don't represent physical pixels anymore. Some (older) Qt components, one of those is the FileDialog, don't work as expected on that setting. Removing it should fix your problem, but will probably affect the visual appearance of you app. More Info: https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/
You could try to build your own FileDialog with the FolderListModel: https://doc.qt.io/qt-5/qml-qt-labs-folderlistmodel-folderlistmodel.html
There is also a QML component available to display and select single or multiple images. You can find more info here: https://felgo.com/updates/release-3-2-0-qt-5-12-3-subscriptions
You can also test it right on your mobile phone: https://felgo.com/web-editor/?snippet=77c7ad94
Related
So I'm trying to build a basic app on Android Studio 1.4.0. Yes, I know it's old, but being pretty new to app-building and having found a tutorial I thought I'd go with it.
My question: I put an image into "#drawable." How do I make sure it resizes when I select different emulators? Should I use "#mipmap?" If so, how exactly would I do that? I have different sizes for my image (xxhdpi, etc.) but I don't know how to make it so the emulator "automatically selects" the correct image size.
For adding a resource to your Project use this plugin
https://plugins.jetbrains.com/plugin/7658-android-drawable-importer
You add your img on one size example xxxhdpi and it automatically make all the resizes, then you only set #drawable/yourimage in the ImageView for example and it selects automatically the image needed for that size
And also I highly recomend you to use at least android studio 2.7+, when you decide to actualize after tutorial you'll encounter a lot of differences and too many methods deprecated
The Android Camera and Gallery has been merged in Android 4.1 and above.
Now, I want to play around with the Android 4.2 Camera app, and try to port it on my older devices.
How do I compile https://android.googlesource.com/platform/packages/apps/Gallery2/ and https://android.googlesource.com/platform/packages/apps/Camera/
As far as the sources etc are concerned, both of these should be compiled together.However, the Camera source doesn't have a manifest, which makes it impossible to port on Eclipse.
So, I need help with:
1.How to import both of these projects?
2.How to join them together as one single apk (I tried merging the res and src folders, but still a lot of compiling errors).
3.The Camera source, while calling up popup menus, make reference to R.styleable references to populate the list, instead of normal arrays, which I'm unable to fix. The problem becomes manifold when I set the build target to ICS, because the R.styleable references refuse to cooperate. Deleting them brings up empty popup menus.
Any help would be greatly appreciated. Thank you.
You can have multiple source folders in a Java project (Android project is a subtype of Java project in this sense).
I am using Font Awesome, which was designed for use with Twitter Bootsrap.
The Android (version 2.1) browser on the Galaxy S (Model # GT-I9000M) phone does not display the icons. It shows them as vertical rectangles, similar to what you see here:
Does anybody know a fix to this problem?
Here is the across the board support for #font-face: http://caniuse.com/fontface
2.1 browser simply doesn't support it, and it's not properly supported until 4.0. 2.2-3 partial support refers to the use of local(), which isn't supported at all. Font will not work at all on the stock Android browser if you are trying to source local fonts or using it to force user to download yours (smiley face hack).
Edit: How to know if a font (#font-face) has already been loaded? You can use this jQuery plugin to detect if Font-Awesome has loaded. If it hasn't (either due to bad font file or due to lack of support by the phone) then you can add a class which adds a background image (of the icon) to the div/span/whatever (can't be the <i> tag) that the icon has been applied to.
You can see a demo here.
I want to use a SlidingDrawer in an activity, and I would love to just use the built-in tray handle, rather than try to find or create my own. I found it online thanks to CommonsWare but I assume that they got it from the Android platform itself, so I figure it will benefit me in the long run to know where to find it, rather than just use their copy of it. I looked for it in my Android SDK installation, under platforms/android-8/android.jar/res/ but with no success.
Where can I find the above image, in the Android SDK itself, rather than just downloading it?
Look in the launcher app: ~\platform\packages\apps\Launcher\res\drawable\handle.xml
It uses all the drawables: tray_handle_normal, tray_handle_pressed, tray_handle_selected.
may be you can type android.R.drawable... in eclipse and let the intelli-sense display all the built in drawables.
but I think it's not there cause I searched for it and didn't find it too
thanks
Be carefull with using images that come with the system. Google itself states that they will not guarantee that these images will be included in the system in every release (the name may change). Also the design of your app will change if the user uses something like Blur or Sense that overrides a lot of the standard design items. If you use a copy of the drawable itself you now how your app will look and you can be sure that your app will keep working even if the manufacturer or Google changes the images that come with a device.
In this linked image , I see the button on the right quite often in a lot of apps. On my Moto Droid, it is used extensively in the settings app. It is also used as the default AlertDialog icon. Can I use this via a android.r.drawable?
The icon is built-in with the Android development, you can access the image by using R.drawable.ic_dialog_menu_generic
While it may be possible to use it via android.R.drawable, you may want to find the image in the resources that come with your SDK ($ANDROID_HOME/platforms/$VERSION/data/res, where $ANDROID_HOME is where you have the SDK installed and $VERSION is a relevant Android API level). So, per Mr. Forloney's answer, you'll find that in, say, drawable-hdpi/ic_dialog_menu_generic.png in the aforementioned directory. Then, copy that image into your project. While it will add 5K to your project size, it will mean that the icon does not change based upon OEM or Android changes.