Preciso de ajuda lista telefonica



  • Olá pessoal to problema nesse esse exercício do livro Foundations of Qt Development
    @
    #ifndef EDITDIALOG_H
    #define EDITDIALOG_H

    #include<QDialog>

    #include"ui_editdialog.h"

    class editdialog: public QDialog

    {
    public:

    editdialog(QWidget *parent=0 );
    
    const QString name()const;
    void setName (const QString&);
    const QString number()const;
    void setNumber(const QString&);
    

    private:

    Ui::editdialog ui;
    

    };

    #endif

    #include "editdialog.h"
    #include "ui_editdialog.h"
    #include<QDialog>

    editdialog::editdialog(QWidget *parent):QDialog(parent)

    {
    ui.setupUi(this);

    }

    const QString editdialog::name()const

    {
    return ui.Namelabel->text().replace("--","").trimmed();

    }

    void editdialog::setName(const QString &name)

    {
    ui.Namelabel->setText(name);

    }

    #include"listdialog.h"
    #include"ui_listdialog.h"
    #include<QDialog>
    #include<editdialog.h>
    #include"ui_editdialog.h"

    listdialog::listdialog() : QDialog()

    {
    ui.setupUi(this);

    connect(ui.addButton ,SIGNAL(clicked()),this
            ,SLOT(addItem()));
    
    connect(ui.editButton,SIGNAL(clicked()), this
            ,SLOT(editItem()));
    
    connect(ui.deleteButton,SIGNAL(clicked()),this
            ,SLOT(deleteItem()));
    

    }

    void listdialog::addItem()

    {
    editdialog dlg(this);

    if( dlg.exec() == Qt::Accepted )

         ui.listWidget(dlg.name() + " -- " + dlg.number());
    

    }

    void listdialog::deleteItem()

    {
    delete ui.listWidget->currentItem();

    }

    void listdialog::editItem()

    {
    if(! ui.listWidget->currentItem())

        return;
    
    QStringList parts = ui.listWidget->currentItem()->text().split("--");editdialog dlg(this);
    
    dlg.setName( parts[0].trimmed());
    dlg.setNumber(parts[1].trimmed());
    

    if( dlg.exec() == Qt::Accepted )

        ui.listWidget->currentItem()->setText(dlg.name()+ "--" + dlg.number());
    

    }

    #ifndef LISTDIALOG_H
    #define LISTDIALOG_H

    #include<QDialog>

    #include"ui_listdialog.h"

    class listdialog : public QDialog

    {

    Q_OBJECT
    

    public:

    listdialog();
    

    private slots:

    void addItem();
    
    void editItem();
    
    void deleteItem();
    
    void Accepted();
    

    private:

    Ui::listdialog ui;
    

    };

    #endif // LISTDIALOG_H

    @

    #include"ui_editdialog.h"
    #include"editdialog.h"
    #include"listdialog.h"
    #include"ui_listdialog.h"
    #include<QtGui>
    #include<QtCore>

    int main(int argc , char **argv)

    {
    QApplication app(argc,argv);

    listdialog dlg;

    dlg.show();
    
    return app.exec();
    

    }

    pagina 34

    C H A P T E R 2 ■ RAPID APPLICATION DEVELOPMENT USING QT

    to estudando sozinho porque na minha faculdade só ensina java eu quero aprender programar em Qt

    "Your text to link here...":http://www.amazon.com/Foundations-Development-Experts-Voice-Source/dp/1590598318



  • Qual a duvida, problema .... posta os erros que o compilador mostra


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.