📄 qmainwindow.3qt
字号:
'\" t.TH QMainWindow 3qt "9 December 2002" "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 \- Main application window, with a menu bar, dock windows (e.g. for toolbars), and a status bar.SH SYNOPSIS\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 * w )".br.ti -1c.BI "QWidget * \fBcentralWidget\fR () const".br.ti -1c.BI "virtual void \fBsetDockEnabled\fR ( Dock dock, bool enable )".br.ti -1c.BI "bool \fBisDockEnabled\fR ( Dock dock ) const".br.ti -1c.BI "bool \fBisDockEnabled\fR ( QDockArea * area ) const".br.ti -1c.BI "virtual void \fBsetDockEnabled\fR ( QDockWindow * dw, Dock dock, bool enable )".br.ti -1c.BI "bool \fBisDockEnabled\fR ( QDockWindow * tb, Dock dock ) const".br.ti -1c.BI "bool \fBisDockEnabled\fR ( QDockWindow * dw, QDockArea * area ) const".br.ti -1c.BI "virtual void \fBaddDockWindow\fR ( QDockWindow * dockWindow, Dock edge = DockTop, bool newLine = FALSE )".br.ti -1c.BI "virtual void \fBaddDockWindow\fR ( QDockWindow * dockWindow, const QString & label, Dock edge = DockTop, bool newLine = FALSE )".br.ti -1c.BI "virtual void \fBmoveDockWindow\fR ( QDockWindow * dockWindow, Dock edge = DockTop )".br.ti -1c.BI "virtual void \fBmoveDockWindow\fR ( QDockWindow * dockWindow, Dock edge, bool nl, int index, int extraOffset = -1 )".br.ti -1c.BI "virtual void \fBremoveDockWindow\fR ( QDockWindow * dockWindow )".br.ti -1c.BI "bool \fBrightJustification\fR () const".br.ti -1c.BI "bool \fBusesBigPixmaps\fR () const".br.ti -1c.BI "bool \fBusesTextLabel\fR () const".br.ti -1c.BI "bool \fBdockWindowsMovable\fR () const".br.ti -1c.BI "bool \fBopaqueMoving\fR () const".br.ti -1c.BI "bool \fBgetLocation\fR ( QDockWindow * dw, Dock & dock, int & index, bool & nl, int & extraOffset ) const".br.ti -1c.BI "QPtrList<QDockWindow> \fBdockWindows\fR ( Dock dock ) const".br.ti -1c.BI "QPtrList<QDockWindow> \fBdockWindows\fR () const".br.ti -1c.BI "void \fBlineUpDockWindows\fR ( bool keepNewLines = FALSE )".br.ti -1c.BI "bool \fBisDockMenuEnabled\fR () const".br.ti -1c.BI "bool \fBhasDockWindow\fR ( QDockWindow * dw )".br.ti -1c.BI "void addToolBar ( QDockWindow *, Dock = DockTop, bool newLine = FALSE ) \fI(obsolete)\fR".br.ti -1c.BI "void addToolBar ( QDockWindow *, const QString & label, Dock = DockTop, bool newLine = FALSE ) \fI(obsolete)\fR".br.ti -1c.BI "void moveToolBar ( QDockWindow *, Dock = DockTop ) \fI(obsolete)\fR".br.ti -1c.BI "void moveToolBar ( QDockWindow *, Dock, bool nl, int index, int extraOffset = -1 ) \fI(obsolete)\fR".br.ti -1c.BI "void removeToolBar ( QDockWindow * ) \fI(obsolete)\fR".br.ti -1c.BI "bool toolBarsMovable () const \fI(obsolete)\fR".br.ti -1c.BI "QPtrList<QToolBar> \fBtoolBars\fR ( Dock dock ) const".br.ti -1c.BI "void lineUpToolBars ( bool keepNewLines = FALSE ) \fI(obsolete)\fR".br.ti -1c.BI "QDockArea * \fBleftDock\fR () const".br.ti -1c.BI "QDockArea * \fBrightDock\fR () const".br.ti -1c.BI "QDockArea * \fBtopDock\fR () const".br.ti -1c.BI "QDockArea * \fBbottomDock\fR () const".br.ti -1c.BI "virtual bool \fBisCustomizable\fR () const".br.ti -1c.BI "bool \fBappropriate\fR ( QDockWindow * dw ) const".br.ti -1c.BI "enum \fBDockWindows\fR { OnlyToolBars, NoToolBars, AllDockWindows }".br.ti -1c.BI "QPopupMenu * \fBcreateDockWindowMenu\fR ( DockWindows dockWindows = AllDockWindows ) const".br.in -1c.SS "Public Slots".in +1c.ti -1c.BI "virtual void \fBsetRightJustification\fR ( bool )".br.ti -1c.BI "virtual void \fBsetUsesBigPixmaps\fR ( bool )".br.ti -1c.BI "virtual void \fBsetUsesTextLabel\fR ( bool )".br.ti -1c.BI "virtual void \fBsetDockWindowsMovable\fR ( bool )".br.ti -1c.BI "virtual void \fBsetOpaqueMoving\fR ( bool )".br.ti -1c.BI "virtual void \fBsetDockMenuEnabled\fR ( bool b )".br.ti -1c.BI "virtual void \fBwhatsThis\fR ()".br.ti -1c.BI "virtual void \fBsetAppropriate\fR ( QDockWindow * dw, bool a )".br.ti -1c.BI "virtual void \fBcustomize\fR ()".br.ti -1c.BI "void setToolBarsMovable ( bool ) \fI(obsolete)\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 \fBdockWindowPositionChanged\fR ( QDockWindow * dockWindow )".br.ti -1c.BI "void toolBarPositionChanged ( QToolBar * ) \fI(obsolete)\fR".br.in -1c.SS "Properties".in +1c.ti -1c.BI "bool \fBdockWindowsMovable\fR - whether the dock windows are movable".br.ti -1c.BI "bool \fBopaqueMoving\fR - whether dock windows are moved opaquely".br.ti -1c.BI "bool \fBrightJustification\fR - whether the main window right-justifies its dock windows".br.ti -1c.BI "bool \fBusesBigPixmaps\fR - whether big pixmaps are enabled".br.ti -1c.BI "bool \fBusesTextLabel\fR - whether text labels for toolbar buttons are enabled".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual void \fBchildEvent\fR ( QChildEvent * e )".br.in -1c.SS "Protected Slots".in +1c.ti -1c.BI "virtual void \fBsetUpLayout\fR ()".br.ti -1c.BI "virtual bool \fBshowDockMenu\fR ( const QPoint & globalPos )".br.ti -1c.BI "void \fBmenuAboutToShow\fR ()".br.in -1c.SH RELATED FUNCTION DOCUMENTATION.in +1c.ti -1c.BI "QTextStream & \fBoperator<<\fR ( QTextStream & ts, const QMainWindow & mainWindow )".br.ti -1c.BI "QTextStream & \fBoperator>>\fR ( QTextStream & ts, QMainWindow & mainWindow )".br.in -1c.SH DESCRIPTIONThe QMainWindow class provides a main application window, with a menu bar, dock windows (e.g. for toolbars), and a status bar..PPMain windows are most often used to provide menus, toolbars and a status bar around a large central widget, such as a text edit, drawing canvas or QWorkspace (for MDI applications). QMainWindow is usually subclassed since this makes it easier to encapsulate the central widget, menus and toolbars as well as the window's state. Subclassing makes it possible to create the slots that are called when the user clicks menu items or toolbar buttons. You can also create main windows using Qt Designer. We'll briefly review adding menu items and toolbar buttons then describe the facilities of QMainWindow itself..PP.nf.br QMainWindow *mw = new QMainWindow;.br QTextEdit *edit = new QTextEdit( mw, "editor" );.br edit->setFocus();.br mw->setCaption( "Main Window" );.br mw->setCentralWidget( edit );.br mw->show();.br.fi.PPQMainWindows may be created in their own right as shown above. The central widget is set with setCentralWidget(). Popup menus can be added to the default menu bar, widgets can be added to the status bar, toolbars and dock windows can be added to any of the dock areas..PP.nf.br ApplicationWindow * mw = new ApplicationWindow();.br mw->setCaption( "Qt Example - Application" );.br mw->show();.fi.PPIn the extract above ApplicationWindow is a subclass of QMainWindow that we must write for ourselves; this is the usual approach to using QMainWindow. (The source for the extracts in this description are taken from application/main.cpp, application/application.cpp, action/main.cpp, and action/application.cpp ).PPWhen subclassing we add the menu items and toolbars in the subclass's constructor. If we've created a QMainWindow instance directly we can add menu items and toolbars just as easily by passing the QMainWindow instance as the parent instead of the \fIthis\fR pointer..PP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -