How to connect the slot button Cascades

I am new to waterfalls and QML and yesterday I tried to port native QtWidget app to waterfalls, but it does not. The problem is, I add some buttons to the container in QML main file and coded my custom slot function which should be executed when the user click some button. But I don't know how to connect the clicked() signal to my function from the custom location.

When using

Connect (CloseButton, signal(Button::clicked()),this,slot(on_closeButton_clicked()));) or connect (exitButton, SIGNAL (clicked ()), this, SLOT (on_exitButton_clicked ())); I get error "unable to connect SIGNAL (null) to SLOT (on_closeButton_clicked ()) ' on all the buttons.

Here is my code in app.cpp

App::App()
{
    QmlDocument *qml = QmlDocument::create("main.qml");
    qml->setContextProperty("cs", this);

    AbstractPane *root = qml->createRootNode();
    Application::setScene(root);
    textHolder = root->findChild("textHolder");
    openButton = root->findChild("openButton");
    saveButton = root->findChild("saveButton");
    saveAsButton = root->findChild("saveAsButton");
    closeButton = root->findChild("closeButton");
    exitButton = root->findChild("exitButton");

    connect(openButton,SIGNAL(Button::clicked()),this,SLOT(on_openButton_clicked()));
    connect(saveButton,SIGNAL(Button::clicked()),this,SLOT(on_saveButton_clicked()));
    connect(saveAsButton,SIGNAL(Button::clicked()),this,SLOT(on_saveAsButton_clicked()));
    connect(closeButton,SIGNAL(Button::clicked()),this,SLOT(on_closeButton_clicked()));
    connect(exitButton,SIGNAL(clicked()),this,SLOT(on_exitButton_clicked()));
}

//one slot function

void App::on_closeButton_clicked()
{
//ui->textEdit->clear();
    textHolder->resetText();
//if(file.open(QIODevice::ReadOnly | QIODevice::Text)){
    file.close();
    fileName.clear();
//}
}

And qml

import bb.cascades 1.0

Page {
    id: mainPage
    content:
    Container {
    id: main
    Container {
    id: buttonHolder
    scrollMode: ScrollMode.None
            layout: StackLayout {
                layoutDirection: LayoutDirection.LeftToRight
                leftPadding: 5.0
                rightPadding: 5.0
                topPadding: 5.0
                bottomPadding: 5.0
            }
            touchPropagationMode: TouchPropagationMode.None
            objectName: "buttonHolder"
            Button {
                id: openButton
                text: "Open"
            }
            Button {
                id: closeButton
                text: "Close"
                onClicked: {
                }
            }
            Button {
                id: saveButton
                text: "Save"
                onClicked: {
                }
            }
            Button {
                id: saveAsButton
                text: "Save As"
                onClicked: {
                }
            }
            Button {
                id: exitButton
                text: "Exit"
            }
        }

    //********************************
        Container {
            id: textHolderArea
            layout: AbsoluteLayout {
            }
            topMargin: 5.0
            leftMargin: 1.0
            rightMargin: 1.0
            bottomMargin: 2.0
            TextArea {
                id: textHolder
                textStyle.fontStyleHint: FontStyleHint.Default
                layoutProperties: AbsoluteLayoutProperties {
                }
                leftMargin: 5.0
                rightMargin: 5.0
                preferredHeight: 645.0
                textStyle.justification: TextJustification.Enabled
                objectName: "textHolder"
                text: ""
            }
        }
    //********************************
    }
}

And I have no idea how call my app.cpp C++ slot in my main QML file

Advertisement

Your buttons should an objectName set to be visible to C++, the id is only visible inside the QML.

Tags: BlackBerry Developers

Similar Questions

  • How to remove the download button located next to my home button? I continue to by clicking on it when I want the House and it's annoying.

    How to remove the download button located next to my home button?

    You can use customization feature to move it to a less irritating location. I suggest the bar the module if you keep this poster.

    Start customizing with one of these, and then drag the arrow to a new location, or in the dialog box to remove all the bars:

    • Right click on a zone empty of the tab bar > customize
    • Press the Alt key > menu view > toolbars > customize

    You will notice that some combined controls separate in the view to customize. If you put something between them, they will not be able to recombine. (For example, if you separate stop and reload or put something between front/rear and area URL.)

  • How to fix the main button to paste constantly

    How to fix the main button to paste constantly

    Short of getting a replacement from Apple or risk a repair third shop there is nothing you can do. How about a button on the home screen? Go to settings > general > accessibility > assistive touch > on.

  • How to disable the setting button in Tools - Options - advanced - network of windows registry?

    Dear support,
    Now, my office has use Firefox as default browser to access the Web server. And there is a policy that users must use ProxyServer. I don't want to change user setting in Firefox proxy. How to disable the setting button in Tools - Options - advanced - network of windows registry?
    Thank you.
    Treky

    You cannot use the Windows registry to disable the elements in Firefox. This link shows how to lock the proxy settings of Firefox, change the values as needed:
    http://www.stbernard.com/ip5kb/iPrism/whatsnew/50SupportFiles/SupportFiles/IP0460.htm

    A change of minor importance, in step 4, instead of add this line to all-js, you can create a file called local - settings.js containing the indicated line and save the file in the same folder as all.js

  • How to connect the cables to an AMD Radeon HD 7450 video card for two monitors individual work?

    I have a HP Pavilion p6-2360eo with the video card Radeon 7450 connected to a monitor of 23xi Pavilion.

    Now, I want to add a monitor of 23xi more, but I do not understand how to connect the cables to the video card to get two logical screen (different views on each monitor)

    Supposedly this monitor can connect to the video card, you have the HDMI connection.  Assuming that the first monitor is connected via DVI, then try a HDMI cable to the second.  I got this from the description of the video card on THIS page.

    Support up to two displays at the same time in these configurations: DVI, HDMI and VGA + HDMI (using the included adapter cable)

  • How to connect the keyboard for apple tv wireless?

    How to connect the keyboard for apple tv wireless?

    If you mean the 4th generation new Apple Tv, you cannot currently. It does not support keyboards at this time.

    If you mean the 3rd generation Apple Tv:

    Use a keyboard Apple Wireless with your Apple TV (2nd or 3rd generation) - Apple supported

  • How to connect the iMac 27 inches 5 K (end of 2014) as PC monitor

    Hello

    How to connect the iMac 27 inches 5 K (end of 2014) as PC monitor?

    Are there any adapter or cable that can help?

    Concerning

    M

    PCs have no support for the target Display Mode.

  • How to connect the value of the input string to numeric values

    Hello

    I'm trying to figure out how to connect the value of unique user input string to numeric values. Basically I want the user to enter the name of a gas that I have a list for (I think I put the list of gases in a table >). Then I want to match numeric values 2 'a' and 'b', according to which gas, name of the user has set. These 'a' and 'b' values will be automatically matched with the name of the gas in a list that I put. For example, hydrogen gas has the value 3 for "a" and 4 for "b. when the user puts the ' hydrogen' name in a string constant, automatically 'a' and 'b' must be issued.» I have connect a and b to a formula

    Thanks for any help

    Hello

    It is perhaps not exactly what you are looking for, but perhaps you could use the enumerated data type and the array of clusters of points (a, b).

    Look at the VI I enclose.

  • How to use the prtsc button please, so I can capture Bank to receive the shipment?

    How to use the prtsc button please, so I can capture Bank to receive the shipment?

    If you can view receipts from the Bank to the screen... just left
    Click on your print screen button to copy the screen of your
    Windows Clipboard. Then... Open Windows Paint and
    Reach... Editing / paste. Then go to... File / save as / JPEG.

    If the file needs cropping... you can use the 'Fix' edition
    option in the Windows Photo Gallery.

    Another option:

    If you run any version of Vista Basic...
    the capture tool can be a better tool for the job:

    Use capture tool to capture screenshots
    http://Windows.Microsoft.com/en-us/Windows-Vista/use-Snipping-Tool-to-capture-screen-shots
    (Vista Home Premium, Business, Ultimate, Enterprise)

    Windows Vista - activate the Vista Snipping Tool
    http://www.PCWorld.com/article/137099/activate_vistas_snipping_tool.html

    Vista tutorial - How to use the tool captures of Vista
    http://www.Vistax64.com/tutorials/148532-how-use-Snipping-Tool-Vista.html

  • How to connect the Officejet Pro 8100 printer to wireless network

    Bought a "nine" Officejet Pro 8100 and want to use via my wireless network. The CD supplied with the printer is obsolete. Updated Apple software but can't see how to connect the printer to the network. Getting Started Guide is no help on this issue. Searched for support without result pages. Utility HP does not provide a method to set up a wireless feature. Find all the instructions, I say first of all make sure that the printer is connected to the wireless network, and that's what I can't find out how. What I forget?

    Finally, I called HP hotline for help and was rescued. It turns out that Apple's software update software includes all the required components. The software from the HP Web site is no longer available. It's frustrating to see the Getting Started Guide refer frequently to the HP installation wizard and be unable to locate it. Once the wizard tech took control of my computer and installed the necessary software, it was a breeze!

    I also note that compose the support number to talk with a guy was rather brief: between 1 and 2 minutes, I recall. Although there was a menu of the phone, it was not a large (unlike the attempt labyrinthine and often circular to locate the online help).

    Insofar as HP knows the necessary software in not available via software update or directly from HP, wouldn't make sense to inform buyers, as well as how to access? At least do not place meaningless, useless on the Web site links that lead into oblivion and frustration!

    Although I did appreciate the journey, I finally arrive at my destination. Thanks to Aris, HP technician. You are exceptional!

  • How to connect the printer wireless hp with the computer?

    * - Original title - the printer printing

    How to connect the printer wireless hp with the computer?

    HP all what you need to be able to complete the task... See here...

    http://h71036.WWW7.HP.com/HHO/us/en/EP/articles/Wireless-Setup-Wizard.html

  • How to connect the bluetooth iball-groovy head game

    How to connect the bluetooth iball-groovy head game

    Hi Gurushankar,

    You can consult the following articles and check.

    Connect to Bluetooth and other wireless or network devices

    http://Windows.Microsoft.com/en-us/Windows7/connect-to-Bluetooth-and-other-wireless-or-network-devices

     

    Add a Bluetooth device or other wireless or network device: frequently asked questions

    http://Windows.Microsoft.com/en-us/Windows7/add-a-Bluetooth-or-other-wireless-or-network-device-frequently-asked-questions

    Hope this information helps.

  • How to disabled the alt button?

    How to disabled the alt button?

    Wednesday, October 17, 2012 12:48:11 + 0000, ArielPilapil wrote:

    How to disabled the alt button?

    Why do you do this? This can screw up a lot of things.

    But you can disable any key or keys by using software such as the free
    SharpKeys to http://www.randyrants.com/sharpkeys/

    Ken Blake, Microsoft MVP

  • How to connect the akai ATT01U

    How to connect the Akai ATT01U with my PC? (Windows 7)

    Johan Burgman

    With the supplied USB cable, I guess.  You probably have to install the software provided with the unit first.  Check job mode, manual quick start or any documentation that came with the device.

  • How to choose the slot one of the two bunk?

    How to choose the slot one of the two bunk?

    Select the two points to cross the selection with the open selection tool, and then clear the high point on the page by holding shift and clicking on it.

    or vice versa. Select the high point of the page first and then select now shift. the high point of the page désélectionnera.

Maybe you are looking for


HashFlare