property attachedObjects in qml...?

I would like to know exactly when the constructor of an attached object called while the qml is being created. Is there by any chance that we can access the attached object from a previous page with the name of the class and the same id qml? You can help the guys. Thanks in advance.

MOD Edit: Topic edited to reflect a new topic

Thanks for the information. I would also add that when a new page of qml is called and if we add an object attached with the same name and id as in the previous page we get a new instance of that class and it is not possible to access the object attached to previous QML page.

Tags: BlackBerry Developers

Similar Questions

  • Accessing the context property of main.qml to a custom list in a file item separate qml

    Hi all

    Sorry if this is already covered somewhere.

    I currently have an application with a list view in my main.qml.  I put a context property for my class app c ++ to be "app" in my main.qml.  My list uses a custom list item that is defined in a file separate qml.  The custom list item has a popup menu.  In this context menu, I want to call Q_INVOKABLE functions that are part of my class from the main application in C++.  What is the best way to be able to do?  Should I just set the context property on my file qml of list item custom like I do with my main.qml or is there a better way?

    Thank you

    I think that this has been repeated several times, but as it is not really intuitive:
    a listitemcomponent lies in a different context, it cannot access the context property of the qml file.
    You can use the reference to the listview to reach outside, see https://developer.blackberry.com/cascades/reference/bb__cascades__listview.html ListItem.view

  • Change the contents of cell based selector QML property in container QML

    I have a selector in which I want to have the text in each cell selector display in one of two ways, depending on the State of another control in the QML that surrounds the selector and the other controls.

    My first attempt used only a QML based Picker with PickerItemComponents.  The PickerItemComponents had their text property set to the return value of a utility JS function that takes two arguments - the PickerItemData extracted string and an indicator a boolean to indicate the JS function how to change the string returned to display in the cell of the selector.

    When I try to spend a QML property set on the selector for JS calls in the PickerItemComponents, I get an error log saying:

    "" ReferenceError: can't find variable: ".

    I assume here that a PickerItemComponent is missing the context of the selector containing the same way that a ListItemComponent is not the context of the parent company of the ListView.  However the docs of PickerItemComponent do not seem to set all of the properties that I could use similiarly to the ListItem.view property, which is ListItemComponent.  (In fact, the PickerItemComponent docs don't same spec property of pickerItemData - it only appears in example code).

    So the next thing I plan extends the C++ PickerProvider class.  However, it seems that this class inherits QObject, not so I don't know if once I go to the trouble to write and expose my own version, I'll be able to finally get the QML of the container including down in the correct callback inside my custom PickerProvider.

    Anyone who has been in this way, please share your experience/solution you are able - thanks!

    You can try @simon_hain replica of this thread
    http://supportforums.BlackBerry.com/T5/native-development/using-QProperty-for-a-label-inside-list-VI...

  • Camera problem-> please very urgent help hit with output

    Hello

    I use default camera in my application once I have capture any image, it is to be saved in the section Gallery consumes memory. Please help how to solve this problem is possible to register in any other directory too, I checked using camera roll path but his does not work... Please help I need to release tomorrow

    import bb.cascades 1.0
    import bb.system 1.0
    import bb.multimedia 1.0
    import my.library 1.0
    import bb.cascades.multimedia 1.0

    {Page}

    ID: cameraScreen
    string property using:
    Boolean photoBeingTaken property

    actions:]
    {ActionItem}
    Title: "capture."
    imageSource: "asset:///images/items/camera-icon.png."

    ActionBar.placement: ActionBarPlacement.OnBar
    onTriggered: {}
    _APP.setBHResult (false);
    photoBeingTaken = _app.getCaptured ();
    If (photoBeingTaken == false) {}
    Camera1.capturePhoto ();
    _APP.setCaptured (true);
                     
    }
    }

    },

    {ActionItem}
    Title: "bookmarks".
    imageSource: "asset:///images/items/bookmark.png."
    ActionBar.placement: ActionBarPlacement.InOverflow

    onTriggered: {}
    _APP.setBHString ("Bookmarks");
    _APP. CallBookmarkScreen (7, 0);
    _APP.setBHResult (false);
    Bookmark var = _bookmarks.createObject ();
    NAV.push (Bookmark)
    }
    attachedObjects:]
    {ComponentDefinition}
    ID: _bookmarks
    Source: "Loading.qml".
    }
    ]
    },
    {ActionItem}
    Title: 'history '.

    imageSource: "asset:///images/items/history.png."
    ActionBar.placement: ActionBarPlacement.InOverflow
    onTriggered: {}
    _APP.setBHString ("History");
    _APP. CallBookmarkScreen (8, 0);
    _APP.setBHResult (false);
    Bookmark var = _history.createObject ();
    NAV.push (Bookmark)
    }
    attachedObjects:]
    {ComponentDefinition}
    ID: _history
    Source: "Loading.qml".
    }
    ]
    },
    {ActionItem}
    Title: "settings".
    imageSource: "asset:///images/items/settings.png."
    ActionBar.placement: ActionBarPlacement.InOverflow
    onTriggered: {}
                    
    var setingscr = _settings.createObject ();
    NAV.push (setingscr)

    }

    attachedObjects:]
    {ComponentDefinition}
    ID: _settings
    Source: "Settings.qml".
    }
    ]
    },
    {ActionItem}
    Title: "Exit".
    imageSource: "asset:///images/items/Exit-button.png."
    ActionBar.placement: ActionBarPlacement.InOverflow
    onTriggered: {}
    _APP.exitpopUP ("\t\tAre are you sure you want to exit?");
    }
    }

    ]

    {Of container
    ID: camerascreen
           
    layout: {DockLayout}

    }
    {Of container
    ID: camerascreen1
    visible: true

    Camera {}
    ID: camera1
    visible: true;
    supCameras variant of property
    attachedObjects:]
    SystemSound {}
    ID: shutterSound
    sound: SystemSound.CameraShutterEvent
    },
    {CameraSettings}
    ID: settings
    }
    ]
    onCreationCompleted: {}
    supCameras = camera1.supportedCameras;
    CameraFocusMode = 1;
    Console.log ("aftercomeback1");
    _APP.setCaptured (false);
    If (supCameras.length == 0 | supCameras [0] == CameraUnit.None) {}
    Console.log ("no unit of the camera is accessible");
    } ElseIf (supCameras [0] == CameraUnit.Rear: supCameras [1] == CameraUnit.Rear) {}
    Console.log ("the rear camera is available.");
    Camera1.open (CameraUnit.Rear);
    } ElseIf (supCameras [0] == CameraUnit.Front: supCameras [1] == CameraUnit.Front) {}
    Console.log ("unity front camera is available.");
    Camera1.open (CameraUnit.front);
    } else {}

    }
    }

    Notecard: {}
    Camera1.getSettings (Settings);
    settings.focusMode = CameraFocusMode.Auto;
    settings.shootingMode = CameraShootingMode.Stabilization
    Camera1.applySettings (Settings);
    }

    onCameraOpened: {}
    Console.log ("aftercomeback1 in oncameraopned");
    Camera1.getSettings (Settings);
    settings.focusMode = CameraFocusMode.Auto;
    settings.shootingMode = CameraShootingMode.Stabilization
    Camera1.applySettings (Settings);
    Camera1.startViewfinder ();
    }
    onCameraClosed: {}
    Console.log ("viewfinder has stopped");
    Camera1.stopViewfinder ();
    }

    onCameraResourceReleased: {}
    Console.log ("viewfinder stopped onCameraResourceReleased");
    Camera1.stopViewfinder ();
    Camera1.close)
    Console.log ("reduce to the minimum is" + Application.minimize ());
    Application.autoExit)
    Camera1.stopViewfinder ();
    Camera1.close)
    }
    / * onCameraResourceAvailable: {}
    Console.log ("viewfinder stopped onCameraResourceAvailable");
    Camera1.open)
    Camera1.startViewfinder ();
    }*/
    onViewfinderStarted: {}
    Console.log ("aftercomeback1 in oncameraopnedonViewfinderStarted");
    Console.log ("oncamera openedd onViewfinderStarted >");
    myIndicator.stop)
    photoBeingTaken = false;
    }

    / * onCameraResourceAvailable: {}
    Camera1.startViewfinder)
    }*/
    onShutterFired: {}
    shutterSound.play ();
    If {(photoBeingTaken)
    Processing.Visible = true;
    }

    }
    / * keyListeners:]
    KeyListener {}
    onKeyEvent: {}
    Perform an action when the signal is emitted
    Camera1.startViewfinder)
    }

    onKeyPressed: {}
    Perform an action when the signal is emitted
    Camera1.startViewfinder)
    }

    onKeyReleased: {}
    Perform an action when the signal is emitted
    Camera1.startViewfinder)
    }
    }
    ]*/
    onViewfinderStartFailed: {}
    Console.log ("oncamera openedd onViewfinderStartFailed >");
    }
    onPhotoSaved: {}
    _APP.setImgFileName (fileName);
    var process = marks.createObject ();
    NAV.push (Processing);

    }
                    
    }
    }
    {Of container
    layout: {DockLayout}
                    
    }
    horizontalAlignment: P
    verticalAlignment: VerticalAlignment.Center
    {ActivityIndicator}
    ID: myIndicator
    visible: false
    preferredWidth: 500
    preferredHeight: 500
    }
    }
    {Of container

    ID: treatment
    verticalAlignment: VerticalAlignment.Center
    horizontalAlignment: P
    visible: false
    preferredHeight: 30
    preferredWidth: 500

    background: Color.create ("#000000")
    TextArea {}
    leftPadding: 170
    verticalAlignment: VerticalAlignment.Center
    horizontalAlignment: HorizontalAlignment.Fill
    editable: false
    text: qsTr ("Loading...")
    textStyle {}
    fontWeight: FontWeight.Bold
    fontStyle: FontStyle.Normal
    color: Color.create ("#ffffff")
    }

    }

    }
    }

    attachedObjects:]
    {ComponentDefinition}
    ID: brands
    Source: "Processing.qml".
    }
    ]
        
       
       
    onCreationCompleted: {}
    Console.log ("onCreationCompleted is called")
    Application.Asleep.Connect (onAsleep);
    Application.Awake.Connect (onAwake);
    Console.log ("onCreationCompleted's over")
    }
    function onAsleep() {}
    Console.log ("onAsleep is called in the function")
    If (camera1.open () == true) {}
    Console.log ("open camera true onAsleep is called in function")
    Camera1.close ();
    Console.log ("closed camera onAsleep is called in function")
    } else {}
    Console.log ("open camera fake onAsleep is called in function")
    Camera1.stopViewfinder ();
    Camera1.close ();
    applicationAsleep();
    }
    }
    function onAwake() {}
    Console.log ("onAwake is called in the function")
    myIndicator.start)
    If (camera1.close () == false) {}
    Console.log ("closed camera fake onAwake is called in function")
    Camera1.open ();
    Console.log ("open camera onAwake is called in function")
    } else {}
    Console.log ("closed camera true onAwake is called in function")
    applicationAwake();
                
    Console.log ("open camera is called in the function")
    Camera1.open ();
    Console.log ("after open camera is called in the function")
    }
    }}

    So, thank you it is is stored in the SD card now... Thanks a lot bb10 community

    is it possible that I can remove the image released from the sd card before you capture another image... access to remove.

    Concerning

    Rashmi

  • problems with application to a textfield focus

    It comes to the page, what am I doing wrong?

    import bb.cascades 1.0

    {Page}
    ID: addPage
    appScene variant property: Application.scene
        
    Signal custom to notify that this page should be closed
    signal is)
        
    title bar: title {} bar
    Title: qsTr ("Add Location") + Retranslate.onLocaleOrLanguageChanged
    dismissAction: {ActionItem}
    Title: "Cancel".
    onTriggered: {}
    The custom here signal to indicate that this page should be closed
    The signal would be treated by the page that invoked it
    addPage.done ();
    }
    }
    }
        
    {Of container
    background: Color.Transparent
    TextField {}
    ID: cityfield
    hintText: qsTr ("enter city or Postal Code") + Retranslate.onLocaleOrLanguageChanged
    inputMode: TextFieldInputMode.Text
    input.submitKey: SubmitKey.Search

    }

    }
    onAppSceneChanged: {}
    This triggers the update if the stage of the application is set to
    This Page QML.
    cityfield.requestFocus ();
    }
    }

    Do you want the text field to get the focus (and pull up the virtual keyboard on Z-devices) as soon as the page is loaded?

    Try to create a property on the qml page:

    property bool showVKB: false
    

    And add this method in your qml:

     onShowVKBChanged: {
            if (showVKB) {
                // This focus request shows the VKB if the Page is created via a ComponentDefinition (see main.qml)
                tfWord.requestFocus();
            }
        }
    

    And then, in your qml page that drives this page, set the showVKB property:

    navigationPane.push(page);
    page.showVKB = true;
    
  • Sharing values between pages in NavigationPane

    Hello

    I'm trying the NavigationPane as well as 2 pages. In the first page, I collect certain values (via text fields, slider, etc.). After that the user fills all the values and click the 'calculate', the second page will be pushed on the screen to display results based on what the user has entered before.

    The way I do now is to store the values of the 'first' page in a few global variables in a javascript file. The second page will then read from these variables and perform the necessary calculation.

    First page:

    import bb.cascades 1.0
    import "ExtJS.js" as MortgageCal
    
    NavigationPane {
        id: navPane
        Page {
            content: Container {
                id: mortgagePaymentSettingPage
                Container {
                    TextField {
                        inputMode: TextFieldInputMode.PhoneNumber
                        id: valueTxt
                        onTextChanged: {
                            ExtJS.Value = Math.round(text)
                        }
                    }
                }
            }
            actions: [
                ActionItem {
                    title: "Calculate"
                    ActionBar.placement: ActionBarPlacement.OnBar
                    onTriggered: {
                        navPane.deprecatedPushQmlByString("resultPage.qml");
                    }
                }
            ]
        }
    }
    

    Second page:

    import bb.cascades 1.0
    import "ExtJS.js" as MortgageCal
    
    Page {
        content: Container {
            id: ResultPage
            Container {
                Label {
                    text: "User Entered: " + ExtJS.Value
                }
    
            }
        }
    }
    

    I wonder if there is a better alternative to make the values of the first page "visiable" on the second page?

    Thank you

    Hello

    the solution is very simple. You can access the valueTxt.text property in resultPage.qml as same qml.

    When you write valueTxt on the second page and put a point, he won't give a suggestion, you must write manually.

    When you compile it will work completely.

    You can access first qml varibale when the second page is pushed by the navigation pane.

    Try this,

    hand. QML

    import bb.cascades 1.0
    
    NavigationPane {
        id: navPane
        Page {
            content: Container {
                id: mortgagePaymentSettingPage
                Container {
                    TextField {
                        inputMode: TextFieldInputMode.PhoneNumber
                        id: valueTxt
                    }
                }
            }
            actions: [
                ActionItem {
                    title: "Calculate"
                    ActionBar.placement: ActionBarPlacement.OnBar
                    onTriggered: {
                        navPane.deprecatedPushQmlByString("resultPage.qml");
                    }
                }
            ]
        }
    }
    

     

    resultPage.qml

     

    import bb.cascades 1.0
    
    Page {
        content: Container {
            Label {
                text: " I am First page Text : " + valueTxt.text
            }
        }
    }
    
  • Cursor position using TextField

    Hello

    Is it possible to get information about the position of the slider component TextField? It is property of cursor QML TextField component, but I can't find something similar in the Cascades.

    ARO

    Maciek

    It seems that the functionality you are looking for does not exist in the current version.

    Please request a feature Issue Tracker: http://supportforums.blackberry.com/t5/Java-Development/Developer-Issue-Tracker/td-p/271768

  • Problems encoding characters but only in c ++

    Hello!

    My project is configured to use the UTF-8 encoding in all its files. I have a label defined in qml. When I set the text property of the QML file, I have no problem with characters such as 'e '. But with the same text, coded in C++, the character is bad.

    Any ideas?

    Hello!

    Please try

    QString::fromUtf8("your text");
    
  • background color works do not in the same file

    I have created a variant of background property in my main.qml file and try to access the same file, but cannot. However I can access this variant of property in OTHER qml files. What gives, ideas? Here is my simplified main.qml file.

    The error I get when you declare the background is: 'value of the 'background' property Type mismatch. "Expecting painting and found null"

    However I can access this variant of property in OTHER qml files.

    TabbedPane {
        id: mainTabPage
        property variant appBackground: Color.create("#D2D5D5")
    
        Tab {
            id: tab1
            NavigationPane {
                id: navPane1
                Page {
                    id: page1
                    Container {
                        background: mainTabPage.appBackground // ERROR HERE
                    }
                }
            }
        }
    
        Tab {
            id: tab2
            ....
        }
    }
    

    Never mind. Found the solution on my own. This is a good workaround and less headaches. You set the varaint of proposal for the hex HTML color string.

    And then in your context, just to create the color with this hexadecimal string as a parameter. Here's how

    And then you can use this hexadecimal string ranging from property and the change in the other leaves, as your settings page.

    Hope that helps.

    TabbedPane {
        id: mainTabPage
        property variant appColorBackground: "#D2D5D5"
    
        Tab {
            id: tab1
            NavigationPane {
                id: navPane1
                Page {
                    id: page1
                    Container {
                        background: Color.create(appColorBackground)
                    }
                }
            }
        }
    
        Tab {
            id: tab2
            ....
        }
    }
    
  • How to save a photo released on film

    Here is my code, but I could not find photos that I took in the floder to camera.

    Anyone know what I did wrong?
    Thank you.

    _______________________________________________________________________

    Project pane tabbed template
    import bb.cascades 1.0
    import bb.multimedia 1.0
    import bb.cascades.multimedia 1.0

    TabbedPane {}
    showTabsOnActionBar: true
    Tab {}
    Title: qsTr ("Capture")
    {Page}
    ID: capture
    actions:]
    {ActionItem}
    Title: "Flash Mode: Off '.
    ActionBar.placement: ActionBarPlacement.InOverflow
    onTriggered: {}
    Camera1.getSettings (Settings);
    settings.flashMode = CameraFlashMode.Off;
    settings.cameraRollPath="169.254.0.1:/accounts/1000/shared/camera ';
    Camera1.applySettings (Settings);

    }
    },
    {ActionItem}
    Title: "Flash Mode: we.
    ActionBar.placement: ActionBarPlacement.InOverflow
    onTriggered: {}
    Camera1.getSettings (Settings);
    settings.flashMode = CameraFlashMode.On;
    settings.cameraRollPath = "169.254.0.1:/accounts/1000/shared/camera";
    Camera1.applySettings (Settings);
    }
    },
    {ActionItem}
    Title: "Flash Mode: Auto.
    ActionBar.placement: ActionBarPlacement.InOverflow
    onTriggered: {}
    Camera1.getSettings (Settings);
    settings.flashMode = CameraFlashMode.Auto;
    settings.cameraRollPath = "169.254.0.1:/accounts/1000/shared/camera";
    Camera1.applySettings (Settings);
    }
    },
    {ActionItem}
    Title: "Flash Mode: Light".
    ActionBar.placement: ActionBarPlacement.InOverflow
    onTriggered: {}
    Camera1.getSettings (Settings);
    settings.flashMode = CameraFlashMode.Light;
    settings.cameraRollPath = "169.254.0.1:/accounts/1000/shared/camera";
    Camera1.applySettings (Settings);
    }
    }
    ]

    The container root.
    content: {container
    ID: cntrRoot
    Control of the camera.
    Camera {}
    ID: camera1
    Boolean photoBeingTaken property
    supCameras variant of property
    attachedObjects:]
    Needed to play the shutter sound.
    SystemSound {}
    ID: shutterSound
    sound: SystemSound.CameraShutterEvent
    },

    {CameraSettings}
    ID: settings
                               
    }
    ]

    Find a supported and the device.
    onCreationCompleted: {}
    supCameras = camera1.supportedCameras;

    Check if your application has access to the camera.
    If (supCameras.length == 0 | supCameras [0] == CameraUnit.None) {}
    Report: "no unit of the camera is accessible."
    Console.log ("no unit of the camera is accessible");
    } ElseIf (supCameras [0] == CameraUnit.Rear: supCameras [1] == CameraUnit.Rear) {}
    Console.log ("the rear camera is available.");
    Camera1.open (CameraUnit.Rear);
    } ElseIf (supCameras [0] == CameraUnit.Front: supCameras [1] == CameraUnit.Front) {}
    Console.log ("unity front camera is available.");
    Camera1.open (CameraUnit.front);
    } else {}
    Report an unknown error.
    }
    }

    Notecard: {}
    If (photoBeingTaken == false) {}
    photoBeingTaken = true;
    Take a photo and automatically
    save it in the file system.
    Camera1.capturePhoto ();
    }
    }

    onCameraOpened: {}
    When the device is open, start the viewfinder.
    Camera1.startViewfinder ();
    }

    onViewfinderStarted: {}
    photoBeingTaken = false;
    }

    In many countries, the law requires that a shutter sound be played
    When an application is taking pictures. Also, if you intend
    you submit your application for BlackBerry World, and then he took that
    He must play the shutter sound when you take pictures.

    onShutterFired: {}
    shutterSound.play ();
    }

    onPhotoSaved: {}
    photoBeingTaken = false;
    }
    } / / End of the control of the camera.
    } / / End of cntrRoot.
    }

    }
    Tab {}
    Title: qsTr ("Gallary")
    {Page}
    ID: tab2
    actions:]
    define the actions of the tab here
    {ActionItem}
    Title: qsTr ("Raise")
    onTriggered: {}
    run the animation of the image
    raiseAnimation.play ();
    }
    }
    ]
    {Of container
    the content tab here
    {Label
    text: qsTr ("Camera Roll")
    horizontalAlignment: P
    textStyle {}
    Base: SystemDefaults.TextStyles.TitleText
    }
    }
    ImageView {}
    ID: imgTab2
    imageSource: "asset:///images/picture1.png."
    verticalAlignment: VerticalAlignment.Center
    horizontalAlignment: P
    layoutProperties: {StackLayoutProperties}
    spaceQuota: 1.0
    }
    scalingMethod: ScalingMethod.AspectFit
    opacity: 0.2
    animations:]
    define animations of image here
    {ParallelAnimation}
    ID: raiseAnimation
    FadeTransition {fromOpacity: 0.2; toOpacity: 1;} {Duration: 1000}
    ScaleTransition {fromX: 1; fromY: 1; toX: 1.5; toy: 1.5;} Duration: 1000; {easingCurve: StockCurve.DoubleElasticOut}
    }
    ]
    }
    }
    }
    }
    Tab {}
    Title: qsTr ("History")
    {Page}
    ID: tab 3
    {Of container
    the content tab here
    {Label
    text: qsTr ("history of the envoys")
    horizontalAlignment: P
    textStyle {}
    Base: SystemDefaults.TextStyles.TitleText
    }
    }
    {Of container
    layout: {DockLayout}
    layoutProperties: {StackLayoutProperties}
    spaceQuota: 1.0
    }
    verticalAlignment: VerticalAlignment.Fill
    horizontalAlignment: HorizontalAlignment.Fill
    {Label
    text: qsTr ("tab 3 content")
    verticalAlignment: VerticalAlignment.Center
    horizontalAlignment: P
    textStyle {}
    Base: SystemDefaults.TextStyles.BodyText
    }
    }
    }
    }
    }
    }
    onCreationCompleted: {}
    This slot is called when declarative scene is created
    write the post creation of initialization here
    Console.log ("TabbedPane - onCreationCompleted()")

    activate the page layout to adapt to the rotation of the device
    don't forget to activate the rotation of the screen in the bar - bescriptor.xml (Application-> Orientation-> Orient)
    OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All;
    }
    }

    You can try the following sample?

    https://github.com/BlackBerry/Cascades-community-samples/tree/master/HelloCamera

  • Registration of QTime in QSettings - problem

    I'm trying to save certain settings. The code below demonstrates the correct alert with correct zoom box and updInter values.

    QSettings settings("ASDF", "QAZWSX");
    
    QTime pickerTime=root->property("pickerTime").toTime();
    
    settings.beginGroup("AppSettings");
        settings.setValue("zoom", root->property("zoom"));
        settings.setValue("updInter", pickerTime);
        alert(settings.value("updInter", "E4").toTime().toString());
    settings.endGroup();
    

    But code below (executed at the beginning of the app) shows the alert box correct with correct zoom and incorrect (00: 00:00) updInter values...

    QSettings settings("ASDF", "QAZWSX");
    
    settings.beginGroup("AppSettings");
        alert(settings.value("zoom", "E3").toString()+" "+settings.value("updInter", "E4").toTime().toString());
    settings.endGroup();
    

    Thank you in advance for the help

    Thanks, @tzander, but savings QTime wasn't mistake - the actual error was that, in some moments (probably onExit), application records QTime == '00:00:00.

    So, I create simple ease condition:

    if(root->property("pickerTime").toString().remove(0,11).compare("00:00:00")!=0){
        settings.setValue("updInter", root->property("pickerTime"));
    }
    

    QML file, I

    property alias pickerTime: intervalPicker.value
    
    (...)
    
    DateTimePicker {
           id: intervalPicker
           mode: DateTimePickerMode.Timer
           value: dateFromTime("00:00:15")
           title: qsTr("Select")
    }
    

    I think, it's very funny, DateTimePicker sometimes changes the value of time

  • How Textfield text on another page qml property access

    Hello

    I started 10 BB development recently and need help. I searched this forum but could not find some information exactly related to my problem (unlike only), or I missed something from basically. My main.qml, I want to access the text property of the textfield of the InputControl.qml to be used as a parameter in my SQLQuery (attached object). I tried to use the fieldname method alias property, but it does not work. I can't feature outside. Here is my code:

    hand. QML

    import bb.cascades 1.4
    import bb.cascades.datamanager 1.2
    import bb.system 1.0
    import bb.data 1.0
    
    Page {
    
        id: root 
    
        titleBar: UIControls {
        }
    
        //! [0]
       content: Container {
    
            leftPadding: ui.du(2)
            rightPadding: ui.du(2)
            topPadding: ui.du(2)
            bottomPadding: ui.du(2)
    
            InputControl {
            }
    
            // The ListView that's used to display the artist data
            //! [1]
            ListView {
                id: myListView
    
                //property variant dq: defaultDataQuery
                // Associate the list view with the data model that's defined in the
                // attachedObjects list
                layout: StackListLayout {
                    headerMode: ListHeaderMode.Sticky
                }
                layoutProperties: StackLayoutProperties {
                    spaceQuota: 1.0
                }
                horizontalAlignment: HorizontalAlignment.Fill
                verticalAlignment: VerticalAlignment.Fill
    
                listItemComponents: [
    
                    ListItemComponent {
                        type:  "item"
    
                        Container {
                            Label {
                                text: ListItemData.Japanisch
                                layoutProperties: StackLayoutProperties {
    
                                }
                                topMargin: 5.0
                                textStyle {
                                    base: SystemDefaults.TextStyles.TitleText
                                    fontWeight: FontWeight.Bold
                                    color: Color.create("#7a184a")
                                }
    
                            }
                            Label {
                                text: ListItemData.Lesung
                                textFit.maxFontSizeValue: 9.0
                                textStyle {
                                    base: SystemDefaults.TextStyles.TitleText
                                    fontWeight: FontWeight.Normal
                                    color: Color.create("#ff1818e9")
                                }
    
                            }
                            Label {
                                text: ListItemData.Deutsch
                                textStyle {
                                    base: SystemDefaults.TextStyles.TitleText
                                    fontWeight: FontWeight.Normal
                                }
    
                                multiline: true
                                textFit.maxFontSizeValue: 8.0
                            }
                            Divider {}
                        }// Container
                    }
                    // Use a standard list item to display the data in the model
                ]    
    
            } // end of ListView
    
        }//![1]
    
        attachedObjects: [
            //! [2]
            // One of the default provided DataModel's
    
            GroupDataModel {
                id: dataModel
                grouping: ItemGrouping.None
            },
            DataSource {
                id: dataSource
    
                // Load the data from an SQL database, based on a specific query
                source: "WadokuJT.db"
                //query: "select Japanisch, Deutsch, Lesung from WadokuJT where Deutsch like '%Wasser%'"
                query: "select Japanisch, Deutsch, Lesung from WadokuJT where Deutsch like '%" + stext + "%'";
    
                onDataLoaded: {
                    // After the data is loaded, insert it into the data model
                    dataModel.insertList(data);
    
                }
                type: DataSourceType.Sql
            } // end of DataSource      
    
        ]//! [2]  
    
        actions: [
            //! [8]
            ActionItem {
                title: qsTr("Search")
                imageSource: "asset:///images/ic_search.png"
                ActionBar.placement: ActionBarPlacement.Signature
                onTriggered: {
                    myListView.dataModel = null
                    dataSource.load()
                    //myListView.dq = defaultDataQuery
                    myListView.dataModel = dataModel 
    
                }
            },
    
            ActionItem {
                title: qsTr("Settings")
                imageSource: "asset:///images/ic_settings.png"
                onTriggered: {
    
                }
            },
    
            ActionItem {
                title: qsTr("Help")
                imageSource: "asset:///images/ic_help.png"
                onTriggered: {
    
                }
            }                           
    
        ]//![8]
    
    } // end of Page
    

    And here is my InputControl.qml

    import bb.cascades 1.4
    
     Container {
         property alias stext: txtSearchText.text
    
        Label {
            id: lblSearchText
            text: "Searchtext\r\n"
    
        }
    
        TextField {
            id: txtSearchText
            layoutProperties: FlowListLayoutProperties {
    
            }
            hintText: "Enter Searchtext"
        }
    }
    

    Any help is greatly appreciated. Thank you.

    Give InputControl an id (in main.qml), for example someId.

    Access the variable an alias like someId.stext

  • JS function as a type of page in QML property

    Hi all

    I'm trying to create useful js 'class' for my blackberry application and save here some information about qml object here is the example of such file js:

    /* * my js */
    
    function Utils(devInfo){ this.devInfo = devInfo; this.text = "test text";
    
     this.getInfo = function(){ return this.text; };}
    

    I want to group some utils functions here and use this js in qml file object, but I don't want to create "Utils" every time, I would like to have a single instance of page qml. I tried to use properties:

    import bb.cascades 1.3
    import com.example.bb10_samples_states 1.0
    import "myscripts.js" as Scripts
    
    Page {
        property variant utils : new Scripts.Utils(deviceInfo)
    
        Container {
            Label {
                id: myLabel
                text: "Hello World"
            }
    
            onTouch: {
                var newLabeltext = utils.getInfo(); // freezing
                myLabel.text = newLabeltext;
            }
        }
    
        attachedObjects: [
            DevInfo{
                id: deviceInfo
            }
        ]
    }
    

    * DevInfo is registered object c ++

    I got the following in the notecard event error message:

    "asset:///main.qml:15: TypeError: result of expression 'utils.getInfo' [[object Object]] is not a function."

    If I do not use the property and only with variable work, everything is ok. The following code works correctly:

    import bb.cascades 1.3
    import com.example.bb10_samples_states 1.0
    import "myscripts.js" as Scripts
    
    Page {
        //property variant utils : new Scripts.Utils(deviceInfo)
    
        Container {
            Label {
                id: myLabel
                text: "Hello World"
            }
    
            onTouch: {
                var utils = new Scripts.Utils(deviceInfo);
    
                var newLabeltext = utils.getInfo();
                myLabel.text = newLabeltext;
            }
        }
    
        attachedObjects: [
            DevInfo{
                id: deviceInfo
            }
        ]
    }
    

    In general, I don't know where I can store object js in qml page to access my functions utils without need to create each time. Any ideas?

    I think I found the answer

    According to this link, there is no global js object and every instance of component QML has own unique copy resources imported from JS:

    ...

    Code-Behind implementation resources

    Most of the JavaScript files imported into a document QML are implementations with State of the QML importation document. In these cases, each instance of the QML object type defined in the document requires a separate copy of the JavaScript and State objects to behave properly.

    The default behavior when importing the JavaScript files must provide a unique and isolated copy for each instance of the QML component. If this JavaScript file any resources or modules with a statement .import, its code will be executed in the same scope as the instance of the QML component and therefore can access and manipulate objects and properties declared in the QML component. Otherwise, it will have its own unique scope, and the objects and properties of the QML component should be passed to the JavaScript file as parameters functions if they are required.

    ...

    http://Qt-project.org/doc/Qt-5/qtqml-JavaScript-resources.html

    So it seems there is no need to implement the model of sigleton or store JS resources in the QML document. I changed my code as follows:

    /**
     * js
     */
    var utils = {
      devInfo : null
    };
    
    function init(deviceInfo){
      utils.devInfo = deviceInfo;
    };
    
    function getText(){
      return utils.devInfo + " done.";
    };
    

    and qml:

    import bb.cascades 1.3
    import com.example.bb10_samples_states 1.0
    
    import "myscripts.js" as Scripts
    
    Page {
        Container {
            Label {
                id: myLabel
                text: "Hello World"
            }
    
            onCreationCompleted: {
                Scripts.init(deviceInfo);
            }
    
            onTouch: {
                myLabel.text = Scripts.getText("Tra-ta-ta");
            }
        }
    
        attachedObjects: [
            DevInfo{
                id: deviceInfo
            }
        ]
    }
    

    It works fine - I can store information in the variable 'utils' and work with qml js objects. Hope so, it will help someone

  • Cannot use the context property in a page created from an another qml with createObject()

                        gestureHandlers: [
    
                            TapHandler {
    
                                onTapped: {
                                    var page = infoPage.createObject();
                                    taskCont.ListItem.view.pushNewPage(page); //this pushes page to navigationPane (function at top of qml)
    
                                }
    
                                attachedObjects: ComponentDefinition {
                                    id: infoPage;
                                    source: "asset:///taskInfo.qml"
                                }
                            }
                        ]
    

    This is how I created the page of 'taskInfo. In the PRC, I registered a context property that I am able to access it from the current page but not in 'taskinfo. "gestureHandlers: []" is "listItemComponents".

    I expect to access the object of 'taskInfo' is because I am able to access it from another page created the same way.

    Here's how to register the context property.

    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    
    mainModel = new ListModel();
    qml->setContextProperty("Model" , mainModel);
    

    OK, I found my problem.

    The reason why he doestn can't work because the page is pushed out "main.qml".

    This is part of my main.qml

    Container {
                id: main_content
    
                TaskList {
                }
    
            }
    

    TaksList is another qml file. When I createObject from this qml file, somewhy context property is not trafered to this object.

    I've found a workaround. I created a function in main.qml and only now I create object, so the contextproperty is transferred

  • Setting a QML property in another file

    I'm pretty new to stunts, so I hope someone could help me with this. This piece of code is supposed to load main.qml, with a button to open a separate sheet (CountryList.qml). On this sheet, it loads a local XML database in a ListView. The user selects one of the items in the ListView, which is supposed to give selectedcountry.text. How would we do that last one?

    hand. QML:

    import bb.cascades 1.2
    
    Page {
        Container {
            Button {
                text: "Pick a country"
                onClicked: {
                    countryList.open()
                }
            }
            Label {
                text: "Selected Country: "
            }
            Label {
                id: selectedcountry
                text: ""
            }
        }
        attachedObjects: [
            CountryList{
                id: countryList
            }
        ]
    }
    

    CountryList.qml:

    import bb.cascades 1.2
    import bb.data 1.0
    
    Sheet {
        id: countryList
        content: Page {
            titleBar: TitleBar {
                title: "Pick a Country"
                dismissAction: ActionItem {
                    title: "Close"
                    onTriggered: {
                        countryList.close()
                    }
                }
            }
            Container {
                Header {
                    title: "List of countries"
                }
                ListView {
                    id: listView
                    dataModel: repoDataModel
                    listItemComponents: [
                        ListItemComponent {
                            type: "header"
                            Container {
                                Label {
                                    text: ""
                                }
                            }
                        },
                        ListItemComponent {
                            type: "item"
                            Container {
                                Label {
                                    text: ListItemData.countryname
                                }
                                Label {
                                    text: "Capital: " + ListItemData.capital
                                    textStyle.fontSize: FontSize.Small
                                }
                                Divider {
                                }
                            }
                        }
                    ]
                    onTriggered: {
                        //Something should go here
                    }
                }
            }
        }
        attachedObjects: [
            GroupDataModel {
                id: repoDataModel
                sortingKeys: [
                "countryname"
                ]
                sortedAscending: false
                grouping: ItemGrouping.ByFullValue
            },
            DataSource {
                id: repoDataSource
                remote: true
                source: "countries.xml"
                query: "repo/country"
                type: DataSourceType.Xml
                onDataLoaded: {
                    repoDataModel.clear();
                    repoDataModel.insertList(data)
                }
            }
        ]
        onCreationCompleted: {
            repoDataSource.load();
        }
    }
    

    onTriggered() your worksheet should issue a

    signal countrySelected (country)

    and the opening Page of the sheet must connect to this signal
    a function such as

    function onCountrySelected (country) {}

    selectedcountry. Text = country

    }

    your current solution always sets the value - even if the user does not select something and only closes the leaf

    This must be decoupled

Maybe you are looking for

  • Open a new tab (before the update, clear page) after updated a page web search engine (junk))

    After clicking on the sign (new tab) this happens: www.Delta-Search.com/?babsrc=NT_ss & mntrId = 067974DE2B19E349 & Mntrid = 119820 & TT = 040713_ctrl & TSP = 4935 I never asked for this, and I've never heard of him. I tried to find where this page i

  • Evo N1015v: Evo N1015v and projector probjems

    An operating system is re - install about 2 weeks ago. All drivers are in, or at least present in the Device Manager. Took out the laptop yesterday and hooked it up to our planning projector show a few pictures. The projector shows the procedure to s

  • 2D string in string table

    Hello Im trying to convert a 'table 2D channels' to a 'string '. I got a simple/effective way to do this? My 2D array is user input in a list/table field. The output must be a string data type, which can be read using the indicator drop-down list box

  • Download of the updates of windows in windows 7

    I downloaded the updates window to update that we suggested by Andre Da Costa via catalog.update.microsoft.com. How and where should I continue to install the downloaded files? I don't need updates, but this means a stop slower every time. hope you c

  • Unknown call claiming to be from Microsoft

    Original title: the files infected Tonight, I received a phone call from a man claiming to be from Microsoft.  He said that they have received information that I have files on my computer infected and that he wanted to guide me through taking them of