📄 qmainwindow.3qt
字号:
.TP\fCRight\fR - to the left of the central widget..TP\fCMinimized\fR - the toolbar is not shown - all handles of minimized toolbars are drawn in one row below the menu bar..PPOther values are also defined for future expansion..SH MEMBER FUNCTION DOCUMENTATION.SH "QMainWindow::QMainWindow ( QWidget * parent = 0, const char * name = 0, WFlags f = WType_TopLevel )"Constructs an empty main window..SH "QMainWindow::~QMainWindow ()"Destructs the object and frees any allocated resources..SH "void QMainWindow::addToolBar ( QToolBar * toolBar, ToolBarDock edge = Top, bool newLine = FALSE )"Adds \fItoolBar\fR to this the end of \fIedge\fR and makes it start a new line of tool bars if \fInl\fR is TRUE..PPIf \fItoolBar\fR is already managed by some main window, it is first removed from that window..SH "void QMainWindow::addToolBar ( QToolBar * toolBar, const QString & label, ToolBarDock edge = Top, bool newLine = FALSE )"Adds \fItoolBar\fR to this the end of \fIedge,\fR labelling it \fIlabel\fR and makes it start a new line of tool bars if \fInewLine\fR is TRUE..PPIf \fItoolBar\fR is already managed by some main window, it is first removed from that window..SH "QWidget * QMainWindow::centralWidget () const"Returns a pointer to the main child of this main widget. The main child is the big widget around which the tool bars are arranged..PPSee also setCentralWidget()..PPExamples:.(lqfd/qfd.cpp.)l.SH "void QMainWindow::childEvent ( QChildEvent * e ) \fC[virtual protected]\fR"Monitors events to ensure layout is updated..PPReimplemented from QObject..SH "void QMainWindow::endMovingToolBar ( QToolBar * toolbar ) \fC[signal]\fR"This signal is emitted if the \fItoolbar\fR has been moved by the user and he/she released the mouse button now, so he/she stopped the moving..SH "bool QMainWindow::event ( QEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QObject..SH "bool QMainWindow::eventFilter ( QObject * o, QEvent * e ) \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QObject..SH "bool QMainWindow::getLocation ( QToolBar * tb, ToolBarDock & dock, int & index, bool & nl, int & extraOffset ) const"Finds and gives back the \fIdock\fR and the \fIindex\fR there of the toolbar \fItb. dock\fR is set to the dock of the mainwindow in which \fItb\fR is and \fIindex\fR is set to the position of the toolbar in this dock. If the toolbar has a new line, \fInl\fR is set to TRUE, else to FALSE..PPThis method returns TRUE if the information could be found out, otherwise FALSE (e.g. because the toolbar \fItb\fR was not found in this mainwindow)..SH "bool QMainWindow::isDockEnabled ( ToolBarDock dock ) const"Returns TRUE if \fIdock\fR is enabled, or FALSE if it is not..PPSee also setDockEnabled()..SH "bool QMainWindow::isDockEnabled ( QToolBar * tb, ToolBarDock dock ) const"Returns TRUE if \fIdock\fR is enabled for the toolbar \fItb\fR , or FALSE if it is not..PPSee also setDockEnabled()..SH "bool QMainWindow::isDockMenuEnabled () const"Returns TRUE, if rightclicking on an empty space on a toolbar dock or rightclicking on a toolbar handle opens a popup menu which allows lining up toolbars and hiding/showing toolbars..PPSee also setDockEnabled() and lineUpToolBars()..SH "void QMainWindow::lineUpToolBars ( bool keepNewLines = FALSE )"As toolbars can be freely moved inside docks, it's possible to line them up nicely with this method to get rid of all the unused space. If \fIkeepNewLines\fR is TRUE, all toolbars stay in the line in which they are, else they are packed together as compact as possible..PPThe method only works if movable() returns TRUE..SH "QMenuBar * QMainWindow::menuBar () const"Returns the menu bar for this window. If there isn't any, menuBar() creates an empty menu bar on the fly..PPSee also statusBar()..SH "QSize QMainWindow::minimumSizeHint () const \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QMainWindow::moveToolBar ( QToolBar * toolBar, ToolBarDock edge = Top )"Moves \fItoolBar\fR to this the end of \fIedge.\fR.PPIf \fItoolBar\fR is already managed by some main window, it is moved from that window to this..SH "void QMainWindow::moveToolBar ( QToolBar * toolBar, ToolBarDock edge, bool nl, int index, int extraOffset = -1 )"Moves \fItoolBar\fR to the position \fIindex\fR of \fIedge.\fR.PPIf \fItoolBar\fR is already managed by some main window, it is moved from that window to this..SH "bool QMainWindow::opaqueMoving () const"Returns whether the toolbars of the mainwindow can be moved opaque or transparent..PPSee also setOpaqueMoving()..SH "void QMainWindow::paintEvent ( QPaintEvent * ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QMainWindow::pixmapSizeChanged ( bool ) \fC[signal]\fR"This signal is called whenever the setUsesBigPixmaps() is called with a value which is different from the current setting. All relevant widgets must connect to this signal..SH "void QMainWindow::removeToolBar ( QToolBar * toolBar )"Removes \fItoolBar\fR from this main window's docking area, if \fItoolBar\fR is non-null and known by this main window..SH "void QMainWindow::resizeEvent ( QResizeEvent * ) \fC[virtual protected]\fR"Monitors events to ensure layout is updated..PPReimplemented from QWidget..SH "bool QMainWindow::rightJustification () const"Returns TRUE if this main windows right-justifies its toolbars, and FALSE if it uses a ragged right edge..PPThe default is to use a ragged right edge..PP("Right edge" sometimes means "bottom edge".).PPSee also setRightJustification()..SH "void QMainWindow::setCentralWidget ( QWidget * w ) \fC[virtual]\fR"Sets the central widget for this window to \fIw.\fR The central widget is the one around which the toolbars etc. are arranged..SH "void QMainWindow::setDockEnabled ( ToolBarDock dock, bool enable )"Sets \fIdock\fR to be available if \fIenable\fR is TRUE, and not available if \fIenable\fR is FALSE..PPThe user can drag a toolbar to any enabled dock..SH "void QMainWindow::setDockEnabled ( QToolBar * tb, ToolBarDock dock, bool enable )"Sets \fIdock\fR to be available for the toolbar \fItb\fR if \fIenable\fR is TRUE, and not available if \fIenable\fR is FALSE..PPThe user can drag the toolbar to any enabled dock..SH "void QMainWindow::setDockMenuEnabled ( bool b ) \fC[slot]\fR"When passing TRUE for \fIb\fR here, rightclicking on an empty space on a toolbar dock or rightclicking on a toolbar handle opens a popup menu which allows lining up toolbars and hiding/showing toolbars..PPSee also lineUpToolBars() and isDockMenuEnabled()..SH "void QMainWindow::setOpaqueMoving ( bool b ) \fC[slot]\fR"If you set \fIb\fR to TRUE, the use can move the toolbars opaque, otherwise this is done transparent. This setting makes only sense, if toolBarsMovable() is set to TRUE..PPSee also setToolbarsMovable()..SH "void QMainWindow::setRightJustification ( bool enable ) \fC[virtual slot]\fR"Sets this main window to right-justifies its toolbars if \fIenable\fR is TRUE. If enable is FALSE, only stretchable toolbars are expanded, while non-stretchable toolbars get just the space they need. Given that most toolbars are not stretchable, this usually results in a ragged right edge..PPThe default is FALSE..PPSee also rightJustification(), QToolBar::setVerticalStretchable() and QToolBar::setHorizontalStretchable()..SH "void QMainWindow::setToolBarsMovable ( bool enable ) \fC[slot]\fR"Sets the toolbars to be movable if \fIenable\fR is TRUE, or static otherwise..PPMovable toolbars can be dragged around between and within the different toolbar docks by the user. By default toolbars are moved transparent, but this setting can be changed by setOpaqueMoving()..PPThe default is TRUE..PPSee also setDockEnabled(), toolBarsMovable() and setOpaqueMoving()..SH "void QMainWindow::setUpLayout () \fC[virtual protected slot]\fR"Sets up the geometry management of this window. Called automatically when needed, so you should never need to call this..SH "void QMainWindow::setUsesBigPixmaps ( bool enable ) \fC[virtual slot]\fR"Sets tool buttons in this main windows to use big pixmaps if \fIenable\fR is TRUE, and small pixmaps if \fIenable\fR is FALSE..PPThe default is FALSE..PPTool buttons and other interested widgets are responsible for reading the correct state on startup, and for connecting to this widget's pixmapSizeChanged() signal..PPSee also QToolButton::setUsesBigPixmap()..SH "void QMainWindow::setUsesTextLabel ( bool enable ) \fC[slot]\fR"Sets tool buttons in this main windows to use text labels if \fIenable\fR is TRUE, and no text labels otherwise..PPThe default is FALSE..PPTool buttons and other interested widgets are responsible for reading the correct state on startup, and for connecting to this widget's usesTextLabelChanged() signal..PPSee also QToolButton::setUsesTextLabel()..SH "void QMainWindow::show () \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPExamples:.(laction/main.cpp themes/main.cpp mainlyQt/editor.cpp application/main.cpp helpviewer/main.cpp i18n/main.cpp fileiconview/main.cpp scribble/main.cpp qfd/qfd.cpp addressbook/main.cpp mdi/main.cpp.)l.PPReimplemented from QWidget..SH "QSize QMainWindow::sizeHint () const \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QMainWindow::startMovingToolBar ( QToolBar * toolbar ) \fC[signal]\fR"This signal is emitted when the \fItoolbar\fR starts moving because the user started dragging it..SH "QStatusBar * QMainWindow::statusBar () const"Returns the status bar for this window. If there isn't any, statusBar() creates an empty status bar on the fly, and if necessary a tool tip group too..PPSee also menuBar() and toolTipGroup()..PPExamples:.(lqfd/qfd.cpp.)l.SH "void QMainWindow::styleChange ( QStyle & old ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QMainWindow::toolBarPositionChanged ( QToolBar * toolbar ) \fC[signal]\fR"This signal is emitted when the \fItoolbar\fR has changed its position. This means it has been moved to another dock or inside the dock..PPSee also getLocation()..SH "bool QMainWindow::toolBarsMovable () const"Returns whether or not the toolbars of this main window are movable..PPSee also setToolBarsMovable()..SH "QToolTipGroup * QMainWindow::toolTipGroup () const"Returns the tool tip group for this window. If there isn't any, toolTipGroup() creates an empty tool tip group on the fly..PPSee also menuBar() and statusBar()..SH "bool QMainWindow::usesBigPixmaps () const"Returns the state last set by setUsesBigPixmaps(). The initial state is FALSE..PPSee also setUsesBigPixmaps();..SH "bool QMainWindow::usesTextLabel () const"Returns the state last set by setUsesTextLabel(). The initial state is FALSE..PPSee also setUsesTextLabel();..SH "void QMainWindow::usesTextLabelChanged ( bool ) \fC[signal]\fR"This signal is called whenever the setUsesTextLabel() is called with a value which is different from the current setting. All relevant widgets must connect to this signal..SH "void QMainWindow::whatsThis () \fC[slot]\fR"Enters What's This? question mode and returns immediately..PPThis is the same as QWhatsThis::enterWhatsThisMode(), but as a slot of of a main window object. This way it can be easily used for popup menus as in the code fragment:.PP.nf.br QPopupMenu * help = new QPopupMenu( this );.br help->insertItem( "What's &This", this , SLOT(whatsThis()), SHIFT+Key_F1);.fi.PPSee also QWhatsThis::enterWhatsThisMode()..SH "SEE ALSO".BR http://doc.trolltech.com/qmainwindow.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 (qmainwindow.3qt) and the Qtversion (2.3.2).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -