PartDesignGui::ComboLinks Class Reference

The ComboLinks class is a helper class that binds to a combo box and provides an interface to add links, retrieve links and select items by link value. More...

#include <TaskTransformedParameters.h>

Public Member Functions

int addLink (App::DocumentObject *linkObj, std::string linkSubname, QString itemText)
 
int addLink (const App::PropertyLinkSub &lnk, QString itemText)
 addLink adds an item to the combo. More...
 
void clear ()
 
QComboBoxcombo (void) const
 
 ComboLinks ()
 
 ComboLinks (QComboBox &combo)
 ComboLinks constructor. More...
 
App::PropertyLinkSubgetCurrentLink () const
 getCurrentLink More...
 
App::PropertyLinkSubgetLink (int index) const
 
void setCombo (QComboBox &combo)
 
int setCurrentLink (const App::PropertyLinkSub &lnk)
 setCurrentLink selects the item with the link that matches the argument. More...
 
 ~ComboLinks ()
 

Detailed Description

The ComboLinks class is a helper class that binds to a combo box and provides an interface to add links, retrieve links and select items by link value.

Constructor & Destructor Documentation

◆ ComboLinks() [1/2]

ComboLinks::ComboLinks ( QComboBox combo)

ComboLinks constructor.

Parameters
combo.It will be cleared as soon as it is bound. Don't add or remove items from the combo directly, otherwise internal tracking list will go out of sync, and crashes may result.

References combo().

◆ ComboLinks() [2/2]

PartDesignGui::ComboLinks::ComboLinks ( )

◆ ~ComboLinks()

PartDesignGui::ComboLinks::~ComboLinks ( )

References clear().

Member Function Documentation

◆ addLink() [1/2]

int ComboLinks::addLink ( App::DocumentObject linkObj,
std::string  linkSubname,
QString  itemText 
)

◆ addLink() [2/2]

int ComboLinks::addLink ( const App::PropertyLinkSub lnk,
QString  itemText 
)

addLink adds an item to the combo.

Doesn't check for duplicates.

Parameters
lnkcan be a link to NULL, which is usually used for special item "Select Reference"
itemText
Returns

References App::DocumentObject::getDocument(), App::PropertyLinkSub::getValue(), and App::PropertyLinkSub::Paste().

Referenced by PartDesignGui::TaskTransformedParameters::fillAxisCombo(), and PartDesignGui::TaskTransformedParameters::fillPlanesCombo().

◆ clear()

◆ combo()

QComboBox & PartDesignGui::ComboLinks::combo ( void  ) const

Referenced by ComboLinks(), and setCombo().

◆ getCurrentLink()

App::PropertyLinkSub & ComboLinks::getCurrentLink ( ) const

getCurrentLink

Returns
the link corresponding to the selected item. May be null link, which is usually used to indicate a "Select reference..." special item. Otherwise, the link is automatically tested for validity (oif an object doesn't exist in the document, an exception will be thrown.)

References getLink().

Referenced by PartDesignGui::TaskPolarPatternParameters::getAxis(), PartDesignGui::TaskLinearPatternParameters::getDirection(), and PartDesignGui::TaskMirroredParameters::getMirrorPlane().

◆ getLink()

App::PropertyLinkSub & ComboLinks::getLink ( int  index) const

References App::Document::isIn().

Referenced by getCurrentLink().

◆ setCombo()

void PartDesignGui::ComboLinks::setCombo ( QComboBox combo)

References combo().

◆ setCurrentLink()

int ComboLinks::setCurrentLink ( const App::PropertyLinkSub lnk)

setCurrentLink selects the item with the link that matches the argument.

If there is no such link in the list, -1 is returned and selected item is not changed. Signals from combo are blocked in this function.

Parameters
lnk
Returns
the index of an item that was selected, -1 if link is not in the list yet.

References App::PropertyLinkSub::getSubValues(), and App::PropertyLinkSub::getValue().


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