如何打开的Qt库的ios(how to open ios gallery in Qt)

2019-09-29 21:48发布

我试图打开使用Qt IOS画廊,我发现很多文章和答案。 我测试他们,但他们没有工作在IOS(10)这里有没有为我工作的两个链接

链接1:打开IOS坑道的FileDialog {}

链接2:混合Objective-C的使用Qt来访问IOS画廊

第一个链接解释如何打开与FileDialog的画廊,根据链路,它的描述:

shortcuts.pictures:在iOS的只是QML文件,并设置文件夹中创建一个FileDialog的。 它将调用了iOS画廊。

。 下面是我的代码,但它不工作!

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

    }

}

第二个链接,我不能编译它,我得到这个错误

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"

谢谢您的回答 :)

Answer 1:

对于画廊的解决方案是:

Android的

1)Android图库

IOS

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;
    }
}

}


文章来源: how to open ios gallery in Qt