I made my program and declared it(the c++ file I am executing in the main c++ file) as a class public QDialog like this
Qt Code:
  1. #include <QDialog>
  2. class DateListDialog: public QDialog {
  3. Q_OBJECT
  4. public:DateListDialog();
  5. }
To copy to clipboard, switch view to plain text mode 
but I want to add a menubar and I am not sure how if it is a QDialog so I wish to turn the QDialog into a QMainWindow I tried changing the code on the header to:
Qt Code:
  1. #include <QMainWindow>
  2. class DateListDialog: public QMainWindow {
  3. Q_OBJECT
  4. public:DateListDialog();
  5. }
To copy to clipboard, switch view to plain text mode 
but then when I do that and add the menubar all it shows it the menubar and not all the other gui items so basically its just an empty QMainWindow

the code I used to add the gui items is this:
Qt Code:
  1. #include <QtGui>
  2. #include "datelistdialog.h"
  3. #include "listwidgetdialog.h"
  4. #include <sstream>
  5. #include <iostream>
  6. using namespace std;
  7.  
  8. DateListDialog::DateListDialog()
  9. {
  10.  
  11. QStringList dates, foods, totalCalories, totalProteins, totalCarbs, totalFats, totalSugars, totalSodiums, totalFibers;
  12. QStringList labels;
  13. labels << tr("Dates") << tr("Foods") << tr("Total Calories") << tr("Total Proteins") << tr("Total Carbs") << tr("Total Fats") << tr("Total Sugars") << tr("Total Sodiums") << tr("Total Fibers");
  14.  
  15. treeWidget = new QTreeWidget;
  16. treeWidget->setColumnCount(9);
  17. treeWidget->setHeaderLabels(labels);
  18.  
  19.  
  20. QVBoxLayout *mainLayout = new QVBoxLayout;
  21. mainLayout->addWidget(treeWidget);
  22. setLayout(mainLayout);
  23.  
  24.  
  25. QFile file(QDir::homePath() + "/caloriecounter.txt");
  26. if (file.open(QIODevice::ReadOnly)){
  27. QTextStream input(&file);
  28. input.setCodec("UTF-8");
  29. while(!input.atEnd()){
  30. //dates << input.readLine();
  31. foods << input.readLine();
  32. totalCalories << input.readLine();
  33. totalProteins << input.readLine();
  34. totalCarbs << input.readLine();
  35. totalFats << input.readLine();
  36. totalSugars << input.readLine();
  37. totalSodiums << input.readLine();
  38. totalFibers << input.readLine();
  39. input.readLine();
  40. }
  41. }
  42.  
  43.  
  44. for (int i = 0; i < foods.size(); ++i) {
  45. //item->setText(0, dates[i]);
  46. item->setText(1, foods[i]);
  47. item->setText(2, totalCalories[i]);
  48. item->setText(3, totalProteins[i]);
  49. item->setText(4, totalCarbs[i]);
  50. item->setText(5, totalFats[i]);
  51. item->setText(6, totalSugars[i]);
  52. item->setText(7,totalSodiums[i]);
  53. item->setText(8, totalFibers[i]);
  54. treeWidget->addTopLevelItem(item);
  55.  
  56. }
  57. //createActions();
  58. //createMenus();
  59. }
To copy to clipboard, switch view to plain text mode 


Any suggestions would be greatly appreciated.
Thanks!