Skip to content

Commit 2eeb48b

Browse files
jepasionQtQt Cherry-pick Bot
authored andcommitted
Doc: Add alternate text for images in Qt GUI
Alternate text (alt text) improves the documentation experience for screen readers and for other accessibility tools. Task-number: QTBUG-135098 Change-Id: Ia5d70756095824f4d3a066c447d43709ab4f6ae2 Reviewed-by: David Boddie <david.boddie@qt.io> (cherry picked from commit 4098e2d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
1 parent 25cb080 commit 2eeb48b

13 files changed

Lines changed: 119 additions & 81 deletions

File tree

src/gui/doc/qtgui.qdocconf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,5 @@ macro.svgcolor.HTML = "<div style=\"padding:10px;color:#fff;background:\1;\"></d
8888
macro.svgcolor.DocBook = "<db:phrase role=\"color:\1\">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</db:phrase>"
8989

9090
# Enforce zero documentation warnings
91+
reportmissingalttextforimages = true
9192
warninglimit = 0

src/gui/doc/src/coordsys.qdoc

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242
\table
4343
\row
4444
\li \inlineimage coordinatesystem-rect.svg
45+
{Rectangle on coordinate grid from (1,2) to (7,6)}
4546
\li \inlineimage coordinatesystem-line.svg
47+
{Line on coordinate grid from (2,7) to (6,1)}
4648
\row
4749
\li QRect(QPoint(1, 2), QPoint(7, 6))
4850
\li QLine(QPoint(2, 7), QPoint(6, 1))
@@ -74,7 +76,9 @@
7476
\table
7577
\row
7678
\li \inlineimage coordinatesystem-rect-raster.svg
79+
{Aliased rectangle with pixels rendered right and below}
7780
\li \inlineimage coordinatesystem-line-raster.svg
81+
{Aliased line with pixels rendered right and below}
7882

7983
\row
8084
\li
@@ -96,13 +100,17 @@
96100
\li {2,1} QRectF
97101
\row
98102
\li \inlineimage qrect-diagram-zero.png
103+
{Rectangle showing width() and height() dimensions}
99104
\li \inlineimage qrectf-diagram-one.png
105+
{Rectangle with one-pixel pen showing corner coordinates}
100106
\row
101107
\li Logical representation
102108
\li One pixel wide pen
103109
\row
104110
\li \inlineimage qrectf-diagram-two.png
111+
{Rectangle with two-pixel pen showing corner coordinates}
105112
\li \inlineimage qrectf-diagram-three.png
113+
{Rectangle with three-pixel pen showing corner coordinates}
106114
\row
107115
\li Two pixel wide pen
108116
\li Three pixel wide pen
@@ -140,7 +148,9 @@
140148
\table
141149
\row
142150
\li \inlineimage coordinatesystem-rect-antialias.svg
151+
{Anti-aliased rectangle with symmetric pixel rendering}
143152
\li \inlineimage coordinatesystem-line-antialias.svg
153+
{Anti-aliased line with symmetric pixel rendering}
144154
\row
145155
\li
146156

@@ -164,10 +174,10 @@
164174

165175
\table
166176
\row
167-
\li \inlineimage qpainter-clock.png
168-
\li \inlineimage qpainter-rotation.png
169-
\li \inlineimage qpainter-scale.png
170-
\li \inlineimage qpainter-translation.png
177+
\li \inlineimage qpainter-clock.png {Clock without transformation}
178+
\li \inlineimage qpainter-rotation.png {Clock with rotation applied}
179+
\li \inlineimage qpainter-scale.png {Clock with scale applied}
180+
\li \inlineimage qpainter-translation.png {Clock with translation applied}
171181
\row
172182
\li nop
173183
\li \l {QPainter::rotate()}{rotate()}
@@ -200,6 +210,7 @@
200210
\li {2,1} Analog Clock Example
201211
\row
202212
\li \inlineimage coordinatesystem-analogclock.png
213+
{Analog clock widget showing hour and minute hands}
203214
\li
204215
The Analog Clock example shows how to draw the contents of a
205216
custom widget using QPainter's transformation matrix.

src/gui/doc/src/richtext.qdoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
\table
106106
\row
107107
\li \inlineimage richtext-document.png
108+
{Document structure with frames and text blocks}
108109
\li \b{Basic structure}
109110

110111
The "top level" of a document might be populated in the way shown.

src/gui/image/qimage.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ bool QImageData::checkForAlphaPixels() const
502502
\li {2,1}32-bit
503503
\row
504504
\li \inlineimage qimage-32bit_scaled.png
505+
{3x3 pixel grid with ARGB color values}
505506
\li
506507
\snippet code/src_gui_image_qimage.cpp 0
507508
\endtable
@@ -523,6 +524,7 @@ bool QImageData::checkForAlphaPixels() const
523524
\li {2,1} 8-bit
524525
\row
525526
\li \inlineimage qimage-8bit_scaled.png
527+
{3x3 pixel grid with indexed colors and color table}
526528
\li
527529
\snippet code/src_gui_image_qimage.cpp 1
528530
\endtable

src/gui/image/qpixmap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ bool QPixmap::convertFromImage(const QImage &image, Qt::ImageConversionFlags fla
999999
transformation modes specified by \a aspectRatioMode and \a
10001000
transformMode.
10011001
1002-
\image qimage-scaling.png
1002+
\image qimage-scaling.png {Three aspect ratio modes compared}
10031003
10041004
\list
10051005
\li If \a aspectRatioMode is Qt::IgnoreAspectRatio, the pixmap

src/gui/kernel/qcursor.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,41 +70,41 @@ QT_BEGIN_NAMESPACE
7070
\table
7171
\header \li Shape \li Qt::CursorShape Value \li Cursor Name
7272
\li Shape \li Qt::CursorShape Value \li Cursor Name
73-
\row \li \inlineimage cursor-arrow.png
73+
\row \li \inlineimage cursor-arrow.png {Arrow cursor}
7474
\li Qt::ArrowCursor \li \c left_ptr
75-
\li \inlineimage cursor-sizev.png
75+
\li \inlineimage cursor-sizev.png {Vertical resize cursor}
7676
\li Qt::SizeVerCursor \li \c size_ver
77-
\row \li \inlineimage cursor-uparrow.png
77+
\row \li \inlineimage cursor-uparrow.png {Up arrow cursor}
7878
\li Qt::UpArrowCursor \li \c up_arrow
79-
\li \inlineimage cursor-sizeh.png
79+
\li \inlineimage cursor-sizeh.png {Horizontal resize cursor}
8080
\li Qt::SizeHorCursor \li \c size_hor
81-
\row \li \inlineimage cursor-cross.png
81+
\row \li \inlineimage cursor-cross.png {Cross cursor}
8282
\li Qt::CrossCursor \li \c cross
83-
\li \inlineimage cursor-sizeb.png
83+
\li \inlineimage cursor-sizeb.png {Diagonal resize cursor}
8484
\li Qt::SizeBDiagCursor \li \c size_bdiag
85-
\row \li \inlineimage cursor-ibeam.png
85+
\row \li \inlineimage cursor-ibeam.png {I-beam cursor}
8686
\li Qt::IBeamCursor \li \c ibeam
87-
\li \inlineimage cursor-sizef.png
87+
\li \inlineimage cursor-sizef.png {Diagonal resize cursor}
8888
\li Qt::SizeFDiagCursor \li \c size_fdiag
89-
\row \li \inlineimage cursor-wait.png
89+
\row \li \inlineimage cursor-wait.png {Wait cursor}
9090
\li Qt::WaitCursor \li \c wait
91-
\li \inlineimage cursor-sizeall.png
91+
\li \inlineimage cursor-sizeall.png {Move cursor}
9292
\li Qt::SizeAllCursor \li \c size_all
93-
\row \li \inlineimage cursor-busy.png
93+
\row \li \inlineimage cursor-busy.png {Busy cursor}
9494
\li Qt::BusyCursor \li \c left_ptr_watch
95-
\li \inlineimage cursor-vsplit.png
95+
\li \inlineimage cursor-vsplit.png {Vertical split cursor}
9696
\li Qt::SplitVCursor \li \c split_v
97-
\row \li \inlineimage cursor-forbidden.png
97+
\row \li \inlineimage cursor-forbidden.png {Forbidden cursor}
9898
\li Qt::ForbiddenCursor \li \c forbidden
99-
\li \inlineimage cursor-hsplit.png
99+
\li \inlineimage cursor-hsplit.png {Horizontal split cursor}
100100
\li Qt::SplitHCursor \li \c split_h
101-
\row \li \inlineimage cursor-hand.png
101+
\row \li \inlineimage cursor-hand.png {Pointing hand cursor}
102102
\li Qt::PointingHandCursor \li \c pointing_hand
103-
\li \inlineimage cursor-openhand.png
103+
\li \inlineimage cursor-openhand.png {Open hand cursor}
104104
\li Qt::OpenHandCursor \li \c openhand
105-
\row \li \inlineimage cursor-whatsthis.png
105+
\row \li \inlineimage cursor-whatsthis.png {What's this cursor}
106106
\li Qt::WhatsThisCursor \li \c whats_this
107-
\li \inlineimage cursor-closedhand.png
107+
\li \inlineimage cursor-closedhand.png {Closed hand cursor}
108108
\li Qt::ClosedHandCursor \li \c closedhand
109109
\row \li
110110
\li Qt::DragMoveCursor \li \c dnd-move or \c move

src/gui/painting/qbrush.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ void QBrushDataPointerDeleter::operator()(QBrushData *d) const noexcept
313313
314314
\table 100%
315315
\row
316-
\li \inlineimage brush-outline.png Outlines
316+
\li \inlineimage brush-outline.png
317+
{Two overlapping rectangles with outlines}
317318
\li
318319
319320
To specify the style and color of lines and outlines, use the
@@ -1283,7 +1284,6 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
12831284
* QGradient implementations
12841285
*/
12851286

1286-
12871287
/*!
12881288
\class QGradient
12891289
\ingroup painting
@@ -1313,9 +1313,11 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
13131313
\li QRadialGradient
13141314
\li QConicalGradient
13151315
\row
1316-
\li \inlineimage qgradient-linear.png
1316+
\li \inlineimage qgradient-linear.png {Linear gradient from white to blue}
13171317
\li \inlineimage qgradient-radial.png
1318+
{Radial gradient from white center to blue}
13181319
\li \inlineimage qgradient-conical.png
1320+
{Conical gradient sweeping around center}
13191321
\endtable
13201322
13211323
The colors in a gradient are defined using stop points of the
@@ -1351,8 +1353,11 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
13511353
\table
13521354
\row
13531355
\li \inlineimage qradialgradient-pad.png
1356+
{Radial gradient with pad spread}
13541357
\li \inlineimage qradialgradient-repeat.png
1358+
{Radial gradient with repeat spread}
13551359
\li \inlineimage qradialgradient-reflect.png
1360+
{Radial gradient with reflect spread}
13561361
\row
13571362
\li \l {QGradient::PadSpread}{PadSpread}
13581363
\li \l {QGradient::RepeatSpread}{RepeatSpread}
@@ -1883,9 +1888,11 @@ bool QGradient::operator==(const QGradient &gradient) const
18831888
18841889
\table
18851890
\row
1886-
\li \inlineimage qlineargradient-pad.png
1891+
\li \inlineimage qlineargradient-pad.png {Linear gradient with pad spread}
18871892
\li \inlineimage qlineargradient-reflect.png
1893+
{Linear gradient with reflect spread}
18881894
\li \inlineimage qlineargradient-repeat.png
1895+
{Linear gradient with repeat spread}
18891896
\row
18901897
\li \l {QGradient::PadSpread}{PadSpread} (default)
18911898
\li \l {QGradient::ReflectSpread}{ReflectSpread}
@@ -1909,7 +1916,6 @@ bool QGradient::operator==(const QGradient &gradient) const
19091916
Gradients Example}
19101917
*/
19111918

1912-
19131919
/*!
19141920
Constructs a default linear gradient with interpolation area
19151921
between (0, 0) and (1, 1).
@@ -2048,7 +2054,6 @@ void QLinearGradient::setFinalStop(const QPointF &stop)
20482054
m_data.linear.y2 = stop.y();
20492055
}
20502056

2051-
20522057
/*!
20532058
\class QRadialGradient
20542059
\ingroup painting
@@ -2072,8 +2077,11 @@ void QLinearGradient::setFinalStop(const QPointF &stop)
20722077
\table
20732078
\row
20742079
\li \inlineimage qradialgradient-pad.png
2080+
{Radial gradient with pad spread}
20752081
\li \inlineimage qradialgradient-reflect.png
2082+
{Radial gradient with reflect spread}
20762083
\li \inlineimage qradialgradient-repeat.png
2084+
{Radial gradient with repeat spread}
20772085
\row
20782086
\li \l {QGradient::PadSpread}{PadSpread} (default)
20792087
\li \l {QGradient::ReflectSpread}{ReflectSpread}

src/gui/painting/qcolor.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -558,9 +558,9 @@ static bool qColorCheckCmykFValidity(float c, float m, float y, float k, float a
558558
\header
559559
\li RGB \li HSV \li CMYK
560560
\row
561-
\li \inlineimage qcolor-rgb.png
562-
\li \inlineimage qcolor-hsv.png
563-
\li \inlineimage qcolor-cmyk.png
561+
\li \inlineimage qcolor-rgb.png {Color wheel with RGB values}
562+
\li \inlineimage qcolor-hsv.png {Color wheel with HSV values}
563+
\li \inlineimage qcolor-cmyk.png {Color wheel with CMYK values}
564564
\endtable
565565
566566
The QColor constructor creates the color based on RGB values. To
@@ -703,19 +703,19 @@ static bool qColorCheckCmykFValidity(float c, float m, float y, float k, float a
703703
color wheel familiar to most people. Red is 0 (degrees), green is
704704
120, and blue is 240.
705705
706-
\inlineimage qcolor-hue.png
706+
\inlineimage qcolor-hue.png {Color wheel showing hue values from 0 to 300}
707707
708708
\li S, for saturation, is in the range 0 to 255, and the bigger it is,
709709
the stronger the color is. Grayish colors have saturation near 0; very
710710
strong colors have saturation near 255.
711711
712-
\inlineimage qcolor-saturation.png
712+
\inlineimage qcolor-saturation.png {Saturation gradient from gray to blue}
713713
714714
\li V, for value, is in the range 0 to 255 and represents lightness or
715715
brightness of the color. 0 is black; 255 is as far from black as
716716
possible.
717717
718-
\inlineimage qcolor-value.png
718+
\inlineimage qcolor-value.png {Value gradient from black to white}
719719
\endlist
720720
721721
Here are some examples: pure red is H=0, S=255, V=255; a dark red,

0 commit comments

Comments
 (0)