Fix separators not being deleted
Bug found with QtQuick but also reproducible with QtWidgets. Added unit-test for both stacks.
This commit is contained in:
@@ -25,6 +25,9 @@ using namespace Layouting;
|
||||
|
||||
Separator* Separator::s_separatorBeingDragged = nullptr;
|
||||
|
||||
/// @brief internal counter just for unit-tests
|
||||
static int s_numSeparators = 0;
|
||||
|
||||
struct Separator::Private
|
||||
{
|
||||
// Only set when anchor is moved through mouse. Side1 if going towards left or top, Side2 otherwise.
|
||||
@@ -46,10 +49,12 @@ struct Separator::Private
|
||||
Separator::Separator(Widget *hostWidget)
|
||||
: d(new Private(hostWidget))
|
||||
{
|
||||
s_numSeparators++;
|
||||
}
|
||||
|
||||
Separator::~Separator()
|
||||
{
|
||||
s_numSeparators--;
|
||||
delete d;
|
||||
if (isBeingDragged())
|
||||
s_separatorBeingDragged = nullptr;
|
||||
@@ -216,6 +221,11 @@ bool Separator::isResizing()
|
||||
return s_separatorBeingDragged != nullptr;
|
||||
}
|
||||
|
||||
int Separator::numSeparators()
|
||||
{
|
||||
return s_numSeparators;
|
||||
}
|
||||
|
||||
void Separator::setLazyPosition(int pos)
|
||||
{
|
||||
if (d->lazyPosition != pos) {
|
||||
|
||||
Reference in New Issue
Block a user