I was trying to make a simple dialog and use the multiple inheritance method to make it work. But I can't get it going. The dialog is called "handmade.ui". The ui_handmade.h file is being generated ok.
The latest error is:
main.cpp:29: error: 'class Ui::handmade' has no member named 'show'
I'm lost. My "handmade" dialog inherits from QDialog which inherits QWidget which contains the show() function. What gives?
Am I including things in the wrong places?
Here's my code.
main.cpp
#include "ui_handmade.h"
#include <QApplication>
int main(int argc, char *argv[])
{
Ui::handmade *dialog = new Ui::handmade;
dialog->show(); // <- Error occurs here
return app.exec();
}
#include "ui_handmade.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Ui::handmade *dialog = new Ui::handmade;
dialog->show(); // <- Error occurs here
return app.exec();
}
To copy to clipboard, switch view to plain text mode
handmade.h
#ifndef HANDMADE_H
#define HANDMADE_H
#include "ui_handmade.h"
class handmade
: public QDialog,
private Ui
::handmade{
Q_OBJECT
public:
~handmade();
/*$PUBLIC_FUNCTIONS$*/
public slots:
/*$PUBLIC_SLOTS$*/
protected:
/*$PROTECTED_FUNCTIONS$*/
protected slots:
/*$PROTECTED_SLOTS$*/
};
#endif
#ifndef HANDMADE_H
#define HANDMADE_H
#include "ui_handmade.h"
class handmade : public QDialog, private Ui::handmade
{
Q_OBJECT
public:
handmade(QWidget* parent = 0);
~handmade();
/*$PUBLIC_FUNCTIONS$*/
public slots:
/*$PUBLIC_SLOTS$*/
protected:
/*$PROTECTED_FUNCTIONS$*/
protected slots:
/*$PROTECTED_SLOTS$*/
};
#endif
To copy to clipboard, switch view to plain text mode
handmade.cpp
#include "handmade.h"
{
setupUi(this);
connect(ctrSlider, SIGNAL(valueChanged()), displayLCD, SLOT(display()));
show(this);
}
handmade::~handmade()
{}
#include "handmade.h"
handmade::handmade(QWidget* parent) : QDialog(parent)
{
setupUi(this);
connect(ctrSlider, SIGNAL(valueChanged()), displayLCD, SLOT(display()));
show(this);
}
handmade::~handmade()
{}
To copy to clipboard, switch view to plain text mode
Thanks,
Paul
Bookmarks