ScrollAreaTocWidget
Qt Base Class: QTreeView
Signature: QTreeView(self, parent: Optional[PySide6.QtWidgets.QWidget] = None) -> None
Base classes
Name | Children | Inherits |
---|---|---|
TreeView prettyqt.widgets.treeview |
⋔ Inheritance diagram
graph TD
1473367137008["custom_widgets.ScrollAreaTocWidget"]
1473296360320["widgets.TreeView"]
1473296343728["widgets.TreeViewMixin"]
1473293692144["widgets.AbstractItemViewMixin"]
1473293679456["widgets.AbstractScrollAreaMixin"]
1473293662864["widgets.FrameMixin"]
1473293688240["widgets.WidgetMixin"]
1473299815024["core.ObjectMixin"]
140713234304496["builtins.object"]
1473245548480["gui.PaintDeviceMixin"]
1473241448160["QtWidgets.QTreeView"]
1473241438400["QtWidgets.QAbstractItemView"]
1473290616416["QtWidgets.QAbstractScrollArea"]
1473290626176["QtWidgets.QFrame"]
1473290849680["QtWidgets.QWidget"]
1473288842240["QtCore.QObject"]
1473291690208["Shiboken.Object"]
1473300082368["QtGui.QPaintDevice"]
1473296360320 --> 1473367137008
1473296343728 --> 1473296360320
1473293692144 --> 1473296343728
1473293679456 --> 1473293692144
1473293662864 --> 1473293679456
1473293688240 --> 1473293662864
1473299815024 --> 1473293688240
140713234304496 --> 1473299815024
1473245548480 --> 1473293688240
140713234304496 --> 1473245548480
1473241448160 --> 1473296360320
1473241438400 --> 1473241448160
1473290616416 --> 1473241438400
1473290626176 --> 1473290616416
1473290849680 --> 1473290626176
1473288842240 --> 1473290849680
1473291690208 --> 1473288842240
140713234304496 --> 1473291690208
1473300082368 --> 1473290849680
1473291690208 --> 1473300082368
🛈 DocStrings
Bases: TreeView
Source code in prettyqt\custom_widgets\scrollareatocwidget.py
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 |
|
__init__(scrollarea: widgets.QScrollArea, orientation: constants.Orientation | constants.OrientationStr = constants.VERTICAL, widget_class: type = widgets.QWidget, **kwargs: type) -> None
A TreeView which can show a Table-of-contents list based on a given ScrollArea.
With default settings, it will scan the widgets contained in the scrollArea for a windowTitle. These widgets will be shown in the TreeView, and the TreeView selection will be synced to what is currently visible in the ScrollArea. This basically emulates the behaviour of many websites (like the [Qt Website][https://doc.qt.io/qt-6/supported-platforms.html]) or from VS code settings.
You can set up the Toc Tree by passing a ScrollArea instance:
widget = widgets.Widget()
layout = widget.set_layout("horizontal")
scrollarea = widgets.ScrollArea()
# add some widgets to the ScrollArea here
# ...
toc = ScrollAreaTocWidget(scrollarea)
layout.add(toc)
layout.add(scrollarea)
The Toc tree can be configured to use other properties for populating than windowTitle. You can also set a widget class filter if you only want a specific widget class to be shown.
The widget supports 3 different scroll modes:
1) Single: Only one row in the Tree will be highlighted. (the one which equals the topmost one from the scrollArea) 2) Multi: All rows which equal to visible widgets in the ScrollArea will be shown. 3) HeadersOnly: like Single, but only highlights top-level widgets from the ScrollArea.
There are also two different expand modes to choose from:
1) ExpandAll: All subsections are always expanded. 2) on_focus: Only the section containing the focused item is expanded.
This widget is used by ConfigWidget.
Source code in prettyqt\custom_widgets\scrollareatocwidget.py
set_widget(widget: widgets.QScrollArea)
Set the ScrollArea widget to follow.
Source code in prettyqt\custom_widgets\scrollareatocwidget.py
⌗ Property table
Qt Property | Type | Doc |
---|---|---|
objectName |
QString | |
modal |
bool | |
windowModality |
Qt::WindowModality | |
enabled |
bool | |
geometry |
QRect | |
frameGeometry |
QRect | |
normalGeometry |
QRect | |
x |
int | |
y |
int | |
pos |
QPoint | |
frameSize |
QSize | |
size |
QSize | |
width |
int | |
height |
int | |
rect |
QRect | |
childrenRect |
QRect | |
childrenRegion |
QRegion | |
sizePolicy |
QSizePolicy | |
minimumSize |
QSize | |
maximumSize |
QSize | |
minimumWidth |
int | |
minimumHeight |
int | |
maximumWidth |
int | |
maximumHeight |
int | |
sizeIncrement |
QSize | |
baseSize |
QSize | |
palette |
QPalette | |
font |
QFont | |
cursor |
QCursor | |
mouseTracking |
bool | |
tabletTracking |
bool | |
isActiveWindow |
bool | |
focusPolicy |
Qt::FocusPolicy | |
focus |
bool | |
contextMenuPolicy |
Qt::ContextMenuPolicy | |
updatesEnabled |
bool | |
visible |
bool | |
minimized |
bool | |
maximized |
bool | |
fullScreen |
bool | |
sizeHint |
QSize | |
minimumSizeHint |
QSize | |
acceptDrops |
bool | |
windowTitle |
QString | |
windowIcon |
QIcon | |
windowIconText |
QString | |
windowOpacity |
double | |
windowModified |
bool | |
toolTip |
QString | |
toolTipDuration |
int | |
statusTip |
QString | |
whatsThis |
QString | |
accessibleName |
QString | |
accessibleDescription |
QString | |
layoutDirection |
Qt::LayoutDirection | |
autoFillBackground |
bool | |
styleSheet |
QString | |
locale |
QLocale | |
windowFilePath |
QString | |
inputMethodHints |
QFlags |
|
frameShape |
QFrame::Shape | |
frameShadow |
QFrame::Shadow | |
lineWidth |
int | |
midLineWidth |
int | |
frameWidth |
int | |
frameRect |
QRect | |
verticalScrollBarPolicy |
Qt::ScrollBarPolicy | |
horizontalScrollBarPolicy |
Qt::ScrollBarPolicy | |
sizeAdjustPolicy |
QAbstractScrollArea::SizeAdjustPolicy | |
autoScroll |
bool | |
autoScrollMargin |
int | |
editTriggers |
QFlags |
|
tabKeyNavigation |
bool | |
showDropIndicator |
bool | |
dragEnabled |
bool | |
dragDropOverwriteMode |
bool | |
dragDropMode |
QAbstractItemView::DragDropMode | |
defaultDropAction |
Qt::DropAction | |
alternatingRowColors |
bool | |
selectionMode |
QAbstractItemView::SelectionMode | |
selectionBehavior |
QAbstractItemView::SelectionBehavior | |
iconSize |
QSize | |
textElideMode |
Qt::TextElideMode | |
verticalScrollMode |
QAbstractItemView::ScrollMode | |
horizontalScrollMode |
QAbstractItemView::ScrollMode | |
autoExpandDelay |
int | |
indentation |
int | |
rootIsDecorated |
bool | |
uniformRowHeights |
bool | |
itemsExpandable |
bool | |
sortingEnabled |
bool | |
animated |
bool | |
allColumnsShowFocus |
bool | |
wordWrap |
bool | |
headerHidden |
bool | |
expandsOnDoubleClick |
bool | |
scrollMode |
PySide::PyObjectWrapper | Scrolling mode |
always_expanded |
bool | Whether the tree is always expanded. |