Dynamically add tabs QML from C++

Hello world

I have a simple TabbedPane defined in QML.  I am trying to reference the TabbedPane via C++ to dynamically add tabs.  Is this possible?  With my current setup, the application starts and crashes then with:

Process 22253787 (MyTabsApplication) terminated SIGSEGV code=1 fltno=11 ip=79310524(/base/usr/lib/libbbcascades.so.1@_ZN2bb8cascades10TabbedPane6removeEPNS0_3TabE+0xf3) mapaddr=00110524. ref=00000010

Here is the code:

TabbedPane {
    id: mytabs
    objectName: "mytabs"

    Tab {
        title: "Tab 1"
        FirstPageView {}
    }
    showTabsOnActionBar: false
}

C++ :

ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
        QObject(app) {

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

    AbstractPane *root = qml->createRootObject();

    TabbedPane *tabbedPane = root->findChild("mytabs");
    Page* page = Page::create();
    Tab* tab = Tab::create()
                 .title("tab2")
                 .description("This is only shown in the side bar");
    tab->setContent(page);
    tabbedPane->add(tab);

    app->setScene(root);

}

Thank you!

Try to declare your root as:

TabbedPane *tabbedPane =  qml->createRootObject();

As TabbedPane is a class of AbstractPane

Tags: BlackBerry Developers

Similar Questions

  • Dynamically add controls QML since a QML function

    Hello!

    I would like to add a control available, under certain conditions. To do this, I want to write a function in QML which it will manage. But I don't know how to instantiate a label and add it. Container has the method add() but syntax that new Sun doesn't.

    Is it still possible?

    Thank you

    Hello!

    This can be done using ComponentDefinition. This page is an example:
    https://developer.BlackBerry.com/Cascades/reference/bb__cascades__qmlcomponentdefinition.html

  • How we can dynamically add or remove action from the popup menu in qml item

    Hi all

    I want to just dynamically add or remove action from the actionset item in the contextual menu especially in qml.

    Thanks in advance.

    Kind regards

    Ankur

    You can do so by joining the actionitem as attachedObjects. Once the page is complete (signal onCreationCompleted), you can add it to the page using addAction()

    To remove, you simply delete the page using removeAction()

    https://developer.BlackBerry.com/Cascades/reference/bb__cascades__page.html

  • Dynamically new tabs, add a tab with a button pane

    In most modern browsers, it is very easy and intuitive how to open a new tab in the same window.
    Usually, there is a small button with a "+" to the right of the tabs. When you click this button, a new tab is created and it receives focus.

    What is the easiest way to mimic this behavior in a JavaFX application?. I think trying to add a tab 'false' with a sign «+» Then I know when this tab is clicked, and on this event, I could dynamically create a new tab and give it focus.
    What is the right way to do it? A small example of how best to implement it would be greatly appreciated.

    This seems to work ok:

    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.Tab;
    import javafx.scene.control.TabPane;
    import javafx.scene.layout.AnchorPane;
    import javafx.stage.Stage;
    
    public class TabPaneWithAddButton extends Application {
    
      @Override
      public void start(Stage primaryStage) {
        final AnchorPane root = new AnchorPane();
        final TabPane tabs = new TabPane();
        final Button addButton = new Button("+");
    
        AnchorPane.setTopAnchor(tabs, 5.0);
        AnchorPane.setLeftAnchor(tabs, 5.0);
        AnchorPane.setRightAnchor(tabs, 5.0);
        AnchorPane.setTopAnchor(addButton, 10.0);
        AnchorPane.setLeftAnchor(addButton, 10.0);
    
        addButton.setOnAction(new EventHandler() {
          @Override
          public void handle(ActionEvent event) {
            final Tab tab = new Tab("Tab " + (tabs.getTabs().size() + 1));
            tabs.getTabs().add(tab);
            tabs.getSelectionModel().select(tab);
          }
        });
    
        root.getChildren().addAll(tabs, addButton);
    
        final Scene scene = new Scene(root, 600, 400);
        scene.getStylesheets().add("tabs.css");
        primaryStage.setScene(scene);
        primaryStage.show();
    
      }
    
      public static void main(String[] args) {
        launch(args);
      }
    }
    

    with the css (tabs.css) file:

    @CHARSET "US-ASCII";
    
    .tab-header-area {
      -fx-padding: 0 0 0 50 ;
    }
    
  • dynamically add or remove items from the context menu?

    Hello

    Is there a (safe) way to dynamically add or remove items

    a context menu for an effect plugin type parameter?

    Thank you.

    N ° parameters, including pop-up lists, filling occurs before the effect is applied to a sequence.

  • Is it possible to dynamically add children to a TabNavigator

    Is it possible to dynamically add and remove children from a TabNavigator. If yes how?

    I have a tabnavigator control with

        <mx:TabNavigator x="70" y="97" width="200" height="200">
            <mx:Canvas label="Tab 1" width="100%" height="100%" id="tab">
            </mx:Canvas>
        </mx:TabNavigator>
    

    How can I add a tab to the tabnavigator?

    Help, please.

    Hello

    Yes, it is possible to add tabs dynamically to TabNavigator.Pls find the code below. Let me know if you have any problem.

    http://www.Adobe.com/2006/mxml">

    Import mx.controls.Label;

    Import mx.containers.VBox;

    private function onCreationComplete():void

    {

    var vbox1: VBox = new VBox();

    vbox1. Label ='Tab 1';

    var lbl1: Label = new Sun

    LBL1. Text ="Panel1";

    vbox1. AddChild (LBL1);

    tabNavigator.addChild (vbox1);

    var vbox2: VBox = new VBox();

    vbox2. Label ="Tab 2";

    var lbl2: Label = new Sun

    LBL2. Text ='Group 2';

    vbox2. AddChild (LBL2);

    tabNavigator.addChild (vbox2);

    var vbox3: VBox = new VBox();

    vbox3. Label ='Tab 3';

    var lbl3: Label = new Sun

    lbl3. Text ="Group 3";

    vbox3. AddChild (lbl3);

    tabNavigator.addChild (vbox3);

    }

    private var counter: number = 0;

    private function addNewTab():void

    {

    var VBox: VBox = new VBox();

    VBOX. Label ="Tab"+ Counter.ToString ();

    var lbl: Label = new Sun

    LBL. Text ="Panel"+ Counter.ToString ();

    vbox.addChild (lbl);

    tabNavigator.addChild (vbox);

    counter ++;

    }

    ]]>

    with respect,

    Mayeul Singh Bartwal

  • How to dynamically add a plot to a graph of mixed signals

    I have a graph of mixed signals where I'm plotting a signal from a time axis. I'm trying to dynamically add a second plot to this graph against the same time axis (with a different scale of Y), but when I built a 2D array and try to connect in the graph (using a local variable) I get an error of size mismatch. I know for sure I did in the past (cable tables with different sizes for a same MSG) with no problems but, today, for some reason any I can't solve this problem.

    Am I missing something?

    Yes, you're probably writing a table 1 d somewhere that is causing to accept only 1 d. To address your problem above, just put a table node build in whenever you have a 1 d table and it will be just a 2D array with a single line of data.

    To add a field to your current locations, your screenshot above should work once the plot knows that he has to accept the 2D tables.

    Reading from a local variable, change something and then write about it once again can lead to a lot of issues down the line. Race conditions are a pain in the butt, so get rid of that sort of thing is good to do from the start. I didn't know the rest of your code, so I don't know how you treat it, but just keep in mind that you add to your software.

  • Dynamic add to cart

    Hey everybody, just try to see if there's a way dynamically add something to the cart. I see the html code for how works the add to Cart button, but it looks like it uses the ID 'product' to add the product itself. However, I am not able to see how I can retrieve the id of the product if all I have is the 'Product Code' (from {tag_productcode}). These two values are different for non insiders.

    I know that if I work a little longer on that I could just get some ajax to visit the real great product page manually and find add to Cart button and enter the ID of the product in this way, this seems excessive.

    If anyone has any ideas, I would be very grateful.

    With the add to Cart then that.

    I don't know why people do not use the documentation - all that it:

    The developer reference

    {{id}} {tag_productid} System displays product ID.
    {{catalogId}} {tag_catalogueid}

    These two you will need dynamic, but make sure you also get the other correct settings.

  • Problem, try to add a user from active directory.

    I joined my vcenter server announcement, when I try to add a user from the ad to the authorization tab, I get this error "the following error occurred when checking the names:

    "ADM\system-test - a general error has occurred: allow exceptions.

    It's not exactly the problem, but it can refine the root cause

    http://KB.VMware.com/kb/1015639

  • "Hyperion" SmartView 11.1.2 tab disappeared from his Excel 2010.

    "Hyperion" of my user Smartview 11.1.2 tab disappeared from his Excel 2010. Trust Center shows that the add-in is not disabled. We reinstalled and installed SV, but nothing has worked. That we can run to register his Excel 2007 SV? There his Excel 2010 Smartview Add-in to HsTbar, Hsaddin.dll

    If the add-in does not appear in the list of people with a disability,

    1. copy the HsAddIn.dll, the HsSpread.dll, the HyperionSmartTag.dll and the HsTbar.xla of the bin Path: \Hyperion\SmartView\bin

    2. paste these files in the folder AddIns Path: C:\Documents and Settings\change
    Note: You must create an AddIns folder for this user.

    3. start > run > cmd > regsvr32/u % Home%\SmartView\bin\HsAddIn.dll Hyperion unregistered (run for each of the *.dll files forever where they are)

    4. start > run > cmd > regsvr32 "C:\Documents and Settings\\Application Data\Microsoft\AddInsHsAddIn.dll' to register (run for each of the *.dll files)

    Note: You should have admin access to the machine in order to register the dll files.

    HTH-
    Jasmine.

  • Dynamically add attributes to xmlelement

    Hello

    I'm trying to dynamically add attributes to an xmlelement. All attributes are stored in a table.
    So what I create a column that contains the attributes in a single line, for example: "sal" = "1000" mgr = '9827.

    So now, I have a query like this:
    select XMLElement(evalname ename)
    from emp;
    Gives me:
    <scott></scott>
    <james></james>
    ...

    What I want to do is to add this attribute to the element, then I me
    <scott "sal"="1000" mgr="9827"></scott>
    ...

    What I've tried is:
    select XMLElement(evalname e1.ename, XMLAttributes(e2.my_attributes))
    from emp e1, (select ename, '"sal"="100" "mgr"="9876"' my_attributes from emp) e2
    where e1.ename = e2.ename
    But which translates:
    <SCOTT MY_ATTRIBUTES="&quot;sal&quot;=&quot;100&quot; &quot;mgr&quot;=&quot;9876&quot;"></SCOTT>
    Someone at - it an idea how to get arround this? I tried with updateXML but I always quotes that have escaped.
    Or is there a better way to dynamically add attributes that are stored in a table?

    Thank you very much.

    Kind regards
    Dimitri
    ----------------------------------
    http://dgielis.blogspot.com/
    http://www.apex-evangelists.com/

    While we are

    SQL>  select * from xmltable('for $i in ora:view("dept")/ROW
                              return element {$i/DNAME}
                                 {for $j in ora:view("emp")/ROW[DEPTNO=$i/DEPTNO]
                                                  return attribute {$j/ENAME} {$j/EMPNO}
                                 }
                             ')
    /
    COLUMN_VALUE
    ----------------------------------------------------------------------------------------------------
    
    
    
    
                                                                                         
    
    5 rows selected.
    

    ;)

  • Cannot add or subtract from the choice of backup discs

    I can't find how to add or subtract from the disks to use for storing upOne of my disks (3) is complete and I want to use new selecta. the preferences window is not resized

    IN aid, he said:
    «If you already set up Time Machine, your backup disks are listed, and information on each disc of the backup is displayed.» To select, add, or remove backup disks, click Select Disk or add or remove the backup disc. »

    I don't see this option in preferences:

    Simon,

    Scroll down in the window pane to display the add/remove disk backup option:

  • With a binding high-speed small (1.3 MB) and living in a multi storage House, is it a lot to win add a device from the airport to the BT router?

    We have a high link flow modest (1 to 3 Mbit/s) and a several-storey house.

    My iMac will work faster Safari if I add a device from the airport to the BT router?

    My iMac will work faster Safari if I add a device from the airport to the BT router?

    No, because the speed of your Internet connection is controlled by your provider, BT, if you need a faster Internet connection, you will need to talk to BT one faster... and more expensive... plan connection.

  • Add an offset from a model chirp

    Hello world

    I would add an offset from a chip model, someone has an idea how to do that? I use a chirp model to draw the FRF of a system excited by a shaker but would need to apply a constant voltage to the agitator before running my chirp (movement around the balance of shift) model.

    Thanks in advance,

    Alex

    shinagan wrote:

    I would like to Add a shift...

    The digital palette has a function 'Add '. That's all you probably need.

    A scalar shift of the wire to a single entry and table ot the other.

  • Reference Dell studio 1536 gacé graphic / help__i have a computer laptop dell studio and I want to add additional video from my laptop hybrid crossfire support card and I can't find a solution and a graphics card for my notbook

    Ideas:

    • I have a dell studio laptop and I want to add additional video from my laptop hybrid crossfire support card and I can't find a solution and a graphics card for my notbook

    There SR 780 chip and also I could not find any housing emty external or internal to a 3D support
    Help, please

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Hi waheedkhan

    Welcome to the Microsoft Answers Forum!

    To install additional video card for laptop is not possible as desktop, as the video card is integrated with the motherboard. However you can contact Dell technical support if they can provide an additional location for add video card. Here is the link to the support technology guide below: http://support.dell.com

    Thank you, and in what concerns:

    Samhrutha G S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

Maybe you are looking for