在下面的QML项目中,当项目安装在kimya.mp3上时,我想通过触摸屏幕上的绿色矩形来播放音频文件( iOS,在项目目录中的声音文件夹中)。
.pro文件:
QT += quick multimedia
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Refer to the do
这是我的.pro文件
QT += quick
CONFIG += c++11
DEFINES += QT_DEPRECATED_WARNINGS
TEMPLATE = app
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
我使用Qt5.9.3在iOS 12上创建了一个应用程序,并在qml文件中使用了SwipeView,因此我需要: import QtQuick 2.7 // also test 2.9
import QtQuick.Controls 2.0 // also test 2.1, 2.2 但是我一直有一个错误: module "QtQuick.Controls" version 2.0 is not installed 在我的cmake文件中,我添加了特定的模块Quick和QuickControls2,库是随Qt5.9.3一起安装的,所以我有: set( MY_QT_MODULES
我正在构建一个基于QML的C++应用程序。
简单地说:
在我的主要QML文件中,单击时有一个按钮(矩形)调用JavaScript函数(在外部JS文件中定义):
// My JS file linked to the main QML window
[...]
function actionOnButtonClicked()
{
var x = 0;
var y = 0;
for(var i = 0; i < 3; i++)
{
createObject(x, y);
x = x + 10;
y = y + 1