Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Portuguese
  4. Preciso de ajuda lista telefonica
Qt 6.11 is out! See what's new in the release blog

Preciso de ajuda lista telefonica

Scheduled Pinned Locked Moved Portuguese
2 Posts 2 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rodrigocg
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved