i have a question regarding qt in c++
header file:
#ifndef TIMER_H
#define TIMER_H
#include <QWidget>
#include <QTimer>
#include <QtGui>
#include <QObject>
class Timer : public QWidget
{
Q_OBJECT
public:
Timer(QWidget * parent = 0);
void setTimer(QString title, QString description, QDate date);
public slots:
void showWarning() {QString show = tit;
QPushButton * thanks = new QPushButton(QObject::tr("Thank you for reminding me!"));
show.append("\n");
show.append(des);
QMessageBox popup;
popup.setText(show);
popup.setWindowTitle("Calendar : Reminder");
popup.setDefaultButton(thanks);
popup.exec();
}
private:
QString tit;
QString des;
};
#endif // TIMER_H
cpp file:
#include "timer.h"
Timer::Timer(QWidget * parent)
: QWidget(parent)
{
}
void Timer::setTimer(QString title, QString description, QDate date)
{
QDateTime now = QDateTime::currentDateTime();
QDateTime timeoftheaction;
QTimer *timer=new QTimer;
tit = title;
des = description;
timeoftheaction.setDate(date);
timeoftheaction.setTime(reminderTime);
QObject::connect(timer, SIGNAL(timeout()),this,SLOT(showWarning()));
timer->start(now.secsTo(timeoftheaction)*1000);
}
When i compile i get the error:
........\QtSDK\Desktop\Qt\4.8.1\mingw\include/QtGui/qwidget.h: In copy constructor 'Timer::Timer(const Timer&)': ..\projectOOI/timer.h:9: instantiated from 'void QList::node_construct(QList::Node*, const T&) [with T = appointment]' ........\QtSDK\Desktop\Qt\4.8.1\mingw\include/QtCore/qlist.h:512:
instantiated from 'void QList::append(const T&) [with T = appointment]' ..\projectOOI/appointoverview.h:10: instantiated from here ........\QtSDK\Desktop\Qt\4.8.1\mingw\include/QtGui/qwidget.h:806: error: 'QWidget::QWidget(const QWidget&)' is private ..\projectOOI/timer.h:9: error: within this context
although i have inherited QWidget publicaly... so i do not get where i go wrong
Qwidgetis non-copyable. - hmjd