CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | Properties | List of all members
ctkSizeGrip Class Reference

ctkSizeGrip is a utility widget that allows widget in a layout to be manually resized. It is not meant to be used as is but with a third party that can change the size hint of a widget such as a container widget (e.g. ctkExpandableWidget). To resize a widget, the user must left click on the size grip and drag left/right to control the width and/or up/bottom to control the height. Left button double-click resets the size hint of the target widget to its default. More...

#include <Libs/Widgets/ctkSizeGrip.h>

Inheritance diagram for ctkSizeGrip:
Inheritance graph
[legend]
Collaboration diagram for ctkSizeGrip:
Collaboration graph
[legend]

Public Types

typedef QWidget Superclass
 

Public Slots

void setWidgetSizeHint (QSize sizeHint)
 

Signals

void widgetSizeHintChanged (QSize sizeHint)
 

Public Member Functions

 ctkSizeGrip (QWidget *parent)
 
 ctkSizeGrip (QWidget *widgetToResize, QWidget *parent)
 
Qt::Orientations orientations () const
 
bool resizeWidget () const
 
void setOrientations (Qt::Orientations orientations)
 
void setResizeWidget (bool resize)
 
void setWidgetToResize (QWidget *target)
 
virtual QSize sizeHint () const
 
QSize widgetSizeHint () const
 
QWidget * widgetToResize () const
 
virtual ~ctkSizeGrip ()
 

Protected Member Functions

virtual bool event (QEvent *event)
 
virtual void mouseDoubleClickEvent (QMouseEvent *mouseEvent)
 
virtual void mouseMoveEvent (QMouseEvent *mouseEvent)
 
virtual void mousePressEvent (QMouseEvent *mouseEvent)
 
virtual void mouseReleaseEvent (QMouseEvent *mouseEvent)
 
virtual void paintEvent (QPaintEvent *paintEvent)
 

Protected Attributes

QScopedPointer< ctkSizeGripPrivate > d_ptr
 

Properties

Qt::Orientations orientations
 
bool resizeWidget
 
QSize widgetSizeHint
 

Detailed Description

ctkSizeGrip is a utility widget that allows widget in a layout to be manually resized. It is not meant to be used as is but with a third party that can change the size hint of a widget such as a container widget (e.g. ctkExpandableWidget). To resize a widget, the user must left click on the size grip and drag left/right to control the width and/or up/bottom to control the height. Left button double-click resets the size hint of the target widget to its default.

See also
ctkExpandableWidget

Definition at line 41 of file ctkSizeGrip.h.

Member Typedef Documentation

◆ Superclass

typedef QWidget ctkSizeGrip::Superclass

Definition at line 77 of file ctkSizeGrip.h.

Constructor & Destructor Documentation

◆ ctkSizeGrip() [1/2]

ctkSizeGrip::ctkSizeGrip ( QWidget *  parent)
explicit

◆ ctkSizeGrip() [2/2]

ctkSizeGrip::ctkSizeGrip ( QWidget *  widgetToResize,
QWidget *  parent 
)
explicit

◆ ~ctkSizeGrip()

virtual ctkSizeGrip::~ctkSizeGrip ( )
virtual

Member Function Documentation

◆ event()

virtual bool ctkSizeGrip::event ( QEvent *  event)
protectedvirtual

◆ mouseDoubleClickEvent()

virtual void ctkSizeGrip::mouseDoubleClickEvent ( QMouseEvent *  mouseEvent)
protectedvirtual

◆ mouseMoveEvent()

virtual void ctkSizeGrip::mouseMoveEvent ( QMouseEvent *  mouseEvent)
protectedvirtual

◆ mousePressEvent()

virtual void ctkSizeGrip::mousePressEvent ( QMouseEvent *  mouseEvent)
protectedvirtual

◆ mouseReleaseEvent()

virtual void ctkSizeGrip::mouseReleaseEvent ( QMouseEvent *  mouseEvent)
protectedvirtual

