Logo Search packages:      
Sourcecode: qt4-x11 version File versions

Q3ToolBar Class Reference

Inheritance diagram for Q3ToolBar:

Q3DockWindow Q3Frame QFrame QWidget QObject QPaintDevice

List of all members.


Detailed Description

The Q3ToolBar class provides a movable panel containing widgets such as tool buttons.

A toolbar is a panel that contains a set of controls, usually represented by small icons. It's purpose is to provide quick access to frequently used commands or options. Within a Q3MainWindow the user can drag toolbars within and between the dock areas. Toolbars can also be dragged out of any dock area to float freely as top-level windows.

Q3ToolBar is a specialization of QDockWindow, and so provides all the functionality of a QDockWindow.

To use Q3ToolBar you simply create a Q3ToolBar as a child of a Q3MainWindow, create a number of QToolButton widgets (or other widgets) in left to right (or top to bottom) order and call addSeparator() when you want a separator. When a toolbar is floated the caption used is the label given in the constructor call. This can be changed with setLabel().

You may use most widgets within a toolbar, with QToolButton and QComboBox being the most common. But note that the toolbar's actions must be {Q3Action}s.

If you create a new widget on an already visible Q3ToolBar, this widget will automatically become visible without needing a show() call. (This differs from every other Qt widget container. We recommend calling show() anyway since we hope to fix this anomaly in a future release.)

Q3ToolBars, like QDockWindows, are located in {QDockArea}s or float as top-level windows. Q3MainWindow provides four QDockAreas (top, left, right and bottom). When you create a new toolbar (as in the example above) as a child of a Q3MainWindow the toolbar will be added to the top dock area. You can move it to another dock area (or float it) by calling Q3MainWindow::moveDockWindow(). Dock areas lay out their windows in lines.

If the main window is resized so that the area occupied by the toolbar is too small to show all its widgets a little arrow button (which looks like a right-pointing chevron, '»') will appear at the right or bottom of the toolbar depending on its orientation. Clicking this button pops up a menu that shows the 'overflowing' items. QToolButtons are represented in the menu using their textLabel property, other QAbstractButton subclasses are represented using their text property, and QComboBoxes are represented as submenus, with the caption text being used in the submenu item.

Usually a toolbar will get precisely the space it needs. However, with setHorizontalStretchable(), setVerticalStretchable() or setStretchableWidget() you can tell the main window to expand the toolbar to fill all available space in the specified orientation.

The toolbar arranges its buttons either horizontally or vertically (see orientation() for details). Generally, QDockArea will set the orientation correctly for you, but you can set it yourself with setOrientation() and track any changes by connecting to the orientationChanged() signal.

You can use the clear() method to remove all items from a toolbar.

qdockwindow.png Toolbar (dock window) A floating QToolbar (dock window)

See also:
QToolButton Q3MainWindow

Definition at line 38 of file q3toolbar.h.


Public Types

enum  CloseMode { Never = 0, Docked = 1, Undocked = 2, Always = Docked | Undocked }
enum  PaintDeviceMetric {
  PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM,
  PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY,
  PdmPhysicalDpiX, PdmPhysicalDpiY
}
enum  Place { InDock, OutsideDock }
enum  Shadow { Plain = 0x0010, Raised = 0x0020, Sunken = 0x0030 }
enum  Shape {
  NoFrame = 0, Box = 0x0001, Panel = 0x0002, WinPanel = 0x0003,
  HLine = 0x0004, VLine = 0x0005, StyledPanel = 0x0006
}
enum  StyleMask { Shadow_Mask = 0x00f0, Shape_Mask = 0x000f }

Public Slots

bool close ()
void deleteLater ()
virtual void dock ()
void hide ()
void lower ()
void raise ()
void repaint ()
void setDisabled (bool)
void setEnabled (bool)
void setFocus ()
void setHidden (bool hidden)
QT_MOC_COMPAT void setShown (bool shown)
void setStyleSheet (const QString &styleSheet)
void setWindowModified (bool)
void setWindowTitle (const QString &)
void show ()
void showFullScreen ()
void showMaximized ()
void showMinimized ()
void showNormal ()
virtual void undock ()
virtual void undock (QWidget *w)
void update ()

Signals

void customContextMenuRequested (const QPoint &pos)
void destroyed (QObject *=0)
void orientationChanged (Qt::Orientation o)
void placeChanged (Q3DockWindow::Place p)
void visibilityChanged (bool)

Public Member Functions

bool acceptDrops () const
QString accessibleDescription () const
QString accessibleName () const
QList< QAction * > actions () const
void activateWindow ()
void addAction (QAction *action)
void addActions (QList< QAction * > actions)
void addSeparator ()
void adjustSize ()
Q3DockAreaarea () const
bool autoFillBackground () const
QPalette::ColorRole backgroundRole () const
QSize baseSize () const
bool blockSignals (bool b)
QBoxLayoutboxLayout ()
QWidgetchildAt (const QPoint &p) const
QWidgetchildAt (int x, int y) const
const QObjectListchildren () const
QRect childrenRect () const
QRegion childrenRegion () const
virtual void clear ()
void clearFocus ()
void clearMask ()
int closeMode () const
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
QRect contentsRect () const
Qt::ContextMenuPolicy contextMenuPolicy () const
void createWinId ()
QCursor cursor () const
int depth () const
int devType () const
bool disconnect (const QObject *receiver, const char *member=0)
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
void dumpObjectInfo ()
void dumpObjectTree ()
QList< QByteArraydynamicPropertyNames () const
void ensurePolished () const
bool event (QEvent *e)
bool eventFilter (QObject *o, QEvent *e)
template<typename T>
findChild (const QString &name=QString()) const
template<typename T>
QList< T > findChildren (const QRegExp &re) const
template<typename T>
QList< T > findChildren (const QString &name=QString()) const
QSize fixedExtent () const
Qt::FocusPolicy focusPolicy () const
QWidgetfocusProxy () const
QWidgetfocusWidget () const
const QFontfont () const
QFontInfo fontInfo () const
QFontMetrics fontMetrics () const
QPalette::ColorRole foregroundRole () const
QRect frameGeometry () const
QRect frameRect () const
Shadow frameShadow () const
Shape frameShape () const
QSize frameSize () const
int frameStyle () const
int frameWidth () const
const QRectgeometry () const
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
void grabKeyboard ()
void grabMouse (const QCursor &)
void grabMouse ()
int grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut)
Qt::HANDLE handle () const
bool hasFocus () const
bool hasMouseTracking () const
int height () const
virtual int heightForWidth (int) const
int heightMM () const
bool inherits (const char *classname) const
QInputContextinputContext ()
virtual QVariant inputMethodQuery (Qt::InputMethodQuery) const
void insertAction (QAction *before, QAction *action)
void insertActions (QAction *before, QList< QAction * > actions)
void installEventFilter (QObject *)
WId internalWinId () const
bool isActiveWindow () const
bool isAncestorOf (const QWidget *child) const
bool isCloseEnabled () const
bool isEnabled () const
bool isEnabledTo (QWidget *) const
bool isEnabledToTLW () const
bool isFullScreen () const
bool isHidden () const
bool isHorizontallyStretchable () const
bool isHorizontalStretchable () const
bool isLeftToRight () const
bool isMaximized () const
bool isMinimized () const
bool isModal () const
bool isMovingEnabled () const
bool isResizeEnabled () const
bool isRightToLeft () const
bool isStretchable () const
bool isTopLevel () const
bool isVerticallyStretchable () const
bool isVerticalStretchable () const
bool isVisible () const
bool isVisibleTo (QWidget *) const
bool isWidgetType () const
bool isWindow () const
bool isWindowModified () const
void killTimer (int id)
QString label () const
QLayoutlayout () const
Qt::LayoutDirection layoutDirection () const
bool lineShapesOk () const
int lineWidth () const
int logicalDpiX () const
int logicalDpiY () const
Q3MainWindowmainWindow () const
QPoint mapFrom (QWidget *, const QPoint &) const
QPoint mapFromGlobal (const QPoint &) const
QPoint mapFromParent (const QPoint &) const
QPoint mapTo (QWidget *, const QPoint &) const
QPoint mapToGlobal (const QPoint &) const
QPoint mapToParent (const QPoint &) const
int margin () const
QRegion mask () const
int maximumHeight () const
QSize maximumSize () const
int maximumWidth () const
int midLineWidth () const
int minimumHeight () const
QSize minimumSize () const
QSize minimumSizeHint () const
int minimumWidth () const
void move (const QPoint &)
void move (int x, int y)
void moveToThread (QThread *thread)
bool newLine () const
QWidgetnextInFocusChain () const
QRect normalGeometry () const
int numColors () const
QString objectName () const
int offset () const
bool opaqueMoving () const
Qt::Orientation orientation () const
void overrideWindowFlags (Qt::WindowFlags type)
void overrideWindowState (Qt::WindowStates state)
QPaintEnginepaintEngine () const
bool paintingActive () const
const QPalettepalette () const
QObjectparent () const
QWidgetparentWidget () const
int physicalDpiX () const
int physicalDpiY () const
Place place () const
QPoint pos () const
QVariant property (const char *name) const
 Q3ToolBar (Q3MainWindow *parent=0, const char *name=0)
 Q3ToolBar (const QString &label, Q3MainWindow *, QWidget *, bool newLine=false, const char *name=0, Qt::WindowFlags f=0)
 Q3ToolBar (const QString &label, Q3MainWindow *, Qt::ToolBarDock=Qt::DockTop, bool newLine=false, const char *name=0)
QRect rect () const
void releaseKeyboard ()
void releaseMouse ()
void releaseShortcut (int id)
void removeAction (QAction *action)
void removeEventFilter (QObject *)
void repaint (const QRegion &)
void repaint (const QRect &)
void repaint (int x, int y, int w, int h)
void resize (const QSize &)
void resize (int w, int h)
bool restoreGeometry (const QByteArray &geometry)
QByteArray saveGeometry () const
void scroll (int dx, int dy, const QRect &)
void scroll (int dx, int dy)
void setAcceptDrops (bool on)
void setAccessibleDescription (const QString &description)
void setAccessibleName (const QString &name)
void setAttribute (Qt::WidgetAttribute, bool on=true)
void setAutoFillBackground (bool enabled)
void setBackgroundRole (QPalette::ColorRole)
void setBaseSize (int basew, int baseh)
void setBaseSize (const QSize &)
virtual void setCloseMode (int m)
void setContentsMargins (int left, int top, int right, int bottom)
void setContextMenuPolicy (Qt::ContextMenuPolicy policy)
void setCursor (const QCursor &)
virtual void setFixedExtentHeight (int h)
virtual void setFixedExtentWidth (int w)
void setFixedHeight (int h)
void setFixedSize (int w, int h)
void setFixedSize (const QSize &)
void setFixedWidth (int w)
void setFocus (Qt::FocusReason reason)
void setFocusPolicy (Qt::FocusPolicy policy)
void setFocusProxy (QWidget *)
void setFont (const QFont &)
void setForegroundRole (QPalette::ColorRole)
void setFrameRect (const QRect &)
void setFrameShadow (Shadow)
void setFrameShape (Shape)
void setFrameStyle (int)
void setGeometry (const QRect &)
void setGeometry (int x, int y, int w, int h)
virtual void setHorizontallyStretchable (bool b)
void setHorizontalStretchable (bool b)
void setInputContext (QInputContext *)
virtual void setLabel (const QString &)
void setLayout (QLayout *)
void setLayoutDirection (Qt::LayoutDirection direction)
void setLineWidth (int)
void setMargin (int)
void setMask (const QRegion &)
void setMask (const QBitmap &)
void setMaximumHeight (int maxh)
void setMaximumSize (int maxw, int maxh)
void setMaximumSize (const QSize &)
void setMaximumWidth (int maxw)
void setMidLineWidth (int)
void setMinimumHeight (int minh)
void setMinimumSize (const QSize &)
void setMinimumSize (int minw, int minh)
void setMinimumWidth (int minw)
void setMouseTracking (bool enable)
virtual void setMovingEnabled (bool b)
virtual void setNewLine (bool b)
void setObjectName (const QString &name)
virtual void setOffset (int o)
virtual void setOpaqueMoving (bool b)
void setOrientation (Qt::Orientation o)
void setPalette (const QPalette &)
void setParent (QObject *)
void setParent (QWidget *parent, Qt::WindowFlags f)
void setParent (QWidget *parent)
bool setProperty (const char *name, const QVariant &value)
virtual void setResizeEnabled (bool b)
void setShortcutAutoRepeat (int id, bool enable=true)
void setShortcutEnabled (int id, bool enable=true)
void setSizeIncrement (int w, int h)
void setSizeIncrement (const QSize &)
void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
void setSizePolicy (QSizePolicy)
void setStatusTip (const QString &)
virtual void setStretchableWidget (QWidget *)
void setStyle (QStyle *)
void setToolTip (const QString &)
void setUpdatesEnabled (bool enable)
void setUserData (uint id, QObjectUserData *data)
virtual void setVerticallyStretchable (bool b)
void setVerticalStretchable (bool b)
void setVisible (bool visible)
void setWhatsThis (const QString &)
virtual void setWidget (QWidget *w)
void setWindowFlags (Qt::WindowFlags type)
void setWindowIcon (const QIcon &icon)
void setWindowIconText (const QString &)
void setWindowModality (Qt::WindowModality windowModality)
void setWindowOpacity (qreal level)
void setWindowRole (const QString &)
void setWindowState (Qt::WindowStates state)
void setWindowSurface (QWindowSurface *surface)
bool signalsBlocked () const
QSize size () const
QSize sizeHint () const
QSize sizeIncrement () const
QSizePolicy sizePolicy () const
void stackUnder (QWidget *)
int startTimer (int interval)
QString statusTip () const
QStylestyle () const
QString styleSheet () const
bool testAttribute (Qt::WidgetAttribute) const
QThreadthread () const
QString toolTip () const
QWidgettopLevelWidget () const
bool underMouse () const
void unsetCursor ()
void unsetLayoutDirection ()
void update (const QRegion &)
void update (const QRect &)
void update (int x, int y, int w, int h)
void updateGeometry ()
bool updatesEnabled () const
QObjectUserData * userData (uint id) const
QRegion visibleRegion () const
QString whatsThis () const
QWidgetwidget () const
int width () const
int widthMM () const
QWidgetwindow () const
Qt::WindowFlags windowFlags () const
QIcon windowIcon () const
QString windowIconText () const
Qt::WindowModality windowModality () const
qreal windowOpacity () const
QString windowRole () const
Qt::WindowStates windowState () const
QWindowSurface * windowSurface () const
QString windowTitle () const
Qt::WindowType windowType () const
WId winId () const
int x () const
int y () const
 ~Q3ToolBar ()

Static Public Member Functions

static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
static QWidgetfind (WId)
static QWidgetkeyboardGrabber ()
static QWidgetmouseGrabber ()
static uint registerUserData ()
static void setTabOrder (QWidget *, QWidget *)

Protected Slots

void updateMicroFocus ()

Protected Member Functions

void actionEvent (QActionEvent *)
void changeEvent (QEvent *)
virtual void childEvent (QChildEvent *)
virtual void closeEvent (QCloseEvent *)
virtual void connectNotify (const char *signal)
void contextMenuEvent (QContextMenuEvent *e)
void create (WId=0, bool initializeWindow=true, bool destroyOldWindow=true)
virtual void customEvent (QEvent *)
void destroy (bool destroyWindow=true, bool destroySubWindows=true)
virtual void disconnectNotify (const char *signal)
virtual void dragEnterEvent (QDragEnterEvent *)
virtual void dragLeaveEvent (QDragLeaveEvent *)
virtual void dragMoveEvent (QDragMoveEvent *)
void drawContents (QPainter *)
void drawFrame (QPainter *)
virtual void dropEvent (QDropEvent *)
virtual void enabledChange (bool)
virtual void enterEvent (QEvent *)
virtual void focusInEvent (QFocusEvent *)
bool focusNextChild ()
virtual bool focusNextPrevChild (bool next)
virtual void focusOutEvent (QFocusEvent *)
bool focusPreviousChild ()
virtual void fontChange (const QFont &)
virtual void frameChanged ()
void hideEvent (QHideEvent *e)
virtual void inputMethodEvent (QInputMethodEvent *)
virtual void keyPressEvent (QKeyEvent *)
virtual void keyReleaseEvent (QKeyEvent *)
virtual void languageChange ()
virtual void leaveEvent (QEvent *)
int metric (PaintDeviceMetric) const
virtual void mouseDoubleClickEvent (QMouseEvent *)
virtual void mouseMoveEvent (QMouseEvent *)
virtual void mousePressEvent (QMouseEvent *)
virtual void mouseReleaseEvent (QMouseEvent *)
virtual void moveEvent (QMoveEvent *)
void paintEvent (QPaintEvent *)
virtual void paletteChange (const QPalette &)
int receivers (const char *signal) const
void resetInputContext ()
void resizeEvent (QResizeEvent *e)
QObjectsender () const
void showEvent (QShowEvent *e)
void styleChange (QStyle &)
virtual void tabletEvent (QTabletEvent *)
virtual void timerEvent (QTimerEvent *)
virtual void wheelEvent (QWheelEvent *)
virtual void windowActivationChange (bool)

Protected Attributes

QObjectData * d_ptr
ushort painters

Static Protected Attributes

static const QMetaObject staticQtMetaObject

Properties

bool acceptDrops
 whether drop events are enabled for this widget
QString accessibleDescription
 the widget's description as seen by assistive technologies
QString accessibleName
 the widget's name as seen by assistive technologies
bool autoFillBackground
 whether the widget background is filled automatically
QSize baseSize
 the base size of the widget
QRect childrenRect
 the bounding rectangle of the widget's children
QRegion childrenRegion
 the combined region occupied by the widget's children
int closeMode
 the close mode of a dock window
QRect contentsRect
 the frame's contents rectangle (including the margins)
Qt::ContextMenuPolicy contextMenuPolicy
 how the widget shows a context menu
QCursor cursor
 the cursor shape for this widget
bool enabled
 whether the widget is enabled
bool focus
 whether this widget (or its focus proxy) has the keyboard input focus
Qt::FocusPolicy focusPolicy
 the way the widget accepts keyboard focus
QFont font
 the font currently set for the widget
QRect frameGeometry
 geometry of the widget relative to its parent including any window frame
QRect frameRect
 the frame's rectangle
Shadow frameShadow
 the frame shadow value from the frame style
Shape frameShape
 the frame shape value from the frame style
QSize frameSize
 the size of the widget including any window frame
int frameWidth
 the width of the frame that is drawn.
bool fullScreen
 whether the widget is full screen
QRect geometry
 the geometry of the widget relative to its parent and excluding the window frame
int height
 the height of the widget excluding any window frame
bool horizontallyStretchable
 whether the dock window is horizontally stretchable.
bool isActiveWindow
 whether this widget's window is the active window
QString label
 the toolbar's label.
Qt::LayoutDirection layoutDirection
 the layout direction for this widget
int lineWidth
 the line width
int margin
 the width of the margin
bool maximized
 whether this widget is maximized
int maximumHeight
 the widget's maximum height
QSize maximumSize
 the widget's maximum size
int maximumWidth
 the widget's maximum width
int midLineWidth
 the width of the mid-line
bool minimized
 whether this widget is minimized (iconified)
int minimumHeight
 the widget's minimum height
QSize minimumSize
 the widget's minimum size
QSize minimumSizeHint
 the recommended minimum size for the widget
int minimumWidth
 the widget's minimum width
bool modal
 whether the widget is a modal widget
bool mouseTracking
 whether mouse tracking is enabled for the widget
bool movingEnabled
 whether the user can move the dock window within the dock area, move the dock window to another dock area, or float the dock window.
bool newLine
 whether the dock window prefers to start a new line in the dock area.
QRect normalGeometry
 the geometry of the widget as it will appear when shown as a normal (not maximized or fullscreen) toplevel widget
QString objectName
 the name of this object
int offset
 the dock window's preferred offset from the dock area's left edge (top edge for vertical dock areas)
bool opaqueMoving
 whether the dock window will be shown normally whilst it is being moved.
QPalette palette
 the widget's palette
Place place
 the location where the dock window is placed
QPoint pos
 the position of the widget within its parent widget
QRect rect
 the internal geometry of the widget excluding any window frame
bool resizeEnabled
 whether the dock window is resizeable
QSize size
 the size of the widget excluding any window frame
QSize sizeHint
 the recommended size for the widget
QSize sizeIncrement
 the size increment of the widget
QSizePolicy sizePolicy
 the default layout behavior of the widget
QString statusTip
 the widget's status tip
bool stretchable
 whether the dock window is stretchable in the current orientation()
QString styleSheet
 the widget's style sheet
QString toolTip
 the widget's tooltip
bool updatesEnabled
 whether updates are enabled
bool verticallyStretchable
 whether the dock window is vertically stretchable.
bool visible
 whether the widget is visible
QString whatsThis
 the widget's What's This help text.
int width
 the width of the widget excluding any window frame
QIcon windowIcon
 the widget's icon
QString windowIconText
 the widget's icon text
Qt::WindowModality windowModality
 which windows are blocked by the modal widget
bool windowModified
 whether the document shown in the window has unsaved changes
double windowOpacity
 The level of opacity for the window.
QString windowTitle
 the window title (caption)
int x
 the x coordinate of the widget relative to its parent including any window frame
int y
 the y coordinate of the widget relative to its parent and including any window frame

Private Slots

void createPopup ()

Private Member Functions

void checkForExtension (const QSize &sz)
void init ()

Private Attributes

Q3ToolBarPrivate * d
QString l
Q3MainWindowmw
QWidgetsw

Friends

class Q3DockArea
class Q3DockAreaLayout
class Q3DockWindowHandle
class Q3DockWindowTitleBar
class Q3MainWindow
class Q3ToolBar
class QCEMainWindow
class QCoreApplication
class QCoreApplicationPrivate
struct QMetaObject
class QThreadData
class QWidget
class QWindowsXPStyle

Related Functions

(Note that these are not member functions.)

qFindChild (const QObject *obj, const QString &name=QString(), T dummy=0)
qFindChild (const QObject *obj, const QString &name)
QList< T > qFindChildren (const QObject *obj, const QString &name=QString(), T dummy=0)
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
QList< T > qFindChildren (const QObject *obj, const QString &name)
T * qobject_cast (QObject *object)
 QObjectList
void * qt_find_obj_child (QObject *parent, const char *type, const QString &name)
const Q_GUI_EXPORT QX11Infoqt_x11Info (const QPaintDevice *pd)
 QWidgetList
 WId

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

Generated by  Doxygen 1.6.0   Back to index