Eneboo - Documentación para desarrolladores
Clases | Tipos públicos | Slots públicos | Métodos públicos | Propiedades | Amigas | Funciones relacionadas
Referencia de la Clase QDockArea

The QDockArea class manages and lays out QDockWindows. Más...

#include <qdockarea.h>

Diagrama de herencias de QDockArea
QWidget QWidget QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject

Lista de todos los miembros.

Clases

struct  DockWindowData

Tipos públicos

enum  HandlePosition { Normal, Reverse, Normal, Reverse }
enum  HandlePosition { Normal, Reverse, Normal, Reverse }

Slots públicos

void lineUp (bool keepNewLines)
void lineUp (bool keepNewLines)

Métodos públicos

 QDockArea (Orientation o, HandlePosition h=Normal, QWidget *parent=0, const char *name=0)
 ~QDockArea ()
void moveDockWindow (QDockWindow *w, const QPoint &globalPos, const QRect &rect, bool swap)
void removeDockWindow (QDockWindow *w, bool makeFloating, bool swap, bool fixNewLines=TRUE)
void moveDockWindow (QDockWindow *w, int index=-1)
bool hasDockWindow (QDockWindow *w, int *index=0)
void invalidNextOffset (QDockWindow *dw)
Orientation orientation () const
HandlePosition handlePosition () const
bool eventFilter (QObject *, QEvent *)
bool isEmpty () const
int count () const
QPtrList< QDockWindowdockWindowList () const
bool isDockWindowAccepted (QDockWindow *dw)
void setAcceptDockWindow (QDockWindow *dw, bool accept)
int findDockWindow (QDockWindow *w)
 QDockArea (Orientation o, HandlePosition h=Normal, QWidget *parent=0, const char *name=0)
 ~QDockArea ()
void moveDockWindow (QDockWindow *w, const QPoint &globalPos, const QRect &rect, bool swap)
void removeDockWindow (QDockWindow *w, bool makeFloating, bool swap, bool fixNewLines=TRUE)
void moveDockWindow (QDockWindow *w, int index=-1)
bool hasDockWindow (QDockWindow *w, int *index=0)
void invalidNextOffset (QDockWindow *dw)
Orientation orientation () const
HandlePosition handlePosition () const
bool eventFilter (QObject *, QEvent *)
bool isEmpty () const
int count () const
QPtrList< QDockWindowdockWindowList () const
bool isDockWindowAccepted (QDockWindow *dw)
void setAcceptDockWindow (QDockWindow *dw, bool accept)
int findDockWindow (QDockWindow *w)

Propiedades

Orientation orientation
 the dock area's orientation
int count
 the number of dock windows in the dock area
bool empty
 whether the dock area is empty
HandlePosition handlePosition
 where the dock window splitter handle is placed in the dock area

Amigas

class QDockWindow
class QDockWindowResizeHandle
class QDockAreaLayout

Funciones relacionadas

(Observar que estas no son funciones miembro.)

QTextStreamoperator<< (QTextStream &ts, const QDockArea &dockArea)
QTextStreamoperator>> (QTextStream &ts, QDockArea &dockArea)

Descripción detallada

The QDockArea class manages and lays out QDockWindows.

A QDockArea is a container which manages a list of {QDockWindow}s which it lays out within its area. In cooperation with the {QDockWindow}s it is responsible for the docking and undocking of {QDockWindow}s and moving them inside the dock area. QDockAreas also handle the wrapping of {QDockWindow}s to fill the available space as compactly as possible. QDockAreas can contain QToolBars since QToolBar is a QDockWindow subclass.

QMainWindow contains four QDockAreas which you can use for your QToolBars and QDockWindows, so in most situations you do not need to use the QDockArea class directly. Although QMainWindow contains support for its own dock areas it isn't convenient for adding new QDockAreas. If you need to create your own dock areas we suggest that you create a subclass of QWidget and add your QDockAreas to your subclass.

qmainwindow-qdockareas.png QMainWindow's QDockAreas

lines Lines. QDockArea uses the concept of lines. A line is a horizontal region which may contain dock windows side-by-side. A dock area may have room for more than one line. When dock windows are docked into a dock area they are usually added at the right hand side of the top-most line that has room (unless manually placed by the user). When users move dock windows they may leave empty lines or gaps in non-empty lines. Dock windows can be lined up to minimize wasted space using the lineUp() function.

The QDockArea class maintains a position list of all its child dock windows. Dock windows are added to a dock area from position 0 onwards. Dock windows are laid out sequentially in position order from left to right, and in the case of multiple lines of dock windows, from top to bottom. If a dock window is floated it still retains its position since this is where the window will return if the user double clicks its caption. A dock window's position can be determined with hasDockWindow(). The position can be changed with moveDockWindow().

To dock or undock a dock window use QDockWindow::dock() and QDockWindow::undock() respectively. If you want to control which dock windows can dock in a dock area use setAcceptDockWindow(). To see if a dock area contains a particular dock window use {hasDockWindow()}; to see how many dock windows a dock area contains use count().

The streaming operators can write the positions of the dock windows in the dock area to a QTextStream. The positions can be read back later to restore the saved positions.

Save the positions to a QTextStream:

    ts << *myDockArea;

Restore the positions from a QTextStream:

    ts >> *myDockArea;

Documentación de las enumeraciones miembro de la clase

A dock window has two kinds of handles, the dock window handle used for dragging the dock window, and the splitter handle used to resize the dock window in relation to other dock windows using a splitter. (The splitter handle is only visible for docked windows.)

This enum specifies where the dock window splitter handle is placed in the dock area.

Normal The splitter handles of dock windows are placed at the right or bottom.

Reverse The splitter handles of dock windows are placed at the left or top.

Valores de enumeraciones:
Normal 
Reverse 
Normal 
Reverse 
Valores de enumeraciones:
Normal 
Reverse 
Normal 
Reverse 

Documentación del constructor y destructor

QDockArea::QDockArea ( Orientation  o,
HandlePosition  h = Normal,
QWidget parent = 0,
const char *  name = 0 
)

Constructs a QDockArea with orientation o, HandlePosition h, parent parent and called name.

QDockArea::~QDockArea ( )

Destroys the dock area and all the dock windows docked in the dock area.

Does not affect any floating dock windows or dock windows in other dock areas, even if they first appeared in this dock area. Floating dock windows are effectively top level windows and are not child windows of the dock area. When a floating dock window is docked (dragged into a dock area) its parent becomes the dock area.

QDockArea::QDockArea ( Orientation  o,
HandlePosition  h = Normal,
QWidget parent = 0,
const char *  name = 0 
)
QDockArea::~QDockArea ( )

Documentación de las funciones miembro

int QDockArea::count ( ) const
int QDockArea::count ( ) const
QPtrList< QDockWindow > QDockArea::dockWindowList ( ) const

Returns a list of the dock windows in the dock area.

QPtrList<QDockWindow> QDockArea::dockWindowList ( ) const
bool QDockArea::eventFilter ( QObject o,
QEvent e 
) [virtual]

Reimplementado de QObject.

bool QDockArea::eventFilter ( QObject ,
QEvent  
) [virtual]

Filters events if this object has been installed as an event filter for the watched object.

In your reimplementation of this function, if you want to filter the event e, out, i.e. stop it being handled further, return TRUE; otherwise return FALSE.

Example:

    class MyMainWindow : public QMainWindow
    {
    public:
        MyMainWindow( QWidget *parent = 0, const char *name = 0 );

    protected:
        bool eventFilter( QObject *obj, QEvent *ev );

    private:
        QTextEdit *textEdit;
    };

    MyMainWindow::MyMainWindow( QWidget *parent, const char *name )
        : QMainWindow( parent, name )
    {
        textEdit = new QTextEdit( this );
        setCentralWidget( textEdit );
        textEdit->installEventFilter( this );
    }

    bool MyMainWindow::eventFilter( QObject *obj, QEvent *ev )
    {
        if ( obj == textEdit ) {
            if ( e->type() == QEvent::KeyPress ) {
                QKeyEvent *k = (QKeyEvent*)ev;
                qDebug( "Ate key press %d", k->key() );
                return TRUE;
            } else {
                return FALSE;
            }
        } else {
            // pass the event on to the parent class
            return QMainWindow::eventFilter( obj, ev );
        }
    }

Notice in the example above that unhandled events are passed to the base class's eventFilter() function, since the base class might have reimplemented eventFilter() for its own internal purposes.

Atención:
If you delete the receiver object in this function, be sure to return TRUE. Otherwise, Qt will forward the event to the deleted object and the program might crash.
Ver también:
installEventFilter()

Reimplementado de QObject.

int QDockArea::findDockWindow ( QDockWindow w)
int QDockArea::findDockWindow ( QDockWindow w)
HandlePosition QDockArea::handlePosition ( ) const [inline]
HandlePosition QDockArea::handlePosition ( ) const [inline]
bool QDockArea::hasDockWindow ( QDockWindow w,
int index = 0 
)
bool QDockArea::hasDockWindow ( QDockWindow w,
int index = 0 
)

Returns TRUE if the dock area contains the dock window w; otherwise returns FALSE. If index is not 0 it will be set as follows: if the dock area contains the dock window *index is set to w's index position; otherwise *index is set to -1.

void QDockArea::invalidNextOffset ( QDockWindow dw)
void QDockArea::invalidNextOffset ( QDockWindow dw)
bool QDockArea::isDockWindowAccepted ( QDockWindow dw)

Returns TRUE if dock window dw could be docked into the dock area; otherwise returns FALSE.

Ver también:
setAcceptDockWindow()
bool QDockArea::isDockWindowAccepted ( QDockWindow dw)
bool QDockArea::isEmpty ( void  ) const
bool QDockArea::isEmpty ( ) const
void QDockArea::lineUp ( bool  keepNewLines) [slot]

Lines up the dock windows in this dock area to minimize wasted space. If keepNewLines is TRUE, only space within lines is cleaned up. If keepNewLines is FALSE the number of lines might be changed.

void QDockArea::lineUp ( bool  keepNewLines) [slot]
void QDockArea::moveDockWindow ( QDockWindow w,
int  index = -1 
)

Moves the QDockWindow w within the dock area. If w is not already docked in this area, w is docked first. If index is -1 or larger than the number of docked widgets, w is appended at the end, otherwise it is inserted at the position index.

void QDockArea::moveDockWindow ( QDockWindow w,
const QPoint globalPos,
const QRect rect,
bool  swap 
)
void QDockArea::moveDockWindow ( QDockWindow w,
int  index = -1 
)
void QDockArea::moveDockWindow ( QDockWindow w,
const QPoint p,
const QRect r,
bool  swap 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Moves the dock window w inside the dock area where p is the new position (in global screen coordinates), r is the suggested rectangle of the dock window and swap specifies whether or not the orientation of the docked widget needs to be changed.

This function is used internally by QDockWindow. You shouldn't need to call it yourself.

Orientation QDockArea::orientation ( ) const [inline]
Orientation QDockArea::orientation ( ) const [inline]
void QDockArea::removeDockWindow ( QDockWindow w,
bool  makeFloating,
bool  swap,
bool  fixNewLines = TRUE 
)
void QDockArea::removeDockWindow ( QDockWindow w,
bool  makeFloating,
bool  swap,
bool  fixNewLines = TRUE 
)

Removes the dock window w from the dock area. If makeFloating is TRUE, w gets floated, and if swap is TRUE, the orientation of w gets swapped. If fixNewLines is TRUE (the default) newlines in the area will be fixed.

You should never need to call this function yourself. Use QDockWindow::dock() and QDockWindow::undock() instead.

void QDockArea::setAcceptDockWindow ( QDockWindow dw,
bool  accept 
)
void QDockArea::setAcceptDockWindow ( QDockWindow dw,
bool  accept 
)

If accept is TRUE, dock window dw can be docked in the dock area. If accept is FALSE, dock window dw cannot be docked in the dock area.

Ver también:
isDockWindowAccepted()

Documentación de las funciones relacionadas y clases amigas

QTextStream & operator<< ( QTextStream ts,
const QDockArea dockArea 
) [related]

Writes the layout of the dock windows in dock area dockArea to the text stream ts.

Ver también:
operator>>()
QTextStream & operator>> ( QTextStream ts,
QDockArea dockArea 
) [related]

Reads the layout description of the dock windows in dock area dockArea from the text stream ts and restores it. The layout description must have been previously written by the operator<<() function.

Ver también:
operator<<()
QDockAreaLayout [friend]
QDockWindow [friend]

Documentación de propiedades

int QDockArea::count [read]

the number of dock windows in the dock area

bool QDockArea::empty [read]

whether the dock area is empty

HandlePosition QDockArea::handlePosition [read]

where the dock window splitter handle is placed in the dock area

The default position is Normal.

Orientation QDockArea::orientation [read]

the dock area's orientation

There is no default value; the orientation is specified in the constructor.


La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'