roar38
19th May 2010, 00:01
Hello,
I've recently completed the Qt tutorial - right out of the book - It's the "Shape Changing Dialogs" one, from chapter 2 "Creating Dialogs" and pages 29-35 of "C++ GUI program with Qt 4 1st edition".
When I try to compile it, I get the above error, even though the class IS defined where it should be. Let me show you:
/sortdialog.h
#ifndef SORTDIALOG_H
#define SORTDIALOG_H
#include <QDialog>
#include "ui_sortdialog.h"
class SortDialog : public QDialog, public Ui::SortDialog
{
Q_OBJECT
public:
SortDialog(QWidget *parent = 0);
void setColumnRange(QChar first, QChar last);
};
#endif // SORTDIALOG_H
/sortdialog.cpp
#include <QtGui>
#include "sortdialog.h"
SortDialog::SortDialog(QWidget *parent)
: QDialog(parent)
{
setupUi(this);
secondaryGroupBox->hide();
tertiaryGroupBox->hide();
layout()->setSizeConstraint(QLayout::SetFixedSize);
setColumnRange('A', 'Z');
}
void SortDialog::setColumnRange(QChar first, QChar last)
{
primaryColumnCombo->clear();
secondaryColumnCombo->clear();
tertiaryColumnCombo->clear();
secondaryColumnCombo->addItem(tr("None"));
tertiaryColumnCombo->addItem(tr("None"));
primaryColumnCombo->setMinimumSize(
secondaryColumnCombo->sizeHint());
QChar ch = first;
while ( ch <= last ) {
primaryColumnCombo->addItem(QString(ch));
secondaryColumnCombo->addItem(QString(ch));
tertiaryColumnCombo->addItem(QString(ch));
ch = ch.unicode() + 1;
}
}
/main.cpp
#include <QApplication>
#include "sortdialog.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
SortDialog *dialog = new SortDialog;
dialog->setColumnRange('C', 'F');
dialog->show();
return app.exec();
}
/sortdialog.pro
FORMS += sortdialog.ui
HEADERS += sortdialog.h \
SOURCES += main.cpp \
sortdialog.cpp \
main.cpp
(note that sortdialog.ui is also available and correctly generates ui_sortdialog.h)
As far as I know I'm doing everything as I should be. But why am I getting this error?
Thanks for your help!
I've recently completed the Qt tutorial - right out of the book - It's the "Shape Changing Dialogs" one, from chapter 2 "Creating Dialogs" and pages 29-35 of "C++ GUI program with Qt 4 1st edition".
When I try to compile it, I get the above error, even though the class IS defined where it should be. Let me show you:
/sortdialog.h
#ifndef SORTDIALOG_H
#define SORTDIALOG_H
#include <QDialog>
#include "ui_sortdialog.h"
class SortDialog : public QDialog, public Ui::SortDialog
{
Q_OBJECT
public:
SortDialog(QWidget *parent = 0);
void setColumnRange(QChar first, QChar last);
};
#endif // SORTDIALOG_H
/sortdialog.cpp
#include <QtGui>
#include "sortdialog.h"
SortDialog::SortDialog(QWidget *parent)
: QDialog(parent)
{
setupUi(this);
secondaryGroupBox->hide();
tertiaryGroupBox->hide();
layout()->setSizeConstraint(QLayout::SetFixedSize);
setColumnRange('A', 'Z');
}
void SortDialog::setColumnRange(QChar first, QChar last)
{
primaryColumnCombo->clear();
secondaryColumnCombo->clear();
tertiaryColumnCombo->clear();
secondaryColumnCombo->addItem(tr("None"));
tertiaryColumnCombo->addItem(tr("None"));
primaryColumnCombo->setMinimumSize(
secondaryColumnCombo->sizeHint());
QChar ch = first;
while ( ch <= last ) {
primaryColumnCombo->addItem(QString(ch));
secondaryColumnCombo->addItem(QString(ch));
tertiaryColumnCombo->addItem(QString(ch));
ch = ch.unicode() + 1;
}
}
/main.cpp
#include <QApplication>
#include "sortdialog.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
SortDialog *dialog = new SortDialog;
dialog->setColumnRange('C', 'F');
dialog->show();
return app.exec();
}
/sortdialog.pro
FORMS += sortdialog.ui
HEADERS += sortdialog.h \
SOURCES += main.cpp \
sortdialog.cpp \
main.cpp
(note that sortdialog.ui is also available and correctly generates ui_sortdialog.h)
As far as I know I'm doing everything as I should be. But why am I getting this error?
Thanks for your help!