fix(cpn): Improve layout and word wrap of Model -> Curves tab (#1923)
This commit is contained in:
@@ -32,12 +32,15 @@ CurvesPanel::CurvesPanel(QWidget * parent, ModelData & model, GeneralSettings &
|
|||||||
maxCurves = firmware->getCapability(NumCurves);
|
maxCurves = firmware->getCapability(NumCurves);
|
||||||
|
|
||||||
QStringList headerLabels;
|
QStringList headerLabels;
|
||||||
headerLabels << "#";
|
headerLabels << "#" << "" << tr("Note: to create a curve right click on the curve row label");
|
||||||
|
|
||||||
headerLabels << tr("Plot") << tr("Details") << tr("Note: to create a curve right click on the curve row label");
|
|
||||||
|
|
||||||
TableLayout *tableLayout = new TableLayout(this, maxCurves, headerLabels);
|
TableLayout *tableLayout = new TableLayout(this, maxCurves, headerLabels);
|
||||||
|
|
||||||
|
QFontMetrics *f = new QFontMetrics(QFont());
|
||||||
|
QSize szpnts;
|
||||||
|
szpnts = f->size(Qt::TextSingleLine, QString(75, 'X'));
|
||||||
|
delete f;
|
||||||
|
|
||||||
for (int i = 0; i < maxCurves; i++) {
|
for (int i = 0; i < maxCurves; i++) {
|
||||||
int col = 0;
|
int col = 0;
|
||||||
|
|
||||||
@@ -81,8 +84,13 @@ CurvesPanel::CurvesPanel(QWidget * parent, ModelData & model, GeneralSettings &
|
|||||||
numpoints[i] = new QLabel();
|
numpoints[i] = new QLabel();
|
||||||
grid[i]->addWidget(numpoints[i], row, 1);
|
grid[i]->addWidget(numpoints[i], row, 1);
|
||||||
points[i] = new QLabel();
|
points[i] = new QLabel();
|
||||||
points[i]->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
points[i]->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||||
points[i]->setWordWrap(true);
|
// at at Qt 5.12
|
||||||
|
// setWordWrap(true) does not work well in this instance due to the nested widgets and
|
||||||
|
// the display results varying between OSes so as a compromise
|
||||||
|
// stop widget expanding uncontrolled and consequentally expanding edit dialog potentially off screen
|
||||||
|
// contents will be truncated if exceed maximum size
|
||||||
|
points[i]->setMaximumWidth(szpnts.width());
|
||||||
grid[i]->addWidget(points[i], row++, 2, Qt::AlignLeft);
|
grid[i]->addWidget(points[i], row++, 2, Qt::AlignLeft);
|
||||||
|
|
||||||
grid[i]->addWidget(new QLabel(tr("Smooth:")), row, 0, Qt::AlignLeft);
|
grid[i]->addWidget(new QLabel(tr("Smooth:")), row, 0, Qt::AlignLeft);
|
||||||
|
|||||||
Reference in New Issue
Block a user