PDA

View Full Version : modal/view architecture



sonuani
3rd April 2008, 13:39
hi,
I have a screen with 10 labels.And based on the key I press, the screen should change and a dialog has to appear.
I want to do it using Modal/view architecture.I am not getting any idea how to do.Plz help/.

aamer4yu
3rd April 2008, 14:54
Your problem seems related only to GUI, where is the data ??
I am not sure of the Model View architecture... but can suggest the following pseudo code for ur problem -


class MyWindow : public QMainWindow
{

LabelWidget * m_pLabelWidget;
Screen * m_pScreen;

MyWindow()
{
connect(m_pLabelWidget,SIGNAL(buttonClicked(QStrin g),this,SLOT(handleButtonClick(QString));
}
}

void MyWindow::handleButton(QString button)
{
if(button == "1")
{
m_pScreen->changeColor(green);
// pop dialog
// other things you want to do....
}
else ...
...
}

Hope it helps :)

sonuani
4th April 2008, 05:39
What is that Screen* and LabelWidget*?