55 #include <QGuiApplication>
59 #include <QMessageLogger>
63 #include <QVBoxLayout>
66 #include <QApplication>
69 #include "../vmisc/def.h"
73 :QFrame(parent, Qt::Popup), mWidget(nullptr), mOwn(true), mOldParent(nullptr), lifeTime(-1)
75 setAttribute(Qt::WA_WindowPropagation);
77 if (parentWidget() ==
nullptr)
79 setAttribute(Qt::WA_DeleteOnClose);
82 setLayout(
new QVBoxLayout());
83 layout()->setContentsMargins(0, 0, 0, 0);
91 layout()->removeWidget(
mWidget);
122 QLabel *label =
new QLabel(msg);
123 QFont f = label->font();
129 popup->
Show(w->frameGeometry().center());
138 const QRect screen(QGuiApplication::primaryScreen()->availableGeometry());
139 coord.setX(coord.x() - width()/2);
141 if (coord.x() < screen.x())
143 coord.setX(screen.x());
146 if (coord.y() < screen.y())
148 coord.setY(screen.y());
151 if (coord.x() > (screen.right()-width()))
153 coord.setX(screen.right()-width());
156 if (coord.y() > (screen.bottom()-height()))
158 coord.setY(screen.bottom()-height());
164 QTimer::singleShot(
lifeTime,
this, SLOT(close()));