<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # QMenuBar Class Reference ## [[QtGui](index.htm) module] 該QMenuBar類提供了一個水平菜單欄。[More...](#details) 繼承[QWidget](qwidget.html)。 ### Methods * `__init__ (self, QWidget?parent?=?None)` * `QAction actionAt (self, QPoint)` * `actionEvent (self, QActionEvent)` * `QRect actionGeometry (self, QAction)` * `QAction activeAction (self)` * `addAction (self, QAction?action)` * `QAction addAction (self, QString?text)` * `QAction addAction (self, QString?text, QObject?receiver, SLOT()SLOT()?member)` * `QAction addAction (self, QString?text, callable?receiver)` * `QAction addMenu (self, QMenu?menu)` * `QMenu addMenu (self, QString?title)` * `QMenu addMenu (self, QIcon?icon, QString?title)` * `QAction addSeparator (self)` * `changeEvent (self, QEvent)` * `clear (self)` * `QWidget cornerWidget (self, Qt.Corner?corner?=?Qt.TopRightCorner)` * `bool event (self, QEvent)` * `bool eventFilter (self, QObject, QEvent)` * `focusInEvent (self, QFocusEvent)` * `focusOutEvent (self, QFocusEvent)` * `int heightForWidth (self, int)` * `initStyleOption (self, QStyleOptionMenuItem?option, QAction?action)` * `QAction insertMenu (self, QAction?before, QMenu?menu)` * `QAction insertSeparator (self, QAction?before)` * `bool isDefaultUp (self)` * `bool isNativeMenuBar (self)` * `keyPressEvent (self, QKeyEvent)` * `leaveEvent (self, QEvent)` * `QSize minimumSizeHint (self)` * `mouseMoveEvent (self, QMouseEvent)` * `mousePressEvent (self, QMouseEvent)` * `mouseReleaseEvent (self, QMouseEvent)` * `paintEvent (self, QPaintEvent)` * `resizeEvent (self, QResizeEvent)` * `setActiveAction (self, QAction?action)` * `setCornerWidget (self, QWidget?widget, Qt.Corner?corner?=?Qt.TopRightCorner)` * `setDefaultUp (self, bool)` * `setNativeMenuBar (self, bool?nativeMenuBar)` * `setVisible (self, bool?visible)` * `QSize sizeHint (self)` * `timerEvent (self, QTimerEvent)` ### Qt Signals * `void hovered (QAction *)` * `void triggered (QAction *)` * * * ## Detailed Description 該QMenuBar類提供了一個水平菜單欄。 菜單欄包含下拉菜單項列表中。您添加菜單項[addMenu](qmenubar.html#addMenu)( ) 。例如, asuming那`menubar`是一個指針,指向一個QMenuBar和`fileMenu`是一個指針,指向[QMenu](qmenu.html),下面的語句插入菜單進入菜單欄: ``` menubar->addMenu(fileMenu); ``` 在菜單項文本的符號設置Alt + F鍵作為此菜單中的快捷方式。 (您可以使用“\u0026\u0026”獲得在菜單欄中一個真正的符號。 ) 有沒有必要制定出一個菜單欄。它會自動將其自身的幾何形狀的父控件的頂部,并適當地改變它,每當父調整大小。 ### Usage 在大多數的主窗口風格的應用程序,你會使用[menuBar()](qmainwindow.html#menuBar)在所提供的功能[QMainWindow](qmainwindow.html),加入[QMenu](qmenu.html)s到菜單欄和添加[QAction](qaction.html)s到彈出式菜單。 例子(從[Menus](index.htm)為例): ``` fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->addAction(newAct); ``` 菜單項可以與被刪除[removeAction](qwidget.html#removeAction)( ) 。 窗口小部件可以使用的情況下被添加到菜單[QWidgetAction](qwidgetaction.html)類來保存它們。這些動作可以被插入到在通常的方式菜單,見[QMenu](qmenu.html)文檔了解更多信息。 ### Platform Dependent Look and Feel 不同的平臺上有菜單欄的外觀和行為的不同要求,當用戶與其互動。舉例來說, Windows系統通常配置,使得帶下劃線的字符助記符,表明在菜單欄項目的快捷鍵只顯示當**Alt**鍵被按下。 | ![A menu bar shown in the](https://img.kancloud.cn/68/dd/68ddf2da6e013d9ad7a411c861be8715_196x41.png) Plastique widget style. | The [Plastique widget style](index.htm), like most other styles, handles the **Help** menu in the same way as it handles any other menu. | | ![A menu bar shown in the](https://img.kancloud.cn/ee/e3/eee3ebec0f3f39a04535ba46111d1796_291x41.png) Motif widget style. | The [Motif widget style](index.htm) treats **Help** menus in a special way, placing them at right-hand end of the menu bar. | ### QMenuBar on Mac OS X QMenuBar在Mac OS X是一個包裝使用系統范圍的菜單欄。如果您有多個菜單欄在一個對話框中的最外層的菜單欄(通常里面一個小部件與部件標志[Qt.Window](qt.html#WindowType-enum))將用于全系統的菜單欄。 Qt的用于Mac OS X還提供了一個菜單欄合并功能,使QMenuBar更符合公認的Mac OS X的菜單欄布局。該合并功能是基于字符串匹配的標題[QMenu](qmenu.html)條目。這些字符串翻譯(使用[QObject.tr](qobject.html#tr)())中的“ QMenuBar ”的上下文。如果項目被移動及其插槽仍然會火,就好像它是在原來的地方。下表概述了字符串尋找和那里的條目,如果匹配放置: | String matches | Placement | Notes | | --- | --- | --- | | about.* | Application Menu &#124; About &lt;application name&gt; | The application name is fetched from the `Info.plist` file (see note below). If this entry is not found no About item will appear in the Application Menu. | | config, options, setup, settings or preferences | Application Menu &#124; Preferences | If this entry is not found the Settings item will be disabled | | quit or exit | Application Menu &#124; Quit &lt;application name&gt; | If this entry is not found a default Quit item will be created to call [QApplication.quit](qcoreapplication.html#quit)() | 您可以通過使用復蓋此行為[QAction.menuRole](qaction.html#menuRole-prop)()屬性。 如果你想在一臺Mac應用程序的所有窗口共享一個菜單欄,你必須創建一個沒有父項的菜單欄。創建一個父少菜單欄是這樣的: ``` QMenuBar *menuBar = new QMenuBar(0); ``` **Note:** Do _not_通話[QMainWindow.menuBar](qmainwindow.html#menuBar)()來創建共享菜單欄,因為該菜單欄將有[QMainWindow](qmainwindow.html)作為其母公司。該菜單欄只會顯示父[QMainWindow](qmainwindow.html)。 **Note:**從設置的值獲得用于在菜單欄的應用程序名稱的文本`Info.plist`文件中的應用程序的包。看[Deploying an Application on Mac OS X](index.htm)了解更多信息。 ### QMenuBar on Windows CE QMenuBar在Windows CE是一個包裝使用系統范圍的菜單欄,類似于蘋果。此功能被激活Windows Mobile和集成QMenuBar與本地軟鍵。左軟鍵可以被控制[QMenuBar.setDefaultAction](qmenubar.html#setDefaultAction)()和右軟鍵,可用于訪問菜單欄。 該[hovered](qmenubar.html#hovered)( )信號不支持本機菜單集成。此外,它是不可能在Windows Mobile上的本機菜單顯示一個圖標。 ### Examples 該[Menus](index.htm)示例顯示了如何使用QMenuBar和[QMenu](qmenu.html)。其他[main window application examples](index.htm)還提供了使用這些類的菜單。 * * * ## Method Documentation ``` QMenuBar.__init__ (self, QWidget?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個父菜單欄_parent_。 ``` QAction QMenuBar.actionAt (self, QPoint) ``` [](qaction.html) [返回](qaction.html)[QAction](qaction.html)在_pt_。返回0,如果有一個在無動作_pt_或者,如果位置有一個隔板。 **See also** [addAction](qmenubar.html#addAction)()和[addSeparator](qmenubar.html#addSeparator)( ) 。 ``` QMenuBar.actionEvent (self, QActionEvent) ``` 從重新實現[QWidget.actionEvent](qwidget.html#actionEvent)( ) 。 ``` QRect QMenuBar.actionGeometry (self, QAction) ``` [](qrect.html) [返回行動的幾何形狀_act_作為](qrect.html)[QRect](qrect.html)。 **See also** [actionAt](qmenubar.html#actionAt)( ) 。 ``` QAction QMenuBar.activeAction (self) ``` [](qaction.html) [返回](qaction.html)[QAction](qaction.html)這是當前突出顯示。如果不采取行動是當前選定的空指針將被返回。 **See also** [setActiveAction](qmenubar.html#setActiveAction)( ) 。 ``` QMenuBar.addAction (self, QAction?action) ``` 這是一個重載函數。 用這種便利函數創建一個新動作_text_。該函數將新創建的行動,行動的菜單的列表中,并返回它。 **See also** [QWidget.addAction](qwidget.html#addAction)()和[QWidget.actions](qwidget.html#actions)( ) 。 ``` QAction QMenuBar.addAction (self, QString?text) ``` [ 這是一個重載函數。 ](qaction.html) [用給定的這個便利函數創建一個新動作_text_。動作的](qaction.html)[triggered](qmenubar.html#triggered)()信號被連接到_receiver_的_member_插槽。該函數將新創建的行動,行動的菜單的列表并返回它。 **See also** [QWidget.addAction](qwidget.html#addAction)()和[QWidget.actions](qwidget.html#actions)( ) 。 ``` QAction QMenuBar.addAction (self, QString?text, QObject?receiver, SLOT()SLOT()?member) ``` [ 這是一個重載函數。 追加行動_action_于訴訟的菜單欄的列表。 ](qaction.html) [**See also**](qaction.html) [QMenu.addAction](qmenu.html#addAction)( )[QWidget.addAction](qwidget.html#addAction)()和[QWidget.actions](qwidget.html#actions)( ) 。 ``` QAction QMenuBar.addAction (self, QString?text, callable?receiver) ``` [](qaction.html) ``` QAction QMenuBar.addMenu (self, QMenu?menu) ``` [ 追加可_menu_菜單欄。返回菜單的menuAction ( ) 。 ](qaction.html) [**Note:**返回](qaction.html)[QAction](qaction.html)對象可以用來隱藏相應的菜單。 **See also** [QWidget.addAction](qwidget.html#addAction)()和[QMenu.menuAction](qmenu.html#menuAction)( ) 。 ``` QMenu QMenuBar.addMenu (self, QString?title) ``` [](qmenu.html) [添加一個新的](qmenu.html)[QMenu](qmenu.html)同_title_菜單欄。菜單欄取菜單的所有權。返回新菜單。 **See also** [QWidget.addAction](qwidget.html#addAction)()和[QMenu.menuAction](qmenu.html#menuAction)( ) 。 ``` QMenu QMenuBar.addMenu (self, QIcon?icon, QString?title) ``` [](qmenu.html) [添加一個新的](qmenu.html)[QMenu](qmenu.html)同_icon_和_title_菜單欄。菜單欄取菜單的所有權。返回新菜單。 **See also** [QWidget.addAction](qwidget.html#addAction)()和[QMenu.menuAction](qmenu.html#menuAction)( ) 。 ``` QAction QMenuBar.addSeparator (self) ``` [ 附加一個分隔符的菜單。 ``` QMenuBar.changeEvent (self, QEvent) ``` ](qaction.html) [從重新實現](qaction.html)[QWidget.changeEvent](qwidget.html#changeEvent)( ) 。 ``` QMenuBar.clear (self) ``` 刪除菜單欄的所有動作。 **Note:**在Mac OS X中,已合并到系統菜單欄的菜單項由該函數不會被刪除。處理這一個方法是刪除多馀的動作自己。您可以設置[menu role](qaction.html#MenuRole-enum)在不同的菜單,讓你提前知道哪個菜單項都被合并,哪些沒有。然后決定如何重新創建或刪除自己。 **See also** [removeAction](qwidget.html#removeAction)( ) 。 ``` QWidget QMenuBar.cornerWidget (self, Qt.Corner?corner?=?Qt.TopRightCorner) ``` [ 返回該插件上的第一個或最后一個菜單項的右邊的左邊,這取決于_corner_。 ](qwidget.html) [**Note:**使用一個角落里比其他](qwidget.html)[Qt.TopRightCorner](qt.html#Corner-enum) or [Qt.TopLeftCorner](qt.html#Corner-enum)將導致警告。 **See also** [setCornerWidget](qmenubar.html#setCornerWidget)( ) 。 ``` bool QMenuBar.event (self, QEvent) ``` 從重新實現[QObject.event](qobject.html#event)( ) 。 ``` bool QMenuBar.eventFilter (self, QObject, QEvent) ``` 從重新實現[QObject.eventFilter](qobject.html#eventFilter)( ) 。 ``` QMenuBar.focusInEvent (self, QFocusEvent) ``` 從重新實現[QWidget.focusInEvent](qwidget.html#focusInEvent)( ) 。 ``` QMenuBar.focusOutEvent (self, QFocusEvent) ``` 從重新實現[QWidget.focusOutEvent](qwidget.html#focusOutEvent)( ) 。 ``` int QMenuBar.heightForWidth (self, int) ``` 從重新實現[QWidget.heightForWidth](qwidget.html#heightForWidth)( ) 。 ``` QMenuBar.initStyleOption (self, QStyleOptionMenuItem?option, QAction?action) ``` 初始化_option_從菜單欄和信息的價值_action_。當他們需要一個這種方法是有用的子類[QStyleOptionMenuItem](qstyleoptionmenuitem.html),但不希望在所有的信息填寫自己。 **See also** [QStyleOption.initFrom](qstyleoption.html#initFrom)()和[QMenu.initStyleOption](qmenu.html#initStyleOption)( ) 。 ``` QAction QMenuBar.insertMenu (self, QAction?before, QMenu?menu) ``` [ 這個方便的功能插件_menu_行動之前,_before_并返回菜單menuAction ( ) 。 ](qaction.html) [**See also**](qaction.html) [QWidget.insertAction](qwidget.html#insertAction)()和[addMenu](qmenubar.html#addMenu)( ) 。 ``` QAction QMenuBar.insertSeparator (self, QAction?before) ``` [](qaction.html) [這個便利函數創建一個新的分隔作用,即一個行動](qaction.html)[QAction.isSeparator](qaction.html#isSeparator)( )返回True 。該函數插入新創建的行動變成行動之前的行動為此菜單欄的列表_before_并返回它。 **See also** [QWidget.insertAction](qwidget.html#insertAction)()和[addSeparator](qmenubar.html#addSeparator)( ) 。 ``` bool QMenuBar.isDefaultUp (self) ``` ``` bool QMenuBar.isNativeMenuBar (self) ``` ``` QMenuBar.keyPressEvent (self, QKeyEvent) ``` 從重新實現[QWidget.keyPressEvent](qwidget.html#keyPressEvent)( ) 。 ``` QMenuBar.leaveEvent (self, QEvent) ``` 從重新實現[QWidget.leaveEvent](qwidget.html#leaveEvent)( ) 。 ``` QSize QMenuBar.minimumSizeHint (self) ``` [](qsize.html) [從重新實現](qsize.html)[QWidget.minimumSizeHint](qwidget.html#minimumSizeHint-prop)( ) 。 ``` QMenuBar.mouseMoveEvent (self, QMouseEvent) ``` 從重新實現[QWidget.mouseMoveEvent](qwidget.html#mouseMoveEvent)( ) 。 ``` QMenuBar.mousePressEvent (self, QMouseEvent) ``` 從重新實現[QWidget.mousePressEvent](qwidget.html#mousePressEvent)( ) 。 ``` QMenuBar.mouseReleaseEvent (self, QMouseEvent) ``` 從重新實現[QWidget.mouseReleaseEvent](qwidget.html#mouseReleaseEvent)( ) 。 ``` QMenuBar.paintEvent (self, QPaintEvent) ``` 從重新實現[QWidget.paintEvent](qwidget.html#paintEvent)( ) 。 ``` QMenuBar.resizeEvent (self, QResizeEvent) ``` 從重新實現[QWidget.resizeEvent](qwidget.html#resizeEvent)( ) 。 ``` QMenuBar.setActiveAction (self, QAction?action) ``` 設置當前突出顯示的動作_act_。 這個函數是Qt 4.1中引入。 **See also** [activeAction](qmenubar.html#activeAction)( ) 。 ``` QMenuBar.setCornerWidget (self, QWidget?widget, Qt.Corner?corner?=?Qt.TopRightCorner) ``` 該_widget_說法有它的所有權轉移給Qt的。 這臺給定的_widget_直接顯示在第一菜單項的左側,或在最后的菜單項的右側,這取決于_corner_。 在菜單欄佔用的所有權_widget_,重定父級成的菜單欄。然而,如果_corner_已經包含了一個小工具,這個以前的部件將不再進行管理,并仍將是菜單欄的可見子。 **Note:**使用一個角落里比其他[Qt.TopRightCorner](qt.html#Corner-enum) or [Qt.TopLeftCorner](qt.html#Corner-enum)將導致警告。 **See also** [cornerWidget](qmenubar.html#cornerWidget)( ) 。 ``` QMenuBar.setDefaultUp (self, bool) ``` ``` QMenuBar.setNativeMenuBar (self, bool?nativeMenuBar) ``` ``` QMenuBar.setVisible (self, bool?visible) ``` 從重新實現[QWidget.setVisible](qwidget.html#visible-prop)( ) 。 ``` QSize QMenuBar.sizeHint (self) ``` [](qsize.html) [從重新實現](qsize.html)[QWidget.sizeHint](qwidget.html#sizeHint-prop)( ) 。 ``` QMenuBar.timerEvent (self, QTimerEvent) ``` 從重新實現[QObject.timerEvent](qobject.html#timerEvent)( ) 。 * * * ## Qt Signal Documentation ``` void hovered (QAction *) ``` 這是該信號的默認超載。 當一個菜單操作高亮顯示這個信號被發射;_action_是導致事件要發送的動作。 通常這是用來更新狀態信息。 **See also** [triggered](qmenubar.html#triggered)()和[QAction.hovered](qaction.html#hovered)( ) 。 ``` void triggered (QAction *) ``` 這是該信號的默認超載。 當屬于該菜單欄的菜單中選擇操作被觸發的鼠標點擊一個結果,這個信號被發射;_action_是導致該信號被發射的操作。 **Note:** [QMenuBar](qmenubar.html)必須有所有權[QMenu](qmenu.html)為了這個信號來工作。 通常情況下,你使用每個菜單操作連接到一個單一的插槽[QAction.triggered](qaction.html#triggered)( ) ,但有時你會想幾個項目連接到一個單一的插槽(通常,如果用戶從一個數組中選擇) 。這個信號是在這樣的情況下是有用的。 **See also** [hovered](qmenubar.html#hovered)()和[QAction.triggered](qaction.html#triggered)( ) 。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看