mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -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
|
* Get the updated configuration
|
||||||
*/
|
*/
|
||||||
QgsAttributeTableConfig config() const;
|
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 )
|
: QDialog( parent, flags )
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
|
||||||
|
connect( mShowAllButton, SIGNAL( clicked( bool ) ), this, SLOT( showAll() ) );
|
||||||
|
connect( mHideAllButton, SIGNAL( clicked( bool ) ), this, SLOT( hideAll() ) );
|
||||||
|
|
||||||
if ( vl )
|
if ( vl )
|
||||||
{
|
{
|
||||||
mConfig = vl->attributeTableConfig();
|
mConfig = vl->attributeTableConfig();
|
||||||
@ -86,6 +90,13 @@ QgsOrganizeTableColumnsDialog::QgsOrganizeTableColumnsDialog( const QgsVectorLay
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !vl || mConfig.columns().count() < 7 )
|
||||||
|
{
|
||||||
|
mShowAllButton->hide();
|
||||||
|
mHideAllButton->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
restoreGeometry( settings.value( "/Windows/QgsOrganizeTableColumnsDialog/geometry" ).toByteArray() );
|
restoreGeometry( settings.value( "/Windows/QgsOrganizeTableColumnsDialog/geometry" ).toByteArray() );
|
||||||
}
|
}
|
||||||
@ -114,3 +125,19 @@ QgsAttributeTableConfig QgsOrganizeTableColumnsDialog::config() const
|
|||||||
config.setColumns( columns );
|
config.setColumns( columns );
|
||||||
return config;
|
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;
|
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:
|
private:
|
||||||
QgsAttributeTableConfig mConfig;
|
QgsAttributeTableConfig mConfig;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,8 +13,25 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Filter table column</string>
|
<string>Filter table column</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item>
|
<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">
|
<widget class="QListWidget" name="mFieldsList">
|
||||||
<property name="dragDropMode">
|
<property name="dragDropMode">
|
||||||
<enum>QAbstractItemView::DragDrop</enum>
|
<enum>QAbstractItemView::DragDrop</enum>
|
||||||
@ -24,15 +41,25 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="2" column="1">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<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">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="standardButtons">
|
<property name="sizeHint" stdset="0">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user