This is probably a very noob question... I am very new to Qt, and trying programming in Qt creator. Now I created a new Qt Quick Application from Qt creator, and I play a audio and i would like control volume and mute but idon't know how.
Button {
id: muteButton
onClicked: mediaPlayer.muted ...
text: qsTr("Mute")
}
Slider {
id: volumeSlider
Layout.fillWidth: true
maximumValue: mediaPlayer.volume = 1.0
property bool sync: false
onValueChanged: {
if (!sync)
mediaPlayer.seek(value)
}
Connections {
target: mediaPlayer
onPositionChanged: {
volumeSlider.sync = true
volumeSlider.value = mediaPlayer.volume
volumeSlider.sync = false
}
}
Try
onClicked:
{ mediaPlayer.muted = true; }
Set to false if you want to unmute.
Related
I have developed the Android app with HTML5,CSS and Javascript using Cordova.
In this I have used some native plugins like geolocation etc.
I want to convert this app to iOS.
Will the app directly be converted to iOS without changing any code?
What should I do?
I know there is Phonegap build services but I have not used Phonegap to develop the app.
I do not have a Mac machine.
Thanks,
Ext.application({
viewport: {
autoBlurInput: false
},
name:'MyApp',
controllers:[],
stores:[],
models:[],
views:[],
launch:function(){
Ext.Msg.defaultAllowedConfig.showAnimation = false;
if (Ext.os.is.Android) {
Ext.Viewport.on('painted', function () {
Ext.Viewport.setHeight(window.innerHeight);
});
}
Ext.Viewport.add(Ext.create('MyApp.view.LoginView'));
}
});
Ext.define('Override.util.PaintMonitor', {
override: 'Ext.util.PaintMonitor',
constructor: function (config) {
return new Ext.util.paintmonitor.CssAnimation(config);
}
});
Ext.define('Override.util.SizeMonitor', {
override: 'Ext.util.SizeMonitor',
constructor: function (config) {
var namespace = Ext.util.sizemonitor;
if (Ext.browser.is.Firefox) {
return new namespace.OverflowChange(config);
} else if (Ext.browser.is.WebKit || Ext.browser.is.IE11) {
return new namespace.Scroll(config);
} else {
return new namespace.Default(config);
}
}
});
I have a directive which controls my input value desired formatted or not.
directive('validNumber', function(shareDataService)
{
return
{
require: 'ngModel',
link: function(scope, element, attrs, ngModelCtrl)
{
if(!ngModelCtrl)
{
return;
}
ngModelCtrl.$parsers.push(function(val) {
if (angular.isUndefined(val)) {
var val = '';
}
var clean = val.replace(/[^-0-9\.]/g, '');
var decimalCheck = clean.split('.');
if(!angular.isUndefined(decimalCheck[1]))
{
decimalCheck[1] = decimalCheck[1].slice(0,2);
clean = decimalCheck[0] + '.' + decimalCheck[1];
}
if (val !== clean)
{
ngModelCtrl.$setViewValue(clean);
ngModelCtrl.$render();
}
return scope.hesapla(clean);
});
element.bind('keypress', function(event) {
if(event.keyCode === 32) { // space
event.preventDefault();
}
});
element.bind('keypress', function(event) {
if(event.keyCode === 45) { // - key
event.preventDefault();
}
});
}
};
})
It's working on browser perfectly but keypress event not working on the device.Tried to inspect device with google chrome but not firing. I also tried keyup or keydown but still not working. How can I get this done?
Thank you
Include jQuery Mobile file
What you need to do is just include a jQuery file into your project. A file named jQuery.mobile.js or quite similar (ex. jQuery.ui.js) of any version can help you.
You can download it from : Download | jQuery Mobile
I have a Sencha Touch 2 project and everything works great in the web browser. No errors in the console, and everything looks good. Once I package it with Phonegap and run it on a mobile device, however, things don't work as well.
I am using ext.device.notification.show in two places in my application. At first, I was doing requires: 'Ext.device.*' and while it worked in web, the app wouldn't run on mobile and eclipse would give me the error message Uncaught TypeError: Cannot read property 'name' of undefined. I switched over to requires: Ext.device.Notification (exact spelling and capitalization) and now the app runs but when I click a button that should create a message box, I get the error Uncaught TypeError: Cannot call method 'confirm' of undefined. The problem is I have no method called confirm. In one case I have a method called confirmItem, but for the second button that should be invoking a message box I have no method remotely close to "confirm."
I'll post one of the controllers below (this one has the confirmItem method):
Ext.define('MyApp.controller.MainController',
{
extend: 'Ext.app.Controller',
requires: ['Ext.device.Notification'],
config:
{
refs:
{
mainView: 'mainview',
btnConfirm: 'mainview button[action=confirmItem]',
},
control:
{
'btnConfirm':
{
tap: 'confirmItem'
},
mainView:
{
onSignOffCommand: 'onSignOffCommand'
}
}
},
// Transitions
getSlideLeftTransition: function ()
{
return {
type: 'slide',
direction: 'left'
};
},
getSlideRightTransition: function ()
{
return {
type: 'slide',
direction: 'right'
};
},
onSignOffCommand: function ()
{
var me = this;
console.log('Signed out.');
loginView = this.getLoginView();
//MainView.setMasked(false);
Ext.Viewport.animateActiveItem(loginView, this.getSlideRightTransition());
},
confirmItem: function ()
{
Ext.device.Notification.show(
{
title: 'Confirm',
message: 'Would you like to Confirm?',
buttons: ['No', 'Yes'],
callback: function (button)
{
if (button == "Yes")
{
MyApp.app.getController('MainController')
.confirmPickup();
}
else
{
console.log('Nope.');
}
}
});
},
confirmPickup: function ()
{
var me = this;
var loginStore = Ext.getStore('LoginStore');
mainView = this.getMainView();
mainView.setMasked(
{
xtype: 'loadmask',
message: ' '
});
if (null != loginStore.getAt(0))
{
var user_id = loginStore.getAt(0).get('id');
var name = loginStore.getAt(0).get('name');
var winner = loginStore.getAt(0).get('winner');
}
if (winner === 1)
{
console.log('success');
}
else
{
console.log('fail');
}
}
});
I only assume this is a problem because whenever I push the button that should be calling confirmItem I get the error. Am I using Ext.device.Notification correctly, or Have I missed something needed to make it work in Phonegap?
I found the solution! Everything was fine from a Sencha Touch point of view in terms of using requires: Ext.device.Notification but some things were missing on the Phonegap side. Specifically, I needed to install the appropriate plugins.
Open a terminal and type: Phonegap local plugin list to see your currently installed plugins. I had none. I went ahead and installed:
org.apache.cordova.device
org.apache.cordova.dialogs
org.apache.cordova.vibration
by using the following reference: http://docs.phonegap.com/en/3.0.0/cordova_device_device.md.html and selecting options from the menu on the left.
I am creating a program in Qt 5.1 and Qt Quick 2.0 for Android but my phone doesn't seem to send keypresses. The same code works when i run it on my desktop so the focus seems to be okay.
Both the Keys.onPressed and the Keys.onBackPressed don't work, the back key just closes the program. I am debugging on a Android 4.2 device via ADB.
Main.qml
Rectangle {
id: container
focus: true
Keys.onPressed: {
console.log(event.key)
if (event.key === Qt.Key_Backspace) {
if (rectangleDetails.visible === true) {
console.log("Left key pressed")
rectangleDetails.visible = false
listViewIndex.visible = true
event.accepted = true
} else {
Qt.quit()
}
}
}
Keys.onBackPressed: {
console.log("Back key pressed")
if (rectangleDetails.visible === true) {
rectangleDetails.visible = false
listViewIndex.visible = true
event.accepted = true
} else {
Qt.quit()
}
}
Thanks in advance
Try Keys.onReleased. This should solve your issue. See here for more information http://qt-project.org/forums/viewthread/29366
This is working fine in my browser but when I install the app on my phone and use it ... it looks fine UNTIL I force it to stop and reopen the app and then all my records are gone.
Im using 2.2 and Phonegap.... any help would be VERY appreciated. Here is my store:
Ext.define('MyApp.store.Presentations', {
extend: 'Ext.data.Store',
config: {
model: 'MyApp.model.Presentations',
sorter: 'title',
grouper: function (record) {
var upperCased = record.get('title')[0].toUpperCase();
return upperCased; //First letter of the title - how we GROUP these
},
autoLoad: true,
proxy: {
type: 'localstorage',
id: 'presentations'
}
}
});
I save like this:
var newPresentation = { title: prezTitle, content: '' };
Ext.getStore('Presentations').add(newPresentation);
var newRecord = Ext.getStore('Presentations').sync();
You can try by adding the following code to the DroidGap class :
super.appView.getSettings().setAllowFileAccess(true);
super.appView.getSettings().setDatabaseEnabled(true);
super.appView.getSettings().setDatabasePath("/data/data/" + appView.getContext().getPackageName() + "/databases/");
super.appView.getSettings().setDomStorageEnabled(true);
This lines have solved the same problem that i got