◆ orientations()

Qt::Orientations ctkSizeGrip::orientations ( ) const

◆ paintEvent()

virtual void ctkSizeGrip::paintEvent ( QPaintEvent *  paintEvent)
protectedvirtual

◆ resizeWidget()

bool ctkSizeGrip::resizeWidget ( ) const

◆ setOrientations()

void ctkSizeGrip::setOrientations ( Qt::Orientations  orientations)

◆ setResizeWidget()

void ctkSizeGrip::setResizeWidget ( bool  resize)

◆ setWidgetSizeHint

void ctkSizeGrip::setWidgetSizeHint ( QSize  sizeHint)
slot

Expressively change the sizeHint of the widget to resize.

See also
widgetSizeHint()

◆ setWidgetToResize()

void ctkSizeGrip::setWidgetToResize ( QWidget *  target)

◆ sizeHint()

virtual QSize ctkSizeGrip::sizeHint ( ) const
virtual

SizeHint of the size grip. It depends on the style in use, but it is typically a small (e.g. 13x13) square sizehint for Qt::Horizontal|Qt::Vertical orientations and a narrow rectangle for Qt::Horizontal or Qt::Vertical orientations.

◆ widgetSizeHint()

QSize ctkSizeGrip::widgetSizeHint ( ) const

Return the sizeHint set by the user or programatically using setWidgetSizeHint(). If width or/and height is 0, it means the sizeHint has not been touched and the original widget sizeHint should be used instead. When the orientation is solely vertical, the returned width component of the sizeHint is 0. If the orientations is solely horizontal, the sizeHint height is 0.

◆ widgetSizeHintChanged

void ctkSizeGrip::widgetSizeHintChanged ( QSize  sizeHint)
signal

◆ widgetToResize()

QWidget* ctkSizeGrip::widgetToResize ( ) const

Set the widget to resize. Note that the widget is not resized by ctkSizeGrip if resizeWidget is false. It should be a third party that should resize the widget (e.g. ctkExpandableWidget).

See also
widgetSizeHint()

Member Data Documentation

◆ d_ptr

QScopedPointer<ctkSizeGripPrivate> ctkSizeGrip::d_ptr
protected

Definition at line 120 of file ctkSizeGrip.h.

Property Documentation

◆ orientations

Qt::Orientations ctkSizeGrip::orientations
readwrite

This property describes the movement of freedom of the sizeGrip. There are 3 supported orientations: Qt::Vertical, Qt::Horizontal and Qt::Horizontal|Qt::Vertical. If the orientation is solely Qt::Horizontal, the size grip only allows vertical resize. If the orientation is solely Qt::Vertical, only horizontal resizes are supported. Note that the orientations change the look of the widget. And it also probably means that the position of the widget should be changed: bottom side for Qt::Vertical, right side for Qt::Horizontal and bottom right corner for Qt::Horizontal|Qt::Vertical. Qt::Horizontal|Qt::Vertical by default.

Definition at line 1 of file ctkSizeGrip.h.

◆ resizeWidget

bool ctkSizeGrip::resizeWidget
readwrite

This property holds whether the size grip resizes the widget or not. If the size grip doesn't resize the widget, it still returns a valid widgetSizeHint that can be used by a third party. By default, the widget is resized. \tbd it is experimental and not really working.

Definition at line 1 of file ctkSizeGrip.h.

◆ widgetSizeHint

QSize ctkSizeGrip::widgetSizeHint
readwrite

This property holds the sizeHint set by the user via the size grip or programatically using setWidgetSizeHint(). If width or/and height is 0, it means the sizeHint has not been touched and the default widget sizeHint should be used instead. For example, if orientations is solely vertical (not also horizontal), the width component of the widget sizeHint is 0. If orientations is solely horizontal, the widgets izeHint height is 0. (0,0) by default (meaning the default widget sizehint should be used).

Definition at line 1 of file ctkSizeGrip.h.


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