/*********************************************************************/
/* */
/* Copyright 2022-2023 RĂ©mi Synave - remi.synave@univ-littoral.fr */
/* */
/* This file is part of DSL. */
/* This software uses Qt to build the Graphical User Interface */
/* https://www.qt.io/ */
/* */
/* DSL is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published */
/* by the Free Software Foundation, either version 3 of the License, */
/* or (at your option) any later version. */
/* */
/* DSL is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with DSL. If not, see . */
/* */
/*********************************************************************/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "MainWindow.hpp"
MainWindow::MainWindow ()
{
setWindowTitle (tr ("CLF"));
QWidget *central= new QWidget(this);
setCentralWidget (central);
setContentsMargins(0, 0, 0, 0);
QVBoxLayout *layoutV = new QVBoxLayout(central);
layoutV->setSpacing(0);
layoutV->setContentsMargins(0, 0, 0, 0);
central->setLayout(layoutV);
wa = new WorkArea (sizeX, sizeY, central);
wa->setContentsMargins(0, 0, 0, 0);
wa->addSL(new StrengthLine(new QPoint((int)(sizeX*0.45),(int)(sizeY*0.1)),
new QPoint((int)(sizeX*0.45),(int)(sizeY*0.9))));
wa->addSL(new StrengthLine(new QPoint((int)(sizeX*0.55),(int)(sizeY*0.1)),
new QPoint((int)(sizeX*0.55),(int)(sizeY*0.9))));
wa->repaint();
layoutV->addWidget(wa);
la = new QLabel(QString("Distance entre les deux lignes : ")+QString::number(1-wa->getDistance()), central);
layoutV->addWidget(la);
connect (wa, SIGNAL(click()), this, SLOT(majDistance()));
setFixedSize (sizeX, sizeY+50);
}
void
MainWindow::majDistance()
{
la->setText(QString("Distance entre les deux lignes : ")+QString::number(1-wa->getDistance()));
}