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

Provides the QT UI for a smtk::attribute::FileSystemItem. More...

#include <qtFileItem.h>

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

Public Slots

virtual void onUpdateItemValue ()
 
void setOutputOptional (int)
 
virtual bool onLaunchFileBrowser ()
 
void updateItemData () override
 
void showContextMenu (const QPoint &pt, int elementIdx)
 
- Public Slots inherited from smtk::extension::qtItem
virtual void updateItemData ()
 Tell the qtItem to update itself based on changes to its underlying attribute item.
 

Signals

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

Public Member Functions

 qtFileItem (const qtAttributeItemInfo &info)
 
void setLabelVisible (bool) override
 
void enableFileBrowser (bool state=true)
 
bool isDirectory () const
 Are the fileItem's values directories?
 
bool showRecentFiles () const
 In the case of files that should exist, should we show values that have been used in the past?
 
bool showExtensions () const
 In the case of files that may or may not exist should we show valid file extensions?
 
bool useFileDirectory () const
 When changing an value should we try to use that file's directory as the file browser's starting point? More...
 
bool hasDefaultDirectory () const
 Is there a default directory for the file browser.
 
const std::string & defaultDirectory () const
 Return the default directory.
 
virtual void setInputValue (int i, const QString &)
 
void updateItemValue (int i)
 
void updateEditorValue (int i)
 
- 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 void markForDeletion ()
 Indicates that the item should be deleted. More...
 
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)
 Factory method that can be registered with smtk::extension::qtUIManager.
 

Protected Slots

virtual void onAddNewValue ()
 
virtual void onRemoveValue ()
 
- Protected Slots inherited from smtk::extension::qtItem
virtual void onAdvanceLevelChanged (int levelIdx)
 
virtual void onChildWidgetSizeChanged ()
 

Protected Member Functions

void createWidget () override
 
QWidget * createFileBrowseWidget (int elementIdx, const smtk::attribute::FileSystemItem &item, const smtk::attribute::FileSystemItemDefinition &itemDef)
 
virtual void loadInputValues (const smtk::attribute::FileSystemItem &item, const smtk::attribute::FileSystemItemDefinition &itemDef)
 
virtual void updateUI ()
 
virtual void addInputEditor (int i, const smtk::attribute::FileSystemItem &item, const smtk::attribute::FileSystemItemDefinition &itemDef)
 
virtual void clearChildWidgets ()
 
bool updateRecentValues (const std::string &val)
 
virtual void updateFileComboLists ()
 
void getEditor (int i, QComboBox **cbox, QLineEdit **lineEdit)
 
- 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 ()
 

Additional Inherited Members

- 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
 

Detailed Description

Provides the QT UI for a smtk::attribute::FileSystemItem.

qtFileSystemItem generates a UI for interacting with a smtk::attribute::FileSystemItem. In the case of a non-extensiable item, this qtItem generates an editable combobox along with a file browser for each value stored within the item. The combobox also stores the previous values entered allowing the user to choose from those along with entering an new value or selecting one using the file browser. If the item is extensible the generated GUI is similar except that instead of a combobox a line edit widget is created.

In either case, the line edit /combobox widget is colored based on whether the value is the default (if one exists), valid, or invalid. Note that the validity takes into consideration not only the validity imposed by the item definition's validity method but whether the file should exist or not.

This qtItem is the default type used by smtk::extension::qtUIManager.

ItemView Configuration Options:

ShowRecentFiles="true/false" - if the file must already exist, this option, when true, will display previous values using a combobox - default is false

ShowFileExtensions="true/false" - if the file is not required to already exist, and there are a set of suffixes associated with the item, this option, when true, will display the suffixes using a combobox - default is false

UseFileDirectory="true/false" - if true and if the value is set, the file browser will open in the directory of the current value. If the current value's directory does not exist the browser will either use the DefaultDirectoryProperty value or revert to its default behavior - default is true

DefaultDirectoryProperty="nameOfResourceStringProperty" - if set and the string vector property value on the item's attribute resource exists and refers to an existing directory. the file browser will open in the directory refereed to by the property value

See fileItemExample.sbt and fileItemExample.smtk as examples. Note that to demonstrate DefaultDirectoryProperty using these files you will need to create a string property called testDir and set it to something valid.

See also
qtItem

Member Function Documentation

◆ useFileDirectory()

bool qtFileItem::useFileDirectory ( ) const

When changing an value should we try to use that file's directory as the file browser's starting point?

Note that if this not true or if the directory does not exist then the default directory (if one has been specified) or the browser's default behavior will be used


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