Results 1 to 3 of 3

Thread: Following Eclipse Integrated Plugin Tutorial -- help

  1. #1
    Join Date
    Jun 2008
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Following Eclipse Integrated Plugin Tutorial -- help

    I'm trying to learn Qt after doing most of my programming in Java. I'm working through the tutorial included under "Getting started" in Eclipse. I've gotten up to the part "Adding Items to the List Widget". Unfortunately I've got a compiler error.
    Qt Code:
    1. #include "addressbook.h"
    2. #include "adddialog.h"
    3.  
    4. AddressBook::AddressBook(QWidget *parent)
    5. : QWidget(parent)
    6. {
    7. ui.setupUi(this);
    8. }
    9. void AddressBook::on_addButton_clicked()
    10. {
    11. AddDialog dialog(this);
    12.  
    13. if (dialog.exec()) {
    14. QString name = dialog.name();
    15. QString email = dialog.email();
    16.  
    17. if (!name.isEmpty() && !email.isEmpty()) {
    18. QListWidgetItem *item = new QListWidgetItem(name, ui.addressList);
    19. item->setData(Qt::UserRole, email);
    20. ui.addressList->setCurrentItem(item);
    21. }
    22. }
    23. }
    24.  
    25.  
    26.  
    27. AddressBook::~AddressBook()
    28. {
    29.  
    30. }
    To copy to clipboard, switch view to plain text mode 

    error:
    addressbook.cpp: In member function ‘void AddressBook:n_addButton_clicked()’:
    addressbook.cpp:48: error: ‘QListWidgetItem’ was not declared in this scope
    addressbook.cpp:48: error: ‘item’ was not declared in this scope
    addressbook.cpp:48: error: expected type-specifier before ‘QListWidgetItem’
    addressbook.cpp:48: error: expected `;' before ‘QListWidgetItem’
    addressbook.cpp:50: error: ‘class QListView’ has no member named ‘setCurrentItem’

    Not sure how to fix it. I'm using Qt-4.4.

  2. #2
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Thanks
    26
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Following Eclipse Integrated Plugin Tutorial -- help

    Try adding
    Qt Code:
    1. #include <QListWidgetItem>
    To copy to clipboard, switch view to plain text mode 
    at the top of the file.
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

  3. #3
    Join Date
    Jun 2008
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Following Eclipse Integrated Plugin Tutorial -- help

    Thanks for the help. Got me on the right track. I used the wrong widget... [SOLVED]

Similar Threads

  1. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 15:13
  2. using Qt plugin for Eclipse
    By high_flyer in forum General Discussion
    Replies: 1
    Last Post: 28th September 2006, 07:26

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.