I have been trying to write a simple class file and can't figure out what I am doing wrong. It is one .h file, one .cpp file, and the main file. Any help would be greatly appreciated. It appears to not like my main file when compiling. I am getting errors on 11,13,16,17,19. In addition, I am getting errors on my QPushButton callout for "quit" and my QVBoxLayout in the main.cc

channelselected.h file

Qt Code:
  1. #ifndef CHANNELSELECTED_H
  2. #define CHANNELSELECTED_H
  3.  
  4. #include <qvbox.h>
  5. #include <qhbox.h>
  6. #include <qlayout.h>
  7. #include <qobject.h>
  8.  
  9. class QCheckBox;
  10.  
  11. class ChannelSelected : public QVBoxLayout
  12. {
  13. Q_OBJECT
  14. public:
  15. ChannelSelected ( QWidget *parent=0, const char *name=0 );
  16. bool isChecked() const;
  17.  
  18. public slots:
  19. void setChecked();
  20. void setUnChecked();
  21.  
  22. signals:
  23. void valueChanged();
  24.  
  25. private;
  26. QPushButton *allpb;
  27. QPushButton *clearpb;
  28. QCheckBox *c0cb;
  29. QCheckBox *c1cb;
  30. QCheckBox *c2cb;
  31. QCheckBox *c3cb;
  32. QCheckBox *c4cb;
  33. QCheckBox *c5cb;
  34. QCheckBox *c6cb;
  35. };
  36. #endif // CHANNELSELECTED_H
To copy to clipboard, switch view to plain text mode 

channelselected.cpp
Qt Code:
  1. #include "channelselected.h"
  2. #include <qcheckbox.h>
  3. #include <qpushbutton.h>
  4.  
  5. ChannelSelected::ChannelSelected ( QWidget *parent, const char *name)
  6. : QVBoxLayout (parent, name);
  7. {
  8. QCheckBox *c0cb = new QCheckBox ("Channel 0", this, "c0cb");
  9. QCheckBox *c1cb = new QCheckBox ("Channel 1", this, "c1cb");
  10. QCheckBox *c2cb = new QCheckBox ("Channel 2", this, "c2cb");
  11. QCheckBox *c3cb = new QCheckBox ("Channel 3", this, "c3cb");
  12. QCheckBox *c4cb = new QCheckBox ("Channel 4", this, "c4cb");
  13. QCheckBox *c5cb = new QCheckBox ("Channel 5", this, "c5cb");
  14. QCheckBox *c6cb = new QCheckBox ("Channel 6", this, "c6cb");
  15. QPushButton *allpb = new QPushButton("All", this, "allpb");
  16. QPushButton *clearpb = new QPushButton("Clear", this, "clearpb);
  17. QVBoxLayout *box = new QVBoxLayout(this);
  18. QHBox *hbox = new QHBox(box);
  19. QHbox *hboxbutt= new QHBox(box);
  20. hbox->addWidget(c0cb);
  21. hbox->addWidget(c1cb);
  22. hbox->addWidget(c2cb);
  23. hbox->addWidget(c3cb);
  24. hbox->addWidget(c4cb);
  25. hbox->addWidget(c5cb);
  26. hbox->addWidget(c6cb);
  27. hboxbutt->addWidget(allpb);
  28. hboxbutt->addWidget(clearpb);
  29. box->addWidget(hbox);
  30. box->addWidget(hboxbutt);
  31.  
  32. connect (allpb, SIGNAL(clicked()), c0cb, SLOT(setChecked()));
  33. connect (allpb, SIGNAL(clicked()), c1cb, SLOT(setChecked()));
  34. connect (allpb, SIGNAL(clicked()), c2cb, SLOT(setChecked()));
  35. connect (allpb, SIGNAL(clicked()), c3cb, SLOT(setChecked()));
  36. connect (allpb, SIGNAL(clicked()), c4cb, SLOT(setChecked()));
  37. connect (allpb, SIGNAL(clicked()), c5cb, SLOT(setChecked()));
  38. connect (allpb, SIGNAL(clicked()), c6cb, SLOT(setChecked()));
  39.  
  40. connect(clearpb, SIGNAL(clicked()), c0cb, SLOT(setChecked()));
  41. connect(clearpb, SIGNAL(clicked()), c1cb, SLOT(setChecked()));
  42. connect(clearpb, SIGNAL(clicked()), c2cb, SLOT(setChecked()));
  43. connect(clearpb, SIGNAL(clicked()), c3cb, SLOT(setChecked()));
  44. connect(clearpb, SIGNAL(clicked()), c4cb, SLOT(setChecked()));
  45. connect(clearpb, SIGNAL(clicked()), c5cb, SLOT(setChecked()));
  46. connect(clearpb, SIGNAL(clicked()), c6cb, SLOT(setChecked()));
  47. }
  48.  
  49. bool ChannelSelected::isChecked() const
  50. {
  51. return;
  52. }
  53.  
  54. void ChannelSelected::setChecked()
  55. {
  56. c0cb->setChecked(TRUE);
  57. c1cb->setChecked(TRUE);
  58. c2cb->setChecked(TRUE);
  59. c3cb->setChecked(TRUE);
  60. c4cb->setChecked(TRUE);
  61. c5cb->setChecked(TRUE);
  62. c6cb->setChecked(TRUE);
  63. }
  64.  
  65. void ChannelSelected::setUnChecked()
  66. {
  67. c0cb->setChecked(FALSE);
  68. c1cb->setChecked(FALSE);
  69. c2cb->setChecked(FALSE);
  70. c3cb->setChecked(FALSE);
  71. c4cb->setChecked(FALSE);
  72. c5cb->setChecked(FALSE);
  73. c6cb->setChecked(FALSE);
  74. }
To copy to clipboard, switch view to plain text mode 

main.cpp file

Qt Code:
  1. #include <qapplication.h>
  2. #include <qpushbutton.h>
  3. #include <qfont.h>
  4. #include <qvbox.h>
  5. #include <qlayout.h>
  6. #include <qobject.h>
  7.  
  8. #include "channelselected.h"
  9.  
  10. class MyWidget : public QVBoxLayout
  11. {
  12. public:
  13. MyWidget( QWidget *parent=0, const char *name=0);
  14. };
  15.  
  16. MyWidget::MyWidget ( QWidget *parent, int, int, const char *name)
  17. :QVBoxLayout(parent, int, int, name)
  18. {
  19. QVBoxLayout *vbox = new QVBoxLayout ( this, 10, 10, "vbox");
  20.  
  21. QPushButton *quit = new QPushButton ("&Quit", vbox, "quit" );
  22. quit->setFont ( QFont("Times", 18, QFont::Bold));
  23.  
  24. connect( quit, SIGNAL(clicked()), qApp, SLOT(quit()) );
  25. ChannelSelected* channelPanel = new ChannelSelected (vbox, 10, 10, "channelPanel")
  26. vbox->addWidget(channelPanel);
  27. vbox->addWidget(quit);
  28. }
  29.  
  30. int main ( int argc, char **argv)
  31. {
  32. QApplication a (argc, argv);
  33. MyWidget w;
  34. a.setMainWidget(&w);
  35. w.show();
  36. return a.exec();
  37. }
To copy to clipboard, switch view to plain text mode