Commit 16760e83 authored by Bob Obara's avatar Bob Obara Committed by Kitware Robot

Merge topic 'convertingToQPointer'

7a4759f2 BUG: Having qtItem use/pass QPointers
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: David Thompson's avatarDavid Thompson <david.thompson@kitware.com>
Merge-request: !1528
parents 2f464d26 7a4759f2
Pipeline #134847 running with stage
......@@ -24,9 +24,7 @@ To implement this, the following was added to Definition:
* I/O classes can read and write these rules in XML and JSON
In addition, the implementation of isUnique has been changed It now used the exclusion mechanism by inserting
itself into the list. Note that this rule is not written out when serialized or when saved
to a file
In addition, the implementation of isUnique has been changed It now used the exclusion mechanism by inserting itself into the list. Note that this rule is not written out when serialized or when saved to a file
The qtAssociationWidget has been modified to use these new ruled when determining availability and qtAttributeView has been modified to test for association rules instead of association masks
......@@ -193,6 +191,13 @@ Added a new ReadOnly Option to Item Views. In the following example the item, a
#### New ViewItem Styles
* There are now Infinite Cylinder and Conical Frustum options for Group Items - See Changes to ParaView Extensions for more info.
#### Using QPointer it qtItem and AttributeItemInfo
* ***AttributeItemInfo::parentWidget() now returns a QPointer\<QWidget>***
* ***qtItem::parentWidget() now returns a QPointer\<QWidget>***
* ***qtItem::widget() now returns a QPointer\<QWidget>***
These changes were done to improve general stability as well as to simplifying when a qtItem needs to delete its main widget.
##Changes to Selection
* Selections now have a `resetSelectionBits()` method
that provides a way to remove a bit-vector from
......
......@@ -245,7 +245,8 @@ void qtDiscreteValueEditor::onInputValueChanged()
{
smtk::view::View::Component comp; // not current used but will be
AttributeItemInfo info(item->activeChildItem(static_cast<int>(i)), comp,
this->Internals->m_childrenFrame, this->Internals->m_inputItem->m_itemInfo.baseView());
this->Internals->m_childrenFrame.data(),
this->Internals->m_inputItem->m_itemInfo.baseView());
qtItem* childItem = uiManager->createItem(info);
if (childItem)
{
......
......@@ -18,7 +18,6 @@
#include <QComboBox>
#include <QLayout>
#include <QPointer>
using namespace smtk::attribute;
using namespace smtk::extension;
......@@ -53,9 +52,9 @@ qtItem::qtItem(const AttributeItemInfo& info)
qtItem::~qtItem()
{
this->clearChildItems();
if (m_itemInfo.parentWidget() && m_widget && m_itemInfo.parentWidget()->layout())
if (m_widget)
{
this->m_itemInfo.parentWidget()->layout()->removeWidget(m_widget);
delete m_widget;
}
if (this->Internals)
{
......
......@@ -17,6 +17,7 @@
#include "smtk/extension/qt/Exports.h"
#include "smtk/view/View.h"
#include <QObject>
#include <QPointer>
class qtItemInternals;
......@@ -55,7 +56,7 @@ class SMTKQTEXT_EXPORT AttributeItemInfo
{
public:
AttributeItemInfo(smtk::attribute::ItemPtr item, smtk::view::View::Component itemComp,
QWidget* parent, qtBaseView* bview)
QPointer<QWidget> parent, qtBaseView* bview)
: m_item(item)
, m_component(itemComp)
, m_parentWidget(parent)
......@@ -74,7 +75,7 @@ public:
smtk::view::View::Component component() const { return m_component; }
QWidget* parentWidget() const { return m_parentWidget; }
QPointer<QWidget> parentWidget() const { return m_parentWidget; }
qtBaseView* baseView() const { return m_baseView; }
......@@ -83,7 +84,7 @@ public:
protected:
smtk::attribute::WeakItemPtr m_item; // Pointer to the attribute Item
smtk::view::View::Component m_component; // qtItem Component Definition
QWidget* m_parentWidget; // Parent Widget of the qtItem
QPointer<QWidget> m_parentWidget; // Parent Widget of the qtItem
qtBaseView* m_baseView; // View Definition
};
......@@ -105,8 +106,8 @@ public:
qtUIManager* uiManager() const { return m_itemInfo.uiManager(); }
QWidget* widget() { return m_widget; }
QWidget* parentWidget() { return m_itemInfo.parentWidget(); }
QPointer<QWidget> widget() { return m_widget; }
QPointer<QWidget> parentWidget() { return m_itemInfo.parentWidget(); }
virtual void addChildItem(qtItem*);
virtual void clearChildItems();
......@@ -142,7 +143,7 @@ protected:
virtual void createWidget() { ; }
virtual void setAdvanceLevel(int level);
QWidget* m_widget;
QPointer<QWidget> m_widget;
bool m_isLeafItem;
bool m_useSelectionManager;
bool m_readOnly;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment