summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r--src/widgets/widgets/qabstractbutton.cpp6
-rw-r--r--src/widgets/widgets/qbuttongroup.cpp21
-rw-r--r--src/widgets/widgets/qbuttongroup.h3
-rw-r--r--src/widgets/widgets/qcombobox.h2
-rw-r--r--src/widgets/widgets/qdockwidget.h2
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp3
-rw-r--r--src/widgets/widgets/qmenu.h2
-rw-r--r--src/widgets/widgets/qmenu_p.h2
-rw-r--r--src/widgets/widgets/qmenubar.h1
-rw-r--r--src/widgets/widgets/qsplitter.cpp8
-rw-r--r--src/widgets/widgets/qsplitter_p.h2
-rw-r--r--src/widgets/widgets/qstatusbar.h2
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp8
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp20
14 files changed, 42 insertions, 40 deletions
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp
index 5f75bd3913..4e85eae3ff 100644
--- a/src/widgets/widgets/qabstractbutton.cpp
+++ b/src/widgets/widgets/qabstractbutton.cpp
@@ -219,12 +219,6 @@ void QButtonGroup::setExclusive(bool exclusive)
}
-// TODO: Qt 5: Merge with addButton(QAbstractButton *button, int id)
-void QButtonGroup::addButton(QAbstractButton *button)
-{
- addButton(button, -1);
-}
-
void QButtonGroup::addButton(QAbstractButton *button, int id)
{
Q_D(QButtonGroup);
diff --git a/src/widgets/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp
index 381e32d96b..a5e96370cf 100644
--- a/src/widgets/widgets/qbuttongroup.cpp
+++ b/src/widgets/widgets/qbuttongroup.cpp
@@ -175,22 +175,13 @@
*/
/*!
- \fn void QButtonGroup::addButton(QAbstractButton *button);
+ \fn void QButtonGroup::addButton(QAbstractButton *button, int id = -1);
- Adds the given \a button to the end of the group's internal list
- of buttons. An id will be assigned to the button by this
- QButtonGroup. Automatically assigned ids are guaranteed to be
- negative, starting with -2. If you are also assigning your own
- ids, use positive values to avoid conflicts.
-
- \sa removeButton() buttons()
-*/
-
-/*!
- \fn void QButtonGroup::addButton(QAbstractButton *button, int id);
-
- Adds the given \a button to the button group, with the given \a
- id. It is recommended to assign only positive ids.
+ Adds the given \a button to the button group. If \a id is -1,
+ an id will be assigned to the button by this QButtonGroup.
+ Automatically assigned ids are guaranteed to be negative,
+ starting with -2. If you are assigning your own ids, use
+ positive values to avoid conflicts.
\sa removeButton() buttons()
*/
diff --git a/src/widgets/widgets/qbuttongroup.h b/src/widgets/widgets/qbuttongroup.h
index e24ac8bbc3..46275d9f04 100644
--- a/src/widgets/widgets/qbuttongroup.h
+++ b/src/widgets/widgets/qbuttongroup.h
@@ -67,8 +67,7 @@ public:
void setExclusive(bool);
bool exclusive() const;
- void addButton(QAbstractButton *);
- void addButton(QAbstractButton *, int id);
+ void addButton(QAbstractButton *, int id = -1);
void removeButton(QAbstractButton *);
QList<QAbstractButton*> buttons() const;
diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h
index 1442cd983e..854ced596b 100644
--- a/src/widgets/widgets/qcombobox.h
+++ b/src/widgets/widgets/qcombobox.h
@@ -131,7 +131,7 @@ public:
enum SizeAdjustPolicy {
AdjustToContents,
AdjustToContentsOnFirstShow,
- AdjustToMinimumContentsLength, // ### Qt 5: remove
+ AdjustToMinimumContentsLength, // ### Qt 6: remove
AdjustToMinimumContentsLengthWithIcon
};
diff --git a/src/widgets/widgets/qdockwidget.h b/src/widgets/widgets/qdockwidget.h
index 21872fa404..bd5a2c2aa4 100644
--- a/src/widgets/widgets/qdockwidget.h
+++ b/src/widgets/widgets/qdockwidget.h
@@ -82,7 +82,7 @@ public:
DockWidgetVerticalTitleBar = 0x08,
DockWidgetFeatureMask = 0x0f,
- AllDockWidgetFeatures = DockWidgetClosable|DockWidgetMovable|DockWidgetFloatable, // ### remove in 5.0
+ AllDockWidgetFeatures = DockWidgetClosable|DockWidgetMovable|DockWidgetFloatable, // ### Qt 6: remove
NoDockWidgetFeatures = 0x00,
Reserved = 0xff
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index 6cee96e717..d1c374a6ca 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -62,9 +62,10 @@ const int QLineEditPrivate::horizontalMargin(2);
QRect QLineEditPrivate::adjustedControlRect(const QRect &rect) const
{
+ QRect widgetRect = !rect.isEmpty() ? rect : q_func()->rect();
QRect cr = adjustedContentsRect();
int cix = cr.x() - hscroll + horizontalMargin;
- return rect.translated(QPoint(cix, vscroll));
+ return widgetRect.translated(QPoint(cix, vscroll));
}
int QLineEditPrivate::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const
diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h
index e4e6390a9d..e98df595d1 100644
--- a/src/widgets/widgets/qmenu.h
+++ b/src/widgets/widgets/qmenu.h
@@ -46,7 +46,6 @@
#include <QtCore/qstring.h>
#include <QtWidgets/qicon.h>
#include <QtWidgets/qaction.h>
-#include <QtWidgets/qplatformmenu_qpa.h>
#ifdef Q_OS_WINCE
#include <windef.h> // for HMENU
@@ -61,6 +60,7 @@ QT_BEGIN_NAMESPACE
class QMenuPrivate;
class QStyleOptionMenuItem;
+class QPlatformMenu;
class Q_WIDGETS_EXPORT QMenu : public QWidget
{
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index ee6e62653f..d637a9be8f 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -61,6 +61,8 @@
#include "QtCore/qbasictimer.h"
#include "private/qwidget_p.h"
+#include <qplatformmenu_qpa.h>
+
QT_BEGIN_NAMESPACE
#ifndef QT_NO_MENU
diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h
index 9818526543..c1272c45ce 100644
--- a/src/widgets/widgets/qmenubar.h
+++ b/src/widgets/widgets/qmenubar.h
@@ -54,6 +54,7 @@ QT_BEGIN_NAMESPACE
class QMenuBarPrivate;
class QStyleOptionMenuItem;
class QWindowsStyle;
+class QPlatformMenuBar;
class Q_WIDGETS_EXPORT QMenuBar : public QWidget
{
diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp
index 285099a4cb..44c450ca47 100644
--- a/src/widgets/widgets/qsplitter.cpp
+++ b/src/widgets/widgets/qsplitter.cpp
@@ -232,14 +232,14 @@ void QSplitterHandle::resizeEvent(QResizeEvent *event)
{
Q_D(const QSplitterHandle);
- // When splitters are only 1 pixel large we increase the
+ // When splitters are only 1 or 0 pixel large we increase the
// actual grab area to five pixels
// Note that QSplitter uses contentsRect for layouting
// and ensures that handles are drawn on top of widgets
// We simply use the contents margins for draggin and only
// paint the mask area
- bool useTinyMode = (d->s->handleWidth() == 1);
+ bool useTinyMode = (d->s->handleWidth() <= 1);
setAttribute(Qt::WA_MouseNoMask, useTinyMode);
if (useTinyMode) {
if (orientation() == Qt::Horizontal)
@@ -1528,14 +1528,14 @@ void QSplitter::setSizes(const QList<int> &list)
By default, this property contains a value that depends on the user's platform
and style preferences.
- If you set handleWidth to 1, the actual grab area will grow to overlap a
+ If you set handleWidth to 1 or 0, the actual grab area will grow to overlap a
few pixels of it's respective widgets.
*/
int QSplitter::handleWidth() const
{
Q_D(const QSplitter);
- if (d->handleWidth > 0) {
+ if (d->handleWidth >= 0) {
return d->handleWidth;
} else {
return style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this);
diff --git a/src/widgets/widgets/qsplitter_p.h b/src/widgets/widgets/qsplitter_p.h
index c9db6ef9af..d9a0cdecb7 100644
--- a/src/widgets/widgets/qsplitter_p.h
+++ b/src/widgets/widgets/qsplitter_p.h
@@ -83,7 +83,7 @@ class QSplitterPrivate : public QFramePrivate
Q_DECLARE_PUBLIC(QSplitter)
public:
QSplitterPrivate() : rubberBand(0), opaque(true), firstShow(true),
- childrenCollapsible(true), compatMode(false), handleWidth(0), blockChildAdd(false) {}
+ childrenCollapsible(true), compatMode(false), handleWidth(-1), blockChildAdd(false) {}
QPointer<QRubberBand> rubberBand;
mutable QList<QSplitterLayoutStruct *> list;
diff --git a/src/widgets/widgets/qstatusbar.h b/src/widgets/widgets/qstatusbar.h
index b05bf627ad..4cab706c0b 100644
--- a/src/widgets/widgets/qstatusbar.h
+++ b/src/widgets/widgets/qstatusbar.h
@@ -87,7 +87,7 @@ protected:
void paintEvent(QPaintEvent *);
void resizeEvent(QResizeEvent *);
- // ### Qt 5: consider making reformat() and hideOrShow() private
+ // ### Qt 6: consider making reformat() and hideOrShow() private
void reformat();
void hideOrShow();
bool event(QEvent *);
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index c9300d3cdd..017cbee219 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -103,11 +103,11 @@ void QWidgetLineControl::updateDisplayText(bool forceUpdate)
int cursor = m_cursor - 1;
QChar uc = m_text.at(cursor);
str[cursor] = uc;
- if (cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) {
+ if (cursor > 0 && uc.isLowSurrogate()) {
// second half of a surrogate, check if we have the first half as well,
// if yes restore both at once
uc = m_text.at(cursor - 1);
- if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00)
+ if (uc.isHighSurrogate())
str[cursor - 1] = uc;
}
}
@@ -220,11 +220,11 @@ void QWidgetLineControl::backspace()
if (m_maskData)
m_cursor = prevMaskBlank(m_cursor);
QChar uc = m_text.at(m_cursor);
- if (m_cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) {
+ if (m_cursor > 0 && uc.isLowSurrogate()) {
// second half of a surrogate, check if we have the first half as well,
// if yes delete both at once
uc = m_text.at(m_cursor - 1);
- if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00) {
+ if (uc.isHighSurrogate()) {
internalDelete(true);
--m_cursor;
}
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index d602d6daa5..91864b6608 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -79,6 +79,7 @@
#include <qtooltip.h>
#include <qstyleoption.h>
#include <QtWidgets/qlineedit.h>
+#include <QtGui/qaccessible.h>
#ifndef QT_NO_SHORTCUT
#include "private/qapplication_p.h"
@@ -577,8 +578,15 @@ void QWidgetTextControlPrivate::repaintOldAndNewSelection(const QTextCursor &old
void QWidgetTextControlPrivate::selectionChanged(bool forceEmitSelectionChanged /*=false*/)
{
Q_Q(QWidgetTextControl);
- if (forceEmitSelectionChanged)
+ if (forceEmitSelectionChanged) {
emit q->selectionChanged();
+#ifndef QT_NO_ACCESSIBILITY
+ if (q->parent()) {
+ QAccessibleTextSelectionEvent ev(q->parent(), cursor.anchor(), cursor.position());
+ QAccessible::updateAccessibility(&ev);
+ }
+#endif
+ }
if (cursor.position() == lastSelectionPosition
&& cursor.anchor() == lastSelectionAnchor)
@@ -593,9 +601,15 @@ void QWidgetTextControlPrivate::selectionChanged(bool forceEmitSelectionChanged
&& (selectionStateChange
|| (cursor.hasSelection()
&& (cursor.position() != lastSelectionPosition
- || cursor.anchor() != lastSelectionAnchor))))
+ || cursor.anchor() != lastSelectionAnchor)))) {
emit q->selectionChanged();
-
+#ifndef QT_NO_ACCESSIBILITY
+ if (q->parent()) {
+ QAccessibleTextSelectionEvent ev(q->parent(), cursor.anchor(), cursor.position());
+ QAccessible::updateAccessibility(&ev);
+ }
+#endif
+ }
emit q->microFocusChanged();
lastSelectionPosition = cursor.position();
lastSelectionAnchor = cursor.anchor();