Skip to content
Permalink
Browse files

Expression builder widget UI tweaks

- remove open,save button
- add Load All | Load Sample values buttons
- remove search label and show inside lineedit
  • Loading branch information
NathanW2 committed Jun 13, 2012
1 parent 409f25f commit ff87deef0702fdde21764b0f8588b402448eb6df
Showing with 50 additions and 81 deletions.
  1. +8 −7 src/gui/qgsexpressionbuilderwidget.cpp
  2. +42 −74 src/ui/qgsexpressionbuilder.ui
@@ -30,9 +30,6 @@ QgsExpressionBuilderWidget::QgsExpressionBuilderWidget( QWidget *parent )
setupUi( this );

mValueGroupBox->hide();
// The open and save button are for future.
btnOpen->hide();
btnSave->hide();
highlighter = new QgsExpressionHighlighter( txtExpressionString->document() );

mModel = new QStandardItemModel( );
@@ -46,6 +43,9 @@ QgsExpressionBuilderWidget::QgsExpressionBuilderWidget( QWidget *parent )
connect( expressionTree->selectionModel(), SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ),
this, SLOT( currentChanged( const QModelIndex &, const QModelIndex & ) ) );

connect( btnLoadAll, SIGNAL( pressed() ), this, SLOT( loadAllValues() ) );
connect( btnLoadSample, SIGNAL( pressed() ), this, SLOT( loadSampleValues() ) );

foreach( QPushButton* button, mOperatorsGroupBox->findChildren<QPushButton *>() )
{
connect( button, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
@@ -109,14 +109,15 @@ void QgsExpressionBuilderWidget::currentChanged( const QModelIndex &index, const
if ( item == 0 )
return;

// Loading field values are handled with a
// right click so we just show the help.
if ( item->getItemType() != QgsExpressionItem::Field )
{

mValueGroupBox->hide();
mValueListWidget->clear();
}

btnLoadAll->setVisible(item->getItemType() == QgsExpressionItem::Field);
btnLoadSample->setVisible(item->getItemType() == QgsExpressionItem::Field);
mValueGroupBox->setVisible(item->getItemType() == QgsExpressionItem::Field);

// Show the help for the current item.
QString help = loadFunctionHelp( item );
txtHelpText->setText( help );
@@ -49,7 +49,7 @@
<property name="spacing">
<number>0</number>
</property>
<item row="5" column="0">
<item row="4" column="0">
<widget class="QTreeView" name="expressionTree">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
@@ -75,37 +75,14 @@
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="topMargin">
<number>2</number>
<widget class="QLineEdit" name="txtSearchEdit">
<property name="enabled">
<bool>true</bool>
</property>
<property name="bottomMargin">
<number>2</number>
<property name="placeholderText">
<string>Search</string>
</property>
<item>
<widget class="QLabel" name="label">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Search</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="txtSearchEdit">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
@@ -124,6 +101,9 @@
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="mFunctionHelGroup">
<property name="title">
@@ -182,7 +162,7 @@
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<item row="0" column="0" colspan="2">
<widget class="QListWidget" name="mValueListWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@@ -216,6 +196,27 @@
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="leftMargin">
<number>6</number>
</property>
<item>
<widget class="QPushButton" name="btnLoadAll">
<property name="text">
<string>Load all unique values</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnLoadSample">
<property name="text">
<string>Load 10 sample values</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
@@ -471,7 +472,16 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
@@ -490,48 +500,6 @@
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QVBoxLayout" name="opensaveLayout">
<property name="spacing">
<number>3</number>
</property>
<item>
<widget class="QPushButton" name="btnSave">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionFileSave.png</normaloff>:/images/themes/default/mActionFileSave.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnOpen">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/gis/mActionFileOpen.png</normaloff>:/images/themes/gis/mActionFileOpen.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>

0 comments on commit ff87dee

Please sign in to comment.
You can’t perform that action at this time.