List of all members | Classes | Public Types | Public Member Functions | Public Slots | Signals | Protected Member Functions | Protected Slots
ParameterWidget Class Reference

The ParameterWidget provides a consistent user and programming interface for managing query criteria. More...

#include <parameterwidget.h>

Public Types

enum  ParameterWidgetTypes {
  Crmacct, User, Text, Date,
  XComBox, Contact, Multiselect, GLAccount,
  Exists, CheckBox, Project, Customer,
  Site, Vendor, Item, Employee,
  Shipto, SalesOrder, WorkOrder, PurchaseOrder,
  TransferOrder
}
 

Public Member Functions

 ParameterWidget (QWidget *pParent, const char *=0)
 Create a new Parameter Widget. More...
 
 ~ParameterWidget ()
 
void appendValue (ParameterList &)
 Add name/value pairs to the input ParameterList to reflect the current user selections. More...
 
Q_INVOKABLE void applyDefaultFilterSet ()
 Find the default filter set for the ParameterWidget with the current parent and apply it. More...
 
Q_INVOKABLE QString filter ()
 
Q_INVOKABLE ParameterList parameters ()
 
Q_INVOKABLE int paramIndex (QString pName)
 
- Public Member Functions inherited from Ui_ParameterWidget
void retranslateUi (QWidget *ParameterWidget)
 
void retranslateUi (QWidget *ParameterWidget)
 
void setupUi (QWidget *ParameterWidget)
 
void setupUi (QWidget *ParameterWidget)
 

Public Slots

void addParam ()
 
void append (QString pName, QString pParam, enum ParameterWidgetTypes pType=Text, QVariant pDefault=QVariant(), bool pRequired=false, QString pExtraInfo=QString())
 Add a new filter to the set of available filters. More...
 
void appendComboBox (QString pName, QString pParam, QString pQuery, QVariant pDefault=QVariant(), bool pRequired=false)
 Add a new XComboBox-based filter to the set of available filters. More...
 
void appendComboBox (QString pName, QString pParam, int pType, QVariant pDefault=QVariant(), bool pRequired=false)
 Add a new XComboBox-based filter to the set of available filters. More...
 
void applySaved (int pId=0, int filter_id=0)
 
void changeFilterObject (int index)
 
void clearFilters ()
 
void removeParam (int)
 
void save ()
 
void setDefault (QString pName, QVariant pDefault=QVariant(), bool pAutoApply=false)
 
void setEnabled (QString pName, bool pEnabled)
 
void setFiltersDefault ()
 
void setFiltersVisabiltyPreference ()
 
void setFiltersVisible (bool visible)
 
void setSavedFilters (int defaultId=-1)
 
void setSavedFiltersIndex (QString)
 
void setType (QString, QString, ParameterWidgetTypes=Text, QVariant pDefault=QVariant(), QVariant extraInfo=QVariant())
 
void setXComboBoxType (QString, QString, enum XComboBox::XComboBoxTypes, QVariant pDefault=QVariant())
 
void setXComboBoxType (QString, QString, QString, QVariant pDefault=QVariant())
 
void sManageFilters ()
 
void storeFilterValue (int pId=-1, QObject *filter=0)
 
void toggleSave ()
 

Signals

void cleared ()
 
void filterChanged ()
 
void filterSetSaved ()
 
void updated ()
 

Protected Member Functions

bool containsUsedType (QString)
 
int getFilterIndex (const QWidget *filterwidget)
 
QWidgetgetFilterWidget (const int index)
 
QString getParameterTypeKey (QString)
 
virtual void resetEmptyParameter ()
 
void setSelectedFilter (int filter_id)
 
virtual void showEvent (QShowEvent *)
 

Protected Slots

void resetMultiselect (QTableWidgetItem *item)
 

Additional Inherited Members

- Public Attributes inherited from Ui_ParameterWidget
QToolButton * _addFilterRow
 
QPushButton * _filterButton
 
QFrame * _filterGroup
 
XComboBox_filterList
 
QLabel_filterListLit
 
QGridLayout * _filtersLayout
 
