<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # QIcon Class Reference ## [[QtGui](index.htm) module] 該QIcon則類提供了在不同的模式和狀態可縮放圖標。[More...](#details) ### Types * `enum Mode { Normal, Disabled, Active, Selected }` * `enum State { On, Off }` ### Methods * `__init__ (self)` * `__init__ (self, QPixmap?pixmap)` * `__init__ (self, QIcon?other)` * `__init__ (self, QString?fileName)` * `__init__ (self, QIconEngine?engine)` * `__init__ (self, QIconEngineV2?engine)` * `__init__ (self, QVariant?variant)` * `QSize actualSize (self, QSize?size, Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off)` * `addFile (self, QString?fileName, QSize?size?=?QSize(), Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off)` * `addPixmap (self, QPixmap?pixmap, Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off)` * `list-of-QSize availableSizes (self, Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off)` * `int cacheKey (self)` * `bool isDetached (self)` * `bool isNull (self)` * `QString name (self)` * `paint (self, QPainter?painter, QRect?rect, Qt.Alignment?alignment?=?Qt.AlignCenter, Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off)` * `paint (self, QPainter?painter, int?x, int?y, int?w, int?h, Qt.Alignment?alignment?=?Qt.AlignCenter, Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off)` * `QPixmap pixmap (self, QSize?size, Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off)` * `QPixmap pixmap (self, int?w, int?h, Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off)` * `QPixmap pixmap (self, int?extent, Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off)` * `int serialNumber (self)` * `swap (self, QIcon?other)` ### Static Methods * `QIcon fromTheme (QString?name, QIcon?fallback?=?QIcon())` * `bool hasThemeIcon (QString?name)` * `setThemeName (QString?path)` * `setThemeSearchPaths (QStringList?searchpath)` * `QString themeName ()` * `QStringList themeSearchPaths ()` * * * ## Detailed Description 該QIcon則類提供了在不同的模式和狀態可縮放圖標。 一個QIcon則可以生成一組像素圖的它被賦予較小的,更大的,積極的,和殘疾人像素圖。這樣的像素圖所使用的Qt控件顯示代表一個特定動作的圖標。 最簡單的使用QIcon則是創建一個從[QPixmap](qpixmap.html)文件或資源,然后使用它,可以讓Qt的制定所有必需的圖標樣式和大小。例如: ``` [QToolButton](qtoolbutton.html) *button = new [QToolButton](qtoolbutton.html); button->setIcon(QIcon("open.xpm")); ``` 要撤消QIcon則,只需在其位置空圖標: ``` button->setIcon(QIcon()); ``` 使用[QImageReader.supportedImageFormats](qimagereader.html#supportedImageFormats)()和[QImageWriter.supportedImageFormats](qimagewriter.html#supportedImageFormats)( )函數來獲取支持的文件格式的完整列表。 當您使用像素圖(擷取像素圖[QSize](qsize.html),模式,狀態) ,且沒有像素映射為這個給定的大小,模式和狀態已經被添加以[addFile](qicon.html#addFile)()或[addPixmap](qicon.html#addPixmap)(),然后QIcon則將會產生1的飛行。該像素圖的產生發生在一個[QIconEngineV2](qiconenginev2.html)。默認引擎秤像素映射下來,如果需要,但再也沒有起來,并使用當前樣式來計算傷殘外觀。通過使用自定義圖標的引擎,您可以自定義生成圖標的每一個方面。同[QIconEnginePluginV2](index.htm)它可以注冊不同的圖標引擎不同的文件后綴,從而有可能為第三方提供額外的圖標引擎包括那些使用Qt 。 **Note:**由于Qt 4.2中,支持SVG圖標引擎包括在內。 ### Making Classes that Use QIcon 如果你自己寫的小工具,有一個選項來設置一個小像素映射,可以考慮允許QIcon則到該像素圖進行設置。 Qt的類[QToolButton](qtoolbutton.html)是這樣的一個部件的一個例子。 提供一種方法來設置QIcon則,當你繪制圖標,選擇任何像素圖是適合你的部件的當前狀態。例如: ``` void MyWidget.drawIcon([QPainter](qpainter.html) *painter, [QPoint](qpoint.html) pos) { [QPixmap](qpixmap.html) pixmap = icon.pixmap([QSize](qsize.html)(22, 22), isEnabled() ? QIcon.Normal : QIcon.Disabled, isChecked() ? QIcon.On : QIcon.Off); painter->drawPixmap(pos, pixmap); } ``` 您可能也使的使用`Active`模式,或許讓你的widget`Active`當鼠標懸停在小部件(見[QWidget.enterEvent](qwidget.html#enterEvent)( ) ) ,同時按下鼠標時以待釋放,這將激活該功能,或當它是當前選定的項目。如果小部件可以切換,在“開”模式可能被用來繪制不同的圖標。 ![QIcon](https://img.kancloud.cn/7b/b5/7bb5bceb5eb226554734b687e61dee30_596x312.png) * * * ## Type Documentation ``` QIcon.Mode ``` 該枚舉類型描述了其中一個像素圖的目的是要使用的模式。當前定義的模式有: | Constant | Value | Description | | --- | --- | --- | | `QIcon.Normal` | `0` | 顯示的像素圖,當用戶不與圖標交互的,而是由圖標表示的功能是可用的。 | | `QIcon.Disabled` | `1` | 顯示像素映射時由圖標表示的功能不可用。 | | `QIcon.Active` | `2` | 顯示像素映射時由圖標表示的功能是提供用戶與交互圖標,例如,移動鼠標,或單擊它。 | | `QIcon.Selected` | `3` | 顯示像素映射時由圖標表示該項目被選中。 | ``` QIcon.State ``` 該枚舉描述了其中一個像素圖的目的是要使用的狀態。該_state_可以是: | Constant | Value | Description | | --- | --- | --- | | `QIcon.Off` | `1` | 顯示像素圖時,部件是在“關”的狀態 | | `QIcon.On` | `0` | 顯示像素圖時,部件是在一個“開”狀態 | * * * ## Method Documentation ``` QIcon.__init__ (self) ``` 構造一個空的圖標。 ``` QIcon.__init__ (self, QPixmap?pixmap) ``` 從構造一個圖標_pixmap_。 ``` QIcon.__init__ (self, QIcon?other) ``` 構造的副本_other_。這是非常快的。 ``` QIcon.__init__ (self, QString?fileName) ``` 構造一個圖標從文件中給定的_fileName_。該文件將被按需加載。 If _fileName_包含相對路徑(例如,文件名只)的相關文件,必須找到相對于運行時的工作目錄。 文件名可以是指在磁盤上或對應用程序的嵌入資源之一實際的文件。請參閱[Resource System](index.htm)概述有關如何嵌入在應用程序的可執行映像和其他資源文件的詳細信息。 使用[QImageReader.supportedImageFormats](qimagereader.html#supportedImageFormats)()和[QImageWriter.supportedImageFormats](qimagewriter.html#supportedImageFormats)( )函數來獲取支持的文件格式的完整列表。 ``` QIcon.__init__ (self, QIconEngine?engine) ``` 該_engine_說法有它的所有權轉移給Qt的。 創建一個具有特定圖標的圖標_engine_。圖標采用了發動機的所有權。 ``` QIcon.__init__ (self, QIconEngineV2?engine) ``` 該_engine_說法有它的所有權轉移給Qt的。 創建一個具有特定圖標的圖標_engine_。圖標采用了發動機的所有權。 ``` QIcon.__init__ (self, QVariant?variant) ``` ``` QSize QIcon.actualSize (self, QSize?size, Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off) ``` [ 返回圖標的實際大小為所請求的_size_,_mode_和_state_。其結果可能會小于要求的,但從來沒有較大。 ](qsize.html) [**See also**](qsize.html) [pixmap](qicon.html#pixmap)()和[paint](qicon.html#paint)( ) 。 ``` QIcon.addFile (self, QString?fileName, QSize?size?=?QSize(), Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off) ``` 增加了一個圖像從文件用給定的_fileName_的圖標,作為一個專業化的_size_,_mode_和_state_。該文件將被按需加載。注:自定義圖標引擎可以自由地忽略額外添加的像素圖。 If _fileName_包含相對路徑(例如,文件名只)的相關文件,必須找到相對于運行時的工作目錄。 文件名可以是指在磁盤上或對應用程序的嵌入資源之一實際的文件。請參閱[Resource System](index.htm)概述有關如何嵌入在應用程序的可執行映像和其他資源文件的詳細信息。 使用[QImageReader.supportedImageFormats](qimagereader.html#supportedImageFormats)()和[QImageWriter.supportedImageFormats](qimagewriter.html#supportedImageFormats)( )函數來獲取支持的文件格式的完整列表。 注意:當您添加一個非空的文件名到[QIcon](qicon.html),圖標變為非空,即使該文件不存在或指向一個損壞的文件。 **See also** [addPixmap](qicon.html#addPixmap)( ) 。 ``` QIcon.addPixmap (self, QPixmap?pixmap, Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off) ``` 添加_pixmap_的圖標,作為一個專業化的_mode_和_state_。 自定義圖標的引擎可以自由地忽略額外添加的像素圖。 **See also** [addFile](qicon.html#addFile)( ) 。 ``` list-of-QSize QIcon.availableSizes (self, Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off) ``` 返回可用圖標大小的列表指定_mode_和_state_。 此功能被引入Qt的4.5 。 ``` int QIcon.cacheKey (self) ``` 返回一個數字,用于標識此內容[QIcon](qicon.html)對象。不同[QIcon](qicon.html)對象可以具有相同的密鑰,如果它們指的是相同的內容。 該cacheKey ( )會改變時,該圖標是通過改變[addPixmap](qicon.html#addPixmap)()或[addFile](qicon.html#addFile)( ) 。 緩存鍵是最有用與緩存結合使用。 此功能被引入Qt的4.3 。 **See also** [QPixmap.cacheKey](qpixmap.html#cacheKey)( ) 。 ``` QIcon QIcon.fromTheme (QString?name, QIcon?fallback?=?QIcon()) ``` [](qicon.html) [返回](qicon.html)[QIcon](qicon.html)對應_name_在當前的圖標主題。如果沒有這樣的圖標在當前主題中找到_fallback_返回來代替。 Freedesktop的圖標規格及命名規范的最新版本可以在這里獲得: * [http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html](http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html) * [http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html](http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html) 來從當前的圖標主題的圖標: ``` [QIcon](qicon.html) undoicon = [QIcon](qicon.html).fromTheme("edit-undo"); ``` 或者,如果你想提供一個保證回退不支持主題圖標的平臺,您可以使用第二個參數: ``` [QIcon](qicon.html) undoicon = [QIcon](qicon.html).fromTheme("edit-undo", [QIcon](qicon.html)(":/undo.png")); ``` **Note:**默認情況下,只有X11將支持主題圖標。為了使用在Mac和Windows主題圖標,你將不得不捆綁一個兼容的主題之一,您[themeSearchPaths](qicon.html#themeSearchPaths)( ),并設置適當的[themeName](qicon.html#themeName)( ) 。 此功能被引入Qt的4.6 。 **See also** [themeName](qicon.html#themeName)( )[setThemeName](qicon.html#setThemeName)()和[themeSearchPaths](qicon.html#themeSearchPaths)( ) 。 ``` bool QIcon.hasThemeIcon (QString?name) ``` 返回True如果有一個圖標供_name_在當前的圖標主題,否則返回False 。 此功能被引入Qt的4.6 。 **See also** [themeSearchPaths](qicon.html#themeSearchPaths)( )[fromTheme](qicon.html#fromTheme)()和[setThemeName](qicon.html#setThemeName)( ) 。 ``` bool QIcon.isDetached (self) ``` ``` bool QIcon.isNull (self) ``` 返回True如果該圖標為空,否則返回False 。 圖標是空的,如果它既不具有像素圖,也不是一個文件名。 注意:即使是一個非空的圖標可能無法建立有效像素映射,如。如果文件不存在或無法讀取。 ``` QString QIcon.name (self) ``` 返回(如果可用)來創建圖標,名稱。 根據創建圖標的方式,它可能有一個相關的名稱。這是用于與創建的圖標的情況下[fromTheme](qicon.html#fromTheme)()或圖標用[QIconEngine](qiconengine.html)支撐[QIconEngineV2.IconNameHook](qiconenginev2.html#IconEngineHook-enum)。 此功能被引入Qt的4.7 。 **See also** [fromTheme](qicon.html#fromTheme)()和[QIconEngine](qiconengine.html)。 ``` QIcon.paint (self, QPainter?painter, QRect?rect, Qt.Alignment?alignment?=?Qt.AlignCenter, Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off) ``` 使用_painter_繪制圖標與指定的_alignment_,需要_mode_和_state_成長方形_rect_。 **See also** [actualSize](qicon.html#actualSize)()和[pixmap](qicon.html#pixmap)( ) 。 ``` QIcon.paint (self, QPainter?painter, int?x, int?y, int?w, int?h, Qt.Alignment?alignment?=?Qt.AlignCenter, Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off) ``` 這是一個重載函數。 繪制圖標進入矩形[QRect](qrect.html)(_x_,_y_,_w_,_h_) 。 ``` QPixmap QIcon.pixmap (self, QSize?size, Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off) ``` [ 返回一個像素圖的要求_size_,_mode_和_state_,生成1如果必要的。像素圖可能小于要求的,但從來沒有較大。 ](qpixmap.html) [**See also**](qpixmap.html) [setPixmap](index.htm#setPixmap)( )[actualSize](qicon.html#actualSize)()和[paint](qicon.html#paint)( ) 。 ``` QPixmap QIcon.pixmap (self, int?w, int?h, Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off) ``` [](qpixmap.html) ``` QPixmap QIcon.pixmap (self, int?extent, Mode?mode?=?QIcon.Normal, State?state?=?QIcon.Off) ``` [ ``` int QIcon.serialNumber (self) ``` ``` QIcon.setThemeName (QString?path) ``` 設置當前的圖標主題_name_。 該_name_應該對應于包含描述它的內容的index.theme文件中的themeSearchPath目錄名( ) 。 此功能被引入Qt的4.6 。 ](qpixmap.html) [**See also**](qpixmap.html) [themeSearchPaths](qicon.html#themeSearchPaths)()和[themeName](qicon.html#themeName)( ) 。 ``` QIcon.setThemeSearchPaths (QStringList?searchpath) ``` 設置為圖標主題的搜索路徑_paths_。 此功能被引入Qt的4.6 。 **See also** [themeSearchPaths](qicon.html#themeSearchPaths)( )[fromTheme](qicon.html#fromTheme)()和[setThemeName](qicon.html#setThemeName)( ) 。 ``` QIcon.swap (self, QIcon?other) ``` 交換圖標_other_與此圖標。這個操作是非常快的,而且永遠不會。 此功能被引入Qt的4.8 。 ``` QString QIcon.themeName () ``` 返回當前的圖標主題的名稱。 在X11上,當前圖標主題取決于您的桌面設置。在其他平臺上它不是默認設置。 此功能被引入Qt的4.6 。 **See also** [setThemeName](qicon.html#setThemeName)( )[themeSearchPaths](qicon.html#themeSearchPaths)( )[fromTheme](qicon.html#fromTheme)()和[hasThemeIcon](qicon.html#hasThemeIcon)( ) 。 ``` QStringList QIcon.themeSearchPaths () ``` 返回圖標主題的搜索路徑。 默認值將取決于平臺: 在X11 ,搜索路徑將如果有使用XDG_DATA_DIRS環境變量。 默認情況下,所有的平臺都會有資源目錄`:\icons`作為后備。您可以使用“ RCC項目” ,以從你的圖標主題的資源文件。 此功能被引入Qt的4.6 。 **See also** [setThemeSearchPaths](qicon.html#setThemeSearchPaths)( )[fromTheme](qicon.html#fromTheme)()和[setThemeName](qicon.html#setThemeName)( ) 。
                  <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>

                              哎呀哎呀视频在线观看