mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
allow to hide/show all columns in attribute table config
This commit is contained in:
parent
47a301ca61
commit
f20e28d98f
@ -23,4 +23,15 @@ class QgsOrganizeTableColumnsDialog : QDialog
|
||||
* Get the updated configuration
|
||||
*/
|
||||
QgsAttributeTableConfig config() const;
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* showAll checks all the fields to show them all in the attribute table
|
||||
*/
|
||||
void showAll();
|
||||
|
||||
/**
|
||||
* hideAll unchecks all the fields to hide them all in the attribute table
|
||||
*/
|
||||
void hideAll();
|
||||
};
|
||||
|
@ -45,6 +45,10 @@ QgsOrganizeTableColumnsDialog::QgsOrganizeTableColumnsDialog( const QgsVectorLay
|
||||
: QDialog( parent, flags )
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
connect( mShowAllButton, SIGNAL( clicked( bool ) ), this, SLOT( showAll() ) );
|
||||
connect( mHideAllButton, SIGNAL( clicked( bool ) ), this, SLOT( hideAll() ) );
|
||||
|
||||
if ( vl )
|
||||
{
|
||||
mConfig = vl->attributeTableConfig();
|
||||
@ -86,6 +90,13 @@ QgsOrganizeTableColumnsDialog::QgsOrganizeTableColumnsDialog( const QgsVectorLay
|
||||
}
|
||||
}
|
||||
|
||||
if ( !vl || mConfig.columns().count() < 7 )
|
||||
{
|
||||
mShowAllButton->hide();
|
||||
mHideAllButton->hide();
|
||||
}
|
||||
|
||||
|
||||
QSettings settings;
|
||||
restoreGeometry( settings.value( "/Windows/QgsOrganizeTableColumnsDialog/geometry" ).toByteArray() );
|
||||
}
|
||||
@ -114,3 +125,19 @@ QgsAttributeTableConfig QgsOrganizeTableColumnsDialog::config() const
|
||||
config.setColumns( columns );
|
||||
return config;
|
||||
}
|
||||
|
||||
void QgsOrganizeTableColumnsDialog::showAll()
|
||||
{
|
||||
for ( int i = 0 ; i < mFieldsList->count() ; i++ )
|
||||
{
|
||||
mFieldsList->item( i )->setCheckState( Qt::Checked );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsOrganizeTableColumnsDialog::hideAll()
|
||||
{
|
||||
for ( int i = 0 ; i < mFieldsList->count() ; i++ )
|
||||
{
|
||||
mFieldsList->item( i )->setCheckState( Qt::Unchecked );
|
||||
}
|
||||
}
|
||||
|
@ -48,8 +48,20 @@ class GUI_EXPORT QgsOrganizeTableColumnsDialog : public QDialog, private Ui::Qgs
|
||||
*/
|
||||
QgsAttributeTableConfig config() const;
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* showAll checks all the fields to show them all in the attribute table
|
||||
*/
|
||||
void showAll();
|
||||
|
||||
/**
|
||||
* hideAll unchecks all the fields to hide them all in the attribute table
|
||||
*/
|
||||
void hideAll();
|
||||
|
||||
private:
|
||||
QgsAttributeTableConfig mConfig;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -13,8 +13,25 @@
|
||||
<property name="windowTitle">
|
||||
<string>Filter table column</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="3">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="mShowAllButton">
|
||||
<property name="text">
|
||||
<string>select all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<widget class="QListWidget" name="mFieldsList">
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::DragDrop</enum>
|
||||
@ -24,15 +41,25 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="mHideAllButton">
|
||||
<property name="text">
|
||||
<string>unselect all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
Loading…
x
Reference in New Issue
Block a user