Skip to content
Permalink
Browse files
Now UI appears properly
  • Loading branch information
carolinux committed May 22, 2015
1 parent 46b2606 commit d33bf3dd33725231908294e6af917d8261e3a9c8
@@ -405,13 +405,20 @@ void QgsAttributeTableDialog::runFieldCalculation( QgsVectorLayer* layer, QStrin
mLayer->endEditCommand();
}

void QgsAttributeTableDialog::replaceSearchWidget(QWidget* oldw, QWidget* neww)
{
mFilterLayout->removeWidget(oldw);
oldw->setVisible(false);
mFilterLayout->addWidget(neww,0,0,0);
neww->setVisible(true);
}

void QgsAttributeTableDialog::filterColumnChanged( QObject* filterAction )
{
mFilterButton->setDefaultAction( qobject_cast<QAction *>( filterAction ) );
mFilterButton->setPopupMode( QToolButton::InstantPopup );
mCbxCaseSensitive->setVisible( true );
// replace the search line edit with a search widget that is suited to the selected field
mFilterQuery->setVisible( false );
// delete previous widget
if ( mCurrentSearchWidgetWrapper != 0 )
{
@@ -427,8 +434,7 @@ void QgsAttributeTableDialog::filterColumnChanged( QObject* filterAction )
//replace with createSearch or so
//go to registry and create a create Search method
mCurrentSearchWidgetWrapper= QgsEditorWidgetRegistry::instance()->createSearch( widgetType, mLayer, fldIdx, widgetConfig, mFilterContainer);
mCurrentSearchWidgetWrapper->widget()->setObjectName("searchy");
mCurrentSearchWidgetWrapper->widget()->setVisible( true );
replaceSearchWidget(mFilterQuery, mCurrentSearchWidgetWrapper->widget());

mApplyFilterButton->setVisible( true );
}
@@ -754,10 +760,11 @@ void QgsAttributeTableDialog::setFilterExpression( QString filterString )
mFilterButton->setDefaultAction( mActionAdvancedFilter );
mFilterButton->setPopupMode( QToolButton::MenuButtonPopup );
mCbxCaseSensitive->setVisible( false );

mFilterQuery->setVisible( true );
if ( mCurrentSearchWidgetWrapper != 0 )
{
mCurrentSearchWidgetWrapper->widget()->setVisible( false );
replaceSearchWidget(mCurrentSearchWidgetWrapper->widget(),mFilterQuery);
}
mApplyFilterButton->setVisible( true );
mMainView->setFilterMode( QgsAttributeTableFilterModel::ShowFilteredList );
@@ -159,6 +159,10 @@ class APP_EXPORT QgsAttributeTableDialog : public QDialog, private Ui::QgsAttrib
void updateTitle();

void updateButtonStatus( QString fieldName, bool isValid );

/* replace the search widget with a new one */
void replaceSearchWidget(QWidget* oldw, QWidget* neww);

signals:
/**
* Informs that editing mode has been toggled
@@ -19,6 +19,7 @@
#include "qgsfieldvalidator.h"

#include <QSettings>
#include <QSizePolicy>

QgsDefaultSearchWidgetWrapper::QgsDefaultSearchWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent )
: QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent )
@@ -39,6 +40,7 @@ QWidget* QgsDefaultSearchWidgetWrapper::createWidget( QWidget* parent )
void QgsDefaultSearchWidgetWrapper::initWidget( QWidget* widget )
{
mLineEdit = qobject_cast<QgsFilterLineEdit*>( widget );
mLineEdit->setSizePolicy(QSizePolicy ::Expanding , QSizePolicy ::Fixed );
connect( widget, SIGNAL( textChanged( QString ) ), this, SLOT( valueChanged( QString ) ) );
}

@@ -1,9 +1,9 @@
/***************************************************************************
qgstexteditwrapper.h
qgsdefaultsearchwidgetwrapper.h
--------------------------------------
Date : 5.1.2014
Copyright : (C) 2014 Matthias Kuhn
Email : matthias dot kuhn at gmx dot ch
Date : 21.5.2015
Copyright : (C) 2015 Karolina Alexiou
Email : carolinegr at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
@@ -542,7 +542,10 @@
</item>
<item>
<widget class="QWidget" name="mFilterContainer" native="true">
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="mFilterLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="margin">
<number>0</number>
</property>
@@ -552,9 +555,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="mSpacer" native="true"/>
</item>
<item>
<widget class="QToolButton" name="mApplyFilterButton">
<property name="toolTip">

0 comments on commit d33bf3d

Please sign in to comment.