API Reference
This page contains the automatic API reference for the qextrawidgets package.
Core
Regexs
Utils
QColorUtils
Utility class for color-related operations.
Source code in source/qextrawidgets/core/utils/color_utils.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
getContrastingTextColor(bg_color)
staticmethod
Returns Qt.black or Qt.white depending on the background color luminance.
Formula based on human perception (NTSC conversion formula).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bg_color
|
QColor
|
Background color to calculate contrast against. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
QColor |
QColor
|
Contrasting text color (Black or White). |
Source code in source/qextrawidgets/core/utils/color_utils.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
QEmojiFinder
Utility class for finding emojis and aliases in text using QRegularExpression.
Source code in source/qextrawidgets/core/utils/emoji_finder.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
findEmojiAliases(text)
classmethod
Finds all text aliases (e.g., :smile:) in the given text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to scan. |
required |
Yields:
| Type | Description |
|---|---|
Tuple[EmojiChar, QRegularExpressionMatch]
|
Generator[Tuple[EmojiChar, QRegularExpressionMatch]]: Tuples of EmojiChar data and their matches. |
Source code in source/qextrawidgets/core/utils/emoji_finder.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
findEmojis(text)
classmethod
Finds all Unicode emojis in the given text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to scan. |
required |
Yields:
| Type | Description |
|---|---|
QRegularExpressionMatch
|
Generator[QRegularExpressionMatch]: Matches for each emoji found. |
Source code in source/qextrawidgets/core/utils/emoji_finder.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
QEmojiFonts
Utility class for loading and accessing emoji fonts.
Source code in source/qextrawidgets/core/utils/emoji_fonts.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
loadTwemojiFont()
classmethod
Loads the bundled Twemoji font into the application font database.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The loaded font family name. |
Source code in source/qextrawidgets/core/utils/emoji_fonts.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
twemojiFont()
classmethod
Returns a QFont object using the Twemoji font family.
Returns:
| Name | Type | Description |
|---|---|---|
QFont |
QFont
|
The Twemoji font. |
Source code in source/qextrawidgets/core/utils/emoji_fonts.py
30 31 32 33 34 35 36 37 | |
QIconGenerator
Class responsible for generating Pixmaps and icons based on text/fonts.
Source code in source/qextrawidgets/core/utils/icon_generator.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
calculateMaxPixelSize(text, font, target_size)
staticmethod
Calculates the maximum pixel size the font can have so the text fits within target_size.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Text to be measured. |
required |
font
|
QFont
|
The font configuration (family, weight, italic). |
required |
target_size
|
QSize
|
The available space. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The calculated pixel size. |
Source code in source/qextrawidgets/core/utils/icon_generator.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
charToPixmap(char, target_size, font=QFont('Arial'), color=QColor(Qt.GlobalColor.black))
classmethod
Generates a QPixmap of a specific size containing a character rendered at the largest possible size.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
char
|
str
|
The character to be rendered. |
required |
target_size
|
QSize
|
The final image size (e.g., 64x64). |
required |
font
|
QFont
|
The base font (will be resized internally). |
QFont('Arial')
|
color
|
QColor
|
The text color. |
QColor(black)
|
Returns:
| Name | Type | Description |
|---|---|---|
QPixmap |
QPixmap
|
Transparent image with the character centered. |
Source code in source/qextrawidgets/core/utils/icon_generator.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
createIconWithBackground(icon_name, background_color, size=48, dpr=1.0, icon_color='white', scale_factor=0.6)
staticmethod
Creates a high-quality (HiDPI) icon with circular background.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon_name
|
str
|
QtAwesome icon name (e.g., 'fa5s.user'). |
required |
background_color
|
str
|
Background color in any Qt-supported format (e.g., '#FF5733', 'red'). |
required |
size
|
int
|
Logical desired size (e.g., 48). |
48
|
dpr
|
float
|
Device Pixel Ratio of the window (e.g., 1.0, 1.25, 2.0). |
1.0
|
icon_color
|
str
|
Icon foreground color. |
'white'
|
scale_factor
|
float
|
Icon size relative to background (0.0 to 1.0). |
0.6
|
Returns:
| Name | Type | Description |
|---|---|---|
QPixmap |
QPixmap
|
High-quality pixmap with icon on circular background. |
Source code in source/qextrawidgets/core/utils/icon_generator.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
getCircularPixmap(pixmap, size, dpr=1.0)
staticmethod
Creates a circular pixmap (center crop) with HiDPI support.
Uses QStyle to calculate alignment for proper center cropping.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pixmap
|
QPixmap
|
Source pixmap to crop. |
required |
size
|
int
|
Logical size of the output circular pixmap. |
required |
dpr
|
float
|
Device Pixel Ratio for HiDPI displays (e.g., 1.0, 1.25, 2.0). |
1.0
|
Returns:
| Name | Type | Description |
|---|---|---|
QPixmap |
QPixmap
|
Circular pixmap with transparent background. |
Source code in source/qextrawidgets/core/utils/icon_generator.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
QSystemUtils
Utilities related to system and application settings.
Source code in source/qextrawidgets/core/utils/system_utils.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
applyDarkMode()
staticmethod
Applies a generic dark palette.
Source code in source/qextrawidgets/core/utils/system_utils.py
20 21 22 23 | |
applyLightMode()
staticmethod
Restores the default system palette (Light).
Source code in source/qextrawidgets/core/utils/system_utils.py
25 26 27 28 29 | |
isDarkMode()
staticmethod
Checks if the application is running in dark mode.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if dark mode is active, False otherwise. |
Source code in source/qextrawidgets/core/utils/system_utils.py
8 9 10 11 12 13 14 15 16 17 18 | |
QTwemojiImageProvider
Utility class for loading, resizing, and caching emoji images.
Source code in source/qextrawidgets/core/utils/twemoji_image_provider.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
getPixmap(emoji, margin, size, dpr=1.0, source_format='png')
staticmethod
Loads and returns a colorized or processed emoji pixmap.
Uses caching to improve performance on subsequent calls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emoji
|
str
|
Emoji character. |
required |
margin
|
int
|
Margin around the emoji in pixels. |
required |
size
|
int
|
Target logical size. |
required |
dpr
|
float
|
Device pixel ratio. Defaults to 1.0. |
1.0
|
source_format
|
str
|
Image format (png or svg). Defaults to "png". |
'png'
|
Returns:
| Name | Type | Description |
|---|---|---|
QPixmap |
QPixmap
|
The processed pixmap. |
Source code in source/qextrawidgets/core/utils/twemoji_image_provider.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
getUrl(alias, margin, size, dpr, source_format)
staticmethod
Generates a unique QUrl key for caching an emoji pixmap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alias
|
str
|
Emoji identifier (unified code or alias). |
required |
margin
|
int
|
Margin size. |
required |
size
|
QSize
|
Logical size. |
required |
dpr
|
float
|
Device pixel ratio. |
required |
source_format
|
str
|
Image format. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
QUrl |
QUrl
|
The generated cache key URL. |
Source code in source/qextrawidgets/core/utils/twemoji_image_provider.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
GUI
Icons
QThemeResponsiveIcon
Bases: QIcon
QIcon wrapper that applies automatic coloring based on system theme.
The icon switches between Black and White based on the current system palette.
Source code in source/qextrawidgets/gui/icons/theme_responsive_icon.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
__init__(source=None)
Initializes the theme responsive icon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Union[str, QPixmap, QIcon, None]
|
Icon source. |
None
|
Source code in source/qextrawidgets/gui/icons/theme_responsive_icon.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
fromAwesome(icon_name, **kwargs)
staticmethod
Creates a theme responsive icon from a QtAwesome icon name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon_name
|
str
|
QtAwesome icon name (e.g., "fa6s.house"). |
required |
**kwargs
|
Any
|
Additional arguments for qtawesome.icon. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
QThemeResponsiveIcon |
QThemeResponsiveIcon
|
The created icon. |
Source code in source/qextrawidgets/gui/icons/theme_responsive_icon.py
38 39 40 41 42 43 44 45 46 47 48 49 | |
themePixmap(size, mode, state, scheme)
Returns a themed pixmap directly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
QSize
|
Target size. |
required |
mode
|
Mode
|
Icon mode. |
required |
state
|
State
|
Icon state. |
required |
scheme
|
ColorScheme
|
System color scheme. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
QPixmap |
QPixmap
|
The themed pixmap. |
Source code in source/qextrawidgets/gui/icons/theme_responsive_icon.py
51 52 53 54 55 56 57 58 59 60 61 62 63 | |
Items
QEmojiCategoryItem
Bases: QStandardItem
A standard item representing a category of emojis in the model.
Source code in source/qextrawidgets/gui/items/emoji_category_item.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
QEmojiCategoryDataRole
Bases: int, Enum
Custom data roles for the category item.
Source code in source/qextrawidgets/gui/items/emoji_category_item.py
12 13 14 15 16 17 | |
__init__(category, icon)
Initializes the category item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
category
|
str
|
The name of the category. |
required |
icon
|
Union[QIcon, QPixmap]
|
The icon representing the category. |
required |
Source code in source/qextrawidgets/gui/items/emoji_category_item.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
category()
Returns the category name.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The category name. |
Source code in source/qextrawidgets/gui/items/emoji_category_item.py
35 36 37 38 39 40 41 42 | |
EmojiSkinTone
Bases: str, Enum
Skin tone modifiers (Fitzpatrick scale) supported by Unicode.
Inherits from 'str' to facilitate direct concatenation with base emojis.
Attributes:
| Name | Type | Description |
|---|---|---|
Default |
Default skin tone (usually yellow/neutral). No modifier. |
|
Light |
Type 1-2: Light skin tone. |
|
MediumLight |
Type 3: Medium-light skin tone. |
|
Medium |
Type 4: Medium skin tone. |
|
MediumDark |
Type 5: Medium-dark skin tone. |
|
Dark |
Type 6: Dark skin tone. |
Source code in source/qextrawidgets/gui/items/emoji_item.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
QEmojiItem
Bases: QStandardItem
A standard item representing a single emoji in the model.
Source code in source/qextrawidgets/gui/items/emoji_item.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
QEmojiDataRole
Bases: int, Enum
Custom data roles for the emoji item.
Source code in source/qextrawidgets/gui/items/emoji_item.py
71 72 73 74 75 76 77 78 79 | |
__init__(emoji_char, skin_tone='')
Initializes the emoji item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emoji_char
|
EmojiChar
|
The emoji character data object. |
required |
skin_tone
|
str
|
The skin tone modifier (hex code). Defaults to "". |
''
|
Source code in source/qextrawidgets/gui/items/emoji_item.py
81 82 83 84 85 86 87 88 89 90 91 92 | |
aliasesText()
Returns a string containing all short names formatted as aliases (e.g. :smile: :happy:).
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Space-separated aliases. |
Source code in source/qextrawidgets/gui/items/emoji_item.py
193 194 195 196 197 198 199 200 | |
clone()
Creates a copy of this QEmojiItem.
Returns:
| Name | Type | Description |
|---|---|---|
QEmojiItem |
A new instance with the same emoji and skin tone. |
Source code in source/qextrawidgets/gui/items/emoji_item.py
220 221 222 223 224 225 226 227 | |
coloredEmojiChar()
Returns the EmojiChar corresponding to the set skin tone, if available. Otherwise, returns the base EmojiChar.
Returns:
| Name | Type | Description |
|---|---|---|
EmojiChar |
EmojiChar
|
The processed emoji character data object. |
Source code in source/qextrawidgets/gui/items/emoji_item.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
data(role=Qt.ItemDataRole.UserRole)
Retrieves data for the given role.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
role
|
int
|
The data role. |
UserRole
|
Returns:
| Type | Description |
|---|---|
Any
|
typing.Any: The data associated with the role. |
Source code in source/qextrawidgets/gui/items/emoji_item.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
emoji()
Returns the emoji character.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The emoji character. |
Source code in source/qextrawidgets/gui/items/emoji_item.py
176 177 178 179 180 181 182 | |
emojiChar()
Returns the raw EmojiChar object associated with this item.
Returns:
| Name | Type | Description |
|---|---|---|
EmojiChar |
EmojiChar
|
The emoji character data object. |
Source code in source/qextrawidgets/gui/items/emoji_item.py
134 135 136 137 138 139 140 141 | |
firstAlias()
Returns the first alias/short name of the emoji.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The first alias, or None/IndexError if empty (though usually not empty). |
Source code in source/qextrawidgets/gui/items/emoji_item.py
202 203 204 205 206 207 208 209 | |
fromEmoji(emoji, skin_tone='')
classmethod
Create a QEmojiItem from an emoji character string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emoji
|
str
|
The emoji character. |
required |
skin_tone
|
str
|
Skin tone modifier. |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
QEmojiItem |
QEmojiItem
|
The created item. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the emoji is not found in the database. |
Source code in source/qextrawidgets/gui/items/emoji_item.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
fromEmojiShortName(short_name, skin_tone='')
classmethod
Create a QEmojiItem from a short name (e.g., 'smile' or ':smile:').
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
short_name
|
str
|
The short name of the emoji. |
required |
skin_tone
|
str
|
Skin tone modifier. |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
QEmojiItem |
QEmojiItem
|
The created item. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the emoji is not found by short name. |
Source code in source/qextrawidgets/gui/items/emoji_item.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
parent()
Returns the parent item of the emoji item.
Returns:
| Name | Type | Description |
|---|---|---|
QEmojiCategoryItem |
Optional[QEmojiCategoryItem]
|
The parent category item. |
Source code in source/qextrawidgets/gui/items/emoji_item.py
250 251 252 253 254 255 256 257 258 259 260 | |
shortNames()
Returns a list of short names (keywords) for the emoji.
Returns:
| Type | Description |
|---|---|
List[str]
|
typing.List[str]: List of short names. |
Source code in source/qextrawidgets/gui/items/emoji_item.py
184 185 186 187 188 189 190 191 | |
skinTone()
Returns the current skin tone hex string stored in data.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The skin tone hex string (e.g., '1F3FB') or empty string. |
Source code in source/qextrawidgets/gui/items/emoji_item.py
211 212 213 214 215 216 217 218 | |
skinToneCompatible(emoji_char)
staticmethod
Checks if the given emoji supports skin tone variations in the library.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emoji_char
|
EmojiChar
|
The emoji to check. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if it supports skin tone variations, False otherwise. |
Source code in source/qextrawidgets/gui/items/emoji_item.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
Models
EmojiCategory
Bases: str, Enum
Standard emoji categories.
Source code in source/qextrawidgets/gui/models/emoji_picker_model.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
QEmojiPickerModel
Bases: QStandardItemModel
Model for managing emoji categories and items using QStandardItemModel.
This model organizes emojis into categories (e.g., Smileys & Emotion, Animals & Nature) and supports optional 'Favorites' and 'Recents' categories. It also handles skin tone updates for compatible emojis.
Attributes:
| Name | Type | Description |
|---|---|---|
categoryInserted |
Signal(QEmojiCategoryItem
|
Emitted when a category is added. |
categoryRemoved |
Signal(QEmojiCategoryItem
|
Emitted when a category is removed. |
skinToneChanged |
Signal(QModelIndex
|
Emitted when a skin tone is applied to an emoji. |
Source code in source/qextrawidgets/gui/models/emoji_picker_model.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | |
__init__(favorite_category=True, recent_category=True)
Initialize the QEmojiPickerModel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
favorite_category
|
bool
|
Whether to include the Favorites category. Defaults to True. |
True
|
recent_category
|
bool
|
Whether to include the Recents category. Defaults to True. |
True
|
Source code in source/qextrawidgets/gui/models/emoji_picker_model.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
addCategory(name, icon)
Add a new category to the model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the category. |
required |
icon
|
Union[QIcon, QPixmap]
|
The icon for the category. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if added, False if it already exists. |
Source code in source/qextrawidgets/gui/models/emoji_picker_model.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | |
addEmoji(category_name, item)
Add an emoji to a specific category.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
category_name
|
str
|
The name of the category. |
required |
item
|
QEmojiItem
|
The emoji item to add. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if added, False if category not found or emoji already exists. |
Source code in source/qextrawidgets/gui/models/emoji_picker_model.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | |
categories()
Get all category items in the model.
Returns:
| Type | Description |
|---|---|
List[QEmojiCategoryItem]
|
List[QEmojiCategoryItem]: A list of all emoji category items. |
Source code in source/qextrawidgets/gui/models/emoji_picker_model.py
240 241 242 243 244 245 246 247 248 249 250 251 252 | |
findCategory(category_name)
Find a category by its name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
category_name
|
str
|
The name of the category to search for. |
required |
Returns:
| Type | Description |
|---|---|
Optional[QEmojiCategoryItem]
|
Optional[QEmojiCategoryItem]: The category item, or None if not found. |
Source code in source/qextrawidgets/gui/models/emoji_picker_model.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
findEmojiInCategory(category_item, emoji)
Find a specific emoji within a given category index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
category_item
|
QEmojiCategoryItem
|
The category to search in. |
required |
emoji
|
str
|
The emoji character to find. |
required |
Returns:
| Type | Description |
|---|---|
Optional[QEmojiItem]
|
Optional[QEmojiItem]: The found emoji item, or None if not found. |
Source code in source/qextrawidgets/gui/models/emoji_picker_model.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
findEmojiInCategoryByName(category, emoji)
Find a specific emoji within a given category by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
category
|
Union[str, EmojiCategory]
|
The name or enum of the category to search in. |
required |
emoji
|
str
|
The emoji character to find. |
required |
Returns:
| Type | Description |
|---|---|
Optional[QEmojiItem]
|
Optional[QEmojiItem]: The found emoji item, or None if not found. |
Source code in source/qextrawidgets/gui/models/emoji_picker_model.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
populate()
Populate the model with emoji categories and items.
Iterates through the emoji database, groups emojis by category, and creates the hierarchical model structure. Compatible emojis are tracked for skin tone updates.
Source code in source/qextrawidgets/gui/models/emoji_picker_model.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
removeCategory(name)
Remove a category from the model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the category to remove. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if removed, False if not found. |
Source code in source/qextrawidgets/gui/models/emoji_picker_model.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | |
removeEmoji(category_name, emoji_char)
Remove an emoji from a specific category.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
category_name
|
str
|
The name of the category. |
required |
emoji_char
|
str
|
The emoji character string. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if removed, False if not found. |
Source code in source/qextrawidgets/gui/models/emoji_picker_model.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
setSkinTone(skin_tone)
Update the skin tone for all compatible emojis in the model.
Iterates through tracked compatible emojis and updates their data with the new skin tone.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
skin_tone
|
str
|
The new skin tone character/code. |
required |
Source code in source/qextrawidgets/gui/models/emoji_picker_model.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
Proxies
QCheckStateProxyModel
Bases: QIdentityProxyModel
A proxy model that stores check states internally, without modifying the source model.
This is useful for views where the user needs to select items (e.g., for filtering) without affecting the selection state of the underlying data.
Source code in source/qextrawidgets/gui/proxys/check_state_proxy.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
data(index, role=Qt.ItemDataRole.DisplayRole)
Returns the data for the given index and role.
Source code in source/qextrawidgets/gui/proxys/check_state_proxy.py
34 35 36 37 38 39 40 41 42 43 44 45 46 | |
flags(index)
Returns the item flags for the given index, ensuring it is checkable.
Source code in source/qextrawidgets/gui/proxys/check_state_proxy.py
24 25 26 27 28 29 30 31 32 | |
getCheckedRows(column=0)
Returns a set of row numbers that are currently checked.
Source code in source/qextrawidgets/gui/proxys/check_state_proxy.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
setAllCheckState(state)
Sets the check state for all items in the model.
Source code in source/qextrawidgets/gui/proxys/check_state_proxy.py
80 81 82 83 | |
setData(index, value, role=Qt.ItemDataRole.EditRole)
Sets the data for the given index and role.
Source code in source/qextrawidgets/gui/proxys/check_state_proxy.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
setInitialCheckState(state)
Sets the default check state for all items not explicitly set.
Source code in source/qextrawidgets/gui/proxys/check_state_proxy.py
66 67 68 69 70 71 72 73 74 75 76 77 78 | |
QDecorationRoleProxyModel
Bases: QIdentityProxyModel
A proxy model that stores decoration data internally, without modifying the source model.
This is useful for views where you need to display icons or colors without affecting the underlying data.
Source code in source/qextrawidgets/gui/proxys/decoration_role_proxy.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
clearDecorations()
Clears all explicit decorations, reverting to the default.
Source code in source/qextrawidgets/gui/proxys/decoration_role_proxy.py
70 71 72 73 74 75 76 77 78 79 80 81 | |
data(index, role=Qt.ItemDataRole.DisplayRole)
Returns the data for the given index and role.
Source code in source/qextrawidgets/gui/proxys/decoration_role_proxy.py
24 25 26 27 28 29 30 31 32 33 34 35 36 | |
setData(index, value, role=Qt.ItemDataRole.EditRole)
Sets the data for the given index and role.
Source code in source/qextrawidgets/gui/proxys/decoration_role_proxy.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
setDefaultDecoration(decoration)
Sets the default decoration for all items not explicitly set.
Source code in source/qextrawidgets/gui/proxys/decoration_role_proxy.py
56 57 58 59 60 61 62 63 64 65 66 67 68 | |
QEmojiPickerProxyModel
Bases: QSortFilterProxyModel
A high-performance proxy model to filter emojis by their alias.
Optimizations: 1. Uses setRecursiveFilteringEnabled(True) to avoid manual O(N^2) child iteration. 2. Caches the search term to avoid repetitive string manipulations per row.
Source code in source/qextrawidgets/gui/proxys/emoji_picker_proxy.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
__init__(parent=None)
Initializes the QEmojiProxyModel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
QWidget
|
The parent widget. Defaults to None. |
None
|
Source code in source/qextrawidgets/gui/proxys/emoji_picker_proxy.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
filterAcceptsRow(source_row, source_parent)
Determines if a row should be included in the view.
With recursive filtering enabled: - We only need to validate the leaf nodes (Emojis). - If we return True for an Emoji, its Category is auto-included. - If we return False for a Category, it is still shown if a child matches.
Source code in source/qextrawidgets/gui/proxys/emoji_picker_proxy.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
setFilterFixedString(pattern)
Overrides the base method to cache the lowercase pattern for faster comparison.
Source code in source/qextrawidgets/gui/proxys/emoji_picker_proxy.py
36 37 38 39 40 41 42 43 | |
QFormatProxyModel
Bases: QIdentityProxyModel
Proxy model that acts as a visual translator applying formatting masks to specific columns.
The class keeps the original data intact for editing and calculations, applying formatting only when the View requests data for display (DisplayRole).
Example
proxy = FormatProxyModel() proxy.setSourceModel(source_model)
Formatter for currency values
def format_currency(value): return f"R$ {value:,.2f}"
Register formatter on column 2
proxy.setColumnFormatter(2, format_currency)
table_view.setModel(proxy)
Source code in source/qextrawidgets/gui/proxys/format_proxy.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
__init__(parent=None)
Initializes the FormatProxyModel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Optional[Any]
|
Optional parent widget. |
None
|
Source code in source/qextrawidgets/gui/proxys/format_proxy.py
25 26 27 28 29 30 31 32 33 34 | |
clearAllFormatters()
Removes all registered formatters and updates the View.
Source code in source/qextrawidgets/gui/proxys/format_proxy.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
columnFormatter(column)
Returns the registered formatter for a specific column.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column
|
int
|
Column index. |
required |
Returns:
| Type | Description |
|---|---|
Optional[Callable[[Any], str]]
|
Formatter callable or None if no formatter is registered. |
Source code in source/qextrawidgets/gui/proxys/format_proxy.py
130 131 132 133 134 135 136 137 138 139 | |
data(index, role=Qt.ItemDataRole.DisplayRole)
Intercepts data requests to apply visual formatting.
Formatting is applied only when: 1. The requested role is DisplayRole 2. The index column has a registered formatter
For all other cases, delegates to the superclass implementation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
QModelIndex
|
Index of the item in the model. |
required |
role
|
int
|
Role defining the type of data requested. |
DisplayRole
|
Returns:
| Type | Description |
|---|---|
Any
|
Formatted data (if DisplayRole and column has formatter), |
Any
|
or original data from superclass. |
Source code in source/qextrawidgets/gui/proxys/format_proxy.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
setColumnFormatter(column, formatter)
Registers or updates the formatting function for a specific column.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column
|
int
|
Column index (0-based). |
required |
formatter
|
Optional[Callable[[Any], str]]
|
Callable that receives the raw value and returns the formatted string. If None, removes the formatter from the column. |
required |
Example
Add formatter
proxy.setColumnFormatter(0, lambda x: f"{x:04d}")
Remove formatter
proxy.setColumnFormatter(0, None)
Source code in source/qextrawidgets/gui/proxys/format_proxy.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
QHeaderProxyModel
Bases: QIdentityProxyModel
A proxy model that handles header data customizations, such as icons.
Source code in source/qextrawidgets/gui/proxys/header_proxy.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
headerData(section, orientation, role=Qt.ItemDataRole.DisplayRole)
Returns the header data for the given section and orientation.
Source code in source/qextrawidgets/gui/proxys/header_proxy.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
reset()
Resets the header icons.
Source code in source/qextrawidgets/gui/proxys/header_proxy.py
44 45 46 | |
setHeaderData(section, orientation, value, role=Qt.ItemDataRole.EditRole)
Sets the header data for the given section and orientation.
Source code in source/qextrawidgets/gui/proxys/header_proxy.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
QMultiFilterProxyModel
Bases: QSortFilterProxyModel
A proxy model that supports multiple filters per column.
Source code in source/qextrawidgets/gui/proxys/multi_filter_proxy.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
__init__(parent=None)
Initializes the multi-filter proxy model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
QObject
|
Parent object. Defaults to None. |
None
|
Source code in source/qextrawidgets/gui/proxys/multi_filter_proxy.py
10 11 12 13 14 15 16 17 | |
filterAcceptsRow(source_row, source_parent)
Determines if a row passes all column filters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_row
|
int
|
Row number. |
required |
source_parent
|
QModelIndex
|
Parent index. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the row matches all filters, False otherwise. |
Source code in source/qextrawidgets/gui/proxys/multi_filter_proxy.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
isColumnFiltered(col)
Returns True if the given column is filtered.
Source code in source/qextrawidgets/gui/proxys/multi_filter_proxy.py
38 39 40 | |
isFiltering()
Returns True if any filter is active.
Source code in source/qextrawidgets/gui/proxys/multi_filter_proxy.py
34 35 36 | |
reset()
Resets the filters.
Source code in source/qextrawidgets/gui/proxys/multi_filter_proxy.py
67 68 69 70 | |
setFilter(col, text_list)
Sets the list of allowed values for a specific column.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
col
|
int
|
Column index. |
required |
text_list
|
Iterable[str]
|
List of allowed string values. If None or empty, the filter is removed. |
required |
Source code in source/qextrawidgets/gui/proxys/multi_filter_proxy.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
QUniqueValuesProxyModel
Bases: QSortFilterProxyModel
A proxy model that filters rows to show only unique values from a specific column.
This is useful for creating filter lists where you want to show each available option exactly once, even if it appears multiple times in the source model.
Source code in source/qextrawidgets/gui/proxys/unique_values_proxy.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
filterAcceptsRow(source_row, source_parent)
Accepts the row only if it's the first occurrence of its value.
Source code in source/qextrawidgets/gui/proxys/unique_values_proxy.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
invalidateFilter()
Rebuilds the unique value cache and invalidates the filter.
Source code in source/qextrawidgets/gui/proxys/unique_values_proxy.py
63 64 65 66 | |
setTargetColumn(column)
Sets the column to filter for unique values.
Source code in source/qextrawidgets/gui/proxys/unique_values_proxy.py
24 25 26 27 28 | |
Validators
QEmojiValidator
Bases: QRegularExpressionValidator
A validator that only accepts text consisting exclusively of emojis.
Source code in source/qextrawidgets/gui/validators/emoji_validator.py
8 9 10 11 12 13 14 15 16 17 | |
__init__(parent=None)
Initializes the emoji validator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
QObject
|
Parent object. Defaults to None. |
None
|
Source code in source/qextrawidgets/gui/validators/emoji_validator.py
11 12 13 14 15 16 17 | |
Widgets
Buttons
QColorButton
Bases: QPushButton
A button that displays a specific color and automatically adjusts its text color for contrast.
Source code in source/qextrawidgets/widgets/buttons/color_button.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
__init__(color, text='', text_color=None, checked_color=None, parent=None)
Initializes the color button.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
(GlobalColor, QColor, str)
|
Background color of the button. |
required |
text
|
str
|
Button text. Defaults to "". |
''
|
text_color
|
(GlobalColor, QColor, str)
|
Text color. If None, it's calculated for contrast. Defaults to None. |
None
|
checked_color
|
(GlobalColor, QColor, str)
|
Color when the button is in checked state. Defaults to None. |
None
|
parent
|
QWidget
|
Parent widget. Defaults to None. |
None
|
Source code in source/qextrawidgets/widgets/buttons/color_button.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
checkedColor()
Returns the color used when the button is checked.
Returns:
| Type | Description |
|---|---|
Optional[QColor]
|
QColor, optional: Checked color or None. |
Source code in source/qextrawidgets/widgets/buttons/color_button.py
95 96 97 98 99 100 101 | |
color()
Returns the button background color.
Returns:
| Name | Type | Description |
|---|---|---|
QColor |
QColor
|
Background color. |
Source code in source/qextrawidgets/widgets/buttons/color_button.py
79 80 81 82 83 84 85 | |
initStyleOption(option)
Method called automatically by Qt before drawing the button.
Here we intercept the style option and change the palette color based on the current state (Hover, Pressed, etc).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
option
|
QStyleOptionButton
|
The style option to initialize. |
required |
Source code in source/qextrawidgets/widgets/buttons/color_button.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
setCheckedColor(color)
Sets the color to use when the button is checked.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
(GlobalColor, QColor, str, None)
|
New checked color. |
required |
Source code in source/qextrawidgets/widgets/buttons/color_button.py
103 104 105 106 107 108 109 110 111 112 | |
setColor(color)
Sets the button background color.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
(GlobalColor, QColor, str)
|
New background color. |
required |
Source code in source/qextrawidgets/widgets/buttons/color_button.py
87 88 89 90 91 92 93 | |
setTextColor(text_color)
Sets the text color.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text_color
|
(GlobalColor, QColor, str, None)
|
New text color. |
required |
Source code in source/qextrawidgets/widgets/buttons/color_button.py
122 123 124 125 126 127 128 129 130 131 | |
textColor()
Returns the text color.
Returns:
| Type | Description |
|---|---|
Optional[QColor]
|
QColor, optional: Text color or None if automatically calculated. |
Source code in source/qextrawidgets/widgets/buttons/color_button.py
114 115 116 117 118 119 120 | |
QColorToolButton
Bases: QToolButton
A tool button that displays a specific color and automatically adjusts its text color for contrast.
Source code in source/qextrawidgets/widgets/buttons/color_tool_button.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
__init__(color, text='', text_color=None, checked_color=None, parent=None)
Initializes the color tool button.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
(GlobalColor, QColor, str)
|
Background color of the button. |
required |
text
|
str
|
Button text. Defaults to "". |
''
|
text_color
|
(GlobalColor, QColor, str)
|
Text color. If None, it's calculated for contrast. Defaults to None. |
None
|
checked_color
|
(GlobalColor, QColor, str)
|
Color when the button is in checked state. Defaults to None. |
None
|
parent
|
QWidget
|
Parent widget. Defaults to None. |
None
|
Source code in source/qextrawidgets/widgets/buttons/color_tool_button.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
checkedColor()
Returns the color used when the button is checked.
Returns:
| Type | Description |
|---|---|
Optional[QColor]
|
QColor, optional: Checked color or None. |
Source code in source/qextrawidgets/widgets/buttons/color_tool_button.py
94 95 96 97 98 99 100 | |
color()
Returns the button background color.
Returns:
| Name | Type | Description |
|---|---|---|
QColor |
QColor
|
Background color. |
Source code in source/qextrawidgets/widgets/buttons/color_tool_button.py
78 79 80 81 82 83 84 | |
initStyleOption(option)
Method called automatically by Qt before drawing the button.
Here we intercept the style option and change the palette color based on the current state (Hover, Pressed, etc).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
option
|
QStyleOptionToolButton
|
The style option to initialize. |
required |
Source code in source/qextrawidgets/widgets/buttons/color_tool_button.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
setCheckedColor(color)
Sets the color to use when the button is checked.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
(GlobalColor, QColor, str, None)
|
New checked color. |
required |
Source code in source/qextrawidgets/widgets/buttons/color_tool_button.py
102 103 104 105 106 107 108 109 110 111 | |
setColor(color)
Sets the button background color.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color
|
(GlobalColor, QColor, str)
|
New background color. |
required |
Source code in source/qextrawidgets/widgets/buttons/color_tool_button.py
86 87 88 89 90 91 92 | |
setTextColor(text_color)
Sets the text color.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text_color
|
(GlobalColor, QColor, str, None)
|
New text color. |
required |
Source code in source/qextrawidgets/widgets/buttons/color_tool_button.py
121 122 123 124 125 126 127 128 129 130 | |
textColor()
Returns the text color.
Returns:
| Type | Description |
|---|---|
Optional[QColor]
|
QColor, optional: Text color or None if automatically calculated. |
Source code in source/qextrawidgets/widgets/buttons/color_tool_button.py
113 114 115 116 117 118 119 | |
Delegates
QGridIconDelegate
Bases: QStyledItemDelegate
Delegate for a grid view. Renders items as rounded grid cells containing ONLY icons or pixmaps.
Implements lazy loading signals for missing images.
Attributes:
| Name | Type | Description |
|---|---|---|
requestImage |
Signal
|
Emitted when an item needs an image loaded. Sends QPersistentModelIndex. |
_requested_indices |
Set[QPersistentModelIndex]
|
Cache of indices that already requested an image. |
Source code in source/qextrawidgets/widgets/delegates/grid_icon_delegate.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
__init__(parent=None, item_internal_margin_ratio=0.1)
Initialize the delegate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Optional[Any]
|
The parent object. |
None
|
item_internal_margin_ratio
|
float
|
Internal margin ratio (0.0 to 0.5). |
0.1
|
Source code in source/qextrawidgets/widgets/delegates/grid_icon_delegate.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
forceReload(index)
Clear the cache for a specific index to force re-requesting the image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
QModelIndex
|
The index to clear from the cache. |
required |
Source code in source/qextrawidgets/widgets/delegates/grid_icon_delegate.py
78 79 80 81 82 83 84 85 86 87 | |
forceReloadAll()
Clear the cache of ALL requested images.
The next time the view paints a missing image item (e.g. on scroll or hover), it will emit requestImage again.
Source code in source/qextrawidgets/widgets/delegates/grid_icon_delegate.py
69 70 71 72 73 74 75 76 | |
itemInternalMargin()
Get the internal margin ratio for the item content.
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
A value between 0.0 (0%) and 0.5 (50%). |
Source code in source/qextrawidgets/widgets/delegates/grid_icon_delegate.py
60 61 62 63 64 65 66 67 | |
paint(painter, option, index)
Paint the item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
painter
|
QPainter
|
The painter object. |
required |
option
|
QStyleOptionViewItem
|
Style options for rendering. |
required |
index
|
QModelIndex
|
The index of the item being painted. |
required |
Source code in source/qextrawidgets/widgets/delegates/grid_icon_delegate.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
setItemInternalMargin(ratio)
Set the internal margin ratio for the item content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ratio
|
float
|
A value between 0.0 (0%) and 0.5 (50%). |
required |
Source code in source/qextrawidgets/widgets/delegates/grid_icon_delegate.py
51 52 53 54 55 56 57 58 | |
QGroupedIconDelegate
Bases: QGridIconDelegate
Delegate for the QGroupedIconView. Renders categories as horizontal bars with expansion arrows and child items as rounded grid cells containing ONLY icons or pixmaps.
Implements lazy loading signals for missing images via QGridIconDelegate.
Source code in source/qextrawidgets/widgets/delegates/grouped_icon_delegate.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
__init__(parent=None, arrow_icon=None, item_internal_margin_ratio=0.1)
Initialize the delegate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Optional[Any]
|
The parent object. |
None
|
arrow_icon
|
Optional[QIcon]
|
Custom icon for the expansion arrow. If None, uses default primitive. |
None
|
item_internal_margin_ratio
|
float
|
Internal margin ratio (0.0 to 0.5). |
0.1
|
Source code in source/qextrawidgets/widgets/delegates/grouped_icon_delegate.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
arrowIcon()
Get the current arrow icon.
Returns:
| Name | Type | Description |
|---|---|---|
QIcon |
QIcon
|
The current arrow icon. |
Source code in source/qextrawidgets/widgets/delegates/grouped_icon_delegate.py
44 45 46 47 48 49 50 51 | |
paint(painter, option, index)
Paint the item.
Delegates to _draw_category for category items and _draw_grid_item (from base) for child items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
painter
|
QPainter
|
The painter object. |
required |
option
|
QStyleOptionViewItem
|
Style options for rendering. |
required |
index
|
QModelIndex
|
The index of the item being painted. |
required |
Source code in source/qextrawidgets/widgets/delegates/grouped_icon_delegate.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
setArrowIcon(icon)
Set the icon used for the expansion indicator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
|
QIcon
|
The new arrow icon. |
required |
Source code in source/qextrawidgets/widgets/delegates/grouped_icon_delegate.py
35 36 37 38 39 40 41 42 | |
Dialogs
QFilterPopup
Bases: QDialog
A popup dialog used for filtering and sorting columns in a QFilterableTable.
Provides options to sort data, search for specific values, and select/deselect items to be displayed in the table.
Source code in source/qextrawidgets/widgets/dialogs/filter_popup.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
__init__(model, column, parent=None)
Initializes the filter popup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
QAbstractItemModel
|
The source data model. |
required |
column
|
int
|
The column to filter. |
required |
parent
|
QWidget
|
Parent widget. Defaults to None. |
None
|
Source code in source/qextrawidgets/widgets/dialogs/filter_popup.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
getSelectedData()
Returns all checked items in the unique check proxy that are visible in the proxy model.
Returns:
| Type | Description |
|---|---|
Set[str]
|
Set[str]: Set of checked item texts. |
Source code in source/qextrawidgets/widgets/dialogs/filter_popup.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | |
isFiltering()
Checks if there is any unchecked item, indicating an active filter.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if any item is unchecked, False otherwise. |
Source code in source/qextrawidgets/widgets/dialogs/filter_popup.py
279 280 281 282 283 284 285 | |
setClearEnabled(enabled)
Sets the enabled state of the clear filter button.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
True to enable, False to disable. |
required |
Source code in source/qextrawidgets/widgets/dialogs/filter_popup.py
241 242 243 244 245 246 247 | |
Displays
QThemeResponsiveLabel
Bases: QLabel
A QLabel that displays a QThemeResponsiveIcon and updates it automatically when the system theme or the widget size changes.
Source code in source/qextrawidgets/widgets/displays/theme_responsive_label.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
__init__(parent=None)
Initializes the label.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Optional[QWidget]
|
The parent widget. |
None
|
Source code in source/qextrawidgets/widgets/displays/theme_responsive_label.py
16 17 18 19 20 21 22 23 24 25 26 | |
icon()
Returns the current icon.
Returns:
| Type | Description |
|---|---|
Optional[QThemeResponsiveIcon]
|
The current icon or None. |
Source code in source/qextrawidgets/widgets/displays/theme_responsive_label.py
64 65 66 67 68 69 70 71 | |
resizeEvent(event)
Updates the pixmap when the widget is resized.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QResizeEvent
|
The resize event. |
required |
Source code in source/qextrawidgets/widgets/displays/theme_responsive_label.py
44 45 46 47 48 49 50 51 52 | |
setIcon(icon)
Sets the icon to be displayed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
|
QThemeResponsiveIcon
|
The theme-responsive icon. |
required |
Source code in source/qextrawidgets/widgets/displays/theme_responsive_label.py
54 55 56 57 58 59 60 61 62 | |
Inputs
QExtraTextEdit
Bases: QTextEdit
A QTextEdit extension that supports auto-resizing based on content and input validation.
Source code in source/qextrawidgets/widgets/inputs/extra_text_edit.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
__init__(parent=None)
Initializes the text edit widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
QWidget
|
Parent widget. Defaults to None. |
None
|
Source code in source/qextrawidgets/widgets/inputs/extra_text_edit.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
insertFromMimeData(source)
Handles insertion from MIME data (pasting) and applies validation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
QMimeData
|
MIME data to insert. |
required |
Source code in source/qextrawidgets/widgets/inputs/extra_text_edit.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
isResponsive()
Returns whether the widget automatically resizes based on content.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if responsive, False otherwise. |
Source code in source/qextrawidgets/widgets/inputs/extra_text_edit.py
62 63 64 65 66 67 68 | |
keyPressEvent(event)
Handles key press events and applies validation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QKeyEvent
|
Key event. |
required |
Source code in source/qextrawidgets/widgets/inputs/extra_text_edit.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | |
maximumHeight()
Returns the maximum height the widget can grow to.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Maximum height in pixels. |
Source code in source/qextrawidgets/widgets/inputs/extra_text_edit.py
96 97 98 99 100 101 102 | |
setMaximumHeight(height)
Sets the maximum height the widget can grow to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
height
|
int
|
Maximum height in pixels. |
required |
Source code in source/qextrawidgets/widgets/inputs/extra_text_edit.py
104 105 106 107 108 109 110 111 112 113 | |
setResponsive(responsive=True)
Sets whether the widget should automatically resize based on content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
responsive
|
bool
|
True to enable auto-resize. Defaults to True. |
True
|
Source code in source/qextrawidgets/widgets/inputs/extra_text_edit.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
setValidator(validator)
Sets a validator for the input text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
validator
|
(QValidator, None)
|
The validator to use. |
required |
Source code in source/qextrawidgets/widgets/inputs/extra_text_edit.py
115 116 117 118 119 120 121 | |
sizeHint()
Informs the layout of the ideal size of the widget at this moment.
Returns:
| Name | Type | Description |
|---|---|---|
QSize |
QSize
|
The suggested size for the widget. |
Source code in source/qextrawidgets/widgets/inputs/extra_text_edit.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
validator()
Returns the current input validator.
Returns:
| Type | Description |
|---|---|
Optional[QValidator]
|
QValidator, None: The current validator. |
Source code in source/qextrawidgets/widgets/inputs/extra_text_edit.py
123 124 125 126 127 128 129 | |
QIconComboBox
Bases: QToolButton
A widget similar to QComboBox but optimized for icons or short text.
It maintains a 1:1 aspect ratio and the style of a QToolButton.
Signals
currentIndexChanged (int): Emitted when the current index changes. currentDataChanged (object): Emitted when the data of the current item changes.
Source code in source/qextrawidgets/widgets/inputs/icon_combo_box.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
__init__(parent=None, size=40)
Initializes the icon combo box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
QWidget
|
Parent widget. Defaults to None. |
None
|
size
|
int
|
Size of the button (width and height). Defaults to 40. |
40
|
Source code in source/qextrawidgets/widgets/inputs/icon_combo_box.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
addItem(icon=None, text=None, data=None, font=None)
Adds an item to the menu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
|
Union[QIcon, str, QPixmap]
|
Item icon, theme icon name, or QPixmap. Defaults to None. |
None
|
text
|
str
|
Item text. Defaults to None. |
None
|
data
|
Any
|
Custom data associated with the item. Defaults to None. |
None
|
font
|
QFont
|
Custom font for the item. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The index of the added item. |
Source code in source/qextrawidgets/widgets/inputs/icon_combo_box.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | |
clear()
Removes all items from the combo box.
Source code in source/qextrawidgets/widgets/inputs/icon_combo_box.py
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
count()
Returns the number of items in the combo box.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Number of items. |
Source code in source/qextrawidgets/widgets/inputs/icon_combo_box.py
275 276 277 278 279 280 281 | |
currentData()
Returns the data associated with the current item.
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
Current item data or None. |
Source code in source/qextrawidgets/widgets/inputs/icon_combo_box.py
143 144 145 146 147 148 149 150 151 | |
currentIndex()
Returns the current index.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Current index. |
Source code in source/qextrawidgets/widgets/inputs/icon_combo_box.py
135 136 137 138 139 140 141 | |
itemData(index)
Returns the data associated with the item at the given index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
Item index. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
Item data or None. |
Source code in source/qextrawidgets/widgets/inputs/icon_combo_box.py
153 154 155 156 157 158 159 160 161 162 163 164 | |
itemFont(index)
Returns the font of the item at the given index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
Item index. |
required |
Returns:
| Type | Description |
|---|---|
Optional[QFont]
|
QFont, optional: Item font or None. |
Source code in source/qextrawidgets/widgets/inputs/icon_combo_box.py
179 180 181 182 183 184 185 186 187 188 189 190 | |
itemIcon(index)
Returns the icon of the item at the given index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
Item index. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
QIcon |
QIcon
|
Item icon. |
Source code in source/qextrawidgets/widgets/inputs/icon_combo_box.py
250 251 252 253 254 255 256 257 258 259 260 261 | |
itemText(index)
Returns the text of the item at the given index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
Item index. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Item text. |
Source code in source/qextrawidgets/widgets/inputs/icon_combo_box.py
209 210 211 212 213 214 215 216 217 218 219 220 | |
setCurrentIndex(index)
Sets the current index and updates the main button.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
Index to set as current. |
required |
Source code in source/qextrawidgets/widgets/inputs/icon_combo_box.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
setItemData(index, data)
Sets the data associated with the item at the given index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
Item index. |
required |
data
|
Any
|
New data. |
required |
Source code in source/qextrawidgets/widgets/inputs/icon_combo_box.py
263 264 265 266 267 268 269 270 271 272 273 | |
setItemFont(index, font)
Sets the font for the item at the given index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
Item index. |
required |
font
|
QFont
|
New font. |
required |
Source code in source/qextrawidgets/widgets/inputs/icon_combo_box.py
166 167 168 169 170 171 172 173 174 175 176 177 | |
setItemIcon(index, icon)
Sets the icon for the item at the given index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
Item index. |
required |
icon
|
Union[QIcon, str, QPixmap]
|
New icon, theme icon name, or QPixmap. |
required |
Source code in source/qextrawidgets/widgets/inputs/icon_combo_box.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
setItemText(index, text)
Sets the text for the item at the given index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
Item index. |
required |
text
|
str
|
New text. |
required |
Source code in source/qextrawidgets/widgets/inputs/icon_combo_box.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
QPasswordLineEdit
Bases: QLineEdit
A line edit widget for passwords with a built-in toggle button to show/hide the text.
Source code in source/qextrawidgets/widgets/inputs/password_line_edit.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
__init__(parent=None)
Initializes the password line edit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
QWidget
|
Parent widget. Defaults to None. |
None
|
Source code in source/qextrawidgets/widgets/inputs/password_line_edit.py
11 12 13 14 15 16 17 18 19 20 21 22 | |
isPasswordHidden()
Checks if the password is currently hidden (EchoMode.Password).
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if hidden, False otherwise. |
Source code in source/qextrawidgets/widgets/inputs/password_line_edit.py
24 25 26 27 28 29 30 | |
setPasswordHidden(hide)
Sets whether the password should be hidden or visible.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hide
|
bool
|
True to hide the password, False to show it. |
required |
Source code in source/qextrawidgets/widgets/inputs/password_line_edit.py
32 33 34 35 36 37 38 39 40 41 42 43 | |
QSearchLineEdit
Bases: QLineEdit
A search line edit with a magnifying glass icon and a clear button.
Source code in source/qextrawidgets/widgets/inputs/search_line_edit.py
7 8 9 10 11 12 13 14 15 16 17 18 | |
__init__(parent=None)
Initializes the search line edit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
QWidget
|
Parent widget. Defaults to None. |
None
|
Source code in source/qextrawidgets/widgets/inputs/search_line_edit.py
10 11 12 13 14 15 16 17 18 | |
Menus
QEmojiPickerMenu
Bases: QMenu
A menu that displays a QEmojiPicker.
Signals
picked (str): Emitted when an emoji is selected.
Source code in source/qextrawidgets/widgets/menus/emoji_picker_menu.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
__init__(parent=None, model=None, emoji_pixmap_getter=partial(QTwemojiImageProvider.getPixmap, margin=0, size=128), emoji_label_size=QSize(32, 32))
Initialize the emoji picker menu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
QWidget
|
The parent widget. |
None
|
model
|
QEmojiPickerModel
|
Custom emoji model. Defaults to None. |
None
|
emoji_pixmap_getter
|
Union[str, QFont, Callable[[str], QPixmap]]
|
Method or font to generate emoji pixmaps. Defaults to EmojiImageProvider.getPixmap. |
partial(getPixmap, margin=0, size=128)
|
emoji_label_size
|
QSize
|
Size of the preview emoji label. Defaults to QSize(32, 32). |
QSize(32, 32)
|
Source code in source/qextrawidgets/widgets/menus/emoji_picker_menu.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
picker()
Returns the internal emoji picker widget.
Returns:
| Name | Type | Description |
|---|---|---|
QEmojiPicker |
QEmojiPicker
|
The emoji picker widget. |
Source code in source/qextrawidgets/widgets/menus/emoji_picker_menu.py
47 48 49 50 51 52 53 | |
Miscellaneous
QAccordionHeader
Bases: QFrame
Header widget for an accordion item.
Signals
clicked: Emitted when the header is clicked.
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_header.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
IndicatorStyle
Bases: IntEnum
Style of the expansion indicator icon.
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_header.py
23 24 25 26 | |
__init__(title='', parent=None, flat=False, icon_style=IndicatorStyle.Arrow, icon_position=IconPosition.LeadingPosition)
Initializes the accordion header.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Header title. Defaults to "". |
''
|
parent
|
QWidget
|
Parent widget. Defaults to None. |
None
|
flat
|
bool
|
Whether the header is flat. Defaults to False. |
False
|
icon_style
|
IndicatorStyle
|
Icon style. Defaults to Arrow. |
Arrow
|
icon_position
|
IconPosition
|
Icon position. Defaults to LeadingPosition. |
LeadingPosition
|
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_header.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
closeEvent(event)
Disconnects signals to prevent crashes on destruction.
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_header.py
74 75 76 77 78 | |
iconWidget()
Returns the icon widget.
Returns:
| Name | Type | Description |
|---|---|---|
QWidget |
QWidget
|
Icon widget. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_header.py
192 193 194 195 196 197 198 199 | |
isExpanded()
Returns whether the header is in expanded state.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if expanded, False otherwise. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_header.py
120 121 122 123 124 125 126 | |
isFlat()
Returns whether the header is flat.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if flat, False otherwise. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_header.py
93 94 95 96 97 98 99 | |
mousePressEvent(event)
Handles mouse press events.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QMouseEvent
|
Mouse event. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_header.py
101 102 103 104 105 106 107 108 109 | |
refreshLayout()
Refreshes the layout based on icon position.
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_header.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
setExpanded(expanded)
Sets the expanded state and updates the icon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expanded
|
bool
|
True to show expanded state, False for collapsed. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_header.py
111 112 113 114 115 116 117 118 | |
setFlat(flat)
Defines whether the header looks like a raised button or plain text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flat
|
bool
|
True for flat (plain text), False for raised button. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_header.py
80 81 82 83 84 85 86 87 88 89 90 91 | |
setIconPosition(position)
Sets the position of the expansion icon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
IconPosition
|
Position (Leading or Trailing). |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_header.py
151 152 153 154 155 156 157 158 159 | |
setIconStyle(style)
Sets the expansion indicator icon style.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
style
|
IndicatorStyle
|
Icon style (Arrow or PlusMinus). |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_header.py
128 129 130 131 132 133 134 135 136 | |
setTitle(title)
Sets the header title.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
New title text. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_header.py
176 177 178 179 180 181 182 | |
titleLabel()
Returns the title label widget.
Returns:
| Name | Type | Description |
|---|---|---|
QLabel |
QLabel
|
Title label. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_header.py
184 185 186 187 188 189 190 | |
updateIcon()
Updates the icon using QThemeResponsiveIcon to ensure dynamic colors.
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_header.py
138 139 140 141 142 143 144 145 146 147 148 149 | |
QAccordionItem
Bases: QWidget
Accordion item with optional smooth expand/collapse animation.
Signals
expandedChanged (bool): Emitted when the expanded state changes.
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_item.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
__init__(title, content_widget, parent=None, expanded=False, flat=False, icon_style=QAccordionHeader.IndicatorStyle.Arrow, icon_position=QAccordionHeader.IconPosition.LeadingPosition, animation_enabled=False, animation_duration=200, animation_easing=QEasingCurve.Type.InOutQuart)
Initializes the accordion item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Section title. |
required |
content_widget
|
QWidget
|
Content widget to be shown/hidden. |
required |
parent
|
QWidget
|
Parent widget. Defaults to None. |
None
|
expanded
|
bool
|
Initial expansion state. Defaults to False. |
False
|
flat
|
bool
|
Whether the header is flat. Defaults to False. |
False
|
icon_style
|
IndicatorStyle
|
Icon style. Defaults to Arrow. |
Arrow
|
icon_position
|
IconPosition
|
Icon position. Defaults to LeadingPosition. |
LeadingPosition
|
animation_enabled
|
bool
|
Whether animations are enabled. Defaults to True. |
False
|
animation_duration
|
int
|
Animation duration in ms. Defaults to 200. |
200
|
animation_easing
|
Type
|
Animation easing curve. Defaults to InOutQuart. |
InOutQuart
|
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_item.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
animationDuration()
Returns the animation duration in milliseconds.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Animation duration. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_item.py
184 185 186 187 188 189 190 | |
animationEasing()
Returns the animation easing curve.
Returns:
| Type | Description |
|---|---|
Type
|
QEasingCurve.Type: The easing curve. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_item.py
200 201 202 203 204 205 206 | |
content()
Returns the content widget.
Returns:
| Name | Type | Description |
|---|---|---|
QWidget |
QWidget
|
Content widget. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_item.py
236 237 238 239 240 241 242 | |
header()
Returns the header widget.
Returns:
| Name | Type | Description |
|---|---|---|
QAccordionHeader |
QAccordionHeader
|
Header widget. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_item.py
244 245 246 247 248 249 250 | |
isAnimationEnabled()
Returns whether animations are enabled.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if animations are enabled, False otherwise. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_item.py
168 169 170 171 172 173 174 | |
isExpanded()
Returns whether the item is expanded.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if expanded, False otherwise. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_item.py
150 151 152 153 154 155 156 | |
setAnimationDuration(duration)
Sets the animation duration in milliseconds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
int
|
Duration in milliseconds (typical range: 100-500). |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_item.py
176 177 178 179 180 181 182 | |
setAnimationEasing(easing)
Sets the animation easing curve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
easing
|
Type
|
QEasingCurve.Type (e.g., InOutQuart, OutCubic, Linear). |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_item.py
192 193 194 195 196 197 198 | |
setAnimationEnabled(enabled)
Enable or disable animations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
True to enable animations, False to disable. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_item.py
160 161 162 163 164 165 166 | |
setExpanded(expanded, animated=False)
Sets the expanded state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expanded
|
bool
|
True to expand, False to collapse. |
required |
animated
|
bool
|
Override animation setting for this call. If None, uses the widget's setting. Defaults to None. |
False
|
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_item.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
setFlat(flat)
Sets whether the header is flat or raised.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flat
|
bool
|
True for flat, False for raised. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_item.py
226 227 228 229 230 231 232 | |
setIconPosition(position)
Sets the icon position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
IconPosition
|
Position (Leading or Trailing). |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_item.py
210 211 212 213 214 215 216 | |
setIconStyle(style)
Sets the icon style.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
style
|
IndicatorStyle
|
Icon style (Arrow or PlusMinus). |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_item.py
218 219 220 221 222 223 224 | |
setTitle(text)
Sets the item title.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
New title text. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_item.py
86 87 88 89 90 91 92 | |
toggle()
Toggles the expanded state.
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion_item.py
82 83 84 | |
QAccordion
Bases: QWidget
Accordion widget with optional smooth animations.
A container that organizes content into collapsible sections. Supports multiple accordion items with expand/collapse animations, customizable styling (flat/raised, icon style, icon position), and vertical alignment control.
Signals
enteredSection (QAccordionItem): Emitted when a section is scrolled into view. leftSection (QAccordionItem): Emitted when a section is scrolled out of view.
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | |
__init__(parent=None, items_alignment=Qt.AlignmentFlag.AlignTop, items_flat=False, items_icon_style=QAccordionHeader.IndicatorStyle.Arrow, items_icon_position=QAccordionHeader.IconPosition.LeadingPosition, animation_enabled=False, animation_duration=200, animation_easing=QEasingCurve.Type.InOutQuart)
Initializes the accordion widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
QWidget
|
Parent widget. Defaults to None. |
None
|
items_alignment
|
AlignmentFlag
|
Vertical alignment of items. Defaults to AlignTop. |
AlignTop
|
items_flat
|
bool
|
Whether items are flat. Defaults to False. |
False
|
items_icon_style
|
IndicatorStyle
|
Icon style. Defaults to Arrow. |
Arrow
|
items_icon_position
|
IconPosition
|
Icon position. Defaults to LeadingPosition. |
LeadingPosition
|
animation_enabled
|
bool
|
Whether animations are enabled. Defaults to False. |
False
|
animation_duration
|
int
|
Animation duration in ms. Defaults to 200. |
200
|
animation_easing
|
Type
|
Animation easing curve. Defaults to InOutQuart. |
InOutQuart
|
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
addAccordionItem(item)
Adds an existing accordion item at the end.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
item
|
QAccordionItem
|
Accordion item to add. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
153 154 155 156 157 158 159 | |
addSection(title, widget, name=None)
Creates and adds a new accordion section at the end.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Section title. |
required |
widget
|
QWidget
|
Content widget. |
required |
name
|
str
|
Unique name for the section. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
QAccordionItem |
QAccordionItem
|
The created accordion item. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
animationDuration()
Returns the default animation duration.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Animation duration in milliseconds. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
349 350 351 352 353 354 355 | |
animationEasing()
Returns the default animation easing curve.
Returns:
| Type | Description |
|---|---|
Type
|
QEasingCurve.Type: The easing curve type. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
367 368 369 370 371 372 373 | |
collapseAll(animated=False)
Collapses all accordion items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
animated
|
bool
|
Override animation setting. If None, uses each item's setting. Defaults to None. |
False
|
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
386 387 388 389 390 391 392 393 | |
expandAll(animated=False)
Expands all accordion items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
animated
|
bool
|
Override animation setting. If None, uses each item's setting. Defaults to None. |
False
|
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
377 378 379 380 381 382 383 384 | |
insertAccordionItem(item, position=-1)
Inserts an existing accordion item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
item
|
QAccordionItem
|
Accordion item to insert. |
required |
position
|
int
|
Insert position (-1 for end). Defaults to -1. |
-1
|
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | |
insertSection(title, widget, position=-1, expanded=False, name=None)
Creates and inserts a new accordion section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Section title. |
required |
widget
|
QWidget
|
Content widget. |
required |
position
|
int
|
Insert position (-1 for end). Defaults to -1. |
-1
|
expanded
|
bool
|
Whether the section is expanded. Defaults to False. |
False
|
name
|
str
|
Unique name for the section. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
QAccordionItem |
QAccordionItem
|
The created accordion item. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
isAnimationEnabled()
Checks if animations are enabled by default.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if animations are enabled, False otherwise. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
331 332 333 334 335 336 337 | |
isAutoStretch()
Returns whether auto-stretch is enabled.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if enabled, False otherwise. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
97 98 99 100 101 102 103 | |
item(name)
Retrieves an accordion item by its name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the item to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
Optional[QAccordionItem]
|
Optional[QAccordionItem]: The item with the matching name, or None if not found. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
249 250 251 252 253 254 255 256 257 258 259 260 261 | |
items()
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
263 264 265 | |
itemsAlignment()
Returns the current vertical alignment of the accordion items.
Returns:
| Type | Description |
|---|---|
AlignmentFlag
|
Qt.AlignmentFlag: The current alignment. |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
311 312 313 314 315 316 317 | |
removeAccordionItem(item)
Removes an accordion item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
item
|
QAccordionItem
|
Accordion item to remove. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
240 241 242 243 244 245 246 247 | |
resetScroll()
Scrolls to the top of the accordion.
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
408 409 410 | |
scrollToItem(target_item)
Scrolls to make the target item visible.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_item
|
QAccordionItem
|
The item to scroll to. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
397 398 399 400 401 402 403 404 405 406 | |
setAnimationDuration(duration)
Sets the animation duration in milliseconds for all items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
int
|
Duration in milliseconds (typical: 100-500). |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
339 340 341 342 343 344 345 346 347 | |
setAnimationEasing(easing)
Sets the animation easing curve for all items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
easing
|
Type
|
The easing curve type. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
357 358 359 360 361 362 363 364 365 | |
setAnimationEnabled(enabled)
Enables or disables animations for all items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
True to enable animations, False to disable. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
321 322 323 324 325 326 327 328 329 | |
setAutoStretch(enabled)
Sets whether expanded items should automatically stretch to fill available space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
True to enable auto-stretch, False to disable. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
83 84 85 86 87 88 89 90 91 92 93 94 95 | |
setFlat(flat)
Sets whether headers are flat or raised for all items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flat
|
bool
|
True for flat headers, False for raised. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
289 290 291 292 293 294 295 296 297 | |
setIconPosition(position)
Changes the icon position of all items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
IconPosition
|
New icon position. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
269 270 271 272 273 274 275 276 277 | |
setIconStyle(style)
Changes the icon style of all items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
style
|
IndicatorStyle
|
New icon style. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
279 280 281 282 283 284 285 286 287 | |
setItemsAlignment(alignment)
Sets the vertical alignment of the accordion items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alignment
|
AlignmentFlag
|
The alignment (AlignTop, AlignVCenter, AlignBottom). |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
299 300 301 302 303 304 305 306 307 308 309 | |
setSectionTitle(index, title)
Sets the title of the section at the given index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
Index of the section. |
required |
title
|
str
|
New title for the section. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/accordion/accordion.py
129 130 131 132 133 134 135 136 | |
QDualList
Bases: QWidget
Base class containing layout structure and business logic for a dual list selection widget.
Instantiates widgets via factory methods (create*) to allow visual customization in child classes.
Signals
selectionChanged (list): Emitted when the selected items change.
Source code in source/qextrawidgets/widgets/miscellaneous/dual_list.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | |
__init__(parent=None)
Initializes the dual list widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
QWidget
|
Parent widget. Defaults to None. |
None
|
Source code in source/qextrawidgets/widgets/miscellaneous/dual_list.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
getSelectedItems()
Returns the list of currently selected items.
Returns:
| Type | Description |
|---|---|
List[str]
|
List[str]: List of selected strings. |
Source code in source/qextrawidgets/widgets/miscellaneous/dual_list.py
239 240 241 242 243 244 245 | |
setAvailableItems(items)
Sets the list of available items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
List[str]
|
List of strings to display in available list. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/dual_list.py
227 228 229 230 231 232 233 234 235 236 237 | |
setSelectedItems(items)
Sets the list of selected items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
List[str]
|
List of strings to display in selected list. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/dual_list.py
247 248 249 250 251 252 253 254 255 | |
QEmojiPicker
Bases: QWidget
A comprehensive emoji picker widget.
Features categories, search, skin tone selection, and recent/favorite emojis.
Signals
picked (str): Emitted when an emoji is selected.
Source code in source/qextrawidgets/widgets/miscellaneous/emoji_picker.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | |
__init__(model=None, emoji_pixmap_getter=partial(QTwemojiImageProvider.getPixmap, margin=0, size=128), emoji_label_size=QSize(32, 32))
Initializes the emoji picker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
QEmojiPickerModel
|
Custom emoji model. Defaults to None. |
None
|
emoji_pixmap_getter
|
Union[str, QFont, Callable[[str], QPixmap]]
|
Method or font to generate emoji pixmaps. Defaults to EmojiImageProvider.getPixmap. |
partial(getPixmap, margin=0, size=128)
|
emoji_label_size
|
QSize
|
Size of the preview emoji label. Defaults to QSize(32, 32). |
QSize(32, 32)
|
Source code in source/qextrawidgets/widgets/miscellaneous/emoji_picker.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
delegate()
Returns the item delegate used by the view.
Source code in source/qextrawidgets/widgets/miscellaneous/emoji_picker.py
495 496 497 | |
emojiPixmapGetter()
Returns the current emoji pixmap getter function.
Returns:
| Type | Description |
|---|---|
Callable[[str], QPixmap]
|
Callable[[str], QPixmap]: A function that takes an emoji string and returns a QPixmap. |
Source code in source/qextrawidgets/widgets/miscellaneous/emoji_picker.py
487 488 489 490 491 492 493 | |
model()
Returns the emoji picker model.
Source code in source/qextrawidgets/widgets/miscellaneous/emoji_picker.py
503 504 505 | |
resetPicker()
Resets the picker state.
Source code in source/qextrawidgets/widgets/miscellaneous/emoji_picker.py
446 447 448 | |
setEmojiPixmapGetter(emoji_pixmap_getter)
Sets the strategy for retrieving emoji pixmaps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emoji_pixmap_getter
|
Union[str, QFont, Callable[[str], QPixmap]]
|
Can be a font family name (str), a QFont object, or a callable that takes an emoji string and returns a QPixmap. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/emoji_picker.py
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | |
translateUI()
Translates the UI components.
Source code in source/qextrawidgets/widgets/miscellaneous/emoji_picker.py
442 443 444 | |
view()
Returns the internal grouped icon view.
Source code in source/qextrawidgets/widgets/miscellaneous/emoji_picker.py
499 500 501 | |
QPager
Bases: QWidget
Pagination component with a sliding window of buttons and in-place editing.
Signals
currentPageChanged (int): Emitted when the current page changes.
Source code in source/qextrawidgets/widgets/miscellaneous/pager.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
__init__(parent=None)
Initializes the pager widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
QWidget
|
Parent widget. Defaults to None. |
None
|
Source code in source/qextrawidgets/widgets/miscellaneous/pager.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
__on_edit_requested(button_sender)
Slot called when the user clicks on the current page to start editing.
Replaces the button with a SpinBox.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
button_sender
|
QPushButton
|
The button that was clicked. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/pager.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
currentPage()
Returns the current page index.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Current page. |
Source code in source/qextrawidgets/widgets/miscellaneous/pager.py
272 273 274 275 276 277 278 | |
setCurrentPage(page)
Sets the current page index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page
|
int
|
Page index to set. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/pager.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
setTotalPages(total)
Sets the total number of pages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
total
|
int
|
Total page count. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/pager.py
211 212 213 214 215 216 217 218 219 220 221 222 223 | |
setVisibleButtonCount(count)
Sets how many page buttons are visible at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count
|
int
|
Maximum number of visible page buttons. |
required |
Source code in source/qextrawidgets/widgets/miscellaneous/pager.py
233 234 235 236 237 238 239 240 241 242 | |
totalPages()
Returns the total number of pages.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Total page count. |
Source code in source/qextrawidgets/widgets/miscellaneous/pager.py
225 226 227 228 229 230 231 | |
visibleButtonCount()
Returns the maximum number of visible page buttons.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Visible button count. |
Source code in source/qextrawidgets/widgets/miscellaneous/pager.py
244 245 246 247 248 249 250 | |
Views
QFilterHeaderView
Bases: QHeaderView
A customized horizontal header for QFilterableTable that renders filter icons.
This header overrides the default painting to draw a filter icon on the right side of the section if the model provides one via the DecorationRole.
Source code in source/qextrawidgets/widgets/views/filter_header_view.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
__init__(orientation, parent=None)
Initializes the filter header.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
orientation
|
Orientation
|
Orientation of the header (Horizontal). |
required |
parent
|
QHeaderView
|
Parent widget. Defaults to None. |
None
|
Source code in source/qextrawidgets/widgets/views/filter_header_view.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
leaveEvent(e)
Resets hover position when mouse leaves the header.
Source code in source/qextrawidgets/widgets/views/filter_header_view.py
59 60 61 62 63 | |
mouseMoveEvent(e)
Updates hover position and triggers repaint.
Source code in source/qextrawidgets/widgets/views/filter_header_view.py
52 53 54 55 56 57 | |
mousePressEvent(e)
Stores the position of the click to detect drags.
Source code in source/qextrawidgets/widgets/views/filter_header_view.py
65 66 67 68 69 | |
mouseReleaseEvent(e)
Handles mouse release to manually trigger click signals.
Source code in source/qextrawidgets/widgets/views/filter_header_view.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
paintSection(painter, rect, logical_index)
Paints the header section with an optional filter icon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
painter
|
QPainter
|
The painter to use. |
required |
rect
|
QRect
|
The rectangle to paint in. |
required |
logical_index
|
int
|
The logical index of the section. |
required |
Source code in source/qextrawidgets/widgets/views/filter_header_view.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
QFilterableTableView
Bases: QTableView
A QTableView extension that provides Excel-style filtering and sorting on headers.
Source code in source/qextrawidgets/widgets/views/filterable_table_view.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
__init__(parent=None)
Initializes the filterable table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
QWidget
|
Parent widget. Defaults to None. |
None
|
Source code in source/qextrawidgets/widgets/views/filterable_table_view.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
model()
Returns the source model (not the proxy).
Returns:
| Name | Type | Description |
|---|---|---|
QAbstractItemModel |
QAbstractItemModel
|
The source model. |
Source code in source/qextrawidgets/widgets/views/filterable_table_view.py
61 62 63 64 65 66 67 | |
setModel(model)
Sets the source model for the table and initializes filters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Optional[QAbstractItemModel]
|
The data model to display. |
required |
Source code in source/qextrawidgets/widgets/views/filterable_table_view.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
QGridIconView
Bases: QAbstractItemView
A custom item view that displays items in a grid layout.
Uses QPersistentModelIndex for internal caching and QTimer for layout debouncing.
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 | |
__init__(parent=None, icon_size=QSize(100, 100), margin=8)
Initialize the QGridIconView.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Optional[QWidget]
|
The parent widget. |
None
|
icon_size
|
QSize
|
The size of the icons in the grid. Defaults to 100x100. |
QSize(100, 100)
|
margin
|
int
|
The margin between items. Defaults to 8. |
8
|
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
horizontalOffset()
Return the horizontal offset of the view (always 0 for this view).
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
555 556 557 | |
indexAt(point)
Return the model index of the item at the viewport coordinates point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
point
|
QPoint
|
The coordinates in the viewport. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
QModelIndex |
QModelIndex
|
The index at the given point, or valid if not found. |
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | |
isIndexHidden(index)
Return True if the item referred to by index is hidden; otherwise returns False.
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
632 633 634 635 636 637 638 639 640 641 642 | |
itemDelegate(_=None)
Returns the item delegate used by the view.
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
88 89 90 91 92 | |
leaveEvent(event)
Handle mouse leave events to reset hover state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QEvent
|
The leave event. |
required |
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
365 366 367 368 369 370 371 372 373 374 375 376 | |
margin()
Get the current margin between items.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The current margin in pixels. |
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
116 117 118 119 120 121 122 123 | |
mouseMoveEvent(event)
Handle mouse move events to track hover state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QMouseEvent
|
The mouse event. |
required |
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
355 356 357 358 359 360 361 362 363 | |
mousePressEvent(event)
Handle mouse press events.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QMouseEvent
|
The mouse event. |
required |
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | |
moveCursor(cursor_action, modifiers)
Move the cursor in response to key navigation (Not implemented).
Returns:
| Name | Type | Description |
|---|---|---|
QModelIndex |
QModelIndex
|
An invalid index. |
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
563 564 565 566 567 568 569 570 | |
paintEvent(event)
Paint the items in the view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QPaintEvent
|
The paint event. |
required |
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | |
scrollTo(index, hint=QAbstractItemView.ScrollHint.EnsureVisible)
Scroll the view to ensure the item at index is visible.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
QModelIndex | QPersistentModelIndex
|
The index to scroll to. |
required |
hint
|
ScrollHint
|
The scroll hint. |
EnsureVisible
|
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | |
setIconSize(size)
Set the size of the icons in the grid view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
QSize
|
The new size for the icons. |
required |
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
94 95 96 97 98 99 100 101 102 | |
setMargin(margin)
Set the margin between items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
margin
|
int
|
The new margin value in pixels. |
required |
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
104 105 106 107 108 109 110 111 112 113 114 | |
setModel(model)
Set the model for the view.
Connects to necessary signals for handling layout updates and structural changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Optional[QAbstractItemModel]
|
The model to be set. |
required |
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | |
setRowHidden(row, hidden)
Hide/show the row from the user view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
int
|
The row to hide/show. |
required |
hidden
|
bool
|
Whether the row should be hidden. |
required |
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
setSelection(rect, command)
Apply selection to items within the rectangle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rect
|
QRect
|
The rectangle in viewport coordinates. |
required |
command
|
SelectionFlag
|
The selection command. |
required |
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 | |
updateGeometries()
Recalculate the layout of item rectangles and update scrollbars. Assumes a flat model structure.
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | |
verticalOffset()
Return the vertical offset of the view.
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
559 560 561 | |
visualRect(index)
Return the rectangle on the viewport occupied by the item at index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
QModelIndex | QPersistentModelIndex
|
The index of the item. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
QRect |
QRect
|
The visual rectangle. |
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | |
visualRegionForSelection(selection)
Return the region covered by the selection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selection
|
QItemSelection
|
The selection to get the region for. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
QRegion |
QRegion
|
The region covered by the selection in viewport coordinates. |
Source code in source/qextrawidgets/widgets/views/grid_icon_view.py
605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 | |
QGroupedIconView
Bases: QGridIconView
A custom item view that displays categories as headers (accordion style) and children items in a grid layout using icons.
Uses QPersistentModelIndex for internal caching and QTimer for layout debouncing. The expansion state is stored in the model using ExpansionStateRole.
Source code in source/qextrawidgets/widgets/views/grouped_icon_view.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | |
__init__(parent=None, icon_size=QSize(100, 100), margin=8, header_height=36)
Initialize the QGroupedIconView.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Optional[QWidget]
|
The parent widget. |
None
|
icon_size
|
QSize
|
The size of the icons in the grid. Defaults to 100x100. |
QSize(100, 100)
|
margin
|
int
|
The margin between items and headers. Defaults to 8. |
8
|
header_height
|
int
|
The height of the category headers. Defaults to 36. |
36
|
Source code in source/qextrawidgets/widgets/views/grouped_icon_view.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
collapseAll()
Collapse all categories.
Source code in source/qextrawidgets/widgets/views/grouped_icon_view.py
115 116 117 118 | |
expandAll()
Expand all categories.
Source code in source/qextrawidgets/widgets/views/grouped_icon_view.py
104 105 106 107 108 109 110 111 112 113 | |
headerHeight()
Get the current height of the category headers.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The header height in pixels. |
Source code in source/qextrawidgets/widgets/views/grouped_icon_view.py
76 77 78 79 80 81 82 83 | |
isExpanded(index)
Return True if the category at index is expanded.
Source code in source/qextrawidgets/widgets/views/grouped_icon_view.py
85 86 87 88 89 | |
isIndexHidden(index)
Return True if the item referred to by index is hidden; otherwise returns False.
Source code in source/qextrawidgets/widgets/views/grouped_icon_view.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 | |
itemDelegate(_=None)
Returns the item delegate used by the view.
Source code in source/qextrawidgets/widgets/views/grouped_icon_view.py
58 59 60 61 62 | |
mousePressEvent(event)
Handle mouse press events.
Toggles category expansion or emits itemClicked signal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QMouseEvent
|
The mouse event. |
required |
Source code in source/qextrawidgets/widgets/views/grouped_icon_view.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
scrollTo(index, hint=QAbstractItemView.ScrollHint.EnsureVisible)
Scroll the view to ensure the item at index is visible.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
QModelIndex | QPersistentModelIndex
|
The index to scroll to. |
required |
hint
|
ScrollHint
|
The scroll hint. |
EnsureVisible
|
Source code in source/qextrawidgets/widgets/views/grouped_icon_view.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
setExpanded(index, expanded)
Set the expansion state of the category at index.
Source code in source/qextrawidgets/widgets/views/grouped_icon_view.py
91 92 93 94 95 96 97 98 99 100 101 102 | |
setHeaderHeight(height)
Set the height of the category headers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
height
|
int
|
The new header height in pixels. |
required |
Source code in source/qextrawidgets/widgets/views/grouped_icon_view.py
64 65 66 67 68 69 70 71 72 73 74 | |
setModel(model)
Set the model for the view.
Connects to necessary signals for handling layout updates and structural changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Optional[QAbstractItemModel]
|
The model to be set. |
required |
Source code in source/qextrawidgets/widgets/views/grouped_icon_view.py
151 152 153 154 155 156 157 158 159 160 161 | |
updateGeometries()
Recalculate the layout of item rectangles and update scrollbars.
Source code in source/qextrawidgets/widgets/views/grouped_icon_view.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |
QListGridView
Bases: QListView
A customized QListView designed to display emojis in a grid layout.
Signals
left: Emitted when the mouse cursor leaves the grid area.
Source code in source/qextrawidgets/widgets/views/list_grid_view.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
__init__(parent=None)
Initializes the emoji grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
QWidget
|
Parent widget. Defaults to None. |
None
|
Source code in source/qextrawidgets/widgets/views/list_grid_view.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
leaveEvent(event)
Handles the mouse leave event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QEvent
|
The leave event. |
required |
Source code in source/qextrawidgets/widgets/views/list_grid_view.py
80 81 82 83 84 85 86 87 | |
resizeEvent(event)
Handles the resize event.
Triggers a geometry update to recalculate the size hint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QResizeEvent
|
The resize event. |
required |
Source code in source/qextrawidgets/widgets/views/list_grid_view.py
89 90 91 92 93 94 95 96 97 98 | |
sizeHint()
Informs the layout of the ideal size for this widget.
Calculates the height needed to display all items based on the current width.
Returns:
| Name | Type | Description |
|---|---|---|
QSize |
QSize
|
The calculated size hint. |
Source code in source/qextrawidgets/widgets/views/list_grid_view.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |