Class overview   Alphabetical list   Annotated list   Header Files   Member List  

PlaceHolder Class Reference


Places itself on top of any target Widget and provides five handles to move and resize the target. More...

#include <placehld.h>

List of all member functions.

Public Members

Public Slots

Protected Members

Private Members


Detailed Description

Places itself on top of any target Widget and provides five handles to move and resize the target.

The PlaceHolder class provides you with a means to resize or move any widget. By using the setTarget() member, you can specify the widget it should attach to. Typically you should create the PlaceHolder with the same parent as the target widget. The PlaceHolder will automatically place itself at the top of the child list of the mutual parent by calling raise()to make sure that no other widgets with the same parent obstruct it. As soon as you set the target to a valid widget, the PlaceHolder will make itself visible. It will place four SizeSlab widgets at the corners of the target widget and one at the center of the target.

The PlaceHolder has a grid setting. This grid setting is used to round the size and position of the target widget to the nearest gridpoints. The default value for the grid is 10x10 pixels. It can be changed with the setGrid() member function. The grid is not used during drag operations. As soon as the mouse button is released after dragging, the target widget is snapped to the grid.

Note: The sizeslabs are created by the PlaceHolder, but they are created as children of the target widget. Therefore, they are not deleted in the destructor of the PlaceHolder. This is not a memory leak!

Warning: Make sure the target set for the PlaceHolder is visible before you attach it. Otherwise it is undefined what will happen! Also, make sure you hide() the PlaceHolder before you delete its target widget!


Member Function Documentation

PlaceHolder::PlaceHolder(QWidget *parent, char *name)

Creates a new PlaceHolder. You should not supply 0 as the parent. This would make the SizeSlabs used by the PlaceHolder windows of their own, resulting in decorations being added by the window manager. The PlaceHolder is hidden by default until its target is set.

PlaceHolder::~PlaceHolder()

Deletes the PlaceHolder.

void PlaceHolder::hide()

Hides the five SizeSlab widgets, making the PlaceHolder invisible.

void PlaceHolder::show()

Shows all five SizeSlab widgets if a valid target is set. Before they are shown, all five SizeSlabs are raised to make sure they are the topmost widgets on the list of children of the target.

bool PlaceHolder::isVisible()

Returns whether the PlaceHolder is visible.

void PlaceHolder::setTarget(QWidget *target)

Sets the target of the PlaceHolder. The SizeSlab widgets are placed in the correct position and the PlaceHolder is made visible.

QWidget* PlaceHolder::getTarget()

Returns the target widget of the PlaceHolder.

void PlaceHolder::setGrid(int x, int y)

Set the grid to x times \y pixels. The grid is used to snap the target widget to a grid on the mutual parent widget.

void PlaceHolder::topLeftDisplace(const QPoint & delta) [slot]

The top left SizeSlab was moved, resize/move the whole widget to match the displacement.

void PlaceHolder::topRightDisplace(const QPoint & delta) [slot]

The top right SizeSlab was moved, resize/move the whole widget to match the displacement.

void PlaceHolder::bottomLeftDisplace(const QPoint & delta) [slot]

The bottom left SizeSlab was moved, resize/move the whole widget to match the displacement.

void PlaceHolder::bottomRightDisplace(const QPoint & delta) [slot]

The bottom right SizeSlab was moved, resize/move the whole widget to match the displacement.

void PlaceHolder::centerDisplace(const QPoint & delta) [slot]

The center SizeSlab was moved, move the whole widget to match the displacement.

void PlaceHolder::displaceDone() [slot]

Snap the resized/moved widget back to the nearest grid points defined by the _gridx and _gridy members.

void PlaceHolder::placeSlabs() [protected]

Place the SizeSlab widgets on the correct position on the target widget. This is a bit complicated, as our parent may not be the same as the parent of the target widget.


Member Variable Documentation

SizeSlab* PlaceHolder::_topLeft [private]

The top left SizeSlab

SizeSlab* PlaceHolder::_topRight [private]

The top right SizeSlab

SizeSlab* PlaceHolder::_bottomLeft [private]

The bottom left SizeSlab

SizeSlab* PlaceHolder::_bottomRight [private]

The bottom right SizeSlab

SizeSlab* PlaceHolder::_center [private]

The center SizeSlab

QWidget* PlaceHolder::_target [private]

The target of the PlaceHolder

int PlaceHolder::_gridx [private]

The grid value for the x-direction

int PlaceHolder::_gridy [private]

The grid value for the y-direction


This file was generated from the following files:
Generated at 14:38, 1998/04/17 for Ebuilder by doxygen  written by Dimitri van Heesch, © 1997-1998