HAL
widget_overlay.cpp
Go to the documentation of this file.
2 
3 #include <QVBoxLayout>
4 
5 namespace hal
6 {
8  mLayout(new QVBoxLayout(this)),
9  mWidget(nullptr)
10  {
11  //setStyleSheet("background-color: rgba(0, 0, 0, 150);");
12  }
13 
15  {
16  if (mWidget)
17  {
18  mWidget->hide();
19  mWidget->setParent(nullptr);
20  }
21 
22  mWidget = widget;
23 
25  mLayout->addWidget(widget, Qt::AlignCenter);
26  mLayout->setAlignment(widget, Qt::AlignCenter);
27 
28  mWidget->show();
29  //mWidget->setStyleSheet("background-color: rgba(43, 43, 43, 255);");
30 
31  // OLD
32  // mWidget->setParent(this);
33  // mWidget->resize(mWidget->sizeHint());
34  }
35 }
36 
37 //void WidgetOverlay::resizeEvent(QResizeEvent* event)
38 //{
39 
40 //}
The Overlay overlays its parent.
Definition: overlay.h:40
WidgetOverlay(QWidget *parent=nullptr)
void setWidget(QWidget *widget)
void addWidget(QWidget *widget, int stretch, Qt::Alignment alignment)
bool setAlignment(QWidget *w, Qt::Alignment alignment)
AlignCenter
void hide()
void setParent(QWidget *parent)
void show()
void setSizePolicy(QSizePolicy)