SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Types | Public Slots | Public Member Functions | Static Public Member Functions | Protected Types | Protected Slots | Protected Member Functions | Protected Attributes | List of all members
smtk::extension::qtReferenceItem Class Reference

A base class for component and resource items. More...

#include <qtReferenceItem.h>

Inheritance diagram for smtk::extension::qtReferenceItem:
[legend]
Collaboration diagram for smtk::extension::qtReferenceItem:
[legend]

Public Types

enum  AcceptsTypes { NONE, RESOURCES, COMPONENTS, BOTH }
 

Public Slots

void updateItemData () override
 
- Public Slots inherited from smtk::extension::qtItem
virtual void updateItemData ()
 Tell the qtItem to update itself based on changes to its underlying attribute item.
 

Public Member Functions

 qtReferenceItem (const qtAttributeItemInfo &info)
 
void markForDeletion () override
 Indicates that the item should be deleted. More...
 
AcceptsTypes acceptableTypes () const
 
void setLabelVisible (bool) override
 
bool setSelectionIconPaths (const std::string &selectedIconPath, const std::string &unselectedIconPath)
 Set the paths (into qrc files or the local filesystem) of icons used to indicate which items are selected and which are not. More...
 
std::pair< std::string, std::string > selectionIconPaths () const
 Return the paths to icons used to display the membership in the item.
 
- Public Member Functions inherited from smtk::extension::qtItem
 qtItem (const qtAttributeItemInfo &info)
 
smtk::attribute::ItemPtr item () const
 
template<typename ItemType >
std::shared_ptr< ItemType > itemAs () const
 
qtUIManageruiManager () const
 
smtk::attribute::ResourcePtr attributeResource () const
 Return the underlying Attribute Resource.
 
QPointer< QWidget > widget ()
 
QPointer< QWidget > parentWidget ()
 
bool isLeafItem ()
 
virtual bool isFixedWidth () const
 
void showAdvanceLevelOverlay (bool)
 
bool useSelectionManager () const
 
void setReadOnly (bool mode)
 
bool isReadOnly () const
 
virtual QWidget * lastEditor () const
 Returns editor widget, used when setting tab order.
 
virtual void updateTabOrder (QWidget *)
 Sets previous widget for tabbing order.
 

Static Public Member Functions

static qtItemcreateItemWidget (const qtAttributeItemInfo &info)
 

Protected Types

enum  UpdateSource { UpdateSource::ITEM_FROM_GUI, UpdateSource::GUI_FROM_ITEM }
 Indicate whether the GUI should be updated from the item it presents or vice versa. More...
 

Protected Slots

void removeObservers ()
 
virtual void selectionLinkToggled (bool linked)
 
virtual void setOutputOptional (int state)
 
void popupClosing ()
 Called whenever the edit button's QMenu is about to hide. More...
 
virtual void linkHover (bool link)
 Link this item to the "hovered" selection bit. More...
 
virtual void linkHoverTrue ()
 
virtual void linkHoverFalse ()
 
virtual void synchronizeAndHide (bool escaping=false)
 Called when the user asks to close the popup. More...
 
virtual void copyFromSelection ()
 
virtual void copyToSelection ()
 
virtual void clearItem ()
 
virtual void sneakilyHideButtons ()
 
virtual void cleverlyShowButtons ()
 
void membershipChanged (int val)
 Update our labels when the membership badge has changed.
 
- Protected Slots inherited from smtk::extension::qtItem
virtual void onAdvanceLevelChanged (int levelIdx)
 
virtual void onChildWidgetSizeChanged ()
 

Protected Member Functions

virtual smtk::view::PhraseModelPtr createPhraseModel () const
 Subclasses override this to create a model of the appropriate type. More...
 
void createWidget () override
 
virtual void clearWidgets ()
 
virtual void updateUI ()
 
virtual std::string synopsis (bool &membershipValid) const
 
virtual void updateSynopsisLabels () const
 
bool eventFilter (QObject *src, QEvent *event) override
 
virtual void toggleCurrentItem ()
 Called by eventFilter() when user hits space/enter in popup.
 
virtual bool synchronize (UpdateSource src)
 Children must implement this.
 
smtk::extension::qt::MembershipBadge::MemberMap & members () const
 retrieve membership from the phraseModel's badge
 
void checkRemovedComponents (smtk::view::DescriptivePhrasePtr, smtk::view::PhraseModelEvent, const std::vector< int > &, const std::vector< int > &, const std::vector< int > &)
 
- Protected Member Functions inherited from smtk::extension::qtItem
virtual void setLocalAdvanceLevel (unsigned int level)
 
virtual void addChildItem (qtItem *)
 
virtual void removeChildItem (qtItem *)
 
virtual void clearChildItems ()
 
QList< qtItem * > & childItems ()
 

Protected Attributes

qtReferenceItemDatam_p
 
- Protected Attributes inherited from smtk::extension::qtItem
QPointer< QWidget > m_widget
 
bool m_isLeafItem
 
bool m_useSelectionManager
 
bool m_readOnly
 
bool m_markedForDeletion
 
qtAttributeItemInfo m_itemInfo
 
QList< smtk::extension::qtItem * > m_childItems
 

Additional Inherited Members

- Signals inherited from smtk::extension::qtItem
void widgetSizeChanged ()
 Signal indicates that the underlying widget's size has been modified.
 
void modified ()
 Signal indicates that the underlying item has been modified.
 
void childModified (qtItem *item)
 Signal indicates that the child from the underlying item has been modified More...
 
void editingWidgetChanged ()
 Indicates editing widget changed. More...
 

Detailed Description

A base class for component and resource items.

The qtReferenceItem class provides a uniform GUI for selecting entries that populate an attribute's item while abstracting away the types of those entries.

Member Enumeration Documentation

◆ UpdateSource

Indicate whether the GUI should be updated from the item it presents or vice versa.

Enumerator
ITEM_FROM_GUI 

Update the attribute-system's reference-item to match the GUI.

GUI_FROM_ITEM 

Update the GUI to match the attribute-system's reference-item.

Member Function Documentation

◆ createPhraseModel()

smtk::view::PhraseModelPtr qtReferenceItem::createPhraseModel ( ) const
protectedvirtual

Subclasses override this to create a model of the appropriate type.

The model should be configured using information the item (this->configuration()) and be ready for use.

Reimplemented in smtk::extension::qtResourceItem.

◆ linkHover

void qtReferenceItem::linkHover ( bool  link)
protectedvirtualslot

Link this item to the "hovered" selection bit.

This should set up the initial state, observe changes to the item, and update the selection, and add some indication to the item showing the "hovered" status (e.g., a color swatch).

◆ markForDeletion()

void qtReferenceItem::markForDeletion ( )
overridevirtual

Indicates that the item should be deleted.

This is similar to Qt's deleteLater() method (in fact it calls it); however, it also allows the qtItem to do some cleanup such as stop observing SMTK "signals".

Reimplemented from smtk::extension::qtItem.

◆ popupClosing

void qtReferenceItem::popupClosing ( )
protectedslot

Called whenever the edit button's QMenu is about to hide.

This may or may not be initiated by synchronizeAndHide(). If not, then it is initiated directly by the user clicking outside the popup, so it will call synchronizeAndHide() with m_p->m_alreadyClosingPopup set so that it will only synchronize and not hide.

◆ setSelectionIconPaths()

bool qtReferenceItem::setSelectionIconPaths ( const std::string &  selectedIconPath,
const std::string &  unselectedIconPath 
)

Set the paths (into qrc files or the local filesystem) of icons used to indicate which items are selected and which are not.

This returns true if the values were modified and false otherwise.

Note that calling this method will not result in re-renders of any views displaying the model; you are responsible for calling this method before rendering takes place or for causing a render if calling after the initial render.

◆ synchronizeAndHide

void qtReferenceItem::synchronizeAndHide ( bool  escaping = false)
protectedvirtualslot

Called when the user asks to close the popup.

If escaping is false and if the widget's state is valid, then update the attribute-system item's state. Otherwise, revert the widget's state to the attribute-system item's state.

In the future we may provide applications with more options (either via signals/slots to resolve problems, or via preferences that can be set).

When escaping is true, this method is being called becuase the user clicked the Cancel or Escape keys. Otherwise, this method is being called because the popup's Done button has been pressed.


The documentation for this class was generated from the following files: