如何在Qt中打开ios画廊

2024-02-13

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

链接 1:使用 FileDialog{} 打开 ios 图库 https://stackoverflow.com/questions/33443114/photo-gallery-in-ios-and-android

链接 2:混合 Objective-c 和 Qt 访问 ios 中的图库 https://github.com/benlau/quickios

第一个链接解释了如何使用 FileDialog 打开图库,根据链接及其描述:

在 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"

谢谢您的回答 :)


画廊的解决方案是:

Android

1)安卓图库 https://forum.qt.io/topic/59813/photo-gallery-in-ios-and-android/10

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

}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在Qt中打开ios画廊 的相关文章

  • UIWebView:在 Safari 中打开一些链接,一些在视图中打开

    我的应用程序具有在 UIWebView 中呈现的内容 出于文本格式原因 内容中有一些链接 其中一些链接应在移动 Safari 中打开其目标 而其他链接则应在内容中导航 到目前为止 我已经使用 UIWebView 委托捕获了链接请求 在我的实
  • 如何在气隙 Mac 上安装新的 Apple 全球开发者关系中级证书?

    您可能知道也可能不知道 现在使用新的中间证书生成新的签名证书 你可以在这里读到它 https developer apple com support wwdr intermediate certificate https developer
  • iOS9 Sprite 套件问题

    一切都很顺利 直到我升级到 xCode 7 和 iOS 9 我当前的项目是一个 2D 平台游戏 自从升级以来 我就陷入了我们许多人似乎都面临的精灵套件错误 错误的困扰 我的问题是 每次游戏在模拟器或设备上运行时 所有精灵的 zPositio
  • 为什么我需要 2 个或更多核心数据模型?

    我很想知道谁使用多个核心数据模型以及为什么 有什么好处 我正在开发一个应用程序 我认为我可以从多个模型中受益 但我不确定其他好处 我即将推出的应用程序将适用于 iPad 和 iPhone 的另一个版本 iPad 有 3 个主要内容 iPho
  • 如何使用 Objective-C 解析 JSON?

    我是 iPhone 新手 谁能告诉我解析此数据并获取活动详细信息 名字和姓氏的步骤 error false data activity id 35336 user id 1 user first name Chandra Bhusan us
  • 如何在 iOS 中创建多行表格单元格?

    如何让第二个单元格扩展以适合文本而不是缩放文本 iOS 中有内置的方法可以做到这一点 还是我必须想出一些自制的解决方案 如果您查看 iOS 联系人应用程序 会发现有一个类似地址的框 但我找不到如何实现这一点 对于任何希望将来实现这一目标的人
  • 如何在javascript中计算日出和日落?

    我正在使用appcelerator titan开发一个IOS应用程序 我想让我的应用程序在日出和日落时向用户发送本地通知 解决这个问题的一个好工具是使用 YQL 的雅虎天气 但是 雅虎天气仅供非商业用途 我正在尝试找到一个javascrip
  • 以编程方式更改自动布局约束后视图未更新

    事先我必须说 我实际上得到了我想要的可见效果 但不是以令人满意的方式 因为现在需要 打破 约束而不是正确更新 我有一个 ViewController 其中包含一个 UITableView 那个的高度tableView可以从 0 不可见 到它
  • Objective-C 属性和内存管理

    给出以下属性定义 property nonatomic retain MyObject foo 以下代码是否会导致内存泄漏 self foo MyObject alloc init 看起来 alloc 调用将对象上的保留计数增加到 1 然后
  • 如何安装 C++ 的 VOCE?

    我正在尝试安装 VOCE api 它是为 C 和 Java 构建的语音识别 API 这是我第二次使用外部 C 库 也是第一次使用 Java C api 语音链接 http voce sourceforge net http voce sou
  • 如何在禁用状态下更改 UIButton 图像 alpha?

    我有一个带有图像的 UIButton 在其禁用状态下 该图像应具有 0 3 alpha UIButton button UIButton buttonWithType UIButtonTypeCustom UIImage arrowImag
  • 我可以安全地将 UInt32 存储到 NSUInteger 吗?

    在标头中 它的定义如下 if LP64 TARGET OS EMBEDDED TARGET OS IPHONE TARGET OS WIN32 NS BUILD 32 LIKE 64 typedef long NSInteger typed
  • Xcode 7.2 无法连接到装有 iOS 9.2 的 iPhone

    出于开发目的 我已经在我的 iPhone 5s 上安装了 iOS 9 2 beta 当然 我还安装了Xcode 7 2 beta 当我想在设备上运行应用程序扩展 键盘 时 该应用程序会正确构建 安装在 iPhone 上并启动 然而 然后我在
  • iPad 横向框架宽度和高度混合

    我已经完成了这个问题所说的 横向模式仅适用于 iPhone 或 iPad https stackoverflow com questions 2647786 landscape mode only for iphone or ipad 但v
  • -[_SwiftValueencodeWithCoder:]:无法识别的选择器发送到实例

    尝试使用 NSCoder 时出现错误 玩家 swift class Player NSObject NSCoding private var playerName String private var playerScore Int pri
  • Qt - 添加超链接到对话框

    有没有办法在 Qt 对话框中添加可点击的超链接 IE 它应该看起来像一个超链接 蓝色文本 当您单击它时 它应该在浏览器中打开该超链接 像这样的东西 Use QLabel setOpenExternalLinks bool 并在标签上设置文本
  • 使用后台配置时 NSURLSessionDownloadTask 不断重试

    当涉及到缓慢的后端和使用后台配置下载数据时 我遇到了问题 NSURLSessionConfiguration sessionConfig NSURLSessionConfiguration backgroundSessionConfigur
  • 如何为QTableView中的当前项目设置样式表

    When QTableView编辑控件对于发生编辑的当前项目可见 当窗口中没有活动的编辑控件时QTableView当前项目的样式使用QTableView selection background color 如何只为当前项目设置不同的样式
  • Xcode 中的 Prefix.pch 文件是什么?

    许多开发人员正在向其中添加各种方便的宏Prefix pch 但我的问题是那是什么Prefix pch file 如果我删除它Prefix pch来自我的文件Xcode 那么我的应用程序会运行吗 或者会显示什么错误吗 或者它会在构建过程中崩溃
  • 如何在 Swift 中将所有 iOS 设备的标签水平居中

    我不知道如何使标签在图像视图中水平居中 标签说 You ve been here What would you rate us 我想要What would you rate us属于 You ve been here 我试图完成此操作的方法

随机推荐