2023-10-03 04:09 PM - edited 2023-10-03 04:11 PM
Hi,
Lets say I have 10 screens and I want to display an image when an event is received on the current active screen.
This is my current implementation.
In model.h
private:
bool displayimage;
public:
void setdisplayimage(bool value)
{
displayimage = value;
}
bool getdisplayimage()
{
return displayimage;
}
In model.cpp
void Model::tick() const
{
on receiving event
setdisplayimage(true);
static_cast<FrontendApplication*>(touchgfx::Application::getInstance())->handleTickEvent();
}
screen1 presenter class
bool Screen1Presenter::GetStatus() const
{
bool getValue = model->getdisplayimage();
return getValue;
}
screen1 view class
void Screen1View::setupScreen()
{
Screen1Base::setupScreen();
displaywidget();
}
void Screen1View::handleTickEvent()
{
displaywidget();
}
void Screen1View::displaywidget()
{
bool status = Screen1ViewBase::presenter->GetStatus();
if(status == 0x00)
{
widget.setVisible(true);
widget.invalidate();
}
else
{
widget.setVisible(false);
widget.invalidate();
}
}
My question is - Does it cause a overhead in handletickevent() to regularly check whether the boolean variable is set?
Is there a better solution than this?
2023-10-05 04:52 AM