Skip to content

Commit

Permalink
Q_PROPERTY to define dialog title in field expression widget
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed May 6, 2014
1 parent 73d11ae commit 90f0721
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions python/gui/qgsfieldexpressionwidget.sip
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class QgsFieldExpressionWidget : QWidget
//! set the geometry calculator used in the expression dialog
void setGeomCalculator( const QgsDistanceArea &da );

//! return the title used for the expression dialog
const QString expressionDialogTitle();

/**
* @brief currentField returns the currently selected field or expression if allowed
* @param isExpression determines if the string returned is the name of a field or an expression
Expand All @@ -27,9 +30,6 @@ class QgsFieldExpressionWidget : QWidget
//! Returns the currently used layer
QgsVectorLayer* layer();

protected:
void changeEvent( QEvent* event );

signals:
//! the signal is emitted when the currently selected field changes
void fieldChanged( QString fieldName );
Expand Down
12 changes: 9 additions & 3 deletions src/gui/qgsfieldexpressionwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class QgsMapLayer;
class QgsVectorLayer;
class QgsFieldModel;


/**
* @brief The QgsFieldExpressionWidget class reates a widget to choose fields and edit expressions
* It contains a combo boxto display the fields and expression and a button to open the expression dialog.
Expand All @@ -39,6 +40,8 @@ class QgsFieldModel;
class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY( QString expressionDialogTitle READ expressionDialogTitle WRITE setExpressionDialogTitle )

public:
/**
* @brief QgsFieldExpressionWidget creates a widget with a combo box to display the fields and expression and a button to open the expression dialog
Expand All @@ -48,6 +51,9 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
//! define the title used in the expression dialog
void setExpressionDialogTitle( QString title );

//! return the title used for the expression dialog
const QString expressionDialogTitle() { return mExpressionDialogTitle; }

//! set the geometry calculator used in the expression dialog
void setGeomCalculator( const QgsDistanceArea &da );

Expand All @@ -61,9 +67,6 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
//! Returns the currently used layer
QgsVectorLayer* layer();

protected:
void changeEvent( QEvent* event );

signals:
//! the signal is emitted when the currently selected field changes
void fieldChanged( QString fieldName );
Expand Down Expand Up @@ -102,6 +105,9 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget

bool isExpressionValid( const QString expressionStr );

protected:
void changeEvent( QEvent* event );

private:
QComboBox* mCombo;
QToolButton* mButton;
Expand Down

0 comments on commit 90f0721

Please sign in to comment.