Skip to content
Permalink
Browse files

Merge pull request #8262 from 3nids/fix17727

move value group box under help area [Expression builder] [needs-docs]
  • Loading branch information
3nids committed Dec 10, 2018
2 parents 24d4640 + 20da34a commit 44d1d10eb35f7f40a268f95573710885b7d23b4c
Showing with 49 additions and 38 deletions.
  1. +17 −4 src/gui/qgsexpressionbuilderwidget.cpp
  2. +32 −34 src/ui/qgsexpressionbuilder.ui
@@ -57,7 +57,6 @@ QgsExpressionBuilderWidget::QgsExpressionBuilderWidget( QWidget *parent )
connect( mValuesListView, &QListView::doubleClicked, this, &QgsExpressionBuilderWidget::mValuesListView_doubleClicked );

mValueGroupBox->hide();
mLoadGroupBox->hide();
// highlighter = new QgsExpressionHighlighter( txtExpressionString->document() );

mModel = new QStandardItemModel();
@@ -94,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() );
@@ -228,8 +240,9 @@ void QgsExpressionBuilderWidget::currentChanged( const QModelIndex &index, const
mValuesModel->setStringList( values );
}

mLoadGroupBox->setVisible( item->getItemType() == QgsExpressionItem::Field && mLayer );
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 );
@@ -1094,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>
@@ -488,39 +495,41 @@
</attribute>
</widget>
</item>
</layout>
</widget>
<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>
</property>
<item>
<widget class="QTextEdit" name="txtHelpText">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="mValueGroupBox">
<layout class="QGridLayout" name="gridLayout_5">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
<number>10</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="4" column="0">
<widget class="QWidget" name="mLoadGroupBox" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
@@ -574,17 +583,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget2">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTextEdit" name="txtHelpText">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

0 comments on commit 44d1d10

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