如何在Qt中打开ios画廊 [英] how to open ios gallery in Qt

查看:88
本文介绍了如何在Qt中打开ios画廊的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Qt打开ios画廊,我发现了很多文章和答案.我测试了它们,但它们在ios中不起作用(10) 这是两个对我不起作用的链接

i'm trying to open ios gallery with Qt , i found many article and answers . i test them but they didn't work in ios(10) here are two links that are not working for me

链接1:使用FileDialog打开ios画廊{}

链接2:将Objective-c与Qt混合以访问ios中的图片库

第一个链接介绍了如何使用FileDialog打开画廊,并提供链接说明:

first link explained how to open gallery with FileDialog ,according to link and it's description :

在iOS中

只需在QML文件内创建一个FileDialog并设置文件夹: 快捷方式图片.它将称为iOS画廊.

in iOS just create a FileDialog inside the QML file and set folder: shortcuts.pictures. It will call the iOS gallery.

.下面是我的代码,但是不起作用!

. below is my code but it doesn't work !!

import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Dialogs 1.0


ApplicationWindow {
    visible: true
    width: 640
    height: 480

    FileDialog {
        id: fileDialog
        visible: true
        folder: shortcuts.pictures

    }

}

第二个链接,我无法编译它,但出现此错误

second link , I couldn't compile it and i got this error

ld: '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a(arclite.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **


The following build commands failed:
    Ld Debug-iphonesimulator/QuickIOSExample.app/QuickIOSExample normal x86_64
(1 failure)
make: *** [xcodebuild-debug-simulator] Error 65
14:05:48: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project quickiosexample (kit: iphonesimulator-clang Qt 5.8.0 for iOS)
When executing step "Make"

感谢您的回答:)

推荐答案

画廊的解决方案是:

1)Android Gallery

import QtQuick 2.8
import QtQuick.Controls 2.1
import QtQuick.Controls.Material 2.2
import QtQuick.Controls.Universal 2.1


Rectangle {
id:rootOpenGallery
y: Global.getMaxHeight()
color: "transparent"
implicitWidth: 85
implicitHeight: openGallery.height

function visibleAnimation(visible)
{
    if(visible===true)
        animShow.start();
    else
        animHide.start();
}

PropertyAnimation { id: animHide;
    target: rootOpenGallery;
    property: "opacity";
    to: 0.0
    duration: 900 }
PropertyAnimation { id: animShow;
    target: rootOpenGallery;
    property: "opacity";
    to: 1.0
    duration: 900 }
Button{
    id:openGallery
    anchors.fill: parent
    //highlighted: true
    Material.background: "#00796B"
    Text{
        text:"Gallery";
        height: parent.height;
        anchors.left: parent.left;anchors.leftMargin: 5
        font.family: Global.fontByekan; verticalAlignment: Text.AlignVCenter;
    }

    Image {
        sourceSize.height: 32; sourceSize.width: 32
        height: parent.height
        anchors.right:  parent.right; anchors.rightMargin: 5
        fillMode: Image.Pad
        source: "../../images/Gallery-image.svg"
    }
    onClicked: {
        picker.showImagePicker();
    }
}

ImageDialog{
    id: picker
    multiSelect: true
    onImageSelected: {
        for(var i=0;i<urls.length;i++)
            if(checkDuplicate(urls[i])===false){
                picListModel.append({"checked":true , "fileName":urls[i] , "upload": false,"errorDescription":""})
            }                
    }

    function checkDuplicate(url){
        for(var i=0;i<picListModel.count;i++) {
            if(picListModel.get(i).fileName===url)
                return true;
        }
        return false;
    }
}

}

这篇关于如何在Qt中打开ios画廊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