widgets: Fix typos in source code comments

Pick-to: 6.2
Change-Id: I22f71a53b0f7f0698450123343e25548c889c3e2
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Jonas Kvinge 2021-10-09 18:51:52 +02:00
parent dedb29cf23
commit 553a1c48fd
25 changed files with 44 additions and 44 deletions

View File

@ -810,7 +810,7 @@ void QDialog::setVisible(bool visible)
/*
The following block is to handle a special case, and does not
really follow propper logic in concern of autoDefault and TAB
really follow proper logic in concern of autoDefault and TAB
order. However, it's here to ease usage for the users. If a
dialog has a default QPushButton, and first widget in the TAB
order also is a QPushButton, then we give focus to the main

View File

@ -348,7 +348,7 @@ bool QWizardHeader::vistaDisabled() const
bool styleDisabled = false;
QWizard *wiz = parentWidget() ? qobject_cast <QWizard *>(parentWidget()->parentWidget()) : 0;
if (wiz) {
// Designer dosen't support the Vista style for Wizards. This property is used to turn
// Designer doesn't support the Vista style for Wizards. This property is used to turn
// off the Vista style.
const QVariant v = wiz->property("_q_wizard_vista_off");
styleDisabled = v.isValid() && v.toBool();

View File

@ -169,7 +169,7 @@ struct AnchorData : public QSimplexVariable {
qreal sizeAtMaximum;
// References to the classes that represent this anchor in the public world
// An anchor may represent a LayoutItem, it may also be acessible externally
// An anchor may represent a LayoutItem, it may also be accessible externally
// through a GraphicsAnchor "handler".
QGraphicsLayoutItem *item;
QGraphicsAnchor *graphicsAnchor;

View File

@ -5036,7 +5036,7 @@ bool QGraphicsItem::collidesWithPath(const QPainterPath &path, Qt::ItemSelection
_q_adjustRect(&rectB);
if (!rectA.intersects(rectB)) {
// This we can determine efficiently. If the two rects neither
// intersect nor contain eachother, then the two items do not collide.
// intersect nor contain each other, then the two items do not collide.
return false;
}

View File

@ -712,7 +712,7 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
if (item == dragDropItem)
dragDropItem = nullptr;
// Reenable selectionChanged() for individual items
// Re-enable selectionChanged() for individual items
--selectionChanging;
if (!selectionChanging && selectedItems.size() != oldSelectedItemsSize)
emit q->selectionChanged();
@ -1439,9 +1439,9 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou
if (mouseEvent->type() == QEvent::GraphicsSceneMouseDoubleClick
&& item != lastMouseGrabberItem && lastMouseGrabberItem) {
// If this item is different from the item that received the last
// mouse event, and mouseEvent is a doubleclick event, then the
// mouse event, and mouseEvent is a double-click event, then the
// event is converted to a press. Known limitation:
// Triple-clicking will not generate a doubleclick, though.
// Triple-clicking will not generate a double-click, though.
QGraphicsSceneMouseEvent mousePress(QEvent::GraphicsSceneMousePress);
mousePress.m_spont = mouseEvent->spontaneous();
mousePress.accept();
@ -2266,7 +2266,7 @@ void QGraphicsScene::setSelectionArea(const QPainterPath &path,
break;
}
// Reenable emitting selectionChanged() for individual items.
// Re-enable emitting selectionChanged() for individual items.
--d->selectionChanging;
if (!d->selectionChanging && changed)
@ -2290,7 +2290,7 @@ void QGraphicsScene::clearSelection()
item->setSelected(false);
d->selectedItems.clear();
// Reenable emitting selectionChanged() for individual items.
// Re-enable emitting selectionChanged() for individual items.
--d->selectionChanging;
if (!d->selectionChanging && changed)
@ -2552,7 +2552,7 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
item->d_ptr->resolvePalette(d->palette.resolveMask());
// Reenable selectionChanged() for individual items
// Re-enable selectionChanged() for individual items
--d->selectionChanging;
if (!d->selectionChanging && d->selectedItems.size() != oldSelectedItemSize)
emit selectionChanged();
@ -4734,7 +4734,7 @@ void QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *item, QPainter *
if (itemIsTooSmallToRender || itemIsOutsideVisibleRect) {
// We cannot simply use !drawItem here. If we did it is possible
// to enter the outter if statement with drawItem == false and minimumRenderSize > 0
// to enter the outer if statement with drawItem == false and minimumRenderSize > 0
// and finally end up inside this inner if, even though none of the above two
// conditions are met. In that case we should not return from this function
// but call draw() instead.

View File

@ -2523,7 +2523,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
break;
case Qt::Key_Enter:
case Qt::Key_Return:
// ### we can't open the editor on enter, becuse
// ### we can't open the editor on enter, because
// some widgets will forward the enter event back
// to the viewport, starting an endless loop
if (state() != EditingState || hasFocus()) {
@ -3354,7 +3354,7 @@ void QAbstractItemView::update(const QModelIndex &index)
Q_D(QAbstractItemView);
if (index.isValid()) {
const QRect rect = visualRect(index);
//this test is important for peformance reason
//this test is important for performance reason
//For example in dataChanged we simply update all the cells without checking
//it can be a major bottleneck to update rects that aren't even part of the viewport
if (d->viewport->rect().intersects(rect))

View File

@ -1417,7 +1417,7 @@ void QListView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFl
top = bottom;
bottom = tmp;
}
// if the rect are on differnet lines, expand
// if the rect are on different lines, expand
if (top.top() != bottom.top()) {
// top rectangle
if (isRightToLeft())
@ -1934,7 +1934,7 @@ QSize QListViewPrivate::itemSize(const QStyleOptionViewItem &option, const QMode
const QAbstractItemDelegate *delegate = q->itemDelegateForIndex(index);
return delegate ? delegate->sizeHint(option, index) : QSize();
}
if (!cachedItemSize.isValid()) { // the last item is probaly the largest, so we use its size
if (!cachedItemSize.isValid()) { // the last item is probably the largest, so we use its size
int row = model->rowCount(root) - 1;
QModelIndex sample = model->index(row, column, root);
const QAbstractItemDelegate *delegate = q->itemDelegateForIndex(sample);
@ -2671,7 +2671,7 @@ void QListModeViewBase::doStaticLayout(const QListViewLayoutInfo &info)
flowPositions.append(flowPosition);
segmentPositions.append(info.wrap ? segPosition + deltaSegPosition : INT_MAX);
}
// if the new items are visble, update the viewport
// if the new items are visible, update the viewport
QRect changedRect(topLeft, rect.bottomRight());
if (clipRect().intersects(changedRect))
viewport()->update();
@ -2977,7 +2977,7 @@ bool QIconModeViewBase::filterDropEvent(QDropEvent *e)
// do not delete item on internal move, see filterStartDrag()
dd->dropEventMoved = true;
e->accept(); // we have handled the event
// if the size has not grown, we need to check if it has shrinked
// if the size has not grown, we need to check if it has shrunk
if (contentsSize != contents) {
if ((contentsSize.width() <= contents.width()
|| contentsSize.height() <= contents.height())) {
@ -3269,7 +3269,7 @@ void QIconModeViewBase::doDynamicLayout(const QListViewLayoutInfo &info)
// insert items in tree
for (int row = insertFrom; row <= info.last; ++row)
tree.insertLeaf(items.at(row).rect(), row);
// if the new items are visble, update the viewport
// if the new items are visible, update the viewport
QRect changedRect(topLeft, rect.bottomRight());
if (clipRect().intersects(changedRect))
viewport()->update();

View File

@ -264,7 +264,7 @@ public:
int autoExpandDelay;
QBasicTimer openTimer;
// used for drawing hilighted expand/collapse indicators
// used for drawing highlighted expand/collapse indicators
mutable int hoverBranch;
// used for blocking recursion when calling setViewportMargins from updateGeometries

View File

@ -779,7 +779,7 @@ Qt::DropActions QTreeModel::supportedDropActions() const
void QTreeModel::itemChanged(QTreeWidgetItem *item)
{
SkipSorting skipSorting(this); //this is kind of wrong, but not doing this would kill performence
SkipSorting skipSorting(this); //this is kind of wrong, but not doing this would kill performance
QModelIndex left = index(item, 0);
QModelIndex right = index(item, item->columnCount() - 1);
emit dataChanged(left, right);
@ -810,7 +810,7 @@ void QTreeModel::emitDataChanged(QTreeWidgetItem *item, int column, const QList<
return;
}
SkipSorting skipSorting(this); //This is a little bit wrong, but not doing it would kill performence
SkipSorting skipSorting(this); //This is a little bit wrong, but not doing it would kill performance
QModelIndex bottomRight, topLeft;
if (column == -1) {

View File

@ -2451,7 +2451,7 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget)
return; // Widget was not under the cursor when it was hidden/deleted.
if (widgetInShow && widget->parentWidget()->data->in_show)
return; // Ingore recursive show.
return; // Ignore recursive show.
QWidget *mouseGrabber = QWidget::mouseGrabber();
if (mouseGrabber && mouseGrabber != widget)

View File

@ -2642,7 +2642,7 @@ void QWidget::setStyle(QStyle *style)
#ifndef QT_NO_STYLE_STYLESHEET
if (QStyleSheetStyle *styleSheetStyle = qt_styleSheet(style)) {
//if for some reason someone try to set a QStyleSheetStyle, ref it
//(this may happen for exemple in QButtonDialogBox which propagates its style)
//(this may happen for example in QButtonDialogBox which propagates its style)
styleSheetStyle->ref();
d->setStyle_helper(style, false);
} else if (qt_styleSheet(d->extra->style) || !qApp->styleSheet().isEmpty()) {

View File

@ -1037,7 +1037,7 @@ void QWidgetWindow::handleExposeEvent(QExposeEvent *event)
// If the window becomes not exposed...
if (wPriv->childrenShownByExpose) {
// ... and child widgets was previously shown by the expose event - hide widgets again.
// This is a workaround, because sometimes when window is minimized programatically,
// This is a workaround, because sometimes when window is minimized programmatically,
// the QPA can notify that the window is exposed after changing window state to minimized
// and then, the QPA can send next expose event with null exposed region (not exposed).
wPriv->hideChildren(true);

View File

@ -151,7 +151,7 @@ static QStyleSheetStyleCaches *styleSheetCaches = nullptr;
* the QStyleSheetStyle is a proxy. If used with others proxy style, we may end up with something like:
* QStyleSheetStyle -> ProxyStyle -> QStyleSheetStyle -> OriginalStyle
* Recursion may happen if the style call the widget()->style() again.
* Not to mention the performence penalty of having two lookup of rules.
* Not to mention the performance penalty of having two lookup of rules.
*
* The first instance of QStyleSheetStyle will set globalStyleSheetStyle to itself. The second one
* will notice the globalStyleSheetStyle is not istelf and call its base style directly.
@ -1418,7 +1418,7 @@ void QRenderRule::drawBackground(QPainter *p, const QRect& rect, const QPoint& o
// ### fix for gradients
const QPainterPath &borderPath = borderClip(originRect(rect, origin));
if (!borderPath.isEmpty()) {
// Drawn intead of being used as clipping path for better visual quality
// Drawn instead of being used as clipping path for better visual quality
bool wasAntialiased = p->renderHints() & QPainter::Antialiasing;
p->setRenderHint(QPainter::Antialiasing);
p->fillPath(borderPath, brush);
@ -2903,7 +2903,7 @@ void QStyleSheetStyle::polish(QWidget *w)
if (styleSheetCaches->styleRulesCache.contains(w)) {
// the widget accessed its style pointer before polish (or repolish)
// (exemple: the QAbstractSpinBox constructor ask for the stylehint)
// (example: the QAbstractSpinBox constructor ask for the stylehint)
styleSheetCaches->styleRulesCache.remove(w);
styleSheetCaches->hasStyleRuleCache.remove(w);
styleSheetCaches->renderRulesCache.remove(w);
@ -3956,7 +3956,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
QWindowsStyle::drawControl(ce, &mi, p, w);
if (mi.checkType != QStyleOptionMenuItem::NotCheckable && !mi.checked) {
// We have a style defined, but QWindowsStyle won't draw anything if not checked.
// So we mimick what QWindowsStyle would do.
// So we mimic what QWindowsStyle would do.
int checkcol = qMax<int>(mi.maxIconWidth, QWindowsStylePrivate::windowsCheckMarkWidth);
QRect vCheckRect = visualRect(opt->direction, mi.rect, QRect(mi.rect.x(), mi.rect.y(), checkcol, mi.rect.height()));
if (mi.state.testFlag(State_Enabled) && mi.state.testFlag(State_Selected)) {
@ -6257,7 +6257,7 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
#endif // QT_CONFIG(toolbar)
// On mac we make pixel adjustments to layouts which are not
// desireable when you have custom style sheets on them
// desirable when you have custom style sheets on them
case SE_CheckBoxLayoutItem:
case SE_ComboBoxLayoutItem:
case SE_DateTimeEditLayoutItem:

View File

@ -40,7 +40,7 @@
/* This is the default Qt style sheet.
IMPORTANT: This style sheet is primarily meant for defining feature
capablities of styles. Do NOT add default styling rules here. When in
capabilities of styles. Do NOT add default styling rules here. When in
doubt ask the stylesheet maintainer.
The stylesheet in here used to be in a CSS file, but was moved here to
@ -116,7 +116,7 @@ using namespace QCss;
// found among the Value_* constants, in which case the second should be that
// constant. Otherwise the first parameter is Value::Identifier and the second
// is a string.
// Adding more values is the same as seperating by spaces in CSS.
// Adding more values is the same as separating by spaces in CSS.
// Ex. border: 2px solid black;
// ^ ^ ^

View File

@ -191,7 +191,7 @@ public:
result = true; // consume this event
} else if (mouseTarget && scrollerIsActive) {
// we grabbed the mouse expicitly when the scroller became active, so undo that now
// we grabbed the mouse explicitly when the scroller became active, so undo that now
sendMouseEvent(nullptr, UngrabMouseBefore);
}
pressDelayEvent.reset(nullptr);

View File

@ -1374,7 +1374,7 @@ void QScrollerPrivate::createScrollingSegments(const QPointF &v,
// v(t) = deltaTime * a * 0.5 * differentialForProgress(t / deltaTime)
// v(0) = vrelease
// v(deltaTime) = 0
// deltaTime = (2 * vrelease) / (a * differntial(0))
// deltaTime = (2 * vrelease) / (a * differential(0))
// pos(t) = integrate(v(t)dt)
// pos(t) = vrelease * t - 0.5 * a * t * t

View File

@ -2711,7 +2711,7 @@ void QComboBox::showPopup()
// Position horizontally.
listRect.moveLeft(above.x());
// Position vertically so the curently selected item lines up
// Position vertically so the currently selected item lines up
// with the combo box.
const QRect currentItemRect = view()->visualRect(view()->currentIndex());
const int offset = listRect.top() - currentItemRect.top();
@ -3269,7 +3269,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e)
if (!hasEditFocus() || !d->lineEdit)
e->ignore();
} else {
e->ignore(); // let the surounding dialog have it
e->ignore(); // let the surrounding dialog have it
}
break;
#endif

View File

@ -1513,7 +1513,7 @@ QDateTimeEdit::StepEnabled QDateTimeEdit::stepEnabled() const
if (d->wrapping)
return StepEnabled(StepUpEnabled | StepDownEnabled);
// 3 cases. date, time, datetime. each case look
// at just the relavant component.
// at just the relevant component.
QVariant max, min, val;
if (!(d->sections & DateSections_Mask)) {
// time only, no date

View File

@ -3298,7 +3298,7 @@ int QDockAreaLayoutInfo::separatorMove(const QList<int> &separator, const QPoint
#if QT_CONFIG(tabbar)
// Sets the correct positions for the separator widgets
// Allocates new sepearator widgets with getSeparatorWidget
// Allocates new separator widgets with getSeparatorWidget
void QDockAreaLayout::updateSeparatorWidgets() const
{
int j = 0;

View File

@ -1290,7 +1290,7 @@ void QLabelPrivate::_q_movieUpdated(const QRect& rect)
void QLabelPrivate::_q_movieResized(const QSize& size)
{
Q_Q(QLabel);
q->update(); //we need to refresh the whole background in case the new size is smaler
q->update(); //we need to refresh the whole background in case the new size is smaller
valid_hints = false;
_q_movieUpdated(QRect(QPoint(0,0), size));
q->updateGeometry();
@ -1674,7 +1674,7 @@ QRectF QLabelPrivate::layoutRect() const
if (!control)
return cr;
ensureTextLayouted();
// Caculate y position manually
// Calculate y position manually
qreal rh = control->document()->documentLayout()->documentSize().height();
qreal yo = 0;
if (align & Qt::AlignVCenter)

View File

@ -2098,7 +2098,7 @@ void QLineEdit::paintEvent(QPaintEvent *)
// Asian users see an IM selection text as cursor on candidate
// selection phase of input method, so the ordinary cursor should be
// invisible if we have a preedit string. another condition is when inputmask
// isn't empty,we don't need draw cursor,because cursor and character overlaping
// isn't empty,we don't need draw cursor,because cursor and character overlapping
// area is white.
if (d->cursorVisible && !d->control->isReadOnly() && d->control->inputMask().isEmpty())
flags |= QWidgetLineControl::DrawCursor;

View File

@ -384,7 +384,7 @@ private:
#endif // QT_CONFIG(dockwidget)
/* This data structure represents the state of all the tool-bars and dock-widgets. It's value based
so it can be easilly copied into a temporary variable. All operations are performed without moving
so it can be easily copied into a temporary variable. All operations are performed without moving
any widgets. Only when we are sure we have the desired state, we call apply(), which moves the
widgets.
*/

View File

@ -2547,7 +2547,7 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event)
if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
// Ingore key events without a Ctrl modifier (except for press/release on the modifier itself).
// Ignore key events without a Ctrl modifier (except for press/release on the modifier itself).
if (!(keyEvent->modifiers() & Qt::ControlModifier) && keyEvent->key() != Qt::Key_Control)
return QAbstractScrollArea::eventFilter(object, event);

View File

@ -1053,7 +1053,7 @@ bool QToolBar::event(QEvent *event)
case QEvent::Leave:
if (d->state != nullptr && d->state->dragging) {
#ifdef Q_OS_WIN
// This is a workaround for loosing the mouse on Vista.
// This is a workaround for losing the mouse on Vista.
QPoint pos = QCursor::pos();
QMouseEvent fake(QEvent::MouseMove, mapFromGlobal(pos), pos, Qt::NoButton,
QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers());

View File

@ -93,7 +93,7 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo
animate = animate && !r.isNull() && !_final_geometry.isNull();
// might make the wigdet go away by sending it to negative space
// might make the widget go away by sending it to negative space
const QRect final_geometry = _final_geometry.isValid() || widget->isWindow() ? _final_geometry :
QRect(QPoint(-500 - widget->width(), -500 - widget->height()), widget->size());