mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
add first/last buttons
This commit is contained in:
parent
f680466bf7
commit
c0a0f7d6c9
@ -751,6 +751,8 @@
|
||||
<file>themes/default/mIconDataDefineColor.svg</file>
|
||||
<file>themes/default/mIconDataDefineColorOn.svg</file>
|
||||
<file>themes/default/mActionNewVirtualLayer.svg</file>
|
||||
<file>themes/default/mActionDoubleArrowRight.svg</file>
|
||||
<file>themes/default/mActionDoubleArrowLeft.svg</file>
|
||||
</qresource>
|
||||
<qresource prefix="/images/tips">
|
||||
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
|
||||
|
81
images/themes/default/mActionDoubleArrowLeft.svg
Normal file
81
images/themes/default/mActionDoubleArrowLeft.svg
Normal file
@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
height="16"
|
||||
viewBox="0 0 4.2333332 4.2333335"
|
||||
width="16"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
sodipodi:docname="mActionDoubleArrowLeft.svg"
|
||||
inkscape:version="0.92.2 5c3e80d, 2017-08-06">
|
||||
<metadata
|
||||
id="metadata14">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs12" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1280"
|
||||
inkscape:window-height="938"
|
||||
id="namedview10"
|
||||
showgrid="false"
|
||||
inkscape:zoom="20.85965"
|
||||
inkscape:cx="8.5803974"
|
||||
inkscape:cy="4.1339743"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg8" />
|
||||
<g
|
||||
transform="rotate(90,148.23542,148.23542)"
|
||||
id="g6"
|
||||
style="fill-rule:evenodd">
|
||||
<path
|
||||
d="M 2.1166581,296.07395 0.39686386,293.42811 H 3.8364709 Z"
|
||||
id="path2"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#6d97c4;stroke:#415a75;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:round" />
|
||||
<path
|
||||
d="m 2.1127601,295.83164 -1.4731694,-2.27117 0.23030714,-7e-5 1.35909406,2.0991 z"
|
||||
id="path4"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#ffffff;fill-opacity:0.52906979" />
|
||||
</g>
|
||||
<g
|
||||
style="fill-rule:evenodd"
|
||||
transform="rotate(90,148.63229,148.63229)"
|
||||
id="g6-7">
|
||||
<path
|
||||
style="fill:#6d97c4;stroke:#415a75;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:round"
|
||||
inkscape:connector-curvature="0"
|
||||
d="M 2.1166581,296.07395 0.39686386,293.42811 H 3.8364709 Z"
|
||||
id="path2-9" />
|
||||
<path
|
||||
style="fill:#ffffff;fill-opacity:0.52906979"
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 2.1127601,295.83164 -1.4731694,-2.27117 0.23030714,-7e-5 1.35909406,2.0991 z"
|
||||
id="path4-3" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.6 KiB |
81
images/themes/default/mActionDoubleArrowRight.svg
Normal file
81
images/themes/default/mActionDoubleArrowRight.svg
Normal file
@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
height="16"
|
||||
viewBox="0 0 4.2333332 4.2333335"
|
||||
width="16"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
sodipodi:docname="mActionDoubleArrowRight.svg"
|
||||
inkscape:version="0.92.2 5c3e80d, 2017-08-06">
|
||||
<metadata
|
||||
id="metadata14">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs12" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1280"
|
||||
inkscape:window-height="938"
|
||||
id="namedview10"
|
||||
showgrid="false"
|
||||
inkscape:zoom="20.85965"
|
||||
inkscape:cx="8.5803974"
|
||||
inkscape:cy="4.1339743"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg8" />
|
||||
<g
|
||||
transform="rotate(-90,-144.39894,148.63228)"
|
||||
id="g6"
|
||||
style="fill-rule:evenodd">
|
||||
<path
|
||||
d="M 2.1166581,296.07395 0.39686386,293.42811 H 3.8364709 Z"
|
||||
id="path2"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#6d97c4;stroke:#415a75;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:round" />
|
||||
<path
|
||||
d="m 2.1127601,295.83164 -1.4731694,-2.27117 0.23030714,-7e-5 1.35909406,2.0991 z"
|
||||
id="path4"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#ffffff;fill-opacity:0.52906979" />
|
||||
</g>
|
||||
<g
|
||||
style="fill-rule:evenodd"
|
||||
transform="rotate(-90,-144.00207,148.23541)"
|
||||
id="g6-7">
|
||||
<path
|
||||
style="fill:#6d97c4;stroke:#415a75;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:round"
|
||||
inkscape:connector-curvature="0"
|
||||
d="M 2.1166581,296.07395 0.39686386,293.42811 H 3.8364709 Z"
|
||||
id="path2-9" />
|
||||
<path
|
||||
style="fill:#ffffff;fill-opacity:0.52906979"
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 2.1127601,295.83164 -1.4731694,-2.27117 0.23030714,-7e-5 1.35909406,2.0991 z"
|
||||
id="path4-3" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.6 KiB |
@ -172,20 +172,36 @@ Select all currently visible features
|
||||
void repaintRequested( const QModelIndexList &indexes );
|
||||
void repaintRequested();
|
||||
|
||||
void editFirstFeature();
|
||||
%Docstring
|
||||
editFirstFeature will try to edit the first feature of the list
|
||||
|
||||
.. versionadded:: 3.8
|
||||
%End
|
||||
|
||||
void editNextFeature();
|
||||
%Docstring
|
||||
editNextFeature will try to edit next feature in form
|
||||
editNextFeature will try to edit next feature of the list
|
||||
|
||||
.. versionadded:: 3.8
|
||||
%End
|
||||
|
||||
void editPreviousFeature();
|
||||
%Docstring
|
||||
editPreviousFeature will try to edit previous feature in form
|
||||
editPreviousFeature will try to edit previous feature of the list
|
||||
|
||||
.. versionadded:: 3.8
|
||||
%End
|
||||
|
||||
void editLastFeature();
|
||||
%Docstring
|
||||
editLastFeature will try to edit the last feature of the list
|
||||
|
||||
.. versionadded:: 3.8
|
||||
%End
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
|
@ -64,6 +64,8 @@ QgsDualView::QgsDualView( QWidget *parent )
|
||||
|
||||
connect( mNextFeatureButton, &QToolButton::clicked, mFeatureListView, &QgsFeatureListView::editNextFeature );
|
||||
connect( mPreviousFeatureButton, &QToolButton::clicked, mFeatureListView, &QgsFeatureListView::editPreviousFeature );
|
||||
connect( mFirstFeatureButton, &QToolButton::clicked, mFeatureListView, &QgsFeatureListView::editFirstFeature );
|
||||
connect( mLastFeatureButton, &QToolButton::clicked, mFeatureListView, &QgsFeatureListView::editLastFeature );
|
||||
|
||||
QButtonGroup *buttonGroup = new QButtonGroup( this );
|
||||
buttonGroup->setExclusive( false );
|
||||
@ -423,10 +425,14 @@ void QgsDualView::updateEditSelectionProgress( int progress, int count )
|
||||
mProgressCount->setText( QStringLiteral( "%1 / %2" ).arg( progress + 1 ).arg( count ) );
|
||||
mPreviousFeatureButton->setEnabled( progress > 0 );
|
||||
mNextFeatureButton->setEnabled( progress + 1 < count );
|
||||
mFirstFeatureButton->setEnabled( progress > 0 );
|
||||
mLastFeatureButton->setEnabled( progress + 1 < count );
|
||||
}
|
||||
|
||||
void QgsDualView::panOrZoomToFeature( const QgsFeatureIds &featureset )
|
||||
{
|
||||
//QgsDebugMsg("hey");
|
||||
|
||||
QgsMapCanvas *canvas = mFilterModel->mapCanvas();
|
||||
if ( canvas )
|
||||
{
|
||||
|
@ -264,11 +264,11 @@ void QgsFeatureListView::keyPressEvent( QKeyEvent *event )
|
||||
switch ( event->key() )
|
||||
{
|
||||
case Qt::Key_Up:
|
||||
editNextOrPreviousFeature( Previous );
|
||||
editOtherFeature( Previous );
|
||||
break;
|
||||
|
||||
case Qt::Key_Down:
|
||||
editNextOrPreviousFeature( Next );
|
||||
editOtherFeature( Next );
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -276,7 +276,7 @@ void QgsFeatureListView::keyPressEvent( QKeyEvent *event )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsFeatureListView::editNextOrPreviousFeature( QgsFeatureListView::NextOrPrevious nextOrPrevious )
|
||||
void QgsFeatureListView::editOtherFeature( QgsFeatureListView::PositionInList positionInList )
|
||||
{
|
||||
int currentRow = 0;
|
||||
if ( 0 != mCurrentEditSelectionModel->selectedIndexes().count() )
|
||||
@ -288,29 +288,31 @@ void QgsFeatureListView::editNextOrPreviousFeature( QgsFeatureListView::NextOrPr
|
||||
QModelIndex newLocalIndex;
|
||||
QModelIndex newIndex;
|
||||
|
||||
switch ( nextOrPrevious )
|
||||
switch ( positionInList )
|
||||
{
|
||||
case First:
|
||||
newLocalIndex = mModel->index( 0, 0 );
|
||||
break;
|
||||
|
||||
case Previous:
|
||||
newLocalIndex = mModel->index( currentRow - 1, 0 );
|
||||
newIndex = mModel->mapToMaster( newLocalIndex );
|
||||
if ( newIndex.isValid() )
|
||||
{
|
||||
setEditSelection( newIndex, QItemSelectionModel::ClearAndSelect );
|
||||
scrollTo( newLocalIndex );
|
||||
}
|
||||
break;
|
||||
|
||||
case Next:
|
||||
newLocalIndex = mModel->index( currentRow + 1, 0 );
|
||||
newIndex = mModel->mapToMaster( newLocalIndex );
|
||||
if ( newIndex.isValid() )
|
||||
{
|
||||
setEditSelection( newIndex, QItemSelectionModel::ClearAndSelect );
|
||||
scrollTo( newLocalIndex );
|
||||
}
|
||||
break;
|
||||
|
||||
case Last:
|
||||
newLocalIndex = mModel->index( mModel->rowCount() - 1, 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
newIndex = mModel->mapToMaster( newLocalIndex );
|
||||
if ( newIndex.isValid() )
|
||||
{
|
||||
setEditSelection( newIndex, QItemSelectionModel::ClearAndSelect );
|
||||
scrollTo( newLocalIndex );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsFeatureListView::contextMenuEvent( QContextMenuEvent *event )
|
||||
|
@ -186,16 +186,30 @@ class GUI_EXPORT QgsFeatureListView : public QListView
|
||||
void repaintRequested();
|
||||
|
||||
/**
|
||||
* editNextFeature will try to edit next feature in form
|
||||
* editFirstFeature will try to edit the first feature of the list
|
||||
* \since QGIS 3.8
|
||||
*/
|
||||
void editNextFeature() {editNextOrPreviousFeature( Next );}
|
||||
void editFirstFeature() {editOtherFeature( First );}
|
||||
|
||||
/**
|
||||
* editPreviousFeature will try to edit previous feature in form
|
||||
* editNextFeature will try to edit next feature of the list
|
||||
* \since QGIS 3.8
|
||||
*/
|
||||
void editPreviousFeature() {editNextOrPreviousFeature( Previous );}
|
||||
void editNextFeature() {editOtherFeature( Next );}
|
||||
|
||||
/**
|
||||
* editPreviousFeature will try to edit previous feature of the list
|
||||
* \since QGIS 3.8
|
||||
*/
|
||||
void editPreviousFeature() {editOtherFeature( Previous );}
|
||||
|
||||
/**
|
||||
* editLastFeature will try to edit the last feature of the list
|
||||
* \since QGIS 3.8
|
||||
*/
|
||||
void editLastFeature() {editOtherFeature( Last );}
|
||||
|
||||
|
||||
|
||||
private slots:
|
||||
void editSelectionChanged( const QItemSelection &deselected, const QItemSelection &selected );
|
||||
@ -211,13 +225,15 @@ class GUI_EXPORT QgsFeatureListView : public QListView
|
||||
private:
|
||||
void selectRow( const QModelIndex &index, bool anchor );
|
||||
|
||||
enum NextOrPrevious
|
||||
enum PositionInList
|
||||
{
|
||||
First,
|
||||
Next,
|
||||
Previous
|
||||
Previous,
|
||||
Last
|
||||
};
|
||||
|
||||
void editNextOrPreviousFeature( NextOrPrevious nextOrPrevious );
|
||||
void editOtherFeature( PositionInList positionInList );
|
||||
|
||||
|
||||
QgsFeatureListModel *mModel = nullptr;
|
||||
|
@ -214,10 +214,10 @@
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
@ -693,35 +693,6 @@
|
||||
</tabstops>
|
||||
<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"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
|
@ -134,8 +134,34 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mFirstFeatureButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../images/images.qrc">
|
||||
<normaloff>:/images/themes/default/mActionDoubleArrowLeft.svg</normaloff>:/images/themes/default/mActionDoubleArrowLeft.svg</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mPreviousFeatureButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
@ -241,6 +267,18 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mNextFeatureButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
@ -253,6 +291,26 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mLastFeatureButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../images/images.qrc">
|
||||
<normaloff>:/images/themes/default/mActionDoubleArrowRight.svg</normaloff>:/images/themes/default/mActionDoubleArrowRight.svg</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user