lib/score/widgets/Layout.hpp
1 #pragma once
2 #include <QFormLayout>
3 #include <QGridLayout>
4 #include <QLabel>
5 #include <QVBoxLayout>
6 
7 namespace score
8 {
9 // Custom form layout due to
10 // https://stackoverflow.com/questions/41715124/qformlayout-does-not-expand-widget-full-height-to-maximum-widget-height
11 
12 class FormLayout : public QGridLayout
13 {
14 public:
15  void addRow(QString&& text, QWidget* widg)
16  {
17  const auto nextRow = rowCount();
18  addWidget(
19  new QLabel{std::move(text)}, nextRow, 0, 1, 1, Qt::AlignHCenter | Qt::AlignTop);
20  addWidget(widg, nextRow, 1, 1, 1);
21  }
22 };
23 }
24 
25 // REFACTORME - find a better name
26 namespace Inspector
27 {
28 class Layout final : public QFormLayout
29 {
30 public:
31  Layout(QWidget* widg = nullptr)
32  : QFormLayout{widg}
33  {
34  this->setContentsMargins(0, 0, 0, 0);
35  this->setSpacing(3);
36  // this->setLabelAlignment(Qt::AlignRight);
37  }
38 };
39 
40 class VBoxLayout final : public QVBoxLayout
41 {
42 public:
43  VBoxLayout(QWidget* widg = nullptr)
44  : QVBoxLayout{widg}
45  {
46  this->setContentsMargins(0, 0, 0, 0);
47  this->setSpacing(3);
48  }
49 };
50 }
Definition: lib/score/widgets/Layout.hpp:29
Definition: lib/score/widgets/Layout.hpp:41
Definition: lib/score/widgets/Layout.hpp:13
Classes used for making and extending the inspector (default right panel).
Definition: lib/score/widgets/Layout.hpp:27
Base toolkit upon which the software is built.
Definition: Application.cpp:90