icon ==== .. py:module:: qfluentwidgets.common.icon Module Contents --------------- .. autoapisummary:: qfluentwidgets.common.icon.FluentIconEngine qfluentwidgets.common.icon.SvgIconEngine qfluentwidgets.common.icon.FontIconEngine qfluentwidgets.common.icon.FluentIconBase qfluentwidgets.common.icon.FluentFontIconBase qfluentwidgets.common.icon.ColoredFluentIcon qfluentwidgets.common.icon.FluentIcon qfluentwidgets.common.icon.Icon qfluentwidgets.common.icon.Action .. autoapisummary:: qfluentwidgets.common.icon.getIconColor qfluentwidgets.common.icon.drawSvgIcon qfluentwidgets.common.icon.writeSvg qfluentwidgets.common.icon.drawIcon qfluentwidgets.common.icon.toQIcon .. py:class:: FluentIconEngine(icon, reverse=False) Bases: :py:obj:`PyQt5.QtGui.QIconEngine` Fluent icon engine .. py:attribute:: icon .. py:attribute:: isThemeReversed :value: False .. py:method:: paint(painter, rect, mode, state) .. py:method:: clone() -> PyQt5.QtGui.QIconEngine .. py:method:: pixmap(size, mode, state) .. py:class:: SvgIconEngine(svg: str) Bases: :py:obj:`PyQt5.QtGui.QIconEngine` Svg icon engine .. py:attribute:: svg .. py:method:: paint(painter, rect, mode, state) .. py:method:: clone() -> PyQt5.QtGui.QIconEngine .. py:method:: pixmap(size, mode, state) .. py:class:: FontIconEngine(fontFamily: str, char: str, color, isBold) Bases: :py:obj:`PyQt5.QtGui.QIconEngine` Font icon engine .. py:attribute:: color .. py:attribute:: char .. py:attribute:: fontFamily .. py:attribute:: isBold .. py:method:: paint(painter, rect, mode, state) .. py:method:: clone() -> PyQt5.QtGui.QIconEngine .. py:method:: pixmap(size, mode, state) .. py:function:: getIconColor(theme=Theme.AUTO, reverse=False) get the color of icon based on theme .. py:function:: drawSvgIcon(icon, painter, rect) draw svg icon Parameters ---------- icon: str | bytes | QByteArray the path or code of svg icon painter: QPainter painter rect: QRect | QRectF the rect to render icon .. py:function:: writeSvg(iconPath: str, indexes=None, **attributes) write svg with specified attributes Parameters ---------- iconPath: str svg icon path indexes: List[int] the path to be filled **attributes: the attributes of path Returns ------- svg: str svg code .. py:function:: drawIcon(icon, painter, rect, state=QIcon.Off, **attributes) draw icon Parameters ---------- icon: str | QIcon | FluentIconBaseBase the icon to be drawn painter: QPainter painter rect: QRect | QRectF the rect to render icon **attribute: the attribute of svg icon .. py:class:: FluentIconBase Fluent icon base class .. py:method:: path(theme=Theme.AUTO) -> str :abstractmethod: get the path of icon Parameters ---------- theme: Theme the theme of icon * `Theme.Light`: black icon * `Theme.DARK`: white icon * `Theme.AUTO`: icon color depends on `config.theme` .. py:method:: icon(theme=Theme.AUTO, color: PyQt5.QtGui.QColor = None) -> PyQt5.QtGui.QIcon create a fluent icon Parameters ---------- theme: Theme the theme of icon * `Theme.Light`: black icon * `Theme.DARK`: white icon * `Theme.AUTO`: icon color depends on `qconfig.theme` color: QColor | Qt.GlobalColor | str icon color, only applicable to svg icon .. py:method:: colored(lightColor: PyQt5.QtGui.QColor, darkColor: PyQt5.QtGui.QColor) -> ColoredFluentIcon create a colored fluent icon Parameters ---------- lightColor: str | QColor | Qt.GlobalColor icon color in light mode darkColor: str | QColor | Qt.GlobalColor icon color in dark mode .. py:method:: qicon(reverse=False) -> PyQt5.QtGui.QIcon convert to QIcon, the theme of icon will be updated synchronously with app Parameters ---------- reverse: bool whether to reverse the theme of icon .. py:method:: render(painter, rect, theme=Theme.AUTO, indexes=None, **attributes) draw svg icon Parameters ---------- painter: QPainter painter rect: QRect | QRectF the rect to render icon theme: Theme the theme of icon * `Theme.Light`: black icon * `Theme.DARK`: white icon * `Theme.AUTO`: icon color depends on `config.theme` indexes: List[int] the svg path to be modified **attributes: the attributes of modified path .. py:class:: FluentFontIconBase(char: str) Bases: :py:obj:`FluentIconBase` Fluent font icon base class .. py:attribute:: fontId :value: None .. py:attribute:: fontFamily :value: None .. py:attribute:: char .. py:attribute:: lightColor .. py:attribute:: darkColor .. py:attribute:: isBold :value: False .. py:method:: fromName(name: str) :classmethod: .. py:method:: bold() .. py:method:: icon(theme=Theme.AUTO, color: PyQt5.QtGui.QColor = None) -> PyQt5.QtGui.QIcon create a fluent icon Parameters ---------- theme: Theme the theme of icon * `Theme.Light`: black icon * `Theme.DARK`: white icon * `Theme.AUTO`: icon color depends on `qconfig.theme` color: QColor | Qt.GlobalColor | str icon color, only applicable to svg icon .. py:method:: colored(lightColor, darkColor) create a colored fluent icon Parameters ---------- lightColor: str | QColor | Qt.GlobalColor icon color in light mode darkColor: str | QColor | Qt.GlobalColor icon color in dark mode .. py:method:: render(painter: PyQt5.QtGui.QPainter, rect, theme=Theme.AUTO, indexes=None, **attributes) draw svg icon Parameters ---------- painter: QPainter painter rect: QRect | QRectF the rect to render icon theme: Theme the theme of icon * `Theme.Light`: black icon * `Theme.DARK`: white icon * `Theme.AUTO`: icon color depends on `config.theme` indexes: List[int] the svg path to be modified **attributes: the attributes of modified path .. py:method:: iconNameMapPath() -> str .. py:method:: loadFont() Load icon font .. py:method:: loadIconNames() Load icon name map .. py:class:: ColoredFluentIcon(icon: FluentIconBase, lightColor, darkColor) Bases: :py:obj:`FluentIconBase` Colored fluent icon .. py:attribute:: fluentIcon .. py:attribute:: lightColor .. py:attribute:: darkColor .. py:method:: path(theme=Theme.AUTO) -> str get the path of icon Parameters ---------- theme: Theme the theme of icon * `Theme.Light`: black icon * `Theme.DARK`: white icon * `Theme.AUTO`: icon color depends on `config.theme` .. py:method:: render(painter, rect, theme=Theme.AUTO, indexes=None, **attributes) draw svg icon Parameters ---------- painter: QPainter painter rect: QRect | QRectF the rect to render icon theme: Theme the theme of icon * `Theme.Light`: black icon * `Theme.DARK`: white icon * `Theme.AUTO`: icon color depends on `config.theme` indexes: List[int] the svg path to be modified **attributes: the attributes of modified path .. py:class:: FluentIcon Bases: :py:obj:`FluentIconBase`, :py:obj:`enum.Enum` Fluent icon .. py:attribute:: UP :value: 'Up' .. py:attribute:: ADD :value: 'Add' .. py:attribute:: BUS :value: 'Bus' .. py:attribute:: CAR :value: 'Car' .. py:attribute:: CUT :value: 'Cut' .. py:attribute:: IOT :value: 'IOT' .. py:attribute:: PIN :value: 'Pin' .. py:attribute:: TAG :value: 'Tag' .. py:attribute:: VPN :value: 'VPN' .. py:attribute:: CAFE :value: 'Cafe' .. py:attribute:: CHAT :value: 'Chat' .. py:attribute:: COPY :value: 'Copy' .. py:attribute:: CODE :value: 'Code' .. py:attribute:: DOWN :value: 'Down' .. py:attribute:: EDIT :value: 'Edit' .. py:attribute:: FLAG :value: 'Flag' .. py:attribute:: FONT :value: 'Font' .. py:attribute:: GAME :value: 'Game' .. py:attribute:: HELP :value: 'Help' .. py:attribute:: HIDE :value: 'Hide' .. py:attribute:: HOME :value: 'Home' .. py:attribute:: INFO :value: 'Info' .. py:attribute:: LEAF :value: 'Leaf' .. py:attribute:: LINK :value: 'Link' .. py:attribute:: MAIL :value: 'Mail' .. py:attribute:: MENU :value: 'Menu' .. py:attribute:: MUTE :value: 'Mute' .. py:attribute:: MORE :value: 'More' .. py:attribute:: MOVE :value: 'Move' .. py:attribute:: PLAY :value: 'Play' .. py:attribute:: SAVE :value: 'Save' .. py:attribute:: SEND :value: 'Send' .. py:attribute:: SYNC :value: 'Sync' .. py:attribute:: UNIT :value: 'Unit' .. py:attribute:: VIEW :value: 'View' .. py:attribute:: WIFI :value: 'Wifi' .. py:attribute:: ZOOM :value: 'Zoom' .. py:attribute:: ALBUM :value: 'Album' .. py:attribute:: BRUSH :value: 'Brush' .. py:attribute:: BROOM :value: 'Broom' .. py:attribute:: CLOSE :value: 'Close' .. py:attribute:: CLOUD :value: 'Cloud' .. py:attribute:: EMBED :value: 'Embed' .. py:attribute:: GLOBE :value: 'Globe' .. py:attribute:: HEART :value: 'Heart' .. py:attribute:: LABEL :value: 'Label' .. py:attribute:: MEDIA :value: 'Media' .. py:attribute:: MOVIE :value: 'Movie' .. py:attribute:: MUSIC :value: 'Music' .. py:attribute:: ROBOT :value: 'Robot' .. py:attribute:: PAUSE :value: 'Pause' .. py:attribute:: PASTE :value: 'Paste' .. py:attribute:: PHOTO :value: 'Photo' .. py:attribute:: PHONE :value: 'Phone' .. py:attribute:: PRINT :value: 'Print' .. py:attribute:: SHARE :value: 'Share' .. py:attribute:: TILES :value: 'Tiles' .. py:attribute:: UNPIN :value: 'Unpin' .. py:attribute:: VIDEO :value: 'Video' .. py:attribute:: TRAIN :value: 'Train' .. py:attribute:: ADD_TO :value: 'AddTo' .. py:attribute:: ACCEPT :value: 'Accept' .. py:attribute:: CAMERA :value: 'Camera' .. py:attribute:: CANCEL :value: 'Cancel' .. py:attribute:: DELETE :value: 'Delete' .. py:attribute:: FOLDER :value: 'Folder' .. py:attribute:: FILTER :value: 'Filter' .. py:attribute:: MARKET :value: 'Market' .. py:attribute:: SCROLL :value: 'Scroll' .. py:attribute:: LAYOUT :value: 'Layout' .. py:attribute:: GITHUB :value: 'GitHub' .. py:attribute:: UPDATE :value: 'Update' .. py:attribute:: REMOVE :value: 'Remove' .. py:attribute:: RETURN :value: 'Return' .. py:attribute:: PEOPLE :value: 'People' .. py:attribute:: QRCODE :value: 'QRCode' .. py:attribute:: RINGER :value: 'Ringer' .. py:attribute:: ROTATE :value: 'Rotate' .. py:attribute:: SEARCH :value: 'Search' .. py:attribute:: VOLUME :value: 'Volume' .. py:attribute:: FRIGID :value: 'Frigid' .. py:attribute:: SAVE_AS :value: 'SaveAs' .. py:attribute:: ZOOM_IN :value: 'ZoomIn' .. py:attribute:: CONNECT :value: 'Connect' .. py:attribute:: HISTORY :value: 'History' .. py:attribute:: SETTING :value: 'Setting' .. py:attribute:: PALETTE :value: 'Palette' .. py:attribute:: MESSAGE :value: 'Message' .. py:attribute:: FIT_PAGE :value: 'FitPage' .. py:attribute:: ZOOM_OUT :value: 'ZoomOut' .. py:attribute:: AIRPLANE :value: 'Airplane' .. py:attribute:: ASTERISK :value: 'Asterisk' .. py:attribute:: CALORIES :value: 'Calories' .. py:attribute:: CALENDAR :value: 'Calendar' .. py:attribute:: FEEDBACK :value: 'Feedback' .. py:attribute:: LIBRARY :value: 'BookShelf' .. py:attribute:: MINIMIZE :value: 'Minimize' .. py:attribute:: CHECKBOX :value: 'CheckBox' .. py:attribute:: DOCUMENT :value: 'Document' .. py:attribute:: LANGUAGE :value: 'Language' .. py:attribute:: DOWNLOAD :value: 'Download' .. py:attribute:: QUESTION :value: 'Question' .. py:attribute:: SPEAKERS :value: 'Speakers' .. py:attribute:: DATE_TIME :value: 'DateTime' .. py:attribute:: FONT_SIZE :value: 'FontSize' .. py:attribute:: HOME_FILL :value: 'HomeFill' .. py:attribute:: PAGE_LEFT :value: 'PageLeft' .. py:attribute:: SAVE_COPY :value: 'SaveCopy' .. py:attribute:: SEND_FILL :value: 'SendFill' .. py:attribute:: SKIP_BACK :value: 'SkipBack' .. py:attribute:: SPEED_OFF :value: 'SpeedOff' .. py:attribute:: ALIGNMENT :value: 'Alignment' .. py:attribute:: BLUETOOTH :value: 'Bluetooth' .. py:attribute:: COMPLETED :value: 'Completed' .. py:attribute:: CONSTRACT :value: 'Constract' .. py:attribute:: HEADPHONE :value: 'Headphone' .. py:attribute:: MEGAPHONE :value: 'Megaphone' .. py:attribute:: PROJECTOR :value: 'Projector' .. py:attribute:: EDUCATION :value: 'Education' .. py:attribute:: LEFT_ARROW :value: 'LeftArrow' .. py:attribute:: ERASE_TOOL :value: 'EraseTool' .. py:attribute:: PAGE_RIGHT :value: 'PageRight' .. py:attribute:: PLAY_SOLID :value: 'PlaySolid' .. py:attribute:: BOOK_SHELF :value: 'BookShelf' .. py:attribute:: HIGHTLIGHT :value: 'Highlight' .. py:attribute:: FOLDER_ADD :value: 'FolderAdd' .. py:attribute:: PAUSE_BOLD :value: 'PauseBold' .. py:attribute:: PENCIL_INK :value: 'PencilInk' .. py:attribute:: PIE_SINGLE :value: 'PieSingle' .. py:attribute:: QUICK_NOTE :value: 'QuickNote' .. py:attribute:: SPEED_HIGH :value: 'SpeedHigh' .. py:attribute:: STOP_WATCH :value: 'StopWatch' .. py:attribute:: ZIP_FOLDER :value: 'ZipFolder' .. py:attribute:: BASKETBALL :value: 'Basketball' .. py:attribute:: BRIGHTNESS :value: 'Brightness' .. py:attribute:: DICTIONARY :value: 'Dictionary' .. py:attribute:: MICROPHONE :value: 'Microphone' .. py:attribute:: ARROW_DOWN :value: 'ChevronDown' .. py:attribute:: FULL_SCREEN :value: 'FullScreen' .. py:attribute:: MIX_VOLUMES :value: 'MixVolumes' .. py:attribute:: REMOVE_FROM :value: 'RemoveFrom' .. py:attribute:: RIGHT_ARROW :value: 'RightArrow' .. py:attribute:: QUIET_HOURS :value: 'QuietHours' .. py:attribute:: FINGERPRINT :value: 'Fingerprint' .. py:attribute:: APPLICATION :value: 'Application' .. py:attribute:: CERTIFICATE :value: 'Certificate' .. py:attribute:: TRANSPARENT :value: 'Transparent' .. py:attribute:: IMAGE_EXPORT :value: 'ImageExport' .. py:attribute:: SPEED_MEDIUM :value: 'SpeedMedium' .. py:attribute:: LIBRARY_FILL :value: 'LibraryFill' .. py:attribute:: MUSIC_FOLDER :value: 'MusicFolder' .. py:attribute:: POWER_BUTTON :value: 'PowerButton' .. py:attribute:: SKIP_FORWARD :value: 'SkipForward' .. py:attribute:: CARE_UP_SOLID :value: 'CareUpSolid' .. py:attribute:: ACCEPT_MEDIUM :value: 'AcceptMedium' .. py:attribute:: CANCEL_MEDIUM :value: 'CancelMedium' .. py:attribute:: CHEVRON_RIGHT :value: 'ChevronRight' .. py:attribute:: CLIPPING_TOOL :value: 'ClippingTool' .. py:attribute:: SEARCH_MIRROR :value: 'SearchMirror' .. py:attribute:: SHOPPING_CART :value: 'ShoppingCart' .. py:attribute:: FONT_INCREASE :value: 'FontIncrease' .. py:attribute:: BACK_TO_WINDOW :value: 'BackToWindow' .. py:attribute:: COMMAND_PROMPT :value: 'CommandPrompt' .. py:attribute:: CLOUD_DOWNLOAD :value: 'CloudDownload' .. py:attribute:: DICTIONARY_ADD :value: 'DictionaryAdd' .. py:attribute:: CARE_DOWN_SOLID :value: 'CareDownSolid' .. py:attribute:: CARE_LEFT_SOLID :value: 'CareLeftSolid' .. py:attribute:: CLEAR_SELECTION :value: 'ClearSelection' .. py:attribute:: DEVELOPER_TOOLS :value: 'DeveloperTools' .. py:attribute:: BACKGROUND_FILL :value: 'BackgroundColor' .. py:attribute:: CARE_RIGHT_SOLID :value: 'CareRightSolid' .. py:attribute:: CHEVRON_DOWN_MED :value: 'ChevronDownMed' .. py:attribute:: CHEVRON_RIGHT_MED :value: 'ChevronRightMed' .. py:attribute:: EMOJI_TAB_SYMBOLS :value: 'EmojiTabSymbols' .. py:attribute:: EXPRESSIVE_INPUT_ENTRY :value: 'ExpressiveInputEntry' .. py:method:: path(theme=Theme.AUTO) get the path of icon Parameters ---------- theme: Theme the theme of icon * `Theme.Light`: black icon * `Theme.DARK`: white icon * `Theme.AUTO`: icon color depends on `config.theme` .. py:class:: Icon(fluentIcon: FluentIcon) Bases: :py:obj:`PyQt5.QtGui.QIcon` .. py:attribute:: fluentIcon .. py:function:: toQIcon(icon: Union[PyQt5.QtGui.QIcon, FluentIconBase, str]) -> PyQt5.QtGui.QIcon convet `icon` to `QIcon` .. py:class:: Action(parent: PyQt5.QtCore.QObject = None, **kwargs) Bases: :py:obj:`PyQt5.QtWidgets.QAction` Fluent action Constructors ------------ * Action(`parent`: QWidget = None, `**kwargs`) * Action(`text`: str, `parent`: QWidget = None, `**kwargs`) * Action(`icon`: QIcon | FluentIconBase, `parent`: QWidget = None, `**kwargs`) .. py:attribute:: fluentIcon :value: None .. py:method:: icon() -> PyQt5.QtGui.QIcon .. py:method:: setIcon(icon: Union[FluentIconBase, PyQt5.QtGui.QIcon])