#include "formbaselist.h"
#include "ui_formbaselist.h"

#include <QResizeEvent>

FormBaseList::FormBaseList(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::FormBaseList)
{
    ui->setupUi(this);
}

FormBaseList::~FormBaseList()
{
    delete ui;
}

void FormBaseList::resizeEvent(QResizeEvent *event)
{
    QStringList texts = { tr("Nuevo"), tr("Editar"), tr("Clonar"), tr("Borrar"), tr("Actualizar") };
    QList<QPushButton*> buttons = { ui->buttonNew, ui->buttonEdit, ui->buttonClone, ui->buttonDelete, ui->buttonUpdate };

    for (int i = 0; i < buttons.size(); ++i) {
        int sz = event->size().width();
        buttons[i]->setText(sz > 400 ? texts[i] : "");
    }
}
