Commit c9f6d2bd authored by Yann Boucher's avatar Yann Boucher
Browse files

Ajout d'une ScrollBar pour la liste des coordonnées

parent 448c013a
Pipeline #78779 passed with stages
in 17 seconds
......@@ -4,6 +4,7 @@
#include <QGroupBox>
#include <QPushButton>
#include <QDebug>
#include <QScrollArea>
UIBuilderVisitor::UIBuilderVisitor(QWidget *base_widget, bool destructive)
{
......@@ -65,9 +66,13 @@ QWidget *UIBuilderVisitor::current_widget()
void UIBuilderVisitor::push_array_widget(const Property &prop)
{
QGroupBox* box = new QGroupBox(QString::fromStdString(prop.identifier()), current_widget());
QScrollArea* scroll = new QScrollArea(current_widget());
QGroupBox* box = new QGroupBox(QString::fromStdString(prop.display_name()));
scroll->setWidget(box);
scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
scroll->setWidgetResizable(true);
box->setLayout(new QVBoxLayout);
add_widget("", box);
add_widget("", scroll);
m_widget_hierarchy.push(box);
}
......@@ -82,7 +87,7 @@ QWidget* UIBuilderVisitor::pop_widget()
void UIBuilderVisitor::visit(StringProperty &str)
{
QLineEdit* line = new QLineEdit(QString::fromStdString(str.str), current_widget());
add_widget(str.identifier(), line);
add_widget(str.display_name(), line);
QObject::connect(line, &QLineEdit::textEdited,
[&str](const QString& qstr) { str.str = qstr.toStdString(); });
......@@ -91,7 +96,7 @@ void UIBuilderVisitor::visit(StringProperty &str)
void UIBuilderVisitor::visit(IntegerProperty &prop)
{
QSpinBox* spin = new QSpinBox(current_widget());
add_widget(prop.identifier(), spin);
add_widget(prop.display_name(), spin);
spin->setValue(prop.val);
spin->setMinimum(prop.prop_min);
......@@ -112,7 +117,7 @@ void UIBuilderVisitor::visit(CoordinateProperty &prop)
frame->layout()->addWidget(new QLabel("y :", frame));
frame->layout()->addWidget(spin_y);
frame->layout()->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
add_widget(prop.identifier(), frame);
add_widget(prop.display_name(), frame);
spin_x->setValue(prop.c.x); spin_y->setValue(prop.c.y);
QObject::connect(spin_x, QOverload<int>::of(&QSpinBox::valueChanged),
......@@ -173,7 +178,7 @@ void UIBuilderVisitor::visit(PropertyList &list)
if (list_widget->layout()->count() <= (int)list.min_size) // no more items to delete, grey the button out
del_button->setEnabled(false);
if (list_widget->layout()->count() < (int)list.max_size)
add_button->setEnabled(true);
add_button->setEnabled(true);
}
});
// J'arrive pas à l'afficher
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment