kwave  18.07.70
Kwave::AboutContainer Class Reference

#include <AboutContainer.h>

Inheritance diagram for Kwave::AboutContainer:
Inheritance graph
Collaboration diagram for Kwave::AboutContainer:
Collaboration graph

Public Member Functions

 AboutContainer (QWidget *parent=Q_NULLPTR)
 
virtual ~AboutContainer () Q_DECL_OVERRIDE
 
void addPerson (const QString &name, const QString &email, const QString &url, const QString &task)
 
virtual QSize sizeHint () const Q_DECL_OVERRIDE
 
virtual QSize minimumSizeHint () const Q_DECL_OVERRIDE
 
void addWidget (QWidget *widget)
 

Private Attributes

QVBoxLayout * m_vbox
 

Detailed Description

simplified clone of K3AboutContainer

See also
K3AboutContainer

Definition at line 43 of file AboutContainer.h.

Constructor & Destructor Documentation

◆ AboutContainer()

Kwave::AboutContainer::AboutContainer ( QWidget *  parent = Q_NULLPTR)
explicit

Definition at line 39 of file AboutContainer.cpp.

References m_vbox.

40  :QFrame(parent)
41 {
42  setFrameStyle(QFrame::NoFrame);
43 
44  QGridLayout* const gbox = new QGridLayout(this);
45  Q_ASSERT(gbox);
46  if (!gbox) return;
47 
48  gbox->setMargin(0);
49  gbox->setMargin(0);
50  gbox->setColumnStretch(0, 10);
51  gbox->setColumnStretch(2, 10);
52  gbox->setRowStretch(0, 10);
53  gbox->setRowStretch(2, 10);
54 
55  m_vbox = new QVBoxLayout();
56  Q_ASSERT(m_vbox);
57  if (!m_vbox) return;
58 
59  m_vbox->setSpacing(0);
60  gbox->addLayout(m_vbox, 1, 1);
61 // gbox->activate();
62 }
QVBoxLayout * m_vbox

◆ ~AboutContainer()

Kwave::AboutContainer::~AboutContainer ( )
virtual

Definition at line 65 of file AboutContainer.cpp.

66 {
67 }

Member Function Documentation

◆ addPerson()

void Kwave::AboutContainer::addPerson ( const QString &  name,
const QString &  email,
const QString &  url,
const QString &  task 
)

Definition at line 140 of file AboutContainer.cpp.

References addWidget().

Referenced by Kwave::AboutDialog::AboutDialog().

142 {
143  Kwave::AboutContributor * const cont = new Kwave::AboutContributor(this,
144  _name, _email, _url, _task);
145  Q_ASSERT(cont);
146  if (!cont) return;
147 
148  addWidget(cont);
149 }
void addWidget(QWidget *widget)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addWidget()

void Kwave::AboutContainer::addWidget ( QWidget *  widget)

Definition at line 124 of file AboutContainer.cpp.

References m_vbox, and sizeHint().

Referenced by Kwave::AboutDialog::AboutDialog(), and addPerson().

125 {
126  widget->setParent(this);
127 
128  m_vbox->addWidget(widget, 0, Qt::AlignCenter);
129  const QSize s(sizeHint());
130  setMinimumSize(s);
131 
132  const QList<QObject *> l = children(); // silence please
133  foreach (QObject *o, l) {
134  if (o->isWidgetType())
135  static_cast<QWidget *>(o)->setMinimumWidth(s.width());
136  }
137 }
virtual QSize sizeHint() const Q_DECL_OVERRIDE
QVBoxLayout * m_vbox
Here is the call graph for this function:
Here is the caller graph for this function:

◆ minimumSizeHint()

QSize Kwave::AboutContainer::minimumSizeHint ( void  ) const
virtual

Definition at line 118 of file AboutContainer.cpp.

References sizeHint().

119 {
120  return sizeHint();
121 }
virtual QSize sizeHint() const Q_DECL_OVERRIDE
Here is the call graph for this function:

◆ sizeHint()

QSize Kwave::AboutContainer::sizeHint ( void  ) const
virtual

Definition at line 70 of file AboutContainer.cpp.

Referenced by addWidget(), and minimumSizeHint().

71 {
72  //
73  // The size is computed by adding the sizeHint().height() of all
74  // widget children and taking the width of the widest child and adding
75  // layout()->margin() and layout()->spacing()
76  //
77 
78  QSize total_size;
79 
80  int numChild = 0;
81  const QList<QObject*> l = children(); // silence please
82  foreach (QObject *o, l) {
83  if (o->isWidgetType()) {
84  ++numChild;
85  QWidget * const w = static_cast<QWidget *>(o);
86 
87  QSize s = w->minimumSize();
88  if (s.isEmpty()) {
89  s = w->minimumSizeHint();
90  if (s.isEmpty()) {
91  s = w->sizeHint();
92  if (s.isEmpty())
93  s = QSize(100, 100); // Default size
94  }
95  }
96  total_size.setHeight(total_size.height() + s.height());
97  if (s.width() > total_size.width()) {
98  total_size.setWidth(s.width());
99  }
100  }
101  }
102 
103  if (numChild > 0) {
104  //
105  // Seems I have to add 1 to the height to properly show the border
106  // of the last entry if layout()->margin() is 0
107  //
108  total_size.setHeight(total_size.height() +
109  layout()->spacing() * (numChild - 1));
110  total_size += QSize(layout()->margin()*2, layout()->margin()*2 + 1);
111  } else {
112  total_size = QSize(1, 1);
113  }
114  return total_size;
115 }
Here is the caller graph for this function:

Member Data Documentation

◆ m_vbox

QVBoxLayout* Kwave::AboutContainer::m_vbox
private

Definition at line 63 of file AboutContainer.h.

Referenced by AboutContainer(), and addWidget().


The documentation for this class was generated from the following files: