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

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

#include <parameterwidget.h>

Inheritance diagram for ParameterWidget:
QWidget Ui::ParameterWidget Ui_ParameterWidget

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 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, int pType, 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, QString pQuery, 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 ()
 

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)
 
void retranslateUi (QWidget *ParameterWidget)
 
void retranslateUi (QWidget *ParameterWidget)
 
void setupUi (QWidget *ParameterWidget)
 
void setupUi (QWidget *ParameterWidget)
 

Public Attributes

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
 

Protected Slots

void resetMultiselect (QTableWidgetItem *item)
 

Protected Member Functions

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

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

◆ ParameterWidgetTypes

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::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::~ParameterWidget ( )

Member Function Documentation

◆ addParam

void ParameterWidget::addParam ( )
slot

◆ append

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

◆ appendComboBox [1/2]

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

◆ appendComboBox [2/2]

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

◆ appendValue()

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

◆ applyDefaultFilterSet()

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.

◆ applySaved

void ParameterWidget::applySaved ( int  pId = 0,
int  filter_id = 0 
)
slot

◆ changeFilterObject

void ParameterWidget::changeFilterObject ( int  index)
slot

◆ cleared

void ParameterWidget::cleared ( )
signal

◆ clearFilters

void ParameterWidget::clearFilters ( )
slot

◆ containsUsedType()

bool ParameterWidget::containsUsedType ( QString  value)
protected

◆ filter()

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.

◆ filterChanged

void ParameterWidget::filterChanged ( )
signal

◆ filterSetSaved

void ParameterWidget::filterSetSaved ( )
signal

◆ getFilterIndex()

int ParameterWidget::getFilterIndex ( const QWidget filterwidget)
protected

◆ getFilterWidget()

QWidget * ParameterWidget::getFilterWidget ( const int  index)
protected

◆ getParameterTypeKey()

QString ParameterWidget::getParameterTypeKey ( QString  pValue)
protected

◆ parameters()

ParameterList ParameterWidget::parameters ( )

◆ paramIndex()

int ParameterWidget::paramIndex ( QString  pName)

Returns the index of an appended parameter definition of pName.

◆ preferencePrefix()

QString ParameterWidget::preferencePrefix ( ) const
protectedvirtual

◆ removeParam

void ParameterWidget::removeParam ( int  pRow)
slot

◆ resetMultiselect

void ParameterWidget::resetMultiselect ( QTableWidgetItem *  item)
protectedslot

◆ retranslateUi() [1/2]

void Ui_ParameterWidget::retranslateUi ( QWidget ParameterWidget)
inlineinherited

◆ retranslateUi() [2/2]

void Ui_ParameterWidget::retranslateUi ( QWidget ParameterWidget)
inlineinherited

◆ save

void ParameterWidget::save ( )
slot

◆ setDefault

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();

◆ setEnabled

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.

◆ setFiltersDefault

void ParameterWidget::setFiltersDefault ( )
slot

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

◆ setFiltersVisabiltyPreference

void ParameterWidget::setFiltersVisabiltyPreference ( )
slot

◆ setFiltersVisible

void ParameterWidget::setFiltersVisible ( bool  visible)
slot

◆ setSavedFilters

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);

◆ setSavedFiltersIndex

void ParameterWidget::setSavedFiltersIndex ( QString  filterSetName)
slot

◆ setSelectedFilter()

void ParameterWidget::setSelectedFilter ( int  filter_id)
protected

◆ setType

void ParameterWidget::setType ( QString  pName,
QString  pParam,
ParameterWidgetTypes  type = Text,
QVariant  pDefault = QVariant(),
QVariant  extraInfo = QVariant() 
)
slot

◆ setupUi() [1/2]

void Ui_ParameterWidget::setupUi ( QWidget ParameterWidget)
inlineinherited

◆ setupUi() [2/2]

void Ui_ParameterWidget::setupUi ( QWidget ParameterWidget)
inlineinherited

◆ setXComboBoxType [1/2]

void ParameterWidget::setXComboBoxType ( QString  pName,
QString  pParam,
enum XComboBox::XComboBoxTypes  xType,
QVariant  pDefault = QVariant() 
)
slot

◆ setXComboBoxType [2/2]

void ParameterWidget::setXComboBoxType ( QString  pName,
QString  pParam,
QString  pQry,
QVariant  pDefault = QVariant() 
)
slot

◆ showEvent()

void ParameterWidget::showEvent ( QShowEvent *  event)
protectedvirtual

◆ sManageFilters

void ParameterWidget::sManageFilters ( )
slot

◆ storeFilterValue

void ParameterWidget::storeFilterValue ( int  pId = -1,
QObject filter = 0 
)
slot

◆ toggleSave

void ParameterWidget::toggleSave ( )
slot

◆ updated

void ParameterWidget::updated ( )
signal

Member Data Documentation

◆ _addFilterRow

QToolButton * Ui_ParameterWidget::_addFilterRow
inherited

◆ _filterButton

QPushButton * Ui_ParameterWidget::_filterButton
inherited

◆ _filterGroup

QFrame * Ui_ParameterWidget::_filterGroup
inherited

◆ _filterList

XComboBox * Ui_ParameterWidget::_filterList
inherited

◆ _filterListLit

QLabel * Ui_ParameterWidget::_filterListLit
inherited

◆ _filtersLayout

QGridLayout * Ui_ParameterWidget::_filtersLayout
inherited

◆ _footerLayout

QHBoxLayout * Ui_ParameterWidget::_footerLayout
inherited

◆ _footerSpacer

QSpacerItem * Ui_ParameterWidget::_footerSpacer
inherited

◆ _headerLayout

QHBoxLayout * Ui_ParameterWidget::_headerLayout
inherited

◆ _headerSpacer

QSpacerItem * Ui_ParameterWidget::_headerSpacer
inherited

◆ _manageButton

QPushButton * Ui_ParameterWidget::_manageButton
inherited

◆ _saveButton

QPushButton * Ui_ParameterWidget::_saveButton
inherited

◆ gridLayout

QGridLayout * Ui_ParameterWidget::gridLayout
inherited

◆ gridLayout_2

QGridLayout * Ui_ParameterWidget::gridLayout_2
inherited

◆ verticalLayout

QVBoxLayout * Ui_ParameterWidget::verticalLayout
inherited

◆ verticalSpacer

QSpacerItem * Ui_ParameterWidget::verticalSpacer
inherited

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

Generated on Mon May 3 2021 xTuple ERP Programmer Reference, Version 4.12.0 doxygen 1.8.17