×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    13

    Opening a ContextMenu placed in another file

    I am trying to isolate ContextMenus, which are somewhat generic, i.e., have Edit+Delete options into a standalone QML file.

    Simple question: how does one invoke the open() method from the Qt Component reference. The following code is wrong, but you can get a sense of what I am trying to do:

    Code:
            onPressAndHold: ProjectContextMenu {}.open()
    I had also tried the basic:

    Code:
            onPressAndHold: ProjectContextMenu {}
    but this results in the error:

    Code:
    Cannot assign object type ContextMenu_QMLTYPE_57 with no default method
    advTHANKSance

  2. #2
    Registered User
    Join Date
    Jul 2004
    Posts
    166

    Re: Opening a ContextMenu placed in another file

    To me it looks like you are creating QML Context menu component and trying to open it. I dont think this way QML works. I suggest you to create context menu element in your current QML and use id to open it. like

    MouseArea {
    id: longPressArea
    anchors.fill: parent
    onPressAndHold: myContextMenu.open()
    }
    }

    check this link here

    http://harmattan-dev.nokia.com/docs/...ntextmenu.html
    http://kunalmaemo.blogspot.com/

  3. #3
    Registered User
    Join Date
    Dec 2011
    Posts
    13

    Re: Opening a ContextMenu placed in another file

    You are quite correct. I am trying to isolate common elements much as one would do by declaring other Qt Components in external files. But I gather that QML isn't designed to do this for every component.

    Are there specific `types' of components where it make sense to put into another file, e.g., visual only?

    Thanks.

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    104

    Re: Opening a ContextMenu placed in another file

    I remember doing something like

    ExternalContextmenu{
    id: externalmenu
    }

    on some,
    onClicked: {
    externalmenu.open()
    }

    ExternalContextmenu.qml will contain the actual ContextMenu representation..

    -CK

  5. #5
    Registered User
    Join Date
    Dec 2011
    Posts
    13

    Re: Opening a ContextMenu placed in another file

    But I thought that id is not visible outside of the local file, so wouldn't the externalmenu.open() invocation would fail as a consequence?

  6. #6
    Registered User
    Join Date
    Dec 2007
    Posts
    104

    Re: Opening a ContextMenu placed in another file

    As,

    ExternalContextmenu{
    id: externalmenu
    }

    is going to be in ur local qml file, its gonna be the local instance.. isnt it ?

    -CK

Similar Threads

  1. Replies: 13
    Last Post: 2010-08-25, 07:32
  2. N93, opening SWF file, FILE ERROR message
    By NokiaMobileUser in forum General Development Questions
    Replies: 3
    Last Post: 2010-05-06, 16:20
  3. PDF file not opening
    By dij2kor in forum Automatic Feedback Channel
    Replies: 2
    Last Post: 2009-11-23, 06:13
  4. .sis file not opening on N70
    By asteroidm in forum Symbian
    Replies: 5
    Last Post: 2007-05-04, 17:14
  5. file opening
    By sarayu in forum Symbian
    Replies: 3
    Last Post: 2007-05-04, 13:37

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×