The code below is suppose to display a label on a window but it doesn't, instead it displays a blank window. what am I doing wrong. Please help.
#ifndef PAYCLASS_H
#define PAYCLASS_H
#include <QMainWindow>
#include <QObject>
#include <QPushButton>
#include <QGridLayout>
#include <QLabel>
#include <QTextEdit>
#include <QDate>
#include <QCalendarWidget>
#include <QTimeEdit>
#include <QHBoxLayout>
class PayClass : public QMainWindow
{
Q_OBJECT
public:
explicit PayClass();
double calculateHrs(int numOfHrs);
double calculatePay();
signals:
public slots:
private:
QPushButton* Calculate;
QGridLayout* Layout;
QHBoxLayout* HLayout;
QLabel* Label1, *Label2, *Label3, *Label4, *Mon, *Tue, *Wed, *Thur, *Fri, *Sat;
QTextEdit* txtEdit1, *txtEdit2;
QDate *dateOnDuty;
QCalendarWidget* Calender;
QTimeEdit* Time1, *StartOfLunch, *endOfLunch, *Time3;
};
#endif // PAYCLASS_H
#include <QtGui/QApplication>
#include "payclass.h"
int main(int argc, char* argv[])
{
QApplication App(argc, argv);
PayClass myApp;
myApp.show();
system("PAUSE");
return 0;
}
#include "payclass.h"
PayClass::PayClass()
{
setWindowTitle("My Hours");
Label1 = new QLabel("Clocking In Time");
Label2 = new QLabel("Start Of Lunch");
Label3 = new QLabel("End Of Lunch");
Label4 = new QLabel("Clocking Out Time");
Calculate = new QPushButton("Calculate");
HLayout = new QHBoxLayout();
Layout = new QGridLayout();
Layout->addWidget(Label1, 0, 0);
setLayout(Layout);
}
Bookmarks