QHBoxLayout * _footerLayout
 
QSpacerItem * _footerSpacer
 
QHBoxLayout * _headerLayout
 
QSpacerItem * _headerSpacer
 
QPushButton * _manageButton
 
QPushButton * _saveButton
 
QGridLayout * gridLayout
 
QGridLayout * gridLayout_2
 
QVBoxLayout * verticalLayout
 
QSpacerItem * verticalSpacer
 

Detailed Description

The ParameterWidget provides a consistent user and programming interface for managing query criteria.

The ParameterWidget can be used to set filtering criteria to apply to MetaSQL queries. The application developer defines what criteria can be used (e.g. filter by a date range), what the default values should be, if any, and which criteria are mandatory. The user then chooses which criteria to actually use at runtime and supplies values (e.g. 'January 1, 2010' through 'December 31, 2010').

It is the application developer's responsibility to ensure that the user's selections are honored by the query.

Specific sets of filtering criteria can be saved, reused, and shared between users. The details of the filter can be hidden from view or made visible, allowing for efficient use of screen real estate.

If application preferences are available, the most recently selected filter will saved when the parent window closes and will be reselected when the window is next opened.

Member Enumeration Documentation

Enumerator
Crmacct 
User 
Text 
Date 
XComBox 
Contact 
Multiselect 
GLAccount 
Exists 
CheckBox 
Project 
Customer 
Site 
Vendor 
Item 
Employee 
Shipto 
SalesOrder 
WorkOrder 
PurchaseOrder 
TransferOrder 

Constructor & Destructor Documentation

ParameterWidget::ParameterWidget ( QWidget pParent,
const char *  pName = 0 
)

Create a new Parameter Widget.

Parameters
pParentThe parent of this widget
pNameThe object name to assign to this widget
ParameterWidget::~ParameterWidget ( )

Member Function Documentation

void ParameterWidget::addParam ( )
slot
void ParameterWidget::append ( QString  pName,
QString  pParam,
enum ParameterWidgetTypes  pType = Text,
QVariant  pDefault = QVariant(),
bool  pRequired = false,
QString  pExtraInfo = QString() 
)
slot

Add a new filter to the set of available filters.

Parameters
pNameThe user-visible name for this filter to distinguish it from other filters in the same set
pParamThe name to use for the parameter in the ParameterList
pTypeThe type of widget for the user to enter a criterion in
pDefaultThe default value to use for this parameter
pRequiredRequired parameters cannot be removed from the filter set
pExtraInfoA query string to use if pType indicates a combo box or multiselect
void ParameterWidget::appendComboBox ( QString  pName,
QString  pParam,
QString  pQuery,
QVariant  pDefault = QVariant(),
bool  pRequired = false 
)
slot

Add a new XComboBox-based filter to the set of available filters.

Parameters
pNameThe user-visible name for this filter to distinguish it from other filters in the same set
pParamThe name to use for the parameter in the ParameterList
pQuerySet the XComboBox to populate itself with this query
pDefaultThe default internal id to select for this XComboBox
pRequiredRequired parameters cannot be removed from the filter set
void ParameterWidget::appendComboBox ( QString  pName,
QString  pParam,
int  pType,
QVariant  pDefault = QVariant(),
bool  pRequired = false 
)
slot

Add a new XComboBox-based filter to the set of available filters.

Parameters
pNameThe user-visible name for this filter to distinguish it from other filters in the same set
pParamThe name to use for the parameter in the ParameterList
pTypeSet the XComboBox to use the corresponding XComboBox::XComboBoxTypes value
pDefaultThe default internal id to select for this XComboBox
pRequiredRequired parameters cannot be removed from the filter set
void ParameterWidget::appendValue ( ParameterList &  pParams)

Add name/value pairs to the input ParameterList to reflect the current user selections.

The ParameterList passed in to this method is modified to reflect the current selections. Parameters already in the list have their associated values changed and parameters not in the list are added. No name/value pairs are removed from the list.

This should be used carefully, as cached ParameterLists may have name/value pairs that the caller does not expect.

Parameters
[in,out]pParamsThe ParameterList to modify
void ParameterWidget::applyDefaultFilterSet ( )

Find the default filter set for the ParameterWidget with the current parent and apply it.

This method searches for the default filter set based on the QObject::objectName of the parent and the QObject::objectName of this ParameterWidget instance. If it is found, then this filter set is applied.

void ParameterWidget::applySaved ( int  pId = 0,
int  filter_id = 0 
)
slot
void ParameterWidget::changeFilterObject ( int  index)
slot
void ParameterWidget::cleared ( )
signal
void ParameterWidget::clearFilters ( )
slot
bool ParameterWidget::containsUsedType ( QString  value)
protected
QString ParameterWidget::filter ( )

Returns a text based list separated by line feeds of parameter names and selected values. Can be useful when passed to printed reports as a header description of what filter has been applied to the presented data.

void ParameterWidget::filterChanged ( )
signal
void ParameterWidget::filterSetSaved ( )
signal
int ParameterWidget::getFilterIndex ( const QWidget filterwidget)
protected
QWidget * ParameterWidget::getFilterWidget ( const int  index)
protected
QString ParameterWidget::getParameterTypeKey ( QString  pValue)
protected
ParameterList ParameterWidget::parameters ( )
int ParameterWidget::paramIndex ( QString  pName)

Returns the index of an appended parameter definition of pName.

void ParameterWidget::removeParam ( int  pRow)
slot
void ParameterWidget::resetEmptyParameter ( )
protectedvirtual

If the last parameter that has been added has not been selected, then reset it.

void ParameterWidget::resetMultiselect ( QTableWidgetItem *  item)
protectedslot
void ParameterWidget::save ( )
slot
void ParameterWidget::setDefault ( QString  pName,
QVariant  pDefault = QVariant(),
bool  pAutoApply = false 
)
slot

Set the default value on an existing parameter pName to pDefault. If pDefault is not passed or 0 then the previous default, if any, will be removed. if pAutoApply is true, then the default filter set will be automatically applied.

See also
applyDefaultFilterSet();
void ParameterWidget::setEnabled ( QString  pName,
bool  pEnabled 
)
slot

Enable or disable an existing parameter pName to pEnabled. Useful if you want a specific value to be forced based on privilege control or some other specific criteria that would limit the user's selection ability. Is effective the next time a user instantiates the parameter.

void ParameterWidget::setFiltersDefault ( )
slot

Sets the current filter as the default for the parent object it resides in.

void ParameterWidget::setFiltersVisabiltyPreference ( )
slot
void ParameterWidget::setFiltersVisible ( bool  visible)
slot
void ParameterWidget::setSavedFilters ( int  defaultId = -1)
slot

Sets a saved filter set with Id defaultId to the currently selected filter. If no pDefaultId is provided the default filter will be used.

See also
setSavedFiltersIndex(QString);
void ParameterWidget::setSavedFiltersIndex ( QString  filterSetName)
slot
void ParameterWidget::setSelectedFilter ( int  filter_id)
protected
void ParameterWidget::setType ( QString  pName,
QString  pParam,
ParameterWidgetTypes  type = Text,
QVariant  pDefault = QVariant(),
QVariant  extraInfo = QVariant() 
)
slot
void ParameterWidget::setXComboBoxType ( QString  pName,
QString  pParam,
enum XComboBox::XComboBoxTypes  xType,
QVariant  pDefault = QVariant() 
)
slot
void ParameterWidget::setXComboBoxType ( QString  pName,
QString  pParam,
QString  pQry,
QVariant  pDefault = QVariant() 
)
slot
void ParameterWidget::showEvent ( QShowEvent *  event)
protectedvirtual
void ParameterWidget::sManageFilters ( )
slot
void ParameterWidget::storeFilterValue ( int  pId = -1,
QObject filter = 0 
)
slot
void ParameterWidget::toggleSave ( )
slot
void ParameterWidget::updated ( )
signal

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

Generated on Fri Oct 7 2016 14:23:30 xTuple ERP Programmer Reference, Version 4.2.0 doxygen 1.8.10