Skip to content
Permalink
Browse files

add button to show the help and values widget

  • Loading branch information
3nids committed Dec 11, 2018
1 parent 37cac47 commit d33f11e6e127f2e2ec8b30c11e264163a358ba47
Showing with 35 additions and 37 deletions.
  1. +17 −2 src/gui/qgsexpressionbuilderwidget.cpp
  2. +18 −35 src/ui/qgsexpressionbuilder.ui
@@ -93,6 +93,19 @@ QgsExpressionBuilderWidget::QgsExpressionBuilderWidget( QWidget *parent )

editorSplit->setSizes( QList<int>( {175, 300} ) );

functionsplit->setCollapsible( 0, false );
connect( mShowHelpButton, &QPushButton::clicked, this, [ = ]()
{
functionsplit->setSizes( QList<int>( {mOperationListGroup->width() - mHelpAndValuesWidget->minimumWidth(),
mHelpAndValuesWidget->minimumWidth()} ) );
mShowHelpButton->setEnabled( false );
} );
connect( functionsplit, &QSplitter::splitterMoved, this, [ = ]( int, int )
{
mShowHelpButton->setEnabled( functionsplit->sizes().at( 1 ) == 0 );
} );


QgsSettings settings;
splitter->restoreState( settings.value( QStringLiteral( "Windows/QgsExpressionBuilderWidget/splitter" ) ).toByteArray() );
editorSplit->restoreState( settings.value( QStringLiteral( "Windows/QgsExpressionBuilderWidget/editorsplitter" ) ).toByteArray() );
@@ -227,7 +240,9 @@ void QgsExpressionBuilderWidget::currentChanged( const QModelIndex &index, const
mValuesModel->setStringList( values );
}

mValueGroupBox->setVisible( item->getItemType() == QgsExpressionItem::Field && mLayer );
bool isField = mLayer && item->getItemType() == QgsExpressionItem::Field;
mValueGroupBox->setVisible( isField );
mShowHelpButton->setText( isField ? tr( "Show Values" ) : tr( "Show Help" ) );

// Show the help for the current item.
QString help = loadFunctionHelp( item );
@@ -1092,7 +1107,7 @@ void QgsExpressionBuilderWidget::indicatorClicked( int line, int index, Qt::Keyb
if ( state & Qt::ControlModifier )
{
int position = txtExpressionString->positionFromLineIndex( line, index );
long fncIndex = txtExpressionString->SendScintilla( QsciScintilla::SCI_INDICATORVALUEAT, FUNCTION_MARKER_ID, ( long int )position );
long fncIndex = txtExpressionString->SendScintilla( QsciScintilla::SCI_INDICATORVALUEAT, FUNCTION_MARKER_ID, static_cast<long int>( position ) );
QgsExpressionFunction *func = QgsExpression::Functions()[fncIndex];
QString help = getFunctionHelp( func );
txtHelpText->setText( help );
@@ -447,23 +447,30 @@
</item>
</layout>
</widget>
<widget class="QFrame" name="moperationListGroup">
<widget class="QFrame" name="mOperationListGroup">
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QSplitter" name="functionsplit">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="layoutWidget1">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QGridLayout" name="gridLayout_9">
<item row="0" column="0">
<widget class="QgsFilterLineEdit" name="txtSearchEdit">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<item row="0" column="1">
<widget class="QPushButton" name="mShowHelpButton">
<property name="text">
<string>Show Help</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QTreeView" name="expressionTree">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
@@ -490,7 +497,13 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget2">
<widget class="QWidget" name="mHelpAndValuesWidget" native="true">
<property name="minimumSize">
<size>
<width>250</width>
<height>0</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
@@ -824,36 +837,6 @@ Saved scripts are auto loaded on QGIS startup.</string>
</customwidgets>
<resources>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
<include location="../../images/images.qrc"/>
</resources>
<connections/>
</ui>

0 comments on commit d33f11e

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