| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When two buttons' roles are equal, the code would fall back to
comparing the buttons' memory addresses. This leads to random results,
which are especially noticeable on Windows and with release builds.
This patch fixes the issue by instead returning false if the roles
are equal. This still satisfies the "comp(a,a)==false" requirement
of strict weak ordering:
https://en.cppreference.com/w/cpp/named_req/Compare
The patch also changes the sorting algorithm used from std::sort()
to std::stable_sort(). Although it doesn't appear to be necessary from
the testing that I did, it is good to ensure that the order of equal
elements is maintained.
Fixes: QTBUG-70451
Change-Id: I47561604108b12bf8ec0c794a2372767f0b2e04e
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some history:
- f1f884d3 worked around an issue in DialogButtonBox.
- c2fd8f7d fixed it by using contentWidth; i.e. the implicit width of
the contentItem. It caused QTBUG-72372.
- I tried to fix QTBUG-72372 with 6476de0b, but created (or exposed)
QTBUG-73860.
The problem in QTBUG-73860 can be seen with the following example:
Dialog {
id: dialog
visible: true
standardButtons: Dialog.Ok
}
The single 'Ok' button here will go outside of the dialog. The
underlying issue can be seen by looking into DialogButtonBox.qml:
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
(control.count === 1 ? contentWidth * 2 : contentWidth) + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding)
The implicit width of the box in this case is contentWidth * 2
(there is one button, so control.count === 1). This should result in
the button taking half the width of the box and being aligned to the
right:
alignment: count === 1 ? Qt.AlignRight : undefined
...
delegate: Button {
width: control.count === 1 ? control.availableWidth / 2 : undefined
}
What actually happens is that the contentItem (ListView) is temporarily 0
until it gets its final size of 100. However, QQuickDialogButtonBox
doesn't respond to this change in the ListView's contentWidth.
This problem can be fixed by returning to c2fd8f7d's resizeContent()
implementation, which uses contentWidth.
Then, there is a second issue:
Dialog {
id: dialog
visible: true
standardButtons: Dialog.Ok
width: 300
}
The button here is also positioned outside of the box. The problem is
that the contentWidth is based on implicitContentWidth:
QQuickContainerPrivate::updateContentWidth()
{
// ...
contentWidth = implicitContentWidth;
// ...
}
implicitContentWidth is calculated by calling getContentWidth():
void QQuickControlPrivate::updateImplicitContentWidth()
{
// ...
implicitContentWidth = getContentWidth();
// ...
}
In the case of horizontal alignment,
QQuickDialogButtonBoxPrivate::getContentWidth() uses the implicit
width of the largest button:
for (int i = 0; i < count; ++i) {
QQuickItem *item = q->itemAt(i);
if (item) {
totalWidth += item->implicitWidth();
maxWidth = qMax(maxWidth, item->implicitWidth());
}
}
// ...
if ((alignment & Qt::AlignHorizontal_Mask) == 0)
totalWidth = qMax(totalWidth, count * maxWidth + totalSpacing);
The Default style button has an implicitWidth of 100.
The DialogButtonBox in the example above is 300 pixels wide, so the
button should be 150, and it is, thanks to its width binding.
However, the DialogButtonBox uses contentWidth to size its contentItem
(ListView), and the contentWidth is, as mentioned, 100: the implicit
width of the button. So, the button ends up hanging over the side
of the box, as it's larger than the box thinks it is.
This problem is fixed by setting DialogButtonBox's contentWidth to the
contentWidth of the contentItem (ListView). This makes DialogButtonBox
use the explicit widths of the buttons rather than their implicit
widths. Since the contentWidth is no longer implicit, we must also
change any use of contentWidth in the implicitWidth binding to
implicitContentWidth.
While writing auto tests for this, they caught an issue where
contentWidth wasn't updated, so now we call resizeContent() in
QQuickContainer::setContentWidth().
Change-Id: I99ffda21b47aeb14d4382e453e87c4312f343a1c
Fixes: QTBUG-72886
Fixes: QTBUG-73860
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
c2fd8f7d made the following changes to the geometry calculation of
QQuickDialogButtonBox's contentItem:
@@ -244,11 +252,8 @@ void QQuickDialogButtonBoxPrivate::resizeContent()
return;
QRectF geometry = q->boundingRect().adjusted(q->leftPadding(), q->topPadding(), -q->rightPadding(), -q->bottomPadding());
- if (alignment != 0) {
- qreal cw = (alignment & Qt::AlignHorizontal_Mask) == 0 ? q->availableWidth() : contentItem->property("contentWidth").toReal();
- qreal ch = (alignment & Qt::AlignVertical_Mask) == 0 ? q->availableHeight() : contentItem->property("contentHeight").toReal();
- geometry = alignedRect(q->isMirrored() ? Qt::RightToLeft : Qt::LeftToRight, alignment, QSizeF(cw, ch), geometry);
- }
+ if (alignment != 0)
+ geometry = alignedRect(q->isMirrored() ? Qt::RightToLeft : Qt::LeftToRight, alignment, QSizeF(contentWidth, contentHeight), geometry);
It turns out that this breaks the use case of a fixed width box (e.g.
where a Dialog is assigned a width of 400 and the box assumes that
width) with a single button.
For example, in the case of the Default style,
QQuickDialogButtonBox::contentWidth is 100 because Button's
implicitWidth is 100. Since contentWidth is "used for calculating the
total implicit width" of the box, it's not useful for positioning
items which have an explicit width. The result is that
QQuickDialogButtonBox thinks the contentItem is smaller than it really
is, and therefore the ListView is positioned too far to the right.
Only the Default and Universal styles are affected, as they are the
only styles that resize the button to cover half of the button box.
This patch fixes the issue by reverting the code above to its original
state, where the content size of the contentItem is used instead
of the contentWidth of the box.
Change-Id: Idd2f94f3b4d3413fc2057c0ade2efdd66d701c08
Fixes: QTBUG-72372
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
QPlatformDialogHelper's meta-object is added to QQuickDialogButtonBox's
meta-object as a related meta object, and all of its enums are merged
into the same namespace by the QML engine. This produces a conflict with
the enum values of the ButtonLayout in QQuickDialogButtonBox, which is
a duplicate of the one that's already pulled in.
Fixes: QTBUG-70141
Task-number: QTBUG-70141
Change-Id: Ib33dc8ddbe8aa80d03183eb23861658c9e978f04
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/quicktemplates2/qquickabstractbutton_p_p.h
src/quicktemplates2/qquickcombobox.cpp
src/quicktemplates2/qquickcontainer.cpp
src/quicktemplates2/qquickcontrol.cpp
src/quicktemplates2/qquickcontrol_p_p.h
src/quicktemplates2/qquickdialog_p_p.h
src/quicktemplates2/qquickdialogbuttonbox.cpp
src/quicktemplates2/qquickdialogbuttonbox_p_p.h
src/quicktemplates2/qquickdrawer.cpp
src/quicktemplates2/qquickmenubar.cpp
src/quicktemplates2/qquickmenubar_p_p.h
src/quicktemplates2/qquickpage.cpp
src/quicktemplates2/qquickpage_p_p.h
src/quicktemplates2/qquickpane.cpp
src/quicktemplates2/qquickpane_p_p.h
src/quicktemplates2/qquickpopup.cpp
src/quicktemplates2/qquickpopup_p_p.h
src/quicktemplates2/qquickrangeslider.cpp
src/quicktemplates2/qquickscrollview.cpp
src/quicktemplates2/qquickslider.cpp
src/quicktemplates2/qquickspinbox.cpp
src/quicktemplates2/qquickswipeview.cpp
src/quicktemplates2/qquicktabbar.cpp
src/quicktemplates2/qquicktextarea_p_p.h
src/quicktemplates2/qquicktextfield_p_p.h
src/quicktemplates2/qquicktheme_p.h
Change-Id: I6e2b8fe99e51e3e26c87546aa66af045bc429ec4
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The code is more readable and less error-prone (this patch caught a few
uninitialized members) when the members are initialized in the same
place where they are declared. In many cases, empty default destructors
can be entirely removed, and we get faster implicitly declared inline
default constructors defined by the compiler.
Change-Id: I14c5448afc901f9b2ac5965f28c1c26c0b646c08
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| | |
In testbench, the settings dialog buttons were wrong laid out.
Change-Id: I3d62d5cc9d6c21a15df70a392e9b1a9d762ff3c6
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
[ChangeLog][Controls][Control] Added implicitContentWidth and
implicitContentHeight properties that can be used to simplify
complex implicit size bindings.
Change-Id: I6ccef572c013605058808ce2ad17f8bd82f49ef0
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Now we have contentWidth and contentHeight promoted/unified to
QQuickPane and QQuickContainer, and all relevant types inherit the
properties from there. The next step is to promote read-only versions
all the way up to the QQuickControl base class.
Change-Id: Ic6ed5d7b7852b0c7faaa59b9a261c360bc63fb6a
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is a follow-up to f1f884d3, which mentioned that:
This can be fixed properly in dev by providing separate contentWidth
and contentHeight properties that cleanly propagate the content size
to QML.
[ChangeLog][Controls][DialogButtonBox] Added contentWidth and
contentHeight properties.
Change-Id: I4b53702568c55d666bccb587af9fe8c8eba0b63d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|\|
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/quickcontrols2/qquickstyle.cpp
tests/auto/controls/data/tst_popup.qml
Change-Id: I7b7bb5f9c63b32eef65c9b2e68f56baa3da69cff
|
| |
| |
| |
| |
| |
| |
| |
| | |
There are a lot more than mentioned in the detailed description, so add
a table and list those suckers.
Change-Id: I92eb33a0d7071426328dafb2b1ec0096d075f257
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
|
|\|
| |
| |
| |
| |
| |
| | |
Conflicts:
tests/auto/controls/data/tst_dialogbuttonbox.qml
Change-Id: I39ea99d988aaa7d1afd35d573cca44d009b859ce
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When there's only one button in the dialog button box, the Default and
Universal styles resize the button to cover half of the button box.
This works in typical scenarios when the dialog button box is assigned
as a footer of a dialog, and thus, gets resized together with the
dialog. However, if the dialog button box is placed into a layout, or
otherwise not given an explicit size, the implicit size calculation
loops until it reaches zero.
1) button box gets the implicit size of the content (one button)
2) button box resizes the button to cover half of the box width
3) button box re-calculates its implicit size => step 1
Avoid the problem by providing a reasonable hard-coded implicit size
for this special case.
Notice that this is just a temporary workaround to avoid the problem.
This can be fixed properly in dev by providing separate contentWidth
and contentHeight properties that cleanly propagate the content size
to QML.
Task-number: QTBUG-59719
Change-Id: I552e0824ae6bff26b570c699252a3e4f09bd3397
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|/
|
|
|
|
|
|
| |
[ChangeLog][Controls][DialogButtonBox] Added buttonLayout property that
can be used to arrange the buttons.
Change-Id: I9160e5df86a0c9444b45ed9f585c50166c145671
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|\
| |
| |
| | |
Change-Id: Ide4b85626dd153b534c39a3afa2f3b9e732badf5
|
| |
| |
| |
| |
| | |
Change-Id: Ie72671fb92108dfaf5aaae4ea3ffb279e14b2f1a
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/quicktemplates2/qquickabstractbutton_p.h
src/quicktemplates2/qquickbuttongroup_p.h
src/quicktemplates2/qquickrangeslider.cpp
src/quicktemplates2/qquickrangeslider_p.h
src/quicktemplates2/qquickswipeview_p.h
src/quicktemplates2/qquicktextarea.cpp
src/quicktemplates2/qquicktextarea_p.h
src/quicktemplates2/qquicktextfield_p.h
Change-Id: I7cba8783b1dd85a4db534222e36572ee05dd01d0
|
| |
| |
| |
| |
| | |
Change-Id: I7bfb3505cf34b6e8a6f670abd81ee6e39084a1fc
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
|
|\|
| |
| |
| | |
Change-Id: I9188f94e40e2ecb4da1963ce2fcf915ab7a4b4fb
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Don't dereference the contentItem pointer without checking. We can use
availableWidth/Height as a fallback.
Task-number: QTBUG-63898
Change-Id: I1ef7704e96e233036eacd6e3586f5bd0c72fac2d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| | |
For the earlier versions, this was already done in the 5.9 branch.
Change-Id: I3fd3840aca0f5aadd7aa77eba358ac0f6c94f942
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There were no signals at all for the following standard buttons:
- Apply
- Discard
- Help
- Reset/RestoreDefaults
[ChangeLog][Controls][Dialog] Added missing applied(), discarded(),
helpRequested(), and reset() signals that are emitted when the
respective standard buttons are clicked.
Task-number: QTBUG-59423
Change-Id: I744a445be2c3506470bdd023e6909f483cc2520a
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|/
|
|
|
|
|
|
|
|
|
| |
There were no convenience signals for Apply, Reset, and Discard.
[ChangeLog][Controls][DialogButtonBox] Added missing applied(),
reset(), and discarded() signals.
Task-number: QTBUG-59423
Change-Id: I49ccc60672fadf64283ff3a6e043c3892cd291ba
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|\
| |
| |
| | |
Change-Id: Ia851f3ac828908ad693f393797e1e2c54bea5eef
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Instead of using system button layout, use layout from macOS, which
better fits the Material Design guidelines and also used in the Android
QPA plugin.
Task-number: QTBUG-58060
Change-Id: I06381219b5f1ad0a32742487fd314a8017d82dfc
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This was mentioned in the detailed description of DialogButtonBox,
but could easily be missed by users looking at Dialog's standardButtons
documentation, because that doesn't mention DialogButtonBox.
Change-Id: If3229589e24992d3071388a044246906e739a918
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| | |
To avoid crashes in the future.
Task-number: QTBUG-59532
Change-Id: Ie81f95939fc5655567f9d987cf040daf3a32df43
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: I03deebff661746d49e537af5b1c8899b938efb0d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/quicktemplates2/qquickswitch.cpp
src/quicktemplates2/qquickswitchdelegate.cpp
tests/auto/controls/data/tst_dialogbuttonbox.qml
tests/auto/controls/data/tst_toolbutton.qml
Change-Id: I1da1d6de83c1d9ac854dfce1d6c9d6ba2c460404
|
| |\
| | |
| | |
| | | |
Change-Id: Ibad627dfcd3389aeddfe08a10d13097c88f081a1
|
| | |
| | |
| | |
| | |
| | | |
Change-Id: I25935a069127a48c00dae951bc77665be6a429e1
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
It was a bit inconsistent before. Admittedly the colon at the end
was the most commonly used style in the quicktemplates2 code base,
but some had a line-break before the colon. This is now chosen as
the one true coding style of QQC2. ;) It makes the initializer list
aligned so that it stands out from the constructor body.
Change-Id: I66835e088df90d7219af04915176006d2a934ddc
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Initialize one member per line. Allow empty constructors with one
initialized member on a single line.
Change-Id: Ie115802561ebd19efd4dacda1fa868b64d279109
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|\| |
| | |
| | |
| | | |
Change-Id: If797ac58344b20e8de4379343131c097247ba2f2
|
| |/
| |
| |
| |
| | |
Change-Id: If68cff4efacc7dc5719c8b8e61937e85e9076870
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|/
|
|
|
| |
Change-Id: Ia075694a7dc43d72d07221b569467fcebdb411fb
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
[ChangeLog][Controls] Added Dialog to provide convenience for handling
dialog popups. Dialog integrates with DialogButtonBox, and provides
convenient accepted() and rejected() signals.
Task-number: QTBUG-51090
Change-Id: I776516738b82c0e5726769c054d6f2a956fb616d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Material Design allows mixing standard flat buttons with non-flat
custom buttons. It is enough that the delegate provides flat standard
buttons by default. It is better to not force all buttons to be flat,
but let the user freely specify whether custom buttons are flat.
This API has not yet been released, so it is still safe to remove.
Change-Id: Iec400553ccefb47f20fb98d64919491d9bb27cbe
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|
[ChangeLog][Controls] Added DialogButtonBox to provide convenience for
handling dialog buttons. DialogButtonBox is able to create a set of standard
buttons with a single line of QML code, and provides convenient accepted()
and rejected() signals.
Task-number: QTBUG-51090
Change-Id: I9b3c6ba1b2836dadf9a2ac9086be1eba214e7c4d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|