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.
Code:
#include "addressbook.h"
#include "adddialog.h"
AddressBook
::AddressBook(QWidget *parent
){
ui.setupUi(this);
}
void AddressBook::on_addButton_clicked()
{
AddDialog dialog(this);
if (dialog.exec()) {
if (!name.isEmpty() && !email.isEmpty()) {
item->setData(Qt::UserRole, email);
ui.addressList->setCurrentItem(item);
}
}
}
AddressBook::~AddressBook()
{
}
error:
addressbook.cpp: In member function ‘void AddressBook::on_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.
Re: Following Eclipse Integrated Plugin Tutorial -- help
Try adding
Code:
#include <QListWidgetItem>
at the top of the file.
Re: Following Eclipse Integrated Plugin Tutorial -- help
Thanks for the help. Got me on the right track. I used the wrong widget... [SOLVED]