📄 qmainwindow.3qt
字号:
'\" t.TH QMainWindow 3qt "17 July 2003" "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 NAMEQMainWindow \- Typical application window, with a menu bar, some tool bars and a status bar.br.PP\fC#include <qmainwindow.h>\fR.PPInherits QWidget..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQMainWindow\fR ( QWidget * " "parent" " = 0, const char * " "name" " = 0, WFlags " "f" " = WType_TopLevel ) ".br.ti -1c.BI "\fB~QMainWindow\fR () ".br.ti -1c.BI "QMenuBar* \fBmenuBar\fR () const".br.ti -1c.BI "QStatusBar* \fBstatusBar\fR () const".br.ti -1c.BI "QToolTipGroup* \fBtoolTipGroup\fR () const".br.ti -1c.BI "virtual void \fBsetCentralWidget\fR ( QWidget * ) ".br.ti -1c.BI "QWidget* \fBcentralWidget\fR () const".br.ti -1c.BI "enum \fBToolBarDock\fR { Unmanaged, TornOff, Top, Bottom, Right, Left, Minimized }".br.ti -1c.BI "virtual void \fBsetDockEnabled\fR ( ToolBarDock " "dock" ", bool enable ) ".br.ti -1c.BI "bool \fBisDockEnabled\fR ( ToolBarDock dock ) const".br.ti -1c.BI "void \fBsetDockEnabled\fR ( QToolBar * " "tb" ", ToolBarDock " "dock" ", bool enable ) ".br.ti -1c.BI "bool \fBisDockEnabled\fR ( QToolBar * " "tb" ", ToolBarDock dock ) const".br.ti -1c.BI "void \fBaddToolBar\fR ( QToolBar *, ToolBarDock = Top, bool " "newLine" " = FALSE ) ".br.ti -1c.BI "void \fBaddToolBar\fR ( QToolBar *, const QString & " "label" ", ToolBarDock = Top, bool " "newLine" " = FALSE ) ".br.ti -1c.BI "void \fBmoveToolBar\fR ( QToolBar *, ToolBarDock = Top ) ".br.ti -1c.BI "void \fBmoveToolBar\fR ( QToolBar *, ToolBarDock, bool " "nl" ", int " "index" ", int " "extraOffset" " = -1 ) ".br.ti -1c.BI "void \fBremoveToolBar\fR ( QToolBar * ) ".br.ti -1c.BI "bool \fBusesBigPixmaps\fR () const".br.ti -1c.BI "bool \fBusesTextLabel\fR () const".br.ti -1c.BI "bool \fBrightJustification\fR () const".br.ti -1c.BI "bool \fBtoolBarsMovable\fR () const".br.ti -1c.BI "bool \fBopaqueMoving\fR () const".br.ti -1c.BI "bool \fBgetLocation\fR ( QToolBar * " "tb" ", ToolBarDock & " "dock" ", int & " "index" ", bool & " "nl" ", int & extraOffset ) const".br.ti -1c.BI "void \fBlineUpToolBars\fR ( bool " "keepNewLines" " = FALSE ) ".br.ti -1c.BI "bool \fBisDockMenuEnabled\fR () const".br.in -1c.SS "Public Slots".in +1c.ti -1c.BI "virtual void \fBsetRightJustification\fR ( bool ) ".br.ti -1c.BI "void \fBsetOpaqueMoving\fR ( bool ) ".br.ti -1c.BI "void \fBsetToolBarsMovable\fR ( bool ) ".br.ti -1c.BI "void \fBsetDockMenuEnabled\fR ( bool ) ".br.ti -1c.BI "virtual void \fBsetUsesBigPixmaps\fR ( bool ) ".br.ti -1c.BI "void \fBsetUsesTextLabel\fR ( bool ) ".br.ti -1c.BI "void \fBwhatsThis\fR () ".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBpixmapSizeChanged\fR ( bool ) ".br.ti -1c.BI "void \fBusesTextLabelChanged\fR ( bool ) ".br.ti -1c.BI "void \fBstartMovingToolBar\fR ( QToolBar * ) ".br.ti -1c.BI "void \fBendMovingToolBar\fR ( QToolBar * ) ".br.ti -1c.BI "void \fBtoolBarPositionChanged\fR ( QToolBar * ) ".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual void \fBresizeEvent\fR ( QResizeEvent * ) ".br.ti -1c.BI "virtual void \fBchildEvent\fR ( QChildEvent * ) ".br.in -1c.SS "Protected Slots".in +1c.ti -1c.BI "virtual void \fBsetUpLayout\fR () ".br.in -1c.SS "Properties".nf.TSl l l l l- - - - -l l l l l.Type Name READ WRITE Optionsbool rightJustification rightJustification setRightJustificationbool usesBigPixmaps usesBigPixmaps setUsesBigPixmapsbool usesTextLabel usesTextLabel setUsesTextLabelbool toolBarsMovable toolBarsMovable setToolBarsMovablebool opaqueMoving opaqueMoving setOpaqueMoving.TE.fi.SH DESCRIPTIONThe QMainWindow class provides a typical application window, with a menu bar, some tool bars and a status bar..PPIn addition, you need the large central widget, which you supply and tell QMainWindow about using setCentralWidget(), and perhaps a few tool bars, which you can add using addToolBar()..PPThe central widget is not touched by QMainWindow. QMainWindow manages its geometry, and that is all. For example, the application/application.cpp example (an editor) sets a QMultiLineEdit to be the central widget..PPQMainWindow automatically detects the creation of a menu bar or status bar if you specify the QMainWindow as parent, or you can use the provided menuBar() and statusBar() functions. menuBar() and statusBar() create a suitable widget if one doesn't exist, and updates the window's layout to make space..PPQMainWindow also provides a QToolTipGroup connected to the status bar. toolTipGroup() provides access to the QToolTipGroup, but there is no way to set the tool tip group..PPThe QMainWindow allows by default toolbars in all docking areas. You can use setDockEnabled() to enable and disable docking areas for toolbars. Currently, only \fCTop, Left, Right, Bottom\fR and \fCMinimized\fR are meaningful..PPSeveral functions let you change the appearance of a QMainWindow globally: .TPsetRightJustification() determines whether QMainWindow should ensure that the toolbars fill the available space (see also QToolBar::setHorizontalStretchable() and QToolBar::setVerticalStretchable()),.TPsetUsesBigPixmaps() determines whether QToolButton (and other classes) should draw small or large pixmaps (see QIconSet for more about that),.TPsetUsesTextLabel() determines whether the toolbar buttons (and other classes), should display a textlabel in addition to pixmaps (see QToolButton for more about that)..PPToolbars can be dragged by the user into each enabled docking area and inside each docking area to change the order of the toolbars there. This feature can be enabled and disabled using setToolBarsMovable(). By default this feature is enabled. If the \fCMinimized\fR dock is enabled the user can hide(minimize)/show(restore) a toolbar with a click on the toolbar handle. The handles of all minimized toolbars are drawn below the menu bar in one row, and if the user moves the mouse cursor onto such a handle, the label of the toolbar is displayed in a tool tip (see QToolBar::label()). So if you enable the Minimized dock, you should specify a meaningful label for each toolbar..PPNormally toolbars are moved transparently (this means while the user drags one, a rectangle is drawn on the screen). With setOpaqueMoving() it's possible to switch between opaque and transparent moving of toolbars..PPThe main window's menubar is static (on the top) by default. If you want a movable menubar, create a QMenuBar as stretchable widget inside its own movable toolbar and restrict this toolbar to only live within the Top or Bottom dock:.PP.nf.br QToolBar *tb = new QToolBar( this );.br addToolBar( tb, tr( "Menubar" ), Top, FALSE );.br QMenuBar *mb = new QMenuBar( tb );.br mb->setFrameStyle( QFrame::NoFrame );.br tb->setStretchableWidget( mb );.br setDockEnabled( tb, Left, FALSE );.br setDockEnabled( tb, Right, FALSE );.fi.PPAn application with multiple toolbars can choose to save the current toolbar layout in order to restore it in the next session. To do so, use getLocation() on each toolbar, store the data and restore the layout using moveToolBar() on each toolbar again. When restoring, ensure to move the toolbars in exactly the same order in which you got the information..PPFor multi-document interfaces (MDI), use a QWorkspace as central widget..PP.ce 1.B "[Image Omitted]".PP.ce 1.B "[Image Omitted]".PPSee also QToolBar, QStatusBar, QMenuBar, QToolTipGroup and QDialog..PPExamples:.(lmainlyQt/editor.cpp.)l.SS "Member Type Documentation".SH "QMainWindow::ToolBarDock"Each toolbar can be in one of the following positions:.TP\fCTop\fR - above the central widget, below the menubar..TP\fCBottom\fR - below the central widget, above the status bar..TP\fCLeft\fR - to the left of the central widget.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -