📄 qtoolbar.3qt
字号:
'\" t.TH QToolBar 3qt "24 January 2005" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQToolBar \- Tool bar.br.PP\fC#include <qtoolbar.h>\fR.PPInherits QWidget..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQToolBar\fR ( const QString & " "label" ", QMainWindow *, QMainWindow::ToolBarDock = QMainWindow::Top, bool " "newLine" " = FALSE, const char * " "name" " = 0 ) ".br.ti -1c.BI "\fBQToolBar\fR ( const QString & " "label" ", QMainWindow *, QWidget *, bool " "newLine" " = FALSE, const char * " "name" " = 0, WFlags " "f" " = 0 ) ".br.ti -1c.BI "\fBQToolBar\fR ( QMainWindow * " "parent" " = 0, const char * " "name" " = 0 ) ".br.ti -1c.BI "\fB~QToolBar\fR () ".br.ti -1c.BI "void \fBaddSeparator\fR () ".br.ti -1c.BI "virtual void \fBsetOrientation\fR ( Orientation ) ".br.ti -1c.BI "Orientation \fBorientation\fR () const".br.ti -1c.BI "QMainWindow* \fBmainWindow\fR () ".br.ti -1c.BI "virtual void \fBsetStretchableWidget\fR ( QWidget * ) ".br.ti -1c.BI "void \fBsetHorizontalStretchable\fR ( bool b ) ".br.ti -1c.BI "void \fBsetVerticalStretchable\fR ( bool b ) ".br.ti -1c.BI "bool \fBisHorizontalStretchable\fR () const".br.ti -1c.BI "bool \fBisVerticalStretchable\fR () const".br.ti -1c.BI "virtual void \fBsetLabel\fR ( const QString & ) ".br.ti -1c.BI "QString \fBlabel\fR () const".br.ti -1c.BI "void \fBclear\fR () ".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBorientationChanged\fR ( Orientation ) ".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual void \fBpaintEvent\fR ( QPaintEvent * ) ".br.in -1c.SS "Properties".nf.TSl l l l l- - - - -l l l l l.Type Name READ WRITE OptionsQString label label setLabelbool hStretchable isHorizontalStretchable setHorizontalStretchablebool vStretchable isVerticalStretchable setVerticalStretchableOrientation orientation orientation setOrientation.TE.fi.SH DESCRIPTIONThe QToolBar class provides a tool bar..PPA toolbar is a panel that contains a set of controls, usually represented by small icons. Its purpose is to provide quick access to frequently used commands or options. Within a main window, the user can drag toolbars freely around and hide them with a click on the toolbar handle..PPTo use QToolBar, you simply create a QToolBar as child of a QMainWindow, create a number of QToolButton widgets (or other widgets) in left to right (or top to bottom) order, call addSeparator() when you want a separator, and that's all..PPThe application/application.cpp example does precisely this..PPYou may use any kind of widget within a toolbar, with QToolButton and QComboBox being the two most common ones..PPEach QToolBar lives in a dock in a QMainWindow, and can optionally start a new line in its dock. Tool bars that start a new line are always positioned at the left end or top of the tool bar dock; others are placed next to the previous tool bar and word-wrapped as necessary. The main window can be resized to a smaller size than a toolbar would need to show all items. If this happens QToolbar shows a little arrow button at the right or bottom end. When clicking on that button, a popup menu is opened which shows all items of the toolbar which are outside the visible area of the mainwindow..PPUsually, a toolbar gets just the space it needs. However, with setHorizontalStretchable()/setVerticalStretchable() or setStretchableWidget() you can advise the main window to expand the toolbar to fill all available width in the specified orientation..PPThe tool bar arranges its buttons either horizontally or vertically (see setOrientation() for details). Generally, QMainWindow will set the orientation correctly for you. The toolbar emits a signal orientationChanged() each time the orientation changes, in case some child widgets need adjustments..PPTo remove all items from a toolbar, you can use the clear() method..PPSee also QToolButton, QMainWindow, Parts of Isys on Visual Design and GUI Design Handbook: Tool Bar..SH MEMBER FUNCTION DOCUMENTATION.SH "QToolBar::QToolBar ( QMainWindow * parent = 0, const char * name = 0 )"Constructs an empty tool bar in the top dock of its parent, without any label and without requiring a newline. This is mostly useless..SH "QToolBar::QToolBar ( const QString & label, QMainWindow * mainWindow, QWidget * parent, bool newLine = FALSE, const char * name = 0, WFlags f = 0 )"Constructs an empty horizontal tool bar with a parent of \fIparent\fR and managed by \fImainWindow.\fR The \fIlabel\fR and \fInewLine\fR are passed straight to QMainWindow::addToolBar(). \fIname\fR is the object name and \fIf\fR is the widget flags..PPThis is the constructor to use if you want to create torn-off toolbars, or toolbars in the status bar..SH "QToolBar::QToolBar ( const QString & label, QMainWindow * parent, QMainWindow::ToolBarDock dock = QMainWindow::Top, bool newLine = FALSE, const char * name = 0 )"Constructs an empty tool bar which is a child of \fIparent\fR and managed by \fIparent,\fR initially in \fIdock,\fR labelled \fIand\fR starting a new line in the dock if \fInewLine\fR is TRUE. \fIname\fR is the object name, as usual..SH "QToolBar::~QToolBar ()"Destructs the object and frees any allocated resources..SH "void QToolBar::addSeparator ()"Adds a separator to the end of the toolbar..SH "void QToolBar::clear ()"Clears the toolbar, deleting all childwidgets..SH "bool QToolBar::event ( QEvent * e ) \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QObject..SH "bool QToolBar::eventFilter ( QObject * obj, QEvent * e ) \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QObject..SH "void QToolBar::hide () \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "bool QToolBar::isHorizontalStretchable () const"Returns whether the toolbar is stretchable horizontally..PPA stretchable toolbar fills all available width in a toolbar dock. A non-stretchable toolbar usually gets just the space it needs..PPSee also setHorizontalStretchable(), setVerticalStretchable() and isVerticalStretchable()..SH "bool QToolBar::isVerticalStretchable () const"Returns whether the toolbar is stretchable vertically..PPA stretchable toolbar fills all available height in a toolbar dock. A non-stretchable toolbar usually gets just the space it needs..PPSee also setHorizontalStretchable(), setVerticalStretchable() and isHorizontalStretchable()..SH "QString QToolBar::label () const"Returns the label of this tool bar..PPSee also setLabel()..SH "QMainWindow * QToolBar::mainWindow ()"Returns a pointer to the QMainWindow which controls this tool bar..SH "QSize QToolBar::minimumSize () const"Reimplemented for internal reasons; the API is not affected..SH "QSize QToolBar::minimumSizeHint () const \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QToolBar::paintEvent ( QPaintEvent * ) \fC[virtual protected]\fR"Paint the handle. The Motif style is rather close to Netscape and even closer to KDE..PPReimplemented from QWidget..SH "void QToolBar::resizeEvent ( QResizeEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QToolBar::setHorizontalStretchable ( bool b )"Sets the toolbar to be horizontally stretchable if \fIb\fR is TRUE, or non-stretchable otherwise..PPA stretchable toolbar fills the available width in a toolbar dock. A non-stretchable toolbar usually gets just the space it needs..PPThe default is FALSE..PPSee also QMainWindow::setRightJustification(), isHorizontalStretchable(), setVerticalStretchable() and isVerticalStretchable()..SH "void QToolBar::setLabel ( const QString & label ) \fC[virtual]\fR"Sets the label of this tool bar to \fIlabel.\fR The label is not currently used; it will be used in a forthcoming tool bar configuration dialog..PPSee also label()..SH "void QToolBar::setStretchableWidget ( QWidget * w ) \fC[virtual]\fR"Sets \fIw\fR to be expanded if this toolbar is requested to stretch (because QMainWindow right-justifies the dock it's in or isVerticalStretchable() or isHorizontalStretchable() of this toolbar is TRUE)..PPIf you call setStretchableWidget() and the toolbar is not stretchable yet, setStretchable( ) is called..PPSee also QMainWindow::setRightJustification(), setVerticalStretchable() and setHorizontalStretchable()..SH "void QToolBar::setVerticalStretchable ( bool b )"Sets the toolbar to be vertically stretchable if \fIb\fR is TRUE, or non-stretchable otherwise..PPA stretchable toolbar fills the available height in a toolbar dock. A non-stretchable toolbar usually gets just the space it needs..PPThe default is FALSE..PPSee also QMainWindow::setRightJustification(), isVerticalStretchable(), setHorizontalStretchable() and isHorizontalStretchable()..SH "void QToolBar::show () \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QToolBar::styleChange ( QStyle & ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "SEE ALSO".BR http://doc.trolltech.com/qtoolbar.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports make our job much simpler. Thank you..PIn case of content or formattting problems with this manual page, pleasereport them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qtoolbar.3qt) and the Qtversion (2.3.10).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -