我在Xtntu的Qt(使用QPainter)中使用给定的阻塞道路参数从A点到B点编写模拟车辆。我在Github上传了代码。
paintEvent方法:
void main_window::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
try
{
if (!((this->new_city->get_size_field1() == -1) && (this->new_city->get_size_field2() == -1)))
{
int x = -1;
int y = -1;
ui->actionNew_simulation->setDisabled(true);
this->q = new QPainter (this);
this->new_city->draw_city(this->q);
this->set_car_button();
this->q->end();
}
}
catch (...)
{
//locked drawing
this->end_simulation();
}
}
感谢所有答案。