Seamly2D
Code documentation
VWidgetPopup Class Reference

Class showing a widget as popup window. More...

#include <vwidgetpopup.h>

Inheritance diagram for VWidgetPopup:
Collaboration diagram for VWidgetPopup:

Public Slots

void Show (QPoint coord)
 

Public Member Functions

 VWidgetPopup (QWidget *parent=nullptr)
 
void SetWidget (QWidget *widget, bool own=true)
 
QWidget * Widget () const
 
bool isOwned () const
 
int GetLifeTime () const
 
void SetLifeTime (int value)
 

Static Public Member Functions

static void PopupMessage (QWidget *w, const QString &msg)
 

Protected Attributes

QWidget * mWidget
 
bool mOwn
 
QWidget * mOldParent
 
int lifeTime
 

Detailed Description

Class showing a widget as popup window.

setWidget() function allows you to specify the widget to be popped up. After widget is set, you normally should call show() slot in order to pop the widget up at the specified global position.

VWidgetPopup takes care about positioning of your widget on the screen so it will be always visible even if popped beside.

Definition at line 71 of file vwidgetpopup.h.

Constructor & Destructor Documentation

◆ VWidgetPopup()

VWidgetPopup::VWidgetPopup ( QWidget *  parent = nullptr)
explicit

Constructor.

If parent not specified (default), then popup widget gets attribute Qt::WA_DeleteOnClose and will be deleted after close.

Definition at line 72 of file vwidgetpopup.cpp.

Referenced by PopupMessage().

Member Function Documentation

◆ GetLifeTime()

int VWidgetPopup::GetLifeTime ( ) const
inline

Definition at line 124 of file vwidgetpopup.h.

References lifeTime.

◆ isOwned()

bool VWidgetPopup::isOwned ( ) const
inline

Returns true if widget is owned by this popup widget, false otherwise.

Definition at line 118 of file vwidgetpopup.h.

References mOwn.

◆ PopupMessage()

void VWidgetPopup::PopupMessage ( QWidget *  w,
const QString &  msg 
)
static

Definition at line 117 of file vwidgetpopup.cpp.

References SCASSERT, SetLifeTime(), SetWidget(), Show(), and VWidgetPopup().

Referenced by MainWindow::SyncMeasurements().

◆ SetLifeTime()

void VWidgetPopup::SetLifeTime ( int  value)
inline

Definition at line 130 of file vwidgetpopup.h.

References lifeTime.

Referenced by PopupMessage().

◆ SetWidget()

void VWidgetPopup::SetWidget ( QWidget *  widget,
bool  own = true 
)

Sets widget to be popped up to widget. If own is true then the widget will be reparented to the popup widget.

Definition at line 87 of file vwidgetpopup.cpp.

References mOldParent, mOwn, and mWidget.

Referenced by PopupMessage().

◆ Show

void VWidgetPopup::Show ( QPoint  coord)
slot

Pops up the widget at global coordinates coord.

Definition at line 133 of file vwidgetpopup.cpp.

References lifeTime.

Referenced by PopupMessage().

◆ Widget()

QWidget * VWidgetPopup::Widget ( ) const
inline

Returns widget to be popped up.

Definition at line 112 of file vwidgetpopup.h.

References mWidget.

Member Data Documentation

◆ lifeTime

int VWidgetPopup::lifeTime
protected

Definition at line 108 of file vwidgetpopup.h.

Referenced by GetLifeTime(), SetLifeTime(), and Show().

◆ mOldParent

QWidget* VWidgetPopup::mOldParent
protected

Definition at line 107 of file vwidgetpopup.h.

Referenced by SetWidget().

◆ mOwn

bool VWidgetPopup::mOwn
protected

Definition at line 106 of file vwidgetpopup.h.

Referenced by isOwned(), and SetWidget().

◆ mWidget

QWidget* VWidgetPopup::mWidget
protected

Definition at line 105 of file vwidgetpopup.h.

Referenced by SetWidget(), and Widget().


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