Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LO21_Pin_Noir_Boucher_Bouri_Detree
CellulutLO21
Commits
783fc501
Commit
783fc501
authored
May 29, 2021
by
Eugene Pin
Browse files
Modification d'un signal. Ajout widget choix du voisinage et début de l'implémentation
parent
fbda5448
Pipeline
#78771
passed with stages
in 17 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
forms/neighborhoodWidget.ui
0 → 100644
View file @
783fc501
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
NeighborhoodWidget
</class>
<widget
class=
"QWidget"
name=
"NeighborhoodWidget"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
993
</width>
<height>
518
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<layout
class=
"QHBoxLayout"
name=
"mainLayout"
stretch=
"1,0"
>
<item>
<widget
class=
"QWidget"
name=
"grid"
native=
"true"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
100
</width>
<height>
100
</height>
</size>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout_3"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"GridView"
name=
"grid_view"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Preferred"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"frameShape"
>
<enum>
QFrame::StyledPanel
</enum>
</property>
<property
name=
"frameShadow"
>
<enum>
QFrame::Raised
</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout
class=
"QVBoxLayout"
name=
"settingsLayout"
>
<property
name=
"sizeConstraint"
>
<enum>
QLayout::SetDefaultConstraint
</enum>
</property>
<item>
<layout
class=
"QFormLayout"
name=
"gridDimLayout"
>
<property
name=
"fieldGrowthPolicy"
>
<enum>
QFormLayout::FieldsStayAtSizeHint
</enum>
</property>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"widthLabel"
>
<property
name=
"text"
>
<string>
Width :
</string>
</property>
<property
name=
"buddy"
>
<cstring>
widthSpinBox
</cstring>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QSpinBox"
name=
"widthSpinBox"
>
<property
name=
"minimum"
>
<number>
1
</number>
</property>
<property
name=
"maximum"
>
<number>
9999
</number>
</property>
<property
name=
"value"
>
<number>
10
</number>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"heightLabel"
>
<property
name=
"text"
>
<string>
Height :
</string>
</property>
<property
name=
"buddy"
>
<cstring>
heightSpinBox
</cstring>
</property>
</widget>
</item>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QSpinBox"
name=
"heightSpinBox"
>
<property
name=
"minimum"
>
<number>
1
</number>
</property>
<property
name=
"maximum"
>
<number>
9999
</number>
</property>
<property
name=
"value"
>
<number>
10
</number>
</property>
</widget>
</item>
<item
row=
"2"
column=
"1"
>
<widget
class=
"QPushButton"
name=
"validateGridDim"
>
<property
name=
"enabled"
>
<bool>
false
</bool>
</property>
<property
name=
"text"
>
<string>
OK
</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget
class=
"QPushButton"
name=
"validationButton"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Fixed"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"text"
>
<string>
Validate
</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>
GridView
</class>
<extends>
QFrame
</extends>
<header>
gridview.hpp
</header>
<container>
1
</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
include/interface.hpp
View file @
783fc501
...
...
@@ -70,6 +70,9 @@ private slots:
void
on_customize_button_clicked
();
//! \brief afficher le widget du choix des voisins
void
show_neighborhood_widget
(
bool
);
private:
//! \brief Initialiser la liste des transitions et voisinages disponibles
void
init_transition_neighborhood_list
();
...
...
include/neighborhoodWidget.hpp
0 → 100644
View file @
783fc501
#ifndef NEIGHBORHOODWIDGET_HPP
#define NEIGHBORHOODWIDGET_HPP
#include <QDialog>
namespace
Ui
{
class
NeighborhoodWidget
;
}
//! \brief Fenêtre de dialogue permettant de choisir les voisins d'une cellule de manière graphique.
class
NeighborhoodWidget
:
public
QDialog
{
Q_OBJECT
public:
explicit
NeighborhoodWidget
(
QWidget
*
parent
=
nullptr
);
~
NeighborhoodWidget
();
//! \brief Retourne le voisinage
QString
voisinage
()
const
;
protected:
void
done
(
int
r
);
private:
Ui
::
NeighborhoodWidget
*
ui
;
};
#endif // NEIGHBORHOODWIDGET_HPP
src/interface.cpp
View file @
783fc501
...
...
@@ -8,6 +8,7 @@
#include "neighborhoodrule.hpp"
#include "propertyvisitors.hpp"
#include "modelloadingdialog.hpp"
#include "neighborhoodWidget.hpp"
#include <QJsonArray>
...
...
@@ -211,6 +212,8 @@ void MainWindow::on_randomPatternButton_clicked()
void
MainWindow
::
on_nbrStatesComboBox_currentTextChanged
(
const
QString
&
arg1
)
{
// A mettre dans la fonction valider
/*
// Nombre d'états possibles
int val = arg1.toInt();
// Nombre de valeurs dans le comboxBox (en partant de 0)
...
...
@@ -230,7 +233,7 @@ void MainWindow::on_nbrStatesComboBox_currentTextChanged(const QString &arg1)
}
}
}
*/
}
void
MainWindow
::
on_drawCellButton_clicked
()
...
...
@@ -409,3 +412,12 @@ void MainWindow::on_customize_button_clicked()
{
enable_rule_customization
();
}
void
MainWindow
::
show_neighborhood_widget
(
bool
)
{
NeighborhoodWidget
widget
(
this
);
if
(
!
widget
.
exec
())
return
;
}
src/neihborhoodWidget.cpp
0 → 100644
View file @
783fc501
#include "neighborhoodWidget.hpp"
#include "ui_neighborhoodWidget.h"
#include <QDate>
#include <QMessageBox>
NeighborhoodWidget
::
NeighborhoodWidget
(
QWidget
*
parent
)
:
QDialog
(
parent
),
ui
(
new
Ui
::
NeighborhoodWidget
)
{
ui
->
setupUi
(
this
);
/*
// récupérer le nom de l'utilisateur actuel
QString name;
name = qgetenv("USER"); // get the user name in Linux
if (name.isEmpty())
name = qgetenv("USERNAME"); // get the name in Windows
ui->auteur->setText(name);
ui->date->setDate(QDate::currentDate());
*/
}
NeighborhoodWidget
::~
NeighborhoodWidget
()
{
delete
ui
;
}
void
NeighborhoodWidget
::
done
(
int
r
)
{
/*
if(QDialog::Accepted == r) // ok was pressed
{
if(ui->nom->text().isEmpty()) // validate the data somehow
{
QMessageBox::information(this, "Erreur", "Le champ 'Titre' doit être rempli.");
return;
}
else
{
QDialog::done(r);
return;
}
}
else // cancel, close or exc was pressed
{
QDialog::done(r);
return;
} */
}
QString
NeighborhoodWidget
::
voisinage
()
const
{
return
"ui->auteur->text();"
;
}
src/propertyvisitors.cpp
View file @
783fc501
...
...
@@ -140,9 +140,11 @@ void UIBuilderVisitor::visit(PropertyList &list)
QPushButton
*
add_button
=
new
QPushButton
(
"Ajouter..."
,
current_widget
());
QPushButton
*
del_button
=
new
QPushButton
(
"Supprimer..."
,
current_widget
());
QPushButton
*
widgetGridNeighborhoodButton
=
new
QPushButton
(
"Grille..."
,
current_widget
());
frame
->
layout
()
->
addWidget
(
add_button
);
frame
->
layout
()
->
addWidget
(
del_button
);
frame
->
layout
()
->
addWidget
(
widgetGridNeighborhoodButton
);
frame
->
layout
()
->
addItem
(
new
QSpacerItem
(
40
,
20
,
QSizePolicy
::
Expanding
,
QSizePolicy
::
Minimum
));
add_widget
(
""
,
frame
);
...
...
@@ -174,6 +176,8 @@ void UIBuilderVisitor::visit(PropertyList &list)
add_button
->
setEnabled
(
true
);
}
});
// J'arrive pas à l'afficher
// QObject::connect(widgetGridNeighborhoodButton, &QPushButton::pressed);
}
}
...
...
src/src.pro
View file @
783fc501
...
...
@@ -17,6 +17,7 @@ SOURCES += \
neighborhood_rules
/
arbitraryneighborhoodrule
.
cpp
\
automaton
.
cpp
\
gridview
.
cpp
\
neihborhoodWidget
.
cpp
\
savingdialog
.
cpp
\
transition_rules
/
circulartransition
.
cpp
\
transition_rules
/
lifegametransition
.
cpp
\
...
...
@@ -64,13 +65,15 @@ HEADERS += \
..
/
include
/
transitionrule
.
hpp
\
..
/
include
/
transition_rules
/
circulartransition
.
hpp
\
..
/
include
/
transition_rules
/
totalistictransition
.
hpp
\
..
/
include
/
modelloadingdialog
.
hpp
..
/
include
/
modelloadingdialog
.
hpp
\
..
/
include
/
neighborhoodWidget
.
hpp
FORMS
+=
\
..
/
forms
/
interface
.
ui
\
..
/
forms
/
savingdialog
.
ui
\
..
/
forms
/
structurelibraryview
.
ui
\
..
/
forms
/
modelloadingdialog
.
ui
..
/
forms
/
modelloadingdialog
.
ui
\
..
/
forms
/
neighborhoodWidget
.
ui
#
Default
rules
for
deployment
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment