##// END OF EJS Templates
Small GUI fix, show full names in repository tree view...
Small GUI fix, show full names in repository tree view Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>

File last commit:

r1420:3c3e24550401
r1461:021e7c505ad4
Show More
VariableMenuHeaderWidget.cpp
43 lines | 1.2 KiB | text/x-c | CppLexer
/ gui / src / Variable / VariableMenuHeaderWidget.cpp
Alexandre Leroux
Creates a widget that will be the header of the menu in variable widget...
r289 #include "Variable/VariableMenuHeaderWidget.h"
Switched to new TS impl but quite broken!...
r1420 #include "Variable/Variable2.h"
Alexandre Leroux
Creates a widget that will be the header of the menu in variable widget...
r289
#include <ui_VariableMenuHeaderWidget.h>
Q_LOGGING_CATEGORY(LOG_VariableMenuHeaderWidget, "VariableMenuHeaderWidget")
VariableMenuHeaderWidget::VariableMenuHeaderWidget(
Switched to new TS impl but quite broken!...
r1420 const QVector<std::shared_ptr<Variable2>>& variables, QWidget* parent)
: QWidget { parent }, ui { new Ui::VariableMenuHeaderWidget }
Alexandre Leroux
Creates a widget that will be the header of the menu in variable widget...
r289 {
ui->setupUi(this);
// Generates label according to the state of the variables. The label contains :
// - the variable name if there is only one variable in the list
// - 'x variables' where x is the number of variables otherwise
const auto nbVariables = variables.size();
Switched to new TS impl but quite broken!...
r1420 if (nbVariables == 1)
{
if (auto variable = variables.first())
{
Alexandre Leroux
Creates a widget that will be the header of the menu in variable widget...
r289 ui->label->setText(variable->name());
}
Switched to new TS impl but quite broken!...
r1420 else
{
Alexandre Leroux
Creates a widget that will be the header of the menu in variable widget...
r289 qCCritical(LOG_VariableMenuHeaderWidget())
<< tr("Can't get the name of the variable : variable is null");
}
}
Switched to new TS impl but quite broken!...
r1420 else if (nbVariables > 1)
{
Alexandre Leroux
Creates a widget that will be the header of the menu in variable widget...
r289 ui->label->setText(tr("%1 variables").arg(nbVariables));
}
Switched to new TS impl but quite broken!...
r1420 else
{
Alexandre Leroux
Creates a widget that will be the header of the menu in variable widget...
r289 ui->label->setText(tr("No variable"));
}
}
VariableMenuHeaderWidget::~VariableMenuHeaderWidget() noexcept
{
delete ui;
}