コード例 #1
0
ファイル: PsRegisterView.cpp プロジェクト: Jokymon/anthaxia
PsRegisterView::PsRegisterView(QWidget* parent, PsModelControl* modelControl)
: QMainWindow(parent)
, mModelControl(modelControl)
{
    this->setWindowFlags(Qt::Widget);
    this->menuBar()->addMenu(tr("&View"));

    mRegisterView = new QTableWidget(this);
    this->setCentralWidget(mRegisterView);

    mRegisterView->setColumnCount(2);
    mRegisterView->setSortingEnabled(false);
    mRegisterView->verticalHeader()->hide();
    mRegisterView->horizontalHeader()->hide();

    updateRegisterDisplay();

    connect(mModelControl, SIGNAL(simulationStopped()), this, SLOT(handleSimulationStopped()));
    connect(mModelControl, SIGNAL(simulationReset()), this, SLOT(handleSimulationReset()));
    connect(mModelControl, SIGNAL(modelChanged()), this, SLOT(handleModelChanged()));
}
コード例 #2
0
ファイル: main.cpp プロジェクト: mostua/TZSP
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Model model;
    model.population = 0;
    MainWindow view(&model);
    Controller controller(&model);
    qRegisterMetaType<vectorSquares>("vectorSquares");
    qRegisterMetaType<vectorPairs>("vectorPairs");
    QObject::connect(&controller, SIGNAL(stepSimulationStarted()), &view, SIGNAL(activateStepButtons()));
    QObject::connect(&controller, SIGNAL(continousSimulationStarted()), &view, SIGNAL(activateContinousButtons()));
    QObject::connect(&controller, SIGNAL(simulationReseted()), &view, SIGNAL(simulationReseted()));
    QObject::connect(&controller, SIGNAL(drawFitnessGraph(double,double,double,int)), &view, SLOT(drawFitnessGraph(double,double,double,int)));
    QObject::connect(&controller, SIGNAL(drawNumberOfIndivuals(vectorPairs,int)), &view, SLOT(drawNumberOfIndivuals(vectorPairs,int)));
    QObject::connect(&controller, SIGNAL(updateBest(vectorSquares)), &view, SIGNAL(updateBest(vectorSquares)));
    QObject::connect(&view, SIGNAL(startStepSimulation(Settings)), &controller, SLOT(beginStepSimulation(Settings)));
    QObject::connect(&view, SIGNAL(startContinousSimulation(Settings)), &controller, SLOT(beginContinousSimulation(Settings)));
    QObject::connect(&view, SIGNAL(resetSimulation()), &controller, SLOT(simulationReset()));

    view.show();
    return a.exec();
}