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

Tags: BlackBerry Developers

Similar Questions

  • Random kernel panics repeatedly trap type 14 = page

    Model name: MacBook Pro

    Model identifier: MacBookPro11, 4

    Processor name: Intel Core i7

    Processor speed: 2.2 GHz

    Number of processors: 1

    Total number of Cores: 4

    (By heart) L2 Cache: 256 KB

    L3 Cache: 6 MB

    Memory: 16 GB

    Boot ROM version: MBP114.0172.B09

    Version of the SCM (System): 2.29f24

    I had a several times random kernel panics. I asked the cover of my MBP and I thought he went to sleep. When I tried to turn it back on, it wouldn't start until I plugged in the AC adapter. Then he hit me with the infamous kernel panic message.

    This is the report that was generated. Any help is appreciated, thanks!

    Panic report *.

    panic (cpu 0 0xffffff801ebce5fa appellant): Kernel trap at 0xffffff7f9ff8309a, type 14 = page fault, registers:

    CR0: 0X000000008001003B, CR2: 0X00000000000000BF CR3: 0X0000000021DE8000 CR4: 0X00000000001627E0

    RAX: 0 X 0000000000000000, RBX: 0XFFFFFF803EDC5600 RCX: 0XFFFFFFFB9E6C971A RDX: 0 X 0000000000000001

    RER: 0XFFFFFF922FDEBCF0, RBP: 0XFFFFFF922FDEBD00, IHR: 0XFFFFFF8040ACC800, RDI: 0XFFFFFF803EDC5600

    R8: 0XFFFFFF803D355800, R9: 0 X 0000000000010001, R10: 0 X 0000000000000000, R11: 0 X 0000000000000320

    R12: 0XFFFFFF803DB8AE00, R13: 0XFFFFFF7F9FF366A0, R14: 0 X 0000000000100004, R15: 0XFFFFFF8040ACC800

    RFL: 0 X 0000000000010286, RIP: 0XFFFFFF7F9FF8309A, CS: 0000000000000008, SS 0 X: 0 X 0000000000000000

    Lack of CR2: 0x00000000000000bf, error code: 0 x 0000000000000000, CPU error: 0x0, PL: 0

    Backtrace (CPU 0), frame: return address

    0xffffff922fdeb980: 0xffffff801eadab12

    0xffffff922fdeba00: 0xffffff801ebce5fa

    0xffffff922fdebbe0: 0xffffff801ebec463

    0xffffff922fdebc00: 0xffffff7f9ff8309a

    0xffffff922fdebd00: 0xffffff7fa003808f

    0xffffff922fdebd40: 0xffffff7fa003443a

    0xffffff922fdebd60: 0xffffff801f0b60b8

    0xffffff922fdebdd0: 0xffffff7fa00343c1

    0xffffff922fdebe10: 0xffffff801f0908e3

    0xffffff922fdebe30: 0xffffff801f08e185

    0xffffff922fdebe60: 0xffffff801f08e6f4

    0xffffff922fdebee0: 0xffffff7f9f854fba

    0xffffff922fdebf00: 0xffffff801eb0f24a

    0xffffff922fdebfb0: 0xffffff801ebc9017

    Extensions of core in backtrace:

    com.apple.iokit.IOUSBHostFamily (1.0.1) [CB4D107B-57A9-3DE7-A77A-8EA3DDEC6D76] @0 x ffffff7f9f83e000-> 0xffffff7f9f8a7fff

    dependency: com.apple.driver.AppleUSBHostMergeProperties (1.0.1) [4E0DFB18A]@0xffffff7f9f83a000 E5756029-CBDC-314-b-BB41-FA2

    com.apple.iokit.IOBluetoothFamily (4.4.5f3) [606B7C2C-2166-3760-8B7B-1E28770CBC61] @0xffffff7f9ff32000-> 0xffffff7f9fff4fff

    dependency: com.apple.iokit.IOReportFamily (31) [C89107EE-2DF2-3BC3-9F6D-3133D43ED7EF] @ ff7f9fd84000 0xffff

    com.apple.iokit.IOBluetoothHostControllerUSBTransport (4.4.5f3) [234D9B62-7B6D-3 a 8E-947F-E2F93C504EDE]@0xffffff7fa0033000-> 0xffffff7fa005efff]

    dependency: com.apple.iokit.IOBluetoothFamily (4.4.5f3) [606B7C2C-2166-3760-8B7B-1E28770CBC61] @0xffffff7f9ff32000

    dependency: com.apple.iokit.IOACPIFamily (1.4) [5D7574C3-8E90-3873-BAEB-D979FC215A7D] @0xfffff f7f9fa46000

    dependency: com.apple.iokit.IOPCIFamily (2.9) [D8216D61-5209-3B0C-866D-7D8B3C5F33FF] @ 7f9f32c000 0xffffff

    dependency: com.apple.iokit.IOUSBHostFamily (1.0.1) [CB4D107B-57A9-3DE7-A77A-8EA3DDEC6D76] @0 x ffffff7f9f83e000

    Corresponding to the current thread BSD process name: kernel_task

    Mac OS version:

    15F34

    Kernel version:

    15.5.0 Darwin kernel version: kills Apr 19 18:36:36 PDT 2016; root:XNU-3248.50.21~8/RELEASE_X86_64

    Kernel UUID: 7E7B0822-D2DE-3B39-A7A5-77B40A668BC6

    Slide kernel: 0x000000001e800000

    Text of core base: 0xffffff801ea00000

    Text __HIB base: 0xffffff801e900000

    Name of system model: MacBookPro11, 4 (Mac-06F11FD93F0323C5)

    Availability of the system in nanoseconds: 76903852857831

    last load kext to 76820228404938: com.apple.iokit.IOBluetoothUSBDFU 4.4.5f3 (addr 0xffffff7fa1668000 size 12288)

    Finally unloaded kext to 71533836158535: com.apple.iokit.SCSITaskUserClient 3.7.7 (addr 0xffffff7fa1668000 size 28672)

    kexts responsible:

    com.apple.iokit.IOBluetoothUSBDFU 4.4.5f3

    com Apple.filesystems.smbfs 3.0.1

    com.apple.driver.AppleHSBluetoothDriver 86

    com.apple.driver.AGPM 110.22.0

    com.apple.driver.ApplePlatformEnabler 2.6.0d0

    com.apple.driver.X86PlatformShim 1.0.0

    com Apple.filesystems.autofs 3.0

    com.apple.driver.AudioAUUC 1.70

    com.apple.driver.AppleOSXWatchdog 1

    3.12.7 com.apple.driver.AppleGraphicsDevicePolicy

    com.apple.driver.AppleUpstreamUserClient 3.6.1

    com.apple.driver.AppleHDA 274,9

    com Apple.Driver.pmtelemetry 1

    com.apple.iokit.IOUserEthernet 1.0.1

    com.apple.iokit.IOBluetoothSerialManager 4.4.5f3

    com.apple.driver.AppleIntelHD5000Graphics 10.1.4

    com.apple.Dont_Steal_Mac_OS_X 7.0.0

    com.apple.driver.AppleHV 1

    com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport 4.4.5f3

    com.apple.driver.AppleLPC 3.1

    com.apple.driver.AppleCameraInterface 5.46.0

    com.apple.driver.AppleIntelSlowAdaptiveClocking 4.0.0

    com.apple.driver.AppleBacklight 170.8.9

    com.apple.driver.AppleMCCSControl 1.2.13

    com.apple.driver.AppleSMCLMU 208

    com.apple.driver.AppleIntelFramebufferAzul 10.1.4

    com.apple.driver.AppleThunderboltIP 3.0.8

    com.apple.driver.AppleUSBCardReader 3.7.1

    com.apple.driver.AppleTopCaseHIDEventDriver 86

    com.apple.driver.AppleUSBTopCaseDriver 86

    2.8.5 com.apple.iokit.IOAHCIBlockStorage

    com.apple.driver.AirPort.Brcm4360 1040.1.1a6

    com.apple.driver.AppleAHCIPort 3.1.8

    com.apple.AppleFSCompression.AppleFSCompressionTypeDataless 1.0.0d1

    com.apple.AppleFSCompression.AppleFSCompressionTypeZlib 1.0.0

    com.apple.BootCache 38

    com.apple.driver.AppleACPIButtons 4.0

    com.apple.driver.AppleSmartBatteryManager 161.0.0

    com.apple.driver.AppleRTC 2.0

    com.apple.driver.AppleHPET 1.8

    com.apple.driver.AppleSMBIOS 2.1

    com.apple.driver.AppleACPIEC 4.0

    com.apple.driver.AppleAPIC 1.7

    com Apple.NKE.applicationfirewall 163

    com Apple.Security.Quarantine 3

    com.apple.security.TMSafetyNet 8

    com.apple.driver.AppleUSBAudio 303.3.1

    com.apple.driver.usb.AppleUSBHub 1.0.1

    com Apple.Driver.USB.cdc 5.0.0

    com.apple.driver.IOBluetoothHIDDriver 4.4.5f3

    com Apple.kext.Triggers 1.0

    com.apple.driver.DspFuncLib 274,9

    com.apple.kext.OSvKernDSPLib 525

    com.apple.iokit.IOSerialFamily 11

    com.apple.iokit.IOSurface 108.2.1

    com.apple.driver.CoreCaptureResponder 1

    com.apple.iokit.IOBluetoothHostControllerUSBTransport 4.4.5f3

    com.apple.iokit.IOBluetoothFamily 4.4.5f3

    com.apple.driver.AppleHDAController 274,9

    com.apple.iokit.IOHDAFamily 274,9

    com.apple.iokit.IOSlowAdaptiveClockingFamily 1.0.0

    com.apple.driver.AppleSMBusController 1.0.14d1

    3.12.8 com.apple.AppleGraphicsDeviceControl

    com.apple.iokit.IOAcceleratorFamily2 205,10

    com.apple.driver.AppleBacklightExpert 1.1.0

    com.apple.iokit.IONDRVSupport 2.4.1

    3.12.8 com.apple.driver.AppleGraphicsControl

    com.apple.iokit.IOGraphicsFamily 2.4.1

    com.apple.driver.X86PlatformPlugin 1.0.0

    com.apple.driver.AppleSMC 3.1.9

    com.apple.driver.IOPlatformPluginFamily 6.0.0d7

    com.apple.iokit.IOAudioFamily 204.4

    com.apple.vecLib.kext 1.2.0

    com.apple.iokit.IOSCSIBlockCommandsDevice 3.7.7

    com.apple.iokit.IOUSBMassStorageDriver 1.0.0

    com.apple.iokit.IOSCSIArchitectureModelFamily 3.7.7

    com.apple.driver.AppleHIDKeyboard 181

    com.apple.driver.AppleMultitouchDriver 304.12

    com.apple.driver.AppleHIDTransport 5

    com.apple.driver.usb.IOUSBHostHIDDevice 1.0.1

    com.Apple.Driver.USB.Networking 5.0.0

    com.apple.driver.usb.AppleUSBHostCompositeDevice 1.0.1

    com.apple.driver.AppleThunderboltDPInAdapter 4.1.3

    com.apple.driver.AppleThunderboltDPAdapterFamily 4.1.3

    com.apple.driver.AppleThunderboltPCIDownAdapter 2.0.2

    com.apple.driver.CoreStorage 517.50.1

    com.apple.driver.AppleThunderboltNHI 4.0.4

    com.apple.iokit.IOThunderboltFamily 6.0.2

    com.apple.iokit.IO80211Family 1110.26

    com.apple.driver.mDNSOffloadUserClient 1.0.1b8

    com Apple.Driver.corecapture 1.0.4

    com.apple.iokit.IOAHCIFamily 2.8.1

    com.apple.driver.usb.AppleUSBXHCIPCI 1.0.1

    com.apple.driver.usb.AppleUSBXHCI 1.0.1

    com.apple.iokit.IONetworkingFamily 3.2

    com.apple.iokit.IOUSBFamily 900.4.1

    com.apple.iokit.IOUSBHostFamily 1.0.1

    com.apple.driver.AppleUSBHostMergeProperties 1.0.1

    com.apple.driver.AppleEFINVRAM 2.0

    com.apple.driver.AppleEFIRuntime 2.0

    com.apple.iokit.IOHIDFamily 2.0.0

    com.apple.iokit.IOSMBusFamily 1.1

    com Apple.Security.sandbox 300.0

    com.apple.kext.AppleMatch 1.0.0d1

    com.apple.driver.AppleKeyStore 2

    com.apple.driver.AppleMobileFileIntegrity 1.0.5

    com.apple.driver.AppleCredentialManager 1.0

    com.apple.driver.DiskImages 417,4

    com.apple.iokit.IOStorageFamily 2.1

    com.apple.iokit.IOReportFamily 31

    com.apple.driver.AppleFDEKeyStore 28.30

    com.apple.driver.AppleACPIPlatform 4.0

    com.apple.iokit.IOPCIFamily 2.9

    com.apple.iokit.IOACPIFamily 1.4

    com.apple.kec.Libm 1

    com Apple.KEC.pthread 1

    com Apple.KEC.corecrypto 1.0

    Model: MacBookPro11, 4, MBP114.0172.B09 of BootROM, 4 processors, Intel Core i7, 2.2 GHz, 16 GB, MSC 2.29f24

    Graphics card: Intel integrated Iris Pro, Intel Iris Pro,

    Memory module: BANK 0/DIMM0, 8 GB, DDR3, 1600 MHz, 0x802C, 0x31364B544631473634485A2D314736453120

    Memory module: BANK 1/DIMM0, 8 GB, DDR3, 1600 MHz, 0x802C, 0x31364B544631473634485A2D314736453120

    Airport: spairport_wireless_card_type_airport_extreme (0x14E4, 0 x 152), Broadcom BCM43xx 1.0 (7.21.95.175.1a6)

    Bluetooth: Version 4.4.5f3 17904, 3 services, 27 aircraft, 1 incoming serial ports

    Network service: Wi - Fi, AirPort, en0

    Serial ATA Device: APPLE SM0256G, 251 GB SSD

    USB device: USB 3.0 Bus

    USB device: Apple keyboard / Trackpad

    USB Device: USB Bluetooth host controller

    Bus crush: MacBook Pro, Apple Inc., 27.1

    You do not have third party kernel extensions, so the problem is probably a hardware failure. Take it to an Apple Store for analysis. It is best to make an appointment with the Genius Bar.

  • REP-0737: must be a function of return type 'ref cursor.

    Hi all

    I have create a ref cursor query in reports 10 g. But it is giving error REP-0737: must be a function of return type 'ref cursor.

    Here is my code

    function QR_1RefCurDS return sys_refcursor is
    
     My_Cur Sys_Refcursor;
    begin
      Open My_Cur for select * from scott.emp order by deptno;
      return My_Cur
    end;
    

    fate of the screen.

    Ref_Cursor_in_reports10g.jpg

    Oracle Forms/Reports has a complete PL/SQL engine and (only) the SQL parser.

    However, the engine of forms/States PL / SQL and SQL Analyzer are at a level that was in the Oracle 8.0 database.

    So, in the forms/States functions/procedures and forms/States triggers, you can not use SQL commands that did not exist in the 8.0 database.

    The predefined SYS_REFCURSOR type is introduced in Oracle 9i.

    Use this:

    PACKAGE test_rc IS

    TYPE of rc_type IS REF CURSOR RETURN emp % ROWTYPE;

    END;

    FUNCTION RETURN QR_1RefCurDS Test_rc.rc_type IS

    test_rc.rc_type RC;

    BEGIN

    OPEN the RC to SELECT * FROM emp;

    RETURN rc;

    END;

    Kind regards

    Zlatko

  • I need to restrict printing, but keep the Content Type and permitted Page Extraction. How can I keep the content type and page extraction authorized display?

    When I change the settings to allow content type and page extraction and save it, it shows authorized.  When I close the pdf file, re-open it, examine the security properties, it shows the type of content as allowed and extraction of page as rejected. I need both to stay permit, how that happen?

    As soon as you select do not allow any type of change made to extract file then pages is automatically banned as well. There is no way around that.

  • How to find the Type of Page?

    Hello

    In an application that is already developed, there are about 90 pages.
    If I open a page, where I can find the type on this page? (Ex: report, tree, form, Login Page, etc.).
    If it's a form, how can I find if it is a shape on a form on a Table or a view, table, procedure, etc.?

    Thanks in advance.

    Concerning
    Sharath

    Hi Benjamin,

    Go to the request of manufacturer-> select your application

    then you saw all the pages of your application icon, now you want to find which page is what type,
    at the top you have a search bar with go button,
    then, after that, you have three icons
    1 display) icon
    2 status display)
    view detail 3).

    I thought that your current view is first is why you saw icon, you want to see the type of page click on the second icon i.e report see
    you will get a page of all the page type.

    Thank you
    Jitendra

  • Creating a new type of page or edit an existing one?

    whenever I create a new document, I select a blank page then under page type list several different types of pages. I would modify an existing or create a custom. for example, whenever I create a new document I have to erase the code and type the following...

    <? PHP

    require_once('classes/class.layout.php');

    $layout = new layout;

    $layout-> page_title = ' may be different each page';

    $layout-> render_header();

    $layout-> render_footer();

    ? >

    I tried to create a model, but he still wants editable regions and I don't want to be stuck using this system. I would like the code above to type every time I create a new document. is this possible? do I have to change some kind of xml or js file system? I use CS5 and I'm on a mac.

    It is not quite as simple as that.  You identify a page by its extension type, so you should have to do all the PHP pages like this.  Personally, I would stick with the code snippet.

  • perform a function javascript on a linked page

    I have a page (one.html) which has a javascript function named rocker. on the page, it passes a variable to the function using onClick. for example, onClick = "toggle('img7').

    now on a separate page (two.html), I have link to this first page. I would like to have the link open this page and run the function of rocker, with a variable I specified in the link. is this possible? If so, how? "something to the effect of < a href =".. One.html & toggle ('img5'); "> my < /a > link

    Thanks a lot for taking the time!

    What I meant is that every page using this method must have
    the toggle() function to fade in, or who are related to him... as well as the
    the function below... two of them. The two functions could be placed in a
    external js file and liinked to all pages that use that.

    > In each page using your method...
    >
    > function runToggle() {}
    > loc = location.toString () var.split("?");
    > if(loc[1]) {}
    > var imgID = loc [1];
    > toggle (imgID).
    >} else {return}
    > }
    >
    > Add this to the body...
    >
    >
    >
    > Here are links...
    > Page 1
    > Page 2
    >
    >
    > --
    > Best regards,
    > .. Trent Pastrana
    > www.fourlevel.com
    >
    >
    >
    >
    > "NickTheNameless" wrote in message
    > news:[email protected]...
    > Thank you very much for your time. This is the rocking function...
    >>
    > function toggle (imgID) {}
    > / / This function allows to alternate the display of a text block status and who
    > of
    > Hide/show two images displayed
    > //the images need ID as follows: for section1, ID = img1, for
    > section2d3, ID = img2d3
    >>
    > model var = / img (\w+) /; var result = pattern.exec (imgID). result
    > must be a table, with the figures in the result [1]
    >>
    > If (result == null) {return ;} / / doing nothing if imgID is wrong}
    > format
    > var = 'section' well + result [1]; Well will be
    > section1,.
    > section 2, etc. We must find the div with this title
    >>
    > var titlePattern = new RegExp (well); for example /section2/
    > var divs = document.getElementsByTagName("DIV");
    >>
    > for (var i = 0; i)< divs.length;="" i++="" )="" {="" cycle="" through="" all="" the="">
    > var oneDiv = div ; //putting each in oneDiv
    > match = titlePattern.exec (oneDiv.getAttribute ('SECTION') var
    >> ); Search in the div to see if it matches the string, section2\b or some
    > such
    >>
    > If (match! = null) {//then is our div, so we switch her}
    > visibility
    > If (oneDiv.style.display == 'none') {//if the text is reduced
    > oneDiv.style.display = "inline"; display text
    > document.getElementById (imgID) SRC =
    > "' http://www.info.apple.com/images/kprocedure/Scripts/buttons/hide.gif '; "
    > document.getElementById (imgID) .alt = 'hide ';
    > return;
    >> }
    > {else}
    > oneDiv.style.display = "none"; otherwise, the text is displayed, thus
    > Reduce it
    > document.getElementById (imgID) SRC =
    > "' http://www.info.apple.com/images/kprocedure/Scripts/buttons/show.gif '; "
    > document.getElementById (imgID) .alt = "show";
    > return;
    >> }
    >> }
    >> }
    >> }
    >>
    >
    >

  • Amateurs of questions on specific types of pages

    Hello world

    I just have a questions very amateur on different types of pages. Hi have a site that is mostly HTML pages and a few that are PHP pages. In an effort to save the update when design changes are to be made I want to use tempates. My question is should I let HTML pages in HTML format or should I do the PHP pages even if there is no interaction with the server and they are strictly static? So I have to have two different types of masters of model, one for the HTML pages and one for PHP pages or do I just make all PHP?

    Thanks for any help.
    Robert

    PHP pages are the best way to go if that's what you use on a large number of your pages. It is more consistent and also if you need to add scripts to the other pages or includes you could easily do if pages are already PHP. The browser eventually noticing any difference but if there are no scripts on the page

  • Problems of type of Page ASP.

    Hello world!!!

    I have some problems viewing .asp pages. When I bind in these types of pages (ASP), I get the coding instead of the normal screen display. Someone told me I need to install IIS and ASP.

    I've done the IIS, but I can see a way to do ASP.

    I would like someone to help me on this...


    Thank you...

    Thanks for your advisors...

    They were very helpful...

  • Keeping a DataModel object through several pages of QML

    Hello

    I have a simple question, but so far I have not been able to grasp the exact application. So I have a DataModel.cpp object that loads data from a JSON data file.

    On my page main qml, the data model object is charged by attaching it with the following code...

          // The model itself is a QListDataModel defined in       // mydatamodel.h and registered as a type in the       // creation of the application.
          MyDataModel
          {
            id: dataModel
    
            // The path to the JSON file with initial data, this file         // will be moved to the data folder on the first launch         // of the application (in order to be able to get write access).
            jsonAssetPath: "app/native/assets/data/mydata.json"
          }
    

    Now, from the Main.qml page, I can launch methods, get / set properties, attached signals etc...  for the dataModel object. This is perfect, but in case my application consists of several pages... ie:

    Main.QML > AddNewItem.qml
               
    On the Add QML page, I add a new object to the object MyDataModel.

    > ViewItems.qml

    On the points of view, a ListView is bound to the MyDataModel object.

    > EditItem.qml

    The edit page is called, and the user to apply changes to the MyDataModel

    > ViewGraph.qml

    On the graphic page, the data is distributed to the MyDataModel to display a graph.

    I can re-gasket the MyDataModel on every pages, but this requires a complete reading of the JSON data set, but this isn't the right approach and leads in data refresh issue when adding, editing and deleting items.

    QML, how can an object RPC be passed from one page to another qml... I quickly tried to set a property on the ViewItems.qml variant, but it generates a qml error: the value of the property Type mismatch "dataModel". Expecting DataModel and found zero.

    Page
    {
      property variant data
    
      ...
    }
    

    A simpler solution might be creating the dataModel once in the C++ code and the injection of the instance (not type) as a context for QML property. It will be accessible from all pages.

    The above code, try to declare the property as regarding:

    property alias data : listViewId.dataModel
    

    then you can assign the qml outside:
    qmlpage. Data = dataModelId

  • Push a page of .qml using C++ defines the Navigation pane.

    If I have a navigation pane, as defined in C++...

    nav =  qml->createRootObject();
    

    How to push a page called page.qml? The only documentation I can find is to build the C++ page, that I don't intend to do. The purpose of the Page doesn't seem to have a constructor that takes a file as input qml Page, so I don't know how to create a Page object to him, pushing with the NavigationPane function-> push(Page*).

    First, you must load the qml file and create the object on the page of the qml. Then push the page in the navigation pane.

    This code can help you!

    NavigationPane *nav_pane = new NavigationPane;
    
    QmlDocument *qml = QmlDocument::create("asset:///MyListView.qml").parent(this);
    Page *new_page = qml->createRootObject();
    nav_pane->push(new_page);
    app->setScene(nav_pane);
    

    -Looks

    Riadh

  • Reset the Properties Page of the property inspector in Dreamweaver CS6

    Need help to reset the button properties page in the property inspector. He was there when I installed CS6, but somehow, I have changed the settings.

    Looking at the expanded property inspector?  There is a small white triangle in the lower right corner of the Inspector that enables / disables the display of the bottom of half of this Panel.  It is this part that contains the Page Properties button...

  • Can run us javascript function locally within the amx page?

    Hello

    I am totally new to the features of the MAF, let me just 1 thing right, im familiar with the implementation of javascript as on PHP. For example, (1) you can create a js file in a certain directory of your project as long as you can connect properly. And, on the php page, you link such as)<script type="text/javascript" src="file.js"></script>)to be of use inside of your php page or (2)locally run the javascript function inside your php page such as

    function myFunction(){
      
    Alert("Hello World.");
    }.


    So far what I've done on the tutorial javascript MAF, same case, you need to specify your javascript function inside a .js file and save your js file in your maf function (so that the javascript functions are available and can be called through the java method of AdfmfContainerUtilities.invokeContainerJavaScriptFunction () inside your file of java bean managed). After that, in my case to test the tutorial, I need to create a managed bean method to call the associated javascript function based on my actionlistener to the button that ive created inside my amx page, it didn't work (NOTHING HAPPENED when the button is clicked, as maybe it's because I was wrong by calling the managed bean method or class({viewScope.popupHelperBean.onPopupShowHideAction}). )


    Please follow this tutorial to understand what im referring to topic-> https://blogs.oracle.com/mobile/entry/how_to_open_and_close

    (If someone has already managed to made this javascript tutorial, please inform me so that I can see on my error).


    Now I'm trying a different approach which is to run the javascript locally, it's just that I don't have enough resources that could satisfy my investigation to start with. I met this amx: verbatim terms during my research. Fact amx: verbatim help by running the JavaScript locally.


    Thanks in advance.




    Hello Amey,

    Thanks, I had run successfully the popup alert box based on javascript this tutorial you had linked to me, it seems that I am on the right track on how to run javascript on the page of the amx. Its just that the tutorial I mentioned on my post doesn't seem to work as it should, I'll try to resolve the issues for a while. I just want to share with the community who are new to the MAF and are currently working on the custom javascript on page amx application:

    1. include your js inside your working directory file

    2. Add the javascript code that is personalized to your AMX

    3. create a managedbean and a method that could call the javascript function

    Carefully follow this tutorial as mentioned by Amey have the idea of how the javascript is running on amxpage--> https://blogs.oracle.com/mobile/entry/invoking_custom_javascript_from_an

    By the way, thank you very much Amey.

    Learner90

  • Is the function of "Subscribe to this Page" by default in Firefox, an RSS reader?

    Hello world

    Does anyone know if the "Subscribe to this Page" feature by default in Firefox is an RSS reader?

    For example, I want to subscribe to some articles, etc, and my research has suggested I install Feedly (https://addons.mozilla.org/firefox/ad.../feedly/), I have now. However, I have noticed while playing that in Firefox, the feature to subscribe to a page offers this too - but is equivalent to the function of Firefox an RSS reader?

    Thanks in advance
    Y2J

    I'm glad that I could be sure of you.

    Please use the Mozilla support forums.

    I hope that you will continue to use Firefox and other Mozilla products.

  • Whenever a page is inactive more than 10 seconds or more, the tab bar disappears and I have to type the page until I can scroll down.

    It seems that the browser backgrounds itself, once I type on the page of the tab bar becomes active (ie. it is no longer used in output) and I can use my space bar or press the key to continue scrolling to the bottom of the page again.

    Hello

    Try Firefox Safe mode to see if the problem goes away. Safe mode is a troubleshooting mode, which disables most of the modules.

    (If you use it, switch to the default theme).

    • Under Windows, you can open Firefox 4.0 + in Safe Mode holding the key SHIFT key when you open the desktop Firefox or shortcut in the start menu.
    • On Mac, you can open Firefox 4.0 + in Safe Mode holding the key option key when starting Firefox.
    • Under Linux, you can open Firefox 4.0 + with leaving Firefox then go to your Terminal and running Safe Mode: firefox-safe-mode (you may need to specify the installation path of Firefox for example/usr/lib/firefox)
    • Or open the Help menu and click on the restart with the disabled... modules menu item while Firefox is running.

    Once you get the pop-up, simply select "" boot mode safe. "

    If the issue is not present in Firefox Safe Mode, your problem is probably caused by an extension, and you need to understand that one. To do this, please follow article Troubleshooting extensions, themes and problems of hardware acceleration to resolve common Firefox problems .

    To exit safe mode of Firefox, simply close Firefox and wait a few seconds before you open Firefox for normal use again.

    When find you what is causing your problems, please let us know. It might help others who have the same problem.

    Thank you.

Maybe you are looking for

  • How to restore pc to windows 7

    I participate in the pilot windows 10 and have now re-installed windows 10 in August. I came across a problem that required me to reset the PC so a windows 7 has created copy of drive system which was o/k I did then windows 10 reset. to my dismay, it

  • Need help if please connect a recorder player VCR DVD Toshiba DVR620 to my Vizio TV and also have Comcast Cable

    I need some help hang my the Toshiba DVR620 DVD/VCR Recorder to my Vizio TV and we have Comcast cable my email address is * address email is removed from the privacy *. Want step by step instructions please. As I can't understand those in the manual.

  • How can I go 10 of Windows to Windows 7

    I want to install windows 7 on my computer. You don't like any Windows 10. Do I need a USB download tool?

  • Z10 blackBerry I can't send messages to my BBM contacts

    When I send messages to someone in bbm they receive it, I tried to wipe security then after clearing security that it worked, but after 24 hours, I can't send messages again, always with the Red Cross, I'm a little frustrated now.

  • Download app PlayBook sample problem

    Hi guys,. I am a totally new beginner to the development of the playbook. I'm looking forward to BB10 but right now I don't have the playbook to play with. So I decided to follow the tutorials on the Web site. In the sample app section, there are sev