How to create the method own slot in QT for blackberry Playbook

Hi all

After two days of work-around, I can successfully develop the project of the QT in Qnx IDE for blackberry playbook 2.0.

But now I have a problem to create the method of the slot to call on the click event of the specific button,

Here is my code.

#include

#include
#include
#include
#include

slots machines
void clickedSlots();

int main (int argc, char * argv []) {}

qputenv ("QT_QPA_FONTDIR", "/ usr/fonts/font_repository/monotype");
QCoreApplication::addLibraryPath ("app/native/lib");
QApplication app (argc, argv);

QWidget window;
Window.Resize(1024, 600);
window.setWindowTitle (QString::fromUtf8 ('QPushbutton Background'));
one click = new QPushButton ("Click Me");
Click on-> setToolTip ("Thanks");
Click on-> setMaximumHeight (100);
Click on-> setGeometry (400, 100, 100, 40);
QObject::connect (click, SIGNAL (clicked ()), & app, SLOT (clickedSlots ()));

QPalette * palette1 = new QPalette();
Palette1-> setColor (QPalette::Button, Qt::blue);
Click on-> setPalette(*palette1);

QPushButton * leave = new QPushButton ("Quit");
QObject::connect (quit, SIGNAL (clicked ()), & app, SLOT (quit ()));

QPalette * palette2 = new QPalette();
Palette2-> setColor (QPalette::Background, Qt::green);
Exit-> setPalette(*palette2);
Exit-> setGeometry (200, 100, 100, 40);
QVBoxLayout layout = new QVBoxLayout (& window);
layout-> setGeometry (QRect (0, 0, 1024, 600));
layout-> addWidget (click);
layout-> addWidget (quit);

Window.Show ();
Return app.exec ();
}

void clickedSlots() {}
QMessageBox msgBox.
msgBox.setWindowTitle ("Hello");
msgBox.setText ("You Clicked");
msgBox.show ();
msgBox.exec ();
}

Please help me with this problem. I had started to develop in QT before 2 days only. I'm not familiar with the development of QT.

Thanks in advance.

bskania.

You have the chance, I'm feeling generous today.

I fixed your code. You should really read the Qt documentation, it's fantastic. Here, it's a good start for the signals and Slots.

http://Qt-project.org/doc/Qt-4.8/signalsandslots.html

Mark this message as the solution and give me one as you please.

main.cpp

#include 

#include 
#include 
#include 
#include 
#include "myslots.h"

int main(int argc, char *argv[]) {
    qputenv("QT_QPA_FONTDIR", "/usr/fonts/font_repository/monotype");
    QCoreApplication::addLibraryPath("app/native/lib");
    QApplication app(argc, argv);

    QWidget window;
    window.resize(1024, 600);
    window.setWindowTitle(QString::fromUtf8("QPushbutton Background"));
    QPushButton *click = new QPushButton("Click Me");
    click->setToolTip("Thanks");
    click->setMaximumHeight(100);
    click->setGeometry(400, 100, 100, 40);
    myslots a;
    QObject::connect(click, SIGNAL(clicked()), &a, SLOT(clickedSlot()));

    QPalette* palette1 = new QPalette();
    palette1->setColor(QPalette::Button, Qt::blue);
    click->setPalette(*palette1);

    QPushButton *quit = new QPushButton("Quit");
    QObject::connect(quit, SIGNAL(clicked()), &app, SLOT(quit()));

    QPalette* palette2 = new QPalette();
    palette2->setColor(QPalette::Background, Qt::green);
    quit->setPalette(*palette2);
    quit->setGeometry(200, 100, 100, 40);
    QVBoxLayout* layout = new QVBoxLayout(&window);
    layout->setGeometry(QRect(0, 0, 1024, 600));
    layout->addWidget(click);
    layout->addWidget(quit);
    window.show();
    return app.exec();
}

myslots.h

#include 
#include 
#include 

class myslots : public QObject {
    Q_OBJECT

    public:
        myslots() { };

    public slots:
        void clickedSlot() {
            QMessageBox* msgBox = new QMessageBox();
            msgBox->setWindowTitle("Hello");
            msgBox->setText("You Clicked " + ((QPushButton*) sender())->text());
            msgBox->exec();
        };
};

myslots. Pro

TARGET = myslots
DEPENDPATH += .
INCLUDEPATH += .
HEADERS += myslots.h
SOURCES += main.cpp

Put all these files in the same folder, run qmake in there, it will produce a Makefile. Run make and it comes out a binary executable called myslots. That and your code works.

I don't have a lot of changes, I'll let you step through the code yourself to find out what I did. Look at the documentation for help.

I have not tested this Momentics, nor Alpha PlayBook/Dev. But I'm 100% sure the code works, since I ran it myself.

Tags: BlackBerry Developers

Similar Questions

  • How to create the Windows EFI boot partition 7 for USB HDD

    I installed Windows 7 x 64 on USB HDD using Imagex and start at the start of the legacy with success.

    Now, I have to use it on new computers to work with enable EFI boot.

    I don't want to disable boot EFI in these pc since it is at work, but I can't start my USB HDD.

    I can boot windows to GO on similar USB HDD on these computers because windows 8 use EFI boot

    I tried to format the boot as FAT 32 partition and used

    bcdboot C:\Windows /s F: /f ALL on windows 7 x64 PC but CMD showed error and advised to ask for helpI did manage to copy boot
    
    bcdboot C:\Windows /s F:  but it was legacy boot not EFI.Please advise me how to create a EFI bootable partition for  my windows 7 installed on USB HDD to be able to use in EFI boot computer.My HDD   partition 1 FAT 32 300 mb    partition 2 NTFS OS installed 25GB   partition 3 NTFS    Datathanks.
    

    Hey Aung,

    Refer to the steps in the following Microsoft article and check.

    Installation of Windows on an EFI computer: http://technet.microsoft.com/en-us/library/dd744321 (WS.10) .aspx

    Note: To get help, I recommend you post the same question in the TechNet forums and check if it helps.

    TechNet: http://social.technet.microsoft.com/Forums/en-US/w7itproinstall/threads

    Keep us informed on the status of the issue.

  • How to create the custom using Javascripts in PLM for Agile process validator

    I have already created customized using ASP.Net validators. But now I need to create custom using Javascript validator.

    Please provide me the details

    1. how to create custom validator and where to create?

    2 provide me with code samples for custom validators javascripts

    Thank you

    Floquet

    I am currently using 6.1.1.5

  • How to create the filter by date of request for access using database connectivity tool

    Hello

    I had started my project by reading the access data, using a UDL connection,

    but now I want to create a filter for access by using a query that would select two dates and get all the corresponding data, how to query using SQL Parmetrized?

    Best regards

    Note: I do not know the SQL language

    Hi salim_mjs,

    You must use the date format that I have used. It is independent of the format in your database. It should be "month/day/year".

    Mike

  • Please show or ask how to create the value of arrayOfValues of setValuesAtTimes parameter?

    Hello AEScriptComm,

    I have a few small scripts that use the method setValueAtTime successfully placing a keyframe on the existing layers of maskPath, but as you can see in the scripts below, results of setValueSatTimeS errors using IE: "Array is not of the correct type", "value is not an array" or "Null is not an object", depending on ,...

    (A) what variable is used as the value of parameter IE:

    .maskPath;

    . maskPath.value;

    . maskPath.value.vertices

    (B) what kind of table is used as the parameter value as in:

    var addTheseKeys = new Array ((1,2,3,4);    (as a parameter of the time)...

    (with either)

    var keyValues = new Array([10,10],[100,100],[15,50],[100,120]);             ...." ]) "

    (GOLD)

    var keyValues = [[10.10], [100 100], [15.50], [100 120]];                               ... (Array of arrays? RE: " ]] " )

    I just read a 'push' of the values in a table may be necessary?, but I was hoping someone who knew setValuesAtTimes could show it please...

    1) .. How to create the value of arrayOfValues of setValuesAtTimes parameter?

    1 (a): WORK setValueAtTime script...

    App.Project.Item (1) .layer (1).property("Masks").property ("mask 1");

    var app.project.item = myProperty (1) .layer (1) .mask (1) .maskPath;

    myShape = app.project.item (1) .layer (1) .mask (1).maskPath.value;

    myProperty.setValueAtTime(1.0,myShape);

    1 (b): If there is no script setValuesAtTimes...

    prop1 = app.project.item var (1) .layer (1).property("ADBE_Transform_Group").property ("ADBE Position");

    var fourKeys = 4;

    var addTheseKeys = new Array (1,2,3,4),

    var keyValues = new Array (10, [10], [100 100], [15.50], [100 120]);

    var app.project.item = myProperty (1) .layer (1) .mask (1) .maskPath;

    myShape = app.project.item (1) .layer (1) .mask (1).maskPath.value;

    var myVertices = app.project.item (1) .layer (1) .mask (1).maskPath.vertices;

    myProperty.setValuesAtTimes (keyValues, addTheseKeys);

    app.beginUndoGroup ("Keys");

    ~ for (var k = 0; k < fourKeys; k ++)

    //~ {

    ~ prop1.setValueAtTime (keyValues [k], addTheseKeys [k]);

    //~ }

    myProperty.setValuesAtTimes (keyValues, addTheseKeys);

    app.endUndoGroup ();

    .. Thanks for any advise\suggestions,

    J

    (A). maskPath.value; It's always a Shape(). (maskPath is a property, not of a shape on its own, and maskPath.value.vertices is only a part of the shape data).

    (B) nothing of what you propose... that is why your failed script fails.

    var keyValues = new Array([10,10],[100,100],[15,50],[100,120]); and

    var keyValues = [[10.10], [100 100], [15.50], [100 120]]; are just as good as arrays of points, the only thing is that keyValues are arrays of objects Shape().

    Read the guide and script for how to report a form of this post (just wrote it...): http://forums.adobe.com/thread/1419866?tstart=0

    Your keyValues array should look like this: [keyValues0, keyValues1, keyValues2, keyValues3], where each entry is a Shape().

    Xavier.

  • AM how to call the methods of class Impl EO

    Hello world

    I try to display database data in a table, and I need to add a transitional and calculated attribute.

    So I created an EO, I added a transitional attribute, and now I need to create the method that calculates its value.

    I created this method of AOS.

    Back to EO Impl class, I want to call this method in the Get accessor of my transitional attribute.

    To call this AM method in the EO Impl category, I have to get the AM, and I don't know how to do it. Because I'm used to getting the pageContext controller AM.

    I googled and found that I don't need to create the method in the AM, I found that I just have to code directly in the Get accessor.

    But again, to calculate my transitional attribute, I have need for some queries and for that I need OADBTransaction, which means once again, I need to get the AM in the Impl EO class.

    I'm confused, I don't know how to do, if anyone can help please

    Thank you

    Kind regards

    Afaf

    If you derive the value based on the query, it would be better to do it in a single query.

    If you can stick the main request and the subquery (s) here, I take a look.

    If this is not possible using the query, you can get the oaDBTransaction like below in the VO RowImpl.

    Import oracle.apps.fnd.framework.OAApplicationModule;

            OAApplicationModule appModule = (OAApplicationModule)this.getApplicationModule();
            appModule.getOADBTransaction()
    

    See you soon

    AJ

  • How to create the laboratory home

    Hello

    I'm new to vmware, I learn to vmware, I want to know how to create the laboratory at home to vmware.

    Thanks in advance.

    I found this very informative article

    http://techhead.co/VMware-ESXi-home-lab-why-what-and-how-considerations-when-building-your-own-home-lab/

  • I don't know how to use the method (PDDrawPageOrCosObjectToBuffer) in the Mac environment.

    Use the method of PDDrawPageOrCosObjectToBuffer of Acrobat SDK from DC () in the Mac environment,

    I want to get a screenshot of the PDF in the bitmap to the screen.

    A description of PDDrawPageOrCosObjectToBuffer () in Acrobat DC SDK API references, but I do not understand how to use the method.

    Please tell me this use.

    If there is a code example using PDDrawPageOrCosObjectToBuffer (), I'm happy.

    Hello

    My code is finally working with PDDrawPageOrCosObjectToBuffer. I hope it helps someone:

    void releaseBufferForCG (void * / * info * /, const void * data, size_t / * size * /)

    {

    Free ((void*) Data);

    }

    CGImageRef CAcrobatBitmapCreator::ConvertToBitmap (const PDPage & i_rPDPage,

    ASFixedMatrix & i_rTransform,

    int & i_rBitmapWidth,

    int & i_rBitmapHeight)

    {

    Get the rect in user-space coordinates update

    ASRealRect updateRectReal = {0,0,0,0};

    ASFixedRect boxFixed;

    PDPageGetBBox (i_rPDPage & boxFixed);

    updateRectReal.top = ASFixedToFloat (boxFixed.top);

    updateRectReal.left = ASFixedToFloat (boxFixed.left);

    updateRectReal.right = ASFixedToFloat (boxFixed.right);

    updateRectReal.bottom = ASFixedToFloat (boxFixed.bottom);

    Convert the fixed transformation matrix to real

    ASRealMatrix transformReal = {0, 0, 0, 0, 0, 0};

    transformReal.a = ASFixedToFloat (i_rTransform.a);

    transformReal.b = ASFixedToFloat (i_rTransform.b);

    transformReal.c = ASFixedToFloat (i_rTransform.c);

    transformReal.d = ASFixedToFloat (i_rTransform.d);

    transformReal.tx = ASFixedToFloat (i_rTransform.h);

    transformReal.ty = ASFixedToFloat (i_rTransform.v);

    ASRealRect destRectReal = {0, i_rBitmapHeight, i_rBitmapWidth, 0}; l, r, t, b

    Prepare the buffer for drawing https://forums.adobe.com/thread/1850089

    This first call to PDDrawPageOrCosObjectToBuffer is only used to get the size of the buffer.

    ASCab flags = ASCabNew();

    ASInt32 bitsPerChannel = 8;

    ASUns32 bufferSize = PDDrawPageOrCosObjectToBuffer (i_rPDPage,

    CosNewNull(),

    ASAtomFromString ("DeviceRGB"),

    NULL,

    NULL,

    bitsPerChannel,

    flags,

    9,

    NULL,

    & transformReal,

    & destRectReal,

    & updateRectReal,

    NULL,

    0,

    (NULL);

    char buffer = (char *) malloc (bufferSize);

    Memset (buffer, 0xff, bufferSize);

    Draw in the buffer

    ASCabPutBool (flags, kPDPageUseAnnotFacesStr, true);

    ASCabPutBool (flags, kPDPageDrawSmoothTextStr, true);

    ASCabPutBool (flags, kPDPageDrawSmoothLineArtStr, true);

    ASCabPutBool (flags, kPDPageDrawSmoothImageStr, true);

    bufferSize = PDDrawPageOrCosObjectToBuffer (i_rPDPage,

    CosNewNull(),

    ASAtomFromString ("DeviceRGB"),

    NULL,

    NULL,

    bitsPerChannel,

    flags,

    9,

    NULL,

    & transformReal,

    & destRectReal,

    & updateRectReal,

    buffer,

    bufferSize,

    (NULL);

    Convert buffer CGImage

    // 1. Remove the 4 bytes of padding at the end, in a new buffer.

    size_t bytesPerRow = (i_rBitmapWidth * 3);

    bytesPerRow = (bytesPerRow % 4 == 0? bytesPerRow: bytesPerRow + (4-(bytesPerRow % 4)));

    size_t bytesPerRowForGC = i_rBitmapWidth * 3;

    size_t bufferCGSize = bytesPerRowForGC * i_rBitmapHeight;

    char * bufferForGC = (char *) malloc (bufferCGSize);

    Memset (bufferForGC, 0xff, bufferCGSize);

    for (int lineIndex = 0; lineIndex)< i_rbitmapheight;="">

    {

    char * destGCPtr = bufferForGC + (lineIndex * bytesPerRowForGC);

    char * srcPtr = buffer + (lineIndex * bytesPerRow);

    If ((srcPtr + bytesPerRowForGC)<= (buffer="" +="" buffersize)="" &&="" (destgcptr="" +="" bytesperrowforgc)=""><= (bufferforgc="" +="" buffercgsize)="">

    {

    memcpy (destGCPtr, srcPtr, bytesPerRowForGC);

    }

    on the other

    {

    break;

    }

    }

    // 2. Create a CGImage using the new buffer.

    CGDataProviderRef provider = CGDataProviderCreateWithData (NULL,

    bufferForGC,

    bufferCGSize,

    releaseBufferForCG); Buffer are ions released this reminder

    Space color CGColorSpaceRef = CGColorSpaceCreateDeviceRGB();

    CGImageRef finalImage = CGImageCreate (i_rBitmapWidth,

    i_rBitmapHeight,

    bitsPerChannel,

    bitsPerChannel * 3.

    bytesPerRowForGC,

    color, space

    kCGImageAlphaNone,

    provider,

    NULL, / / decode (of remapping the colors)

    true, / / interpolate (pixel smoothing)

    kCGRenderingIntentDefault);

    CGColorSpaceRelease (colorspace);

    CGDataProviderRelease (provider);

    Free (buffer);

    FinalImage return;

    }

    David

  • How to create the project to unify


    Hi all

    Can someone let me know how to create the project to unify.

    Kind regards

    Avinash

    By project, I guess you mean actually project and not a global envelope for programs, etc.  Moreover, this assumes that your environment has already been configured with BP needed, etc. and you simply add a new project to a shell that is already configured.

    As a general rule, these would be created on the workspace business Mode of administration in the company section shells/sponsored projects.

    In this screen, you can click NEW to create a unique project, but the best method is to use the COPY here and select a model project that has associated with BP, etc.

    I hope this helps.

  • How to create the new database in oracle 11g

    Hello
    I m new in oracle 11g, I downloaded oracle 11g and with the help of the guide of the developer-2 days, I learned all the SQL queries, but I worked with human resources database.
    Now, I want to create my own database with the required tables. Can anyone help me how I can make my own database in oracle 11g.

    Thank you
    Manna

    870692 wrote:
    Hello
    I m new in oracle 11g, I downloaded oracle 11g and with the help of the guide of the developer-2 days, I learned all the SQL queries, but I worked with human resources database.
    Now, I want to create my own database with the required tables. Can anyone help me how I can make my own database in oracle 11g.

    Thank you
    Manna

    Be sure to distinguish between the terms and the database schema. Other products, make them bad. It would be a HR diagram (or a user, which is the same in Oracle). If you do not need to use the database Wizard, unless you are working with a new host with no database.

    A simple way would be to get the DDL to create the HR schema and modify it for your own. It can be extracted from your database in several ways, or you can copy the hr_cre.sql to your own script and change. The two ways are educational, and you can google for instructions.

  • Satellite P750 PSAY1A: how to create the recovery Toshiba on the new HARD drive partition

    Hello

    I have an old Toshiba Satellite P750 (PSAY1A-01Y022). I just upgraded my memory from 4 GB to 8 GB and am preparing to take my 500 GB HARD drive 1 TB. I had to order the disk online and wait to happen.

    I always try to understand how to create the arrival of my new HARD drive Toshiba Recovery Partition. I do the same thing for an old book, I handled based on something similar to it's original factory State.

    I have reflected on the recovery partition, but does not know how it was created. It is not NTFS. Does anyone have experience in the creation of a Toshiba Recovery on a new HARD drive Partition?

    And the help is very appreciated.

    Thanks and regards,
    Dinesh

    Recovery partition can be created when you use the original Toshiba Recovery disk and install recovery image. Before the partitions to boot OS install will be automatically created, recovery image copied on a recovery and then partition as last step recovery image installation starts.

    A sort of migration of files from one to the other HARD disk is not solution.

    Only for laptop with factory will work and the usable recovery partition.

  • Do you know how to create the façade as a backdrop

    Do you know how to create the façade as the Web, I mean like we did the word and click on it will be rather another process by clicking on the button.

    If possible, I can click on the link in the table... No idea no matter who

    In my view, that the user questioned a hyperlink control. See, for example: http://forums.ni.com/t5/LabVIEW/NI-Example-Finder-Like/m-p/1023011#M455994

    You could probably do this in an XControl.

  • How to create the icon on the desktop just for SilverLight?

    How to create the icon on the desktop just for SilverLight?

    Hello

    • Why is it you are wanting to create a shortcut?
     
    Silverlight is a plugin for Internet Explorer and other browsers, Windows Media Center is to allow video playback which supports silverlight. You cannot create a shortcut for the same.
     
  • How to create the usb flash disk to Reboot

    How to create the reboot usb flash drive. If I want to do a recovery or restart the usb flash drive how to

    Hello

    read the google links

    and make sure that your motherboard allows you to boot from USB

    http://www.Google.com/search?hl=en&source=HP&q=how+to+make+a+USB+flash+drive+bootable&AQ=1&AQI=G3G-c1g3&aql=&OQ=how+to+make+a+USB+flash+drive

    and if you talk about the recovery partition of computer manufacturers from the D: to a bootable flash drive, you can not do

  • I want to know how to create the account admin hiden for my laptop.

    original title: admin account

    I want to know how to create the account admin hiden for my laptop.

    She has windows vista. I'm the only Admin and the only user. No other person has access.

    The hidden account called administrator is already present.  To activate it:

    1. Click on Start > all programs > Accessories .
    2. Right click on command prompt .
    3. Click run as administrator .
    4. In the command prompt window, type net user administrator / Active: Yes
    5. Press enter .

    Boulder computer Maven
    Most Microsoft Valuable Professional

Maybe you are looking for