Announcements | Last Post | |
---|---|---|
SoC Curricula | 09/30/2017 01:08PM | |
Demarcation or scoping of examinations and assessment | 02/13/2017 07:59AM | |
School of Computing Short Learning Programmes | 11/24/2014 08:37AM | |
Unisa contact information | 07/28/2011 01:28PM |
Solutions example exam paper May 17, 2010 07:06PM |
Registered: 16 years ago Posts: 15 Rating: 0 |
Re: Solutions example exam paper May 18, 2010 12:17PM |
Registered: 15 years ago Posts: 234 Rating: 0 |
Re: Solutions example exam paper May 18, 2010 03:52PM |
Registered: 14 years ago Posts: 12 Rating: 0 |
Re: Solutions example exam paper May 18, 2010 04:18PM |
Registered: 16 years ago Posts: 12 Rating: 0 |
Re: Solutions example exam paper May 18, 2010 05:21PM |
Registered: 14 years ago Posts: 55 Rating: 0 |
Language: C++ (QT)ButtonClass::ButtonClass() { setWindowTitle("Button Fun" ); QPushButton *button1 =new QPushButton("This" ); QPushButton *button2=new QPushButton("That" ); QHBoxLayout* buttons=new QHBoxLayout() ; buttons->addWidget(button1); buttons->addWidget(button2); QHBoxLayout* main=new QHBoxLayout(); setLayout(main); main->addLayout(buttons); QObject::connect(button1, SIGNAL(clicked()),this, SLOT(something())); QObject::connect(button2, SIGNAL(clicked()),this, SLOT(something())); } void ButtonClass::something() { if (button1->isEnabled()==true) { button1->setEnabled(true); } else if (button2->isEnabled()) { button1->setEnabled(false);; } }
Re: Solutions example exam paper May 18, 2010 05:59PM |
Registered: 14 years ago Posts: 12 Rating: 0 |
Language: C++ (QT)virtual QString toString() { return QString("Thing %1").arg(num); }
Language: C++ (QT)QTextStream cout(stdin); foreach(QString item, thingList) { cout << item << endl; }
Re: Solutions example exam paper May 18, 2010 06:29PM |
Registered: 14 years ago Posts: 12 Rating: 0 |
Language: C++ (QT)ButtonClass::ButtonClass() { setWindowTitle("Button Fun" ); QPushButton *button1 =new QPushButton("This"); //Error - Should be button1 = new QPushButton("This"); QPushButton *button2=new QPushButton("That"); //Error - Should be button2 = new QPushButton("That"); QHBoxLayout* buttons=new QHBoxLayout() ; buttons->addWidget(button1); buttons->addWidget(button2); QHBoxLayout* main=new QHBoxLayout(); setLayout(main); main->addLayout(buttons); QObject::connect(button1, SIGNAL(clicked()),this, SLOT(something())); QObject::connect(button2, SIGNAL(clicked()),this, SLOT(something())); } void ButtonClass::something() { if (button1->isEnabled()==true) { button1->setEnabled(true); } else if (button2->isEnabled()) { button1->setEnabled(false); } }
Re: Solutions example exam paper May 18, 2010 06:59PM |
Registered: 14 years ago Posts: 55 Rating: 0 |
Language: C++ (QT)ButtonClass::ButtonClass() { setWindowTitle("Button Fun" ); button1=new QPushButton("This" ); button2=new QPushButton("That" ); QHBoxLayout* buttons=new QHBoxLayout(); buttons->addWidget(button1); buttons->addWidget(button2); QHBoxLayout* main=new QHBoxLayout(); setLayout(main); main->addLayout(buttons); QObject::connect(button1, SIGNAL(clicked()),this, SLOT(something())); QObject::connect(button2, SIGNAL(clicked()),this, SLOT(something())); } void ButtonClass::something() { if (button1->isEnabled()==true) { button1->setEnabled(false); button2->setEnabled(true); } else if (button2->isEnabled()==true) { button2->setEnabled(false); button1->setEnabled(true); } }
Re: Solutions example exam paper May 18, 2010 07:00PM |
Registered: 14 years ago Posts: 12 Rating: 0 |
Language: C++ (QT)void Button::something() { if (QObject::sender() == button1) { if (!button2->isEnabled()) { button2->setEnabled(true); } button1->setEnabled(false); } else if (QObject::sender() == button2) { if (!button1->isEnabled()) { button1->setEnabled(true); } button2->setEnabled(false); } } Constructor by Justice as above minus the offending lines as marked.
Re: Solutions example exam paper May 18, 2010 07:23PM |
Registered: 16 years ago Posts: 12 Rating: 0 |
Re: Solutions example exam paper May 18, 2010 07:45PM |
Registered: 16 years ago Posts: 12 Rating: 0 |
Anonymous User
Re: Solutions example exam paper May 19, 2010 07:44AM |
Rating: 0 |
Re: Solutions example exam paper May 19, 2010 09:59AM |
Registered: 18 years ago Posts: 1,424 Rating: 0 |
Language: C++ (QT)void ButtonClass::something() { // set button1 to the opposite enabled state that is was on button1->setEnabled(!button1->isEnabled()); // set button2 state to be the opposite of button1';s enabled state button2->setEnabled(!button1->isEnabled()); }
Anonymous User
Re: Solutions example exam paper May 19, 2010 10:21AM |
Rating: 0 |
Re: Solutions example exam paper May 19, 2010 10:40AM |
Registered: 14 years ago Posts: 55 Rating: 0 |
Re: Solutions example exam paper May 19, 2010 11:56AM |
Registered: 14 years ago Posts: 12 Rating: 0 |
Re: Solutions example exam paper May 19, 2010 12:16PM |
Registered: 14 years ago Posts: 55 Rating: 0 |
Language: C++ (QT)void foo() { Thing moat; Thing* tp1 = new Thing(1, &moat); Thing* tp2 = new Thing(2, &moat); Thing* tp3 = new Thing(3, &moat); }
Language: C++ (QT)QObject moat;
Language: C++ (QT)Thing moat(0, 0);
Re: Solutions example exam paper May 19, 2010 01:24PM |
Registered: 18 years ago Posts: 1,424 Rating: 0 |
Language: C++ (QT)void ButtonClass::buttonClicked(QAbstractButton *button){ button1->setEnabled(button != button1); button2->setEnabled(button != button2); }
Re: Solutions example exam paper May 19, 2010 01:39PM |
Registered: 16 years ago Posts: 12 Rating: 0 |
Re: Solutions example exam paper May 19, 2010 03:34PM |
Registered: 14 years ago Posts: 55 Rating: 0 |
Re: Solutions example exam paper May 19, 2010 08:47PM |
Registered: 14 years ago Posts: 12 Rating: 0 |
Re: Solutions example exam paper May 19, 2010 09:36PM |
Registered: 14 years ago Posts: 6 Rating: 0 |
Re: Solutions example exam paper May 19, 2010 09:53PM |
Registered: 14 years ago Posts: 55 Rating: 0 |
Re: Solutions example exam paper May 20, 2010 09:26AM |
Registered: 14 years ago Posts: 12 Rating: 0 |
Anonymous User
Re: Solutions example exam paper May 20, 2010 09:41AM |
Rating: 0 |
Re: Solutions example exam paper May 20, 2010 10:43AM |
Registered: 14 years ago Posts: 12 Rating: 0 |
Re: Solutions example exam paper May 13, 2011 07:42AM |
Registered: 14 years ago Posts: 17 Rating: 0 |