summaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/accessible/qaccessiblewidgets.cpp12
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp10
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp60
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp6
-rw-r--r--src/widgets/itemviews/qcolumnview.cpp20
-rw-r--r--src/widgets/itemviews/qdirmodel.cpp4
-rw-r--r--src/widgets/itemviews/qlistview.cpp6
-rw-r--r--src/widgets/itemviews/qtreeview.cpp8
-rw-r--r--src/widgets/kernel/qformlayout.cpp21
-rw-r--r--src/widgets/kernel/qwidget.cpp2
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp4
-rw-r--r--src/widgets/styles/qcommonstyle.cpp11
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm2
-rw-r--r--src/widgets/styles/qstyle.cpp2
-rw-r--r--src/widgets/util/qcompleter.cpp4
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp3
-rw-r--r--src/widgets/widgets/qcombobox.cpp4
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp40
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp2
-rw-r--r--src/widgets/widgets/qdockwidget.cpp3
-rw-r--r--src/widgets/widgets/qfontcombobox.cpp2
-rw-r--r--src/widgets/widgets/qmainwindow.cpp16
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp7
-rw-r--r--src/widgets/widgets/qspinbox.cpp5
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp4
27 files changed, 131 insertions, 131 deletions
diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp
index 2f57fa08ee..95888924fb 100644
--- a/src/widgets/accessible/qaccessiblewidgets.cpp
+++ b/src/widgets/accessible/qaccessiblewidgets.cpp
@@ -824,12 +824,12 @@ QString QAccessibleTextWidget::attributes(int offset, int *startOffset, int *end
AttributeFormatter attrs;
QString family = charFormatFont.family();
if (!family.isEmpty()) {
- family = family.replace('\\',QStringLiteral("\\\\"));
- family = family.replace(':',QStringLiteral("\\:"));
- family = family.replace(',',QStringLiteral("\\,"));
- family = family.replace('=',QStringLiteral("\\="));
- family = family.replace(';',QStringLiteral("\\;"));
- family = family.replace('\"',QStringLiteral("\\\""));
+ family = family.replace('\\', QLatin1String("\\\\"));
+ family = family.replace(':', QLatin1String("\\:"));
+ family = family.replace(',', QLatin1String("\\,"));
+ family = family.replace('=', QLatin1String("\\="));
+ family = family.replace(';', QLatin1String("\\;"));
+ family = family.replace('\"', QLatin1String("\\\""));
attrs["font-family"] = QString::fromLatin1("\"%1\"").arg(family);
}
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 5424a4126a..11b3659990 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -87,7 +87,7 @@ QT_BEGIN_NAMESPACE
about the underlying files and directories related to items in the model.
Directories can be created and removed using mkdir(), rmdir().
- \note QFileSystemModel requires an instance of a GUI application.
+ \note QFileSystemModel requires an instance of \l QApplication.
\section1 Example Usage
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
index 53db11d2d7..4c01219d87 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -1082,7 +1082,7 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP
if (candidates.isEmpty())
after = (beforeSequence == adjacents.last() ? adjacents.first() : adjacents.last());
else
- after = (candidates.last() == adjacents.last() ? adjacents.first() : adjacents.last());
+ after = (candidates.constLast() == adjacents.last() ? adjacents.first() : adjacents.last());
// ### At this point we assumed that candidates will not contain 'after', this may not hold
// when simplifying FLOATing anchors.
@@ -1134,9 +1134,9 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP
// One restriction we have is to not simplify half of an anchor and let the other half
// unsimplified. So we remove center edges before and after the sequence.
- const AnchorData *firstAnchor = g.edgeData(beforeSequence, candidates.first());
+ const AnchorData *firstAnchor = g.edgeData(beforeSequence, candidates.constFirst());
if (firstAnchor->isCenterAnchor) {
- beforeSequence = candidates.first();
+ beforeSequence = candidates.constFirst();
candidates.remove(0);
// If there's not candidates to be simplified, leave.
@@ -1144,9 +1144,9 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraphIteration(QGraphicsAnchorLayoutP
continue;
}
- const AnchorData *lastAnchor = g.edgeData(candidates.last(), afterSequence);
+ const AnchorData *lastAnchor = g.edgeData(candidates.constLast(), afterSequence);
if (lastAnchor->isCenterAnchor) {
- afterSequence = candidates.last();
+ afterSequence = candidates.constLast();
candidates.remove(candidates.count() - 1);
if (candidates.isEmpty())
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index b00a950823..4b5e380f4b 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -2151,7 +2151,7 @@ bool QGraphicsItem::isBlockedByModalPanel(QGraphicsItem **blockingPanel) const
if (!blockingPanel)
blockingPanel = &dummy;
- QGraphicsScenePrivate *scene_d = d_ptr->scene->d_func();
+ const QGraphicsScenePrivate *scene_d = d_ptr->scene->d_func();
if (scene_d->modalPanels.isEmpty())
return false;
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index da5c2849ae..aa781e8f8b 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -940,7 +940,7 @@ void QGraphicsScenePrivate::grabMouse(QGraphicsItem *item, bool implicit)
{
// Append to list of mouse grabber items, and send a mouse grab event.
if (mouseGrabberItems.contains(item)) {
- if (mouseGrabberItems.last() == item) {
+ if (mouseGrabberItems.constLast() == item) {
Q_ASSERT(!implicit);
if (!lastMouseGrabberItemHasImplicitMouseGrab) {
qWarning("QGraphicsItem::grabMouse: already a mouse grabber");
@@ -950,14 +950,14 @@ void QGraphicsScenePrivate::grabMouse(QGraphicsItem *item, bool implicit)
}
} else {
qWarning("QGraphicsItem::grabMouse: already blocked by mouse grabber: %p",
- mouseGrabberItems.last());
+ mouseGrabberItems.constLast());
}
return;
}
// Send ungrab event to the last grabber.
if (!mouseGrabberItems.isEmpty()) {
- QGraphicsItem *last = mouseGrabberItems.last();
+ QGraphicsItem *last = mouseGrabberItems.constLast();
if (lastMouseGrabberItemHasImplicitMouseGrab) {
// Implicit mouse grab is immediately lost.
last->ungrabMouse();
@@ -987,12 +987,12 @@ void QGraphicsScenePrivate::ungrabMouse(QGraphicsItem *item, bool itemIsDying)
return;
}
- if (item != mouseGrabberItems.last()) {
+ if (item != mouseGrabberItems.constLast()) {
// Recursively ungrab the next mouse grabber until we reach this item
// to ensure state consistency.
ungrabMouse(mouseGrabberItems.at(index + 1), itemIsDying);
}
- if (!popupWidgets.isEmpty() && item == popupWidgets.last()) {
+ if (!popupWidgets.isEmpty() && item == popupWidgets.constLast()) {
// If the item is a popup, go via removePopup to ensure state
// consistency and that it gets hidden correctly - beware that
// removePopup() reenters this function to continue removing the grab.
@@ -1017,7 +1017,7 @@ void QGraphicsScenePrivate::ungrabMouse(QGraphicsItem *item, bool itemIsDying)
// items get a GrabMouse event, but this is a rare case with a simple
// implementation and it does ensure a consistent state.
if (!itemIsDying && !mouseGrabberItems.isEmpty()) {
- QGraphicsItem *last = mouseGrabberItems.last();
+ QGraphicsItem *last = mouseGrabberItems.constLast();
QEvent event(QEvent::GrabMouse);
sendEvent(last, &event);
}
@@ -1039,11 +1039,11 @@ void QGraphicsScenePrivate::clearMouseGrabber()
void QGraphicsScenePrivate::grabKeyboard(QGraphicsItem *item)
{
if (keyboardGrabberItems.contains(item)) {
- if (keyboardGrabberItems.last() == item)
+ if (keyboardGrabberItems.constLast() == item)
qWarning("QGraphicsItem::grabKeyboard: already a keyboard grabber");
else
qWarning("QGraphicsItem::grabKeyboard: already blocked by keyboard grabber: %p",
- keyboardGrabberItems.last());
+ keyboardGrabberItems.constLast());
return;
}
@@ -1051,7 +1051,7 @@ void QGraphicsScenePrivate::grabKeyboard(QGraphicsItem *item)
if (!keyboardGrabberItems.isEmpty()) {
// Just send ungrab event to current grabber.
QEvent ungrabEvent(QEvent::UngrabKeyboard);
- sendEvent(keyboardGrabberItems.last(), &ungrabEvent);
+ sendEvent(keyboardGrabberItems.constLast(), &ungrabEvent);
}
keyboardGrabberItems << item;
@@ -1071,7 +1071,7 @@ void QGraphicsScenePrivate::ungrabKeyboard(QGraphicsItem *item, bool itemIsDying
qWarning("QGraphicsItem::ungrabKeyboard: not a keyboard grabber");
return;
}
- if (item != keyboardGrabberItems.last()) {
+ if (item != keyboardGrabberItems.constLast()) {
// Recursively ungrab the topmost keyboard grabber until we reach this
// item to ensure state consistency.
ungrabKeyboard(keyboardGrabberItems.at(index + 1), itemIsDying);
@@ -1088,7 +1088,7 @@ void QGraphicsScenePrivate::ungrabKeyboard(QGraphicsItem *item, bool itemIsDying
// Send notification about mouse regrab.
if (!itemIsDying && !keyboardGrabberItems.isEmpty()) {
- QGraphicsItem *last = keyboardGrabberItems.last();
+ QGraphicsItem *last = keyboardGrabberItems.constLast();
QEvent event(QEvent::GrabKeyboard);
sendEvent(last, &event);
}
@@ -1100,7 +1100,7 @@ void QGraphicsScenePrivate::ungrabKeyboard(QGraphicsItem *item, bool itemIsDying
void QGraphicsScenePrivate::clearKeyboardGrabber()
{
if (!keyboardGrabberItems.isEmpty())
- ungrabKeyboard(keyboardGrabberItems.first());
+ ungrabKeyboard(keyboardGrabberItems.constFirst());
}
void QGraphicsScenePrivate::enableMouseTrackingOnViews()
@@ -1142,8 +1142,8 @@ void QGraphicsScenePrivate::storeMouseButtonsForMouseGrabber(QGraphicsSceneMouse
for (int i = 0x1; i <= 0x10; i <<= 1) {
if (event->buttons() & i) {
mouseGrabberButtonDownPos.insert(Qt::MouseButton(i),
- mouseGrabberItems.last()->d_ptr->genericMapFromScene(event->scenePos(),
- event->widget()));
+ mouseGrabberItems.constLast()->d_ptr->genericMapFromScene(event->scenePos(),
+ event->widget()));
mouseGrabberButtonDownScenePos.insert(Qt::MouseButton(i), event->scenePos());
mouseGrabberButtonDownScreenPos.insert(Qt::MouseButton(i), event->screenPos());
}
@@ -1308,7 +1308,7 @@ void QGraphicsScenePrivate::sendMouseEvent(QGraphicsSceneMouseEvent *mouseEvent)
return;
}
- QGraphicsItem *item = mouseGrabberItems.last();
+ QGraphicsItem *item = mouseGrabberItems.constLast();
if (item->isBlockedByModalPanel())
return;
@@ -1335,7 +1335,7 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou
// Deliver to any existing mouse grabber.
if (!mouseGrabberItems.isEmpty()) {
- if (mouseGrabberItems.last()->isBlockedByModalPanel())
+ if (mouseGrabberItems.constLast()->isBlockedByModalPanel())
return;
// The event is ignored by default, but we disregard the event's
// accepted state after delivery; the mouse is grabbed, after all.
@@ -1401,7 +1401,7 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou
// Any item will do.
if (sceneModality && cachedItemsUnderMouse.isEmpty())
- cachedItemsUnderMouse << modalPanels.first();
+ cachedItemsUnderMouse << modalPanels.constFirst();
// Find a mouse grabber by sending mouse press events to all mouse grabber
// candidates one at a time, until the event is accepted. It's accepted by
@@ -1450,7 +1450,7 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou
sendMouseEvent(mouseEvent);
}
- bool dontSendUngrabEvents = mouseGrabberItems.isEmpty() || mouseGrabberItems.last() != item;
+ bool dontSendUngrabEvents = mouseGrabberItems.isEmpty() || mouseGrabberItems.constLast() != item;
if (disabled) {
ungrabMouse(item, /* itemIsDying = */ dontSendUngrabEvents);
break;
@@ -2167,8 +2167,8 @@ QList<QGraphicsItem *> QGraphicsScene::collidingItems(const QGraphicsItem *item,
*/
QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position, const QTransform &deviceTransform) const
{
- QList<QGraphicsItem *> itemsAtPoint = items(position, Qt::IntersectsItemShape,
- Qt::DescendingOrder, deviceTransform);
+ const QList<QGraphicsItem *> itemsAtPoint = items(position, Qt::IntersectsItemShape,
+ Qt::DescendingOrder, deviceTransform);
return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first();
}
@@ -3771,7 +3771,7 @@ void QGraphicsScene::focusOutEvent(QFocusEvent *focusEvent)
// Remove all popups when the scene loses focus.
if (!d->popupWidgets.isEmpty())
- d->removePopup(d->popupWidgets.first());
+ d->removePopup(d->popupWidgets.constFirst());
}
/*!
@@ -3868,7 +3868,7 @@ bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEv
// Find the common ancestor item for the new topmost hoverItem and the
// last item in the hoverItem list.
- QGraphicsItem *commonAncestorItem = (item && !hoverItems.isEmpty()) ? item->commonAncestorItem(hoverItems.last()) : 0;
+ QGraphicsItem *commonAncestorItem = (item && !hoverItems.isEmpty()) ? item->commonAncestorItem(hoverItems.constLast()) : 0;
while (commonAncestorItem && !itemAcceptsHoverEvents_helper(commonAncestorItem))
commonAncestorItem = commonAncestorItem->parentItem();
if (commonAncestorItem && commonAncestorItem->panel() != item->panel()) {
@@ -3909,7 +3909,7 @@ bool QGraphicsScenePrivate::dispatchHoverEvent(QGraphicsSceneHoverEvent *hoverEv
// Generate a move event for the item itself
if (item
&& !hoverItems.isEmpty()
- && item == hoverItems.last()) {
+ && item == hoverItems.constLast()) {
sendHoverEvent(QEvent::GraphicsSceneHoverMove, item, hoverEvent);
return true;
}
@@ -3959,7 +3959,7 @@ void QGraphicsScene::keyPressEvent(QKeyEvent *keyEvent)
// ### Merge this function with keyReleaseEvent; they are identical
// ### (except this comment).
Q_D(QGraphicsScene);
- QGraphicsItem *item = !d->keyboardGrabberItems.isEmpty() ? d->keyboardGrabberItems.last() : 0;
+ QGraphicsItem *item = !d->keyboardGrabberItems.isEmpty() ? d->keyboardGrabberItems.constLast() : 0;
if (!item)
item = focusItem();
if (item) {
@@ -3991,7 +3991,7 @@ void QGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent)
// ### Merge this function with keyPressEvent; they are identical (except
// ### this comment).
Q_D(QGraphicsScene);
- QGraphicsItem *item = !d->keyboardGrabberItems.isEmpty() ? d->keyboardGrabberItems.last() : 0;
+ QGraphicsItem *item = !d->keyboardGrabberItems.isEmpty() ? d->keyboardGrabberItems.constLast() : 0;
if (!item)
item = focusItem();
if (item) {
@@ -4100,9 +4100,9 @@ void QGraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
// Reset the mouse grabber when the last mouse button has been released.
if (!mouseEvent->buttons()) {
if (!d->mouseGrabberItems.isEmpty()) {
- d->lastMouseGrabberItem = d->mouseGrabberItems.last();
+ d->lastMouseGrabberItem = d->mouseGrabberItems.constLast();
if (d->lastMouseGrabberItemHasImplicitMouseGrab)
- d->mouseGrabberItems.last()->ungrabMouse();
+ d->mouseGrabberItems.constLast()->ungrabMouse();
} else {
d->lastMouseGrabberItem = 0;
}
@@ -5902,7 +5902,7 @@ void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent)
cachedItemsUnderMouse = itemsAtPosition(touchPoint.screenPos().toPoint(),
touchPoint.scenePos(),
static_cast<QWidget *>(sceneTouchEvent->target()));
- item = cachedItemsUnderMouse.isEmpty() ? 0 : cachedItemsUnderMouse.first();
+ item = cachedItemsUnderMouse.isEmpty() ? 0 : cachedItemsUnderMouse.constFirst();
}
if (sceneTouchEvent->device()->type() == QTouchDevice::TouchScreen) {
@@ -6013,7 +6013,7 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve
{
Q_Q(QGraphicsScene);
- if (cachedItemsUnderMouse.isEmpty() || cachedItemsUnderMouse.first() != origin) {
+ if (cachedItemsUnderMouse.isEmpty() || cachedItemsUnderMouse.constFirst() != origin) {
const QTouchEvent::TouchPoint &firstTouchPoint = touchEvent->touchPoints().first();
cachedItemsUnderMouse = itemsAtPosition(firstTouchPoint.screenPos().toPoint(),
firstTouchPoint.scenePos(),
@@ -6129,7 +6129,7 @@ void QGraphicsScenePrivate::enterModal(QGraphicsItem *panel, QGraphicsItem::Pane
}
if (!mouseGrabberItems.isEmpty() && lastMouseGrabberItemHasImplicitMouseGrab) {
- QGraphicsItem *item = mouseGrabberItems.last();
+ QGraphicsItem *item = mouseGrabberItems.constLast();
if (item->isBlockedByModalPanel())
ungrabMouse(item, /*itemIsDying =*/ false);
}
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index 44e80ebeb9..3f7d2d1cd1 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -2375,7 +2375,7 @@ QGraphicsItem *QGraphicsView::itemAt(const QPoint &pos) const
Q_D(const QGraphicsView);
if (!d->scene)
return 0;
- QList<QGraphicsItem *> itemsAtPos = items(pos);
+ const QList<QGraphicsItem *> itemsAtPos = items(pos);
return itemsAtPos.isEmpty() ? 0 : itemsAtPos.first();
}
@@ -2860,7 +2860,7 @@ bool QGraphicsView::viewportEvent(QEvent *event)
// the mouse grab.
// Remove all popups when the scene loses focus.
if (!d->scene->d_func()->popupWidgets.isEmpty())
- d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.first());
+ d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.constFirst());
QApplication::sendEvent(d->scene, event);
break;
case QEvent::Show:
@@ -2884,7 +2884,7 @@ bool QGraphicsView::viewportEvent(QEvent *event)
|| (QApplication::activeModalWidget() && QApplication::activeModalWidget() != window())
|| (QApplication::activeWindow() != window())) {
if (!d->scene->d_func()->popupWidgets.isEmpty())
- d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.first());
+ d->scene->d_func()->removePopup(d->scene->d_func()->popupWidgets.constFirst());
}
d->useLastMouseEvent = false;
// a hack to pass a viewport pointer to the scene inside the leave event
diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp
index 26173b5e92..6c7c914bc0 100644
--- a/src/widgets/itemviews/qcolumnview.cpp
+++ b/src/widgets/itemviews/qcolumnview.cpp
@@ -412,9 +412,9 @@ void QColumnViewPrivate::updateScrollbars()
// find the total horizontal length of the laid out columns
int horizontalLength = 0;
if (!columns.isEmpty()) {
- horizontalLength = (columns.last()->x() + columns.last()->width()) - columns.first()->x();
+ horizontalLength = (columns.constLast()->x() + columns.constLast()->width()) - columns.constFirst()->x();
if (horizontalLength <= 0) // reverse mode
- horizontalLength = (columns.first()->x() + columns.first()->width()) - columns.last()->x();
+ horizontalLength = (columns.constFirst()->x() + columns.constFirst()->width()) - columns.constLast()->x();
}
QSize viewportSize = viewport->size();
@@ -629,7 +629,7 @@ void QColumnViewPrivate::closeColumns(const QModelIndex &parent, bool build)
while (!dirsToAppend.isEmpty()) {
QAbstractItemView *newView = createColumn(dirsToAppend.takeLast(), true);
if (!dirsToAppend.isEmpty())
- newView->setCurrentIndex(dirsToAppend.last());
+ newView->setCurrentIndex(dirsToAppend.constLast());
}
if (build && !alreadyExists)
@@ -713,8 +713,8 @@ QAbstractItemView *QColumnViewPrivate::createColumn(const QModelIndex &index, bo
columnSizes.resize(qMax(columnSizes.count(), columns.count() + 1));
columnSizes[columns.count()] = initialWidth;
}
- if (!columns.isEmpty() && columns.last()->isHidden())
- columns.last()->setVisible(true);
+ if (!columns.isEmpty() && columns.constLast()->isHidden())
+ columns.constLast()->setVisible(true);
columns.append(view);
doLayout();
@@ -835,7 +835,7 @@ void QColumnViewPrivate::setPreviewWidget(QWidget *widget)
{
Q_Q(QColumnView);
if (previewColumn) {
- if (!columns.isEmpty() && columns.last() == previewColumn)
+ if (!columns.isEmpty() && columns.constLast() == previewColumn)
columns.removeLast();
previewColumn->deleteLater();
}
@@ -1003,11 +1003,11 @@ void QColumnViewPrivate::_q_changeCurrentColumn()
parentColumn->setCurrentIndex(current.parent());
}
- if (columns.last()->isHidden()) {
- columns.last()->setVisible(true);
+ if (columns.constLast()->isHidden()) {
+ columns.constLast()->setVisible(true);
}
- if (columns.last()->selectionModel())
- columns.last()->selectionModel()->clear();
+ if (columns.constLast()->selectionModel())
+ columns.constLast()->selectionModel()->clear();
updateScrollbars();
}
diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp
index 315d2503a4..95e6a1840d 100644
--- a/src/widgets/itemviews/qdirmodel.cpp
+++ b/src/widgets/itemviews/qdirmodel.cpp
@@ -212,7 +212,7 @@ void QDirModelPrivate::invalidate()
Directories can be created and removed using mkdir(), rmdir(), and the
model will be automatically updated to take the changes into account.
- \note QDirModel requires an instance of a GUI application.
+ \note QDirModel requires an instance of \l QApplication.
\sa nameFilters(), setFilter(), filter(), QListView, QTreeView, QFileSystemModel,
{Dir View Example}, {Model Classes}
@@ -885,7 +885,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const
#if defined(Q_OS_WIN)
if (absolutePath.startsWith(QLatin1String("//"))) { // UNC path
- QString host = pathElements.first();
+ QString host = pathElements.constFirst();
int r = 0;
for (; r < d->root.children.count(); ++r)
if (d->root.children.at(r).info.fileName() == host)
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 3303aac6ed..0788e0287a 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -2396,9 +2396,9 @@ QPoint QListModeViewBase::initStaticLayout(const QListViewLayoutInfo &info)
} else if (info.wrap) {
if (info.flow == QListView::LeftToRight) {
x = batchSavedPosition;
- y = segmentPositions.last();
+ y = segmentPositions.constLast();
} else { // flow == QListView::TopToBottom
- x = segmentPositions.last();
+ x = segmentPositions.constLast();
y = batchSavedPosition;
}
} else { // not first and not wrap
@@ -2613,7 +2613,7 @@ int QListModeViewBase::perItemScrollingPageSteps(int length, int bounds, bool wr
int steps = positions.count() - 1;
int max = qMax(length, bounds);
int min = qMin(length, bounds);
- int pos = min - (max - positions.last());
+ int pos = min - (max - positions.constLast());
while (pos >= 0 && steps > 0) {
pos -= (positions.at(steps) - positions.at(steps - 1));
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index ca1e8f13ee..cfe68d6b6a 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -2356,10 +2356,10 @@ void QTreeView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFl
return;
}
if (!topLeft.isValid() && !d->viewItems.isEmpty())
- topLeft = d->viewItems.first().index;
+ topLeft = d->viewItems.constFirst().index;
if (!bottomRight.isValid() && !d->viewItems.isEmpty()) {
const int column = d->header->logicalIndex(d->header->count() - 1);
- const QModelIndex index = d->viewItems.last().index;
+ const QModelIndex index = d->viewItems.constLast().index;
bottomRight = index.sibling(index.row(), column);
}
@@ -2667,9 +2667,9 @@ void QTreeView::selectAll()
SelectionMode mode = d->selectionMode;
d->executePostedLayout(); //make sure we lay out the items
if (mode != SingleSelection && mode != NoSelection && !d->viewItems.isEmpty()) {
- const QModelIndex &idx = d->viewItems.last().index;
+ const QModelIndex &idx = d->viewItems.constLast().index;
QModelIndex lastItemIndex = idx.sibling(idx.row(), d->model->columnCount(idx.parent()) - 1);
- d->select(d->viewItems.first().index, lastItemIndex,
+ d->select(d->viewItems.constFirst().index, lastItemIndex,
QItemSelectionModel::ClearAndSelect
|QItemSelectionModel::Rows);
}
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index ce5e58642c..0bc1c029fe 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -65,13 +65,9 @@ public:
T &operator()(int r, int c) { return m_storage[r * NumColumns + c]; }
int rowCount() const { return m_storage.size() / NumColumns; }
- void addRow(const T &value);
void insertRow(int r, const T &value);
void removeRow(int r);
- bool find(const T &value, int *rowPtr, int *colPtr) const ;
- int count(const T &value) const { return m_storage.count(value); }
-
// Hmmpf.. Some things are faster that way.
const Storage &storage() const { return m_storage; }
@@ -82,13 +78,6 @@ private:
};
template <class T, int NumColumns>
-void FixedColumnMatrix<T, NumColumns>::addRow(const T &value)
-{
- for (int i = 0; i < NumColumns; ++i)
- m_storage.append(value);
-}
-
-template <class T, int NumColumns>
void FixedColumnMatrix<T, NumColumns>::insertRow(int r, const T &value)
{
typename Storage::iterator it = m_storage.begin();
@@ -103,16 +92,6 @@ void FixedColumnMatrix<T, NumColumns>::removeRow(int r)
}
template <class T, int NumColumns>
-bool FixedColumnMatrix<T, NumColumns>::find(const T &value, int *rowPtr, int *colPtr) const
-{
- const int idx = m_storage.indexOf(value);
- if (idx == -1)
- return false;
- storageIndexToPosition(idx, rowPtr, colPtr);
- return true;
-}
-
-template <class T, int NumColumns>
void FixedColumnMatrix<T, NumColumns>::storageIndexToPosition(int idx, int *rowPtr, int *colPtr)
{
*rowPtr = idx / NumColumns;
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index a71089793c..25874e9bcc 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -565,7 +565,7 @@ void QWidget::setAutoFillBackground(bool enabled)
Composite widgets can also be created by subclassing a standard widget,
such as QWidget or QFrame, and adding the necessary layout and child
- widgets in the constructor of the subclass. Many of the \l{Qt Examples}
+ widgets in the constructor of the subclass. Many of the \l{Qt Widgets Examples}
{examples provided with Qt} use this approach, and it is also covered in
the Qt \l{Tutorials}.
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index 242e62572b..81fbe49a43 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -1012,9 +1012,11 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget)
// The Windows compositor handles fullscreen OpenGL window specially. Besides
// having trouble with popups, it also has issues with flip-flopping between
// OpenGL-based and normal flushing. Therefore, stick with GL for fullscreen
-// windows. (QTBUG-53515)
+// windows (QTBUG-53515). Similary, translucent windows should not switch to
+// layered native windows (QTBUG-54734).
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE)
|| tlw->windowState().testFlag(Qt::WindowFullScreen)
+ || tlw->testAttribute(Qt::WA_TranslucentBackground)
#endif
)
{
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 6b9e5577a4..36975c5877 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -5248,6 +5248,13 @@ static QPixmap cachedPixmapFromXPM(const char * const *xpm)
return result;
}
+#ifndef QT_NO_IMAGEFORMAT_PNG
+static inline QString clearText16IconPath()
+{
+ return QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png");
+}
+#endif // !QT_NO_IMAGEFORMAT_PNG
+
static QIcon clearTextIcon(bool rtl)
{
const QString directionalThemeName = rtl
@@ -5260,7 +5267,7 @@ static QIcon clearTextIcon(bool rtl)
QIcon icon;
#ifndef QT_NO_IMAGEFORMAT_PNG
- QPixmap clearText16(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png"));
+ QPixmap clearText16(clearText16IconPath());
Q_ASSERT(!clearText16.size().isEmpty());
icon.addPixmap(clearText16);
QPixmap clearText32(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-32.png"));
@@ -5575,6 +5582,8 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-16.png"));
case SP_MediaVolumeMuted:
return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png"));
+ case SP_LineEditClearButton:
+ return QPixmap(clearText16IconPath());
#endif // QT_NO_IMAGEFORMAT_PNG
default:
break;
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 56531b10de..d28bd644c6 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -2933,7 +2933,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
QImage img;
QSize pixmapSize = opt->rect.size();
- if (pixmapSize.isValid()) {
+ if (!pixmapSize.isEmpty()) {
QPixmap pix(pixmapSize);
pix.fill(QColor(fillR, fillG, fillB));
QPainter pix_paint(&pix);
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index d72a898ee9..93bc00f662 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -733,7 +733,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value State_None Indicates that the widget does not have a state.
\value State_Active Indicates that the widget is active.
- \value State_AutoRaise Used to indicate if auto-raise appearance should be usd on a tool button.
+ \value State_AutoRaise Used to indicate if auto-raise appearance should be used on a tool button.
\value State_Children Used to indicate if an item view branch has children.
\value State_DownArrow Used to indicate if a down arrow should be visible on the widget.
\value State_Editing Used to indicate if an editor is opened on the widget.
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index 5425644b41..3006f0c9ce 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -1044,6 +1044,10 @@ void QCompleter::setModel(QAbstractItemModel *model)
{
Q_D(QCompleter);
QAbstractItemModel *oldModel = d->proxy->sourceModel();
+#ifndef QT_NO_FILESYSTEMMODEL
+ if (qobject_cast<const QFileSystemModel *>(oldModel))
+ setCompletionRole(Qt::EditRole); // QTBUG-54642, clear FileNameRole set by QFileSystemModel
+#endif
d->proxy->setSourceModel(model);
if (d->popup)
setPopup(d->popup); // set the model and make new connections
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index 774f5a708d..5778d16456 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -757,8 +757,7 @@ bool QAbstractSpinBox::event(QEvent *event)
case QEvent::HoverEnter:
case QEvent::HoverLeave:
case QEvent::HoverMove:
- if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event))
- d->updateHoverControl(he->pos());
+ d->updateHoverControl(static_cast<const QHoverEvent *>(event)->pos());
break;
case QEvent::ShortcutOverride:
if (d->edit->event(event))
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 51e23ca7f9..af178ce8f5 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -2108,9 +2108,9 @@ void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi)
if (lineEdit) {
const QString newText = itemText(normalized);
if (lineEdit->text() != newText) {
- lineEdit->setText(newText);
+ lineEdit->setText(newText); // may cause lineEdit -> nullptr (QTBUG-54191)
#ifndef QT_NO_COMPLETER
- if (lineEdit->completer())
+ if (lineEdit && lineEdit->completer())
lineEdit->completer()->setCompletionPrefix(newText);
#endif
}
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index cfba2cc87f..b168c98410 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -52,6 +52,8 @@
#include <qset.h>
#include <qstyle.h>
+#include <algorithm>
+
#ifndef QT_NO_DATETIMEEDIT
//#define QDATETIMEEDIT_QDTEDEBUG
@@ -246,9 +248,10 @@ void QDateTimeEdit::setDateTime(const QDateTime &datetime)
Q_D(QDateTimeEdit);
if (datetime.isValid()) {
d->clearCache();
+ const QDate date = datetime.date();
if (!(d->sections & DateSections_Mask))
- setDateRange(datetime.date(), datetime.date());
- d->setValue(QDateTime(datetime.date(), datetime.time(), d->spec), EmitIfChanged);
+ setDateRange(date, date);
+ d->setValue(QDateTime(date, datetime.time(), d->spec), EmitIfChanged);
}
}
@@ -861,14 +864,6 @@ QString QDateTimeEdit::displayFormat() const
return isRightToLeft() ? d->unreversedFormat : d->displayFormat;
}
-template<typename C> static inline C reverse(const C &l)
-{
- C ret;
- for (int i=l.size() - 1; i>=0; --i)
- ret.append(l.at(i));
- return ret;
-}
-
void QDateTimeEdit::setDisplayFormat(const QString &format)
{
Q_D(QDateTimeEdit);
@@ -882,8 +877,8 @@ void QDateTimeEdit::setDisplayFormat(const QString &format)
d->displayFormat += d->sectionNode(i).format();
}
d->displayFormat += d->separators.at(0);
- d->separators = reverse(d->separators);
- d->sectionNodes = reverse(d->sectionNodes);
+ std::reverse(d->separators.begin(), d->separators.end());
+ std::reverse(d->sectionNodes.begin(), d->sectionNodes.end());
}
d->formatExplicitlySet = true;
@@ -1776,15 +1771,18 @@ void QDateTimeEditPrivate::setSelected(int sectionIndex, bool forward)
int QDateTimeEditPrivate::sectionAt(int pos) const
{
- if (pos < separators.first().size()) {
+ if (pos < separators.first().size())
return (pos == 0 ? FirstSectionIndex : NoSectionIndex);
- } else if (displayText().size() - pos < separators.last().size() + 1) {
+
+ const QString text = displayText();
+ const int textSize = text.size();
+ if (textSize - pos < separators.last().size() + 1) {
if (separators.last().size() == 0) {
return sectionNodes.count() - 1;
}
- return (pos == displayText().size() ? LastSectionIndex : NoSectionIndex);
+ return (pos == textSize ? LastSectionIndex : NoSectionIndex);
}
- updateCache(value, displayText());
+ updateCache(value, text);
for (int i=0; i<sectionNodes.size(); ++i) {
const int tmp = sectionPos(i);
@@ -1805,12 +1803,14 @@ int QDateTimeEditPrivate::sectionAt(int pos) const
int QDateTimeEditPrivate::closestSection(int pos, bool forward) const
{
Q_ASSERT(pos >= 0);
- if (pos < separators.first().size()) {
+ if (pos < separators.first().size())
return forward ? 0 : FirstSectionIndex;
- } else if (displayText().size() - pos < separators.last().size() + 1) {
+
+ const QString text = displayText();
+ if (text.size() - pos < separators.last().size() + 1)
return forward ? LastSectionIndex : sectionNodes.size() - 1;
- }
- updateCache(value, displayText());
+
+ updateCache(value, text);
for (int i=0; i<sectionNodes.size(); ++i) {
const int tmp = sectionPos(sectionNodes.at(i));
if (pos < tmp + sectionSize(i)) {
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index 55e774024a..b347e93807 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -3170,7 +3170,7 @@ void QDockAreaLayout::splitDockWidget(QDockWidget *after,
QDockWidget *dockWidget,
Qt::Orientation orientation)
{
- QList<int> path = indexOf(after);
+ const QList<int> path = indexOf(after);
if (path.isEmpty())
return;
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index d2fa9a7c06..9e95d086bd 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -811,7 +811,8 @@ void QDockWidgetPrivate::endDrag(bool abort)
} else {
setResizerActive(false);
}
- undockedGeometry = q->geometry();
+ if (q->isFloating()) // Might not be floating when dragging a QDockWidgetGroupWindow
+ undockedGeometry = q->geometry();
q->activateWindow();
} else {
// The tab was not plugged back in the QMainWindow but the QDockWidget cannot
diff --git a/src/widgets/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp
index 1d736c8e96..9bd33409ae 100644
--- a/src/widgets/widgets/qfontcombobox.cpp
+++ b/src/widgets/widgets/qfontcombobox.cpp
@@ -162,7 +162,7 @@ static QFontDatabase::WritingSystem writingSystemForFont(const QFont &font, bool
return QFontDatabase::TraditionalChinese;
}
- system = writingSystems.last();
+ system = writingSystems.constLast();
if (!*hasLatin) {
// we need to show something
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index 5dfa439b2e..c31e9750bf 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -1729,10 +1729,20 @@ QMenu *QMainWindow::createPopupMenu()
menu = new QMenu(this);
for (int i = 0; i < dockwidgets.size(); ++i) {
QDockWidget *dockWidget = dockwidgets.at(i);
- if (dockWidget->parentWidget() == this
- && !d->layout->layoutState.dockAreaLayout.indexOf(dockWidget).isEmpty()) {
- menu->addAction(dockwidgets.at(i)->toggleViewAction());
+ // filter to find out if we own this QDockWidget
+ if (dockWidget->parentWidget() == this) {
+ if (d->layout->layoutState.dockAreaLayout.indexOf(dockWidget).isEmpty())
+ continue;
+ } else if (QDockWidgetGroupWindow *dwgw =
+ qobject_cast<QDockWidgetGroupWindow *>(dockWidget->parentWidget())) {
+ if (dwgw->parentWidget() != this)
+ continue;
+ if (dwgw->layoutInfo()->indexOf(dockWidget).isEmpty())
+ continue;
+ } else {
+ continue;
}
+ menu->addAction(dockwidgets.at(i)->toggleViewAction());
}
menu->addSeparator();
}
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index ee6da73302..c5b08387a3 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -2384,13 +2384,10 @@ void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos)
QWidget *w = qobject_cast<QWidget*>(c);
if (!w)
continue;
- if (w == widget)
- continue;
- if (!w->isTopLevel() || !w->isVisible() || w->isMinimized())
- continue;
if (!qobject_cast<QDockWidget*>(w) && !qobject_cast<QDockWidgetGroupWindow *>(w))
continue;
- candidates << w;
+ if (w != widget && w->isTopLevel() && w->isVisible() && !w->isMinimized())
+ candidates << w;
if (QDockWidgetGroupWindow *group = qobject_cast<QDockWidgetGroupWindow *>(w)) {
// Sometimes, there are floating QDockWidget that have a QDockWidgetGroupWindow as a parent.
foreach (QObject *c, group->children()) {
diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp
index a5c096c3a8..0daa624ae8 100644
--- a/src/widgets/widgets/qspinbox.cpp
+++ b/src/widgets/widgets/qspinbox.cpp
@@ -479,9 +479,8 @@ QString QSpinBox::textFromValue(int value) const
QString str;
if (d->displayIntegerBase != 10) {
- str = QString::number(qAbs(value), d->displayIntegerBase);
- if (value < 0)
- str.prepend('-');
+ const QLatin1String prefix = value < 0 ? QLatin1String("-") : QLatin1String();
+ str = prefix + QString::number(qAbs(value), d->displayIntegerBase);
} else {
str = locale().toString(value);
if (!d->showGroupSeparator && (qAbs(value) >= 1000 || value == INT_MIN)) {
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index 77b5a4830b..d5ecb150a8 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -2641,8 +2641,8 @@ void QWidgetTextControl::insertFromMimeData(const QMimeData *source)
#ifndef QT_NO_TEXTHTMLPARSER
if (source->hasFormat(QLatin1String("application/x-qrichtext")) && d->acceptRichText) {
// x-qrichtext is always UTF-8 (taken from Qt3 since we don't use it anymore).
- QString richtext = QString::fromUtf8(source->data(QLatin1String("application/x-qrichtext")));
- richtext.prepend(QLatin1String("<meta name=\"qrichtext\" content=\"1\" />"));
+ const QString richtext = QLatin1String("<meta name=\"qrichtext\" content=\"1\" />")
+ + QString::fromUtf8(source->data(QLatin1String("application/x-qrichtext")));
fragment = QTextDocumentFragment::fromHtml(richtext, d->doc);
hasData = true;
} else if (source->hasHtml() && d->acceptRichText) {