SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Types | Signals | Public Member Functions | Protected Attributes | List of all members
smtk::extension::qt::MembershipBadge Class Reference

A badge that lets the user choose from a set of objects. More...

#include <MembershipBadge.h>

Inheritance diagram for smtk::extension::qt::MembershipBadge:
[legend]
Collaboration diagram for smtk::extension::qt::MembershipBadge:
[legend]

Public Types

using DescriptivePhrase = smtk::view::DescriptivePhrase
 
using MemberMap = std::map< std::weak_ptr< smtk::resource::PersistentObject >, int, std::owner_less< std::weak_ptr< smtk::resource::PersistentObject > >>
 

Signals

void membershipChange (int val)
 

Public Member Functions

 smtkTypeMacro (smtk::extension::qt::MembershipBadge)
 
 smtkSuperclassMacro (smtk::view::Badge)
 
 smtkSharedFromThisMacro (smtk::view::Badge)
 
 smtkCreateMacro (smtk::view::Badge)
 
 MembershipBadge (smtk::view::BadgeSet &, const smtk::view::Configuration::Component &)
 
bool appliesToPhrase (const DescriptivePhrase *) const override
 Returns true if the badge should appear next to the given phrase:
 
std::string icon (const DescriptivePhrase *phrase, const std::array< float, 4 > &) const override
 Returns a string for rendering the badge icon. More...
 
bool action (const smtk::view::DescriptivePhrase *, const smtk::view::BadgeAction &) override
 Take an action when the badge is clicked. More...
 
MemberMap & getMemberMap ()
 Provide external access to which items are selected.
 
bool singleSelect () const
 Returns true if this badge is set to only allow a single member at a time.
 
MembershipCriteria membershipCriteria () const
 
- Public Member Functions inherited from smtk::view::Badge
 smtkTypeMacroBase (Badge)
 
 Badge (const Badge &)=delete
 
Badgeoperator= (const Badge &)=delete
 
virtual std::string tooltip (const DescriptivePhrase *) const
 Return a tool-tip string for the badge that is relevant to this phrase. More...
 
bool isDefault () const
 Return whether this badge be invoked by non-specific user gestures. More...
 
void setIsDefault (bool isDefault)
 Set this badge as a default.
 

Protected Attributes

MemberMap m_members
 From available items, has this object been turned on?
 
bool m_singleSelect
 If true, only 1 item may be a member; toggling an item resets others. More...
 
std::string m_iconOn
 SVG for icon showing membership.
 
std::string m_iconOff
 SVG for icon showing non-membership.
 
const smtk::view::BadgeSetm_parent { nullptr }
 
MembershipCriteria m_criteria { MembershipCriteria::All }
 
std::string m_filter
 
- Protected Attributes inherited from smtk::view::Badge
bool m_isDefault { false }
 Should this badge be invoked by non-specific user gestures when it is applicable?
 

Detailed Description

A badge that lets the user choose from a set of objects.

Member Function Documentation

◆ action()

bool smtk::extension::qt::MembershipBadge::action ( const smtk::view::DescriptivePhrase ,
const smtk::view::BadgeAction  
)
overridevirtual

Take an action when the badge is clicked.

Return true if the action is supported (and was taken) by the badge for the given phrase; otherwise return false.

Reimplemented from smtk::view::Badge.

◆ icon()

std::string smtk::extension::qt::MembershipBadge::icon ( const DescriptivePhrase phrase,
const std::array< float, 4 > &  background 
) const
overridevirtual

Returns a string for rendering the badge icon.

The string is currently interpreted by qtDescriptivePhraseDelegate::paint() as scalable vector graphics (SVG).

The icon may change depending on (1) the state of the phrase or its parent view, (2) the background color of the phrase.

Implements smtk::view::Badge.

Member Data Documentation

◆ m_singleSelect

bool smtk::extension::qt::MembershipBadge::m_singleSelect
protected
Initial value:
{
false
}

If true, only 1 item may be a member; toggling an item resets others.


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