qt-interest@trolltech.com
[Top] [All Lists]

Abt Push Butoon+ Signals & SLOTS

Subject: Abt Push Butoon+ Signals & SLOTS
From: Bharath Kumar
Date: Thu, 04 Aug 2005 10:42:18 +0530
Hi all,
What i want is whenever i press PushButton (like 1,2,3,4..... in our telephone) it should be displayed on LCD and it''s value should be posted to some application wchich is running backside. I'm able to put bush buttons using grid,but i can't "connect" it to LCD display with an int value which is on the face of PushButton. **The code is attached as an attachment as main.cpp .The exe(t7) also there for reference.* *

Plz any one help me out.*"*I'm using Qt/X11 version is 4.0 on Linux 2.4.18.3"* *

Thanks in advance.
Regards,
BHARATH

Notice: The information contained in this e-mail message and/or attachments
 to it may contain confidential or privileged information. If you are not
 the intended recipient, any dissemination, use, review, distribution,
 printing or copying of the information contained in this e-mail message
 and/or attachments to it are strictly prohibited. If you have received
 this communication in error, please notify us by reply e-mail or
 telephone and immediately and permanently delete the message and any
 attachments.
Thank you

/****************************************************************
**
** VOIP APPLICATION
**
****************************************************************/

#include <stdio.h>
#include <QApplication>
#include <QFont>
#include <QGridWidget>
#include <QLCDNumber>
#include <QPushButton>
#include <QVBoxWidget>
#include <QAbstractButton>
#include <QLineEdit>
#include <QWidget>


#include "lcdrange.h"

class MyWidget : public QVBoxWidget
{
public:
    MyWidget(QWidget *parent = 0);
};

MyWidget::MyWidget(QWidget *parent)
    : QVBoxWidget(parent)
{
    setWindowTitle(tr("VoIP Application"));
    resize(325,400);
    
    //QLineEdit *inputLineEdit = new QLineEdit();
    
   //this is for lcd with max of 20 chars it can display
    QLCDNumber *lcd = new QLCDNumber(30, this);
   //lcd->setSegmentStyle(QLCDNumber::Filled);

    QGridWidget *grid = new QGridWidget(4, this);

    QPushButton *b1 = new QPushButton(grid);
    b1->setText("1") ;
    b1->setFont(QFont("Times", 16, QFont::Bold));
    connect(b1, SIGNAL(clicked()), lcd, SLOT(display(int)));
    
    QPushButton *b2 = new QPushButton(grid);
    b2->setText("2") ;
    b2->setFont(QFont("Times", 16, QFont::Bold));
    connect(b2, SIGNAL(clicked()), lcd, SLOT(display(int)));
    
    QPushButton *b3 = new QPushButton(grid);
    b3->setText("3") ;
    b3->setFont(QFont("Times", 16, QFont::Bold));
    connect(b3, SIGNAL(clicked()), lcd, SLOT(display(int)));

    QPushButton *call = new QPushButton(grid);
    call->setText("&CALL") ;
    call->setFont(QFont("Times", 16, QFont::Bold));
    connect(call, SIGNAL(clicked()), lcd, SLOT(display(int)));
    
    QPushButton *b4 = new QPushButton(grid);
    b4->setText("4") ;
    b4->setFont(QFont("Times", 16, QFont::Bold));
    connect(b4, SIGNAL(clicked()), lcd, SLOT(display(int)));
    
    QPushButton *b5 = new QPushButton(grid);
    b5->setText("5") ;
    b5->setFont(QFont("Times", 16, QFont::Bold));
    connect(b5, SIGNAL(clicked()), lcd, SLOT(display(int)));
    
    QPushButton *b6 = new QPushButton(grid);
    b6->setText("6") ;
    b6->setFont(QFont("Times", 16, QFont::Bold));
    connect(b6, SIGNAL(clicked()), lcd, SLOT(display(int)));
    
    QPushButton *flash = new QPushButton(grid);
    flash->setText("&FLAS") ;
    flash->setFont(QFont("Times", 16, QFont::Bold));
    connect(flash, SIGNAL(clicked()), lcd, SLOT(display(int)));
    
    QPushButton *b7 = new QPushButton(grid);
    b7->setText("7") ;
    b7->setFont(QFont("Times", 16, QFont::Bold));
    connect(b7, SIGNAL(clicked()), lcd, SLOT(display(int)));
    
    QPushButton *b8 = new QPushButton(grid);
    b8->setText("8") ;
    b8->setFont(QFont("Times", 16, QFont::Bold));
    connect(b8, SIGNAL(clicked()), lcd, SLOT(display(int)));
    
    QPushButton *b9 = new QPushButton(grid);
    b9->setText("9") ;
    b9->setFont(QFont("Times", 16, QFont::Bold));
    connect(b9, SIGNAL(clicked()), lcd, SLOT(display(int)));
    
    QPushButton *transfer = new QPushButton(grid);
    transfer->setText("&XFER") ;
    transfer->setFont(QFont("Times", 16, QFont::Bold));
    connect(transfer, SIGNAL(clicked()), lcd, SLOT(display(int)));
    
    QPushButton *star = new QPushButton(grid);
    star->setText("*") ;
    star->setFont(QFont("Times", 16, QFont::Bold));
    connect(star, SIGNAL(clicked()), lcd, SLOT(display(int)));
    
    QPushButton *b0 = new QPushButton(grid);
    b0->setText("0") ;
    b0->setFont(QFont("Times", 16, QFont::Bold));
    connect(b0, SIGNAL(clicked()), lcd, SLOT(display(int)));
    
    QPushButton *hash = new QPushButton(grid);
    hash->setText("#") ;
    hash->setFont(QFont("Times", 16, QFont::Bold));
    connect(hash, SIGNAL(clicked()), lcd, SLOT(display(int)));
    
    QPushButton *conf = new QPushButton(grid);
    conf->setText("C&ONF") ;
    conf->setFont(QFont("Times", 16, QFont::Bold));
    connect(conf, SIGNAL(clicked()), lcd, SLOT(display(int)));
    
    QPushButton *quit = new QPushButton(grid);
    quit->setText("Q&uit") ;
    quit->setFont(QFont("Times", 16, QFont::Bold));
    connect(quit, SIGNAL(clicked()), qApp, SLOT(quit()));
    
}
int main(int argc, char *argv[])
{
            QApplication app(argc, argv);
            MyWidget widget;
            widget.show();
            return app.exec();
}

<Prev in Thread] Current Thread [Next in Thread>