summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <[email protected]>2017-10-25 14:51:58 +0200
committerAlbert Astals Cid <[email protected]>2017-10-25 14:51:58 +0200
commit3435eb6df89db93932a9fa28a4c109f78b6275aa (patch)
tree9a1bf19212196c693310e540b335abbb73427630
parent5413d38d22e413d4b84eac51ada93e00d903e885 (diff)
Convert m_formWidgets from hash to set
We don't use the key for anything
-rw-r--r--ui/pageview.cpp2
-rw-r--r--ui/pageviewutils.cpp10
-rw-r--r--ui/pageviewutils.h4
3 files changed, 7 insertions, 9 deletions
diff --git a/ui/pageview.cpp b/ui/pageview.cpp
index fb25169..0593380 100644
--- a/ui/pageview.cpp
+++ b/ui/pageview.cpp
@@ -1016,7 +1016,7 @@ void PageView::notifySetup( const QVector< Okular::Page * > & pageSet, int setup
w->setFormWidgetsController( d->formWidgetsController() );
w->setVisibility( false );
w->setCanBeFilled( allowfillforms );
- item->formWidgets().insert( ff->id(), w );
+ item->formWidgets().insert( w );
hasformwidgets = true;
}
}
diff --git a/ui/pageviewutils.cpp b/ui/pageviewutils.cpp
index a46384a..88123d3 100644
--- a/ui/pageviewutils.cpp
+++ b/ui/pageviewutils.cpp
@@ -51,9 +51,7 @@ PageViewItem::PageViewItem( const Okular::Page * page )
PageViewItem::~PageViewItem()
{
- QHash<int, FormWidgetIface*>::iterator it = m_formWidgets.begin(), itEnd = m_formWidgets.end();
- for ( ; it != itEnd; ++it )
- delete *it;
+ qDeleteAll( m_formWidgets );
qDeleteAll( m_videoWidgets );
}
@@ -122,7 +120,7 @@ bool PageViewItem::isVisible() const
return m_visible;
}
-QHash<int, FormWidgetIface*>& PageViewItem::formWidgets()
+QSet<FormWidgetIface*>& PageViewItem::formWidgets()
{
return m_formWidgets;
}
@@ -163,7 +161,7 @@ void PageViewItem::moveTo( int x, int y )
m_croppedGeometry.moveTop( y );
m_uncroppedGeometry.moveLeft( qRound( x - m_crop.left * m_uncroppedGeometry.width() ) );
m_uncroppedGeometry.moveTop( qRound( y - m_crop.top * m_uncroppedGeometry.height() ) );
- QHash<int, FormWidgetIface*>::iterator it = m_formWidgets.begin(), itEnd = m_formWidgets.end();
+ QSet<FormWidgetIface*>::iterator it = m_formWidgets.begin(), itEnd = m_formWidgets.end();
for ( ; it != itEnd; ++it )
{
Okular::NormalizedRect r = (*it)->rect();
@@ -200,7 +198,7 @@ bool PageViewItem::setFormWidgetsVisible( bool visible )
return false;
bool somehadfocus = false;
- QHash<int, FormWidgetIface*>::iterator it = m_formWidgets.begin(), itEnd = m_formWidgets.end();
+ QSet<FormWidgetIface*>::iterator it = m_formWidgets.begin(), itEnd = m_formWidgets.end();
for ( ; it != itEnd; ++it )
{
bool hadfocus = (*it)->setVisibility( visible && (*it)->formField()->isVisible() );
diff --git a/ui/pageviewutils.h b/ui/pageviewutils.h
index ca8bd78..a5cd89a 100644
--- a/ui/pageviewutils.h
+++ b/ui/pageviewutils.h
@@ -47,7 +47,7 @@ class PageViewItem
int pageNumber() const;
double zoomFactor() const;
bool isVisible() const;
- QHash<int, FormWidgetIface*>& formWidgets();
+ QSet<FormWidgetIface*>& formWidgets();
QHash< Okular::Movie *, VideoWidget * >& videoWidgets();
/* The page is cropped as follows: */
@@ -87,7 +87,7 @@ class PageViewItem
QRect m_croppedGeometry;
QRect m_uncroppedGeometry;
Okular::NormalizedRect m_crop;
- QHash<int, FormWidgetIface*> m_formWidgets;
+ QSet<FormWidgetIface*> m_formWidgets;
QHash< Okular::Movie *, VideoWidget * > m_videoWidgets;
};