Skip to content

Commit

Permalink
Merge pull request #5416 from jdugge/mapTipsDelaySetting
Browse files Browse the repository at this point in the history
[FEATURE] Make map tips delay configurable
  • Loading branch information
m-kuhn committed Apr 25, 2018
2 parents ade216d + 8be522f commit ccc1ac1
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/app/qgisapp.cpp
Expand Up @@ -3880,14 +3880,22 @@ void QgisApp::createMapTips()
mpMapTipsTimer = new QTimer( mMapCanvas );
// connect the timer to the maptips slot
connect( mpMapTipsTimer, &QTimer::timeout, this, &QgisApp::showMapTip );
// set the interval to 0.850 seconds - timer will be started next time the mouse moves
mpMapTipsTimer->setInterval( 850 );
// set the delay to 0.850 seconds or time defined in the Settings
// timer will be started next time the mouse moves
QgsSettings settings;
int timerInterval = settings.value( "qgis/mapTipsDelay", 850 ).toInt();
mpMapTipsTimer->setInterval( timerInterval );
mpMapTipsTimer->setSingleShot( true );

// Create the maptips object
mpMaptip = new QgsMapTip();
}

void QgisApp::setMapTipsDelay( int timerInterval )
{
mpMapTipsTimer->setInterval( timerInterval );
}

void QgisApp::createDecorations()
{
QgsDecorationCopyright *mDecorationCopyright = new QgsDecorationCopyright( this );
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgisapp.h
Expand Up @@ -966,6 +966,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! shows the snapping Options
void snappingOptions();

void setMapTipsDelay( int timerInterval );

protected:

//! Handle state changes (WindowTitleChange)
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgsoptions.cpp
Expand Up @@ -642,6 +642,9 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
// WMS getLegendGraphic setting
mLegendGraphicResolutionSpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/defaultLegendGraphicResolution" ), 0 ).toInt() );

// Map Tips delay
mMapTipsDelaySpinBox->setValue( mSettings->value( QStringLiteral( "qgis/mapTipsDelay" ), 850 ).toInt() );

//
// Raster properties
//
Expand Down Expand Up @@ -1311,7 +1314,9 @@ void QgsOptions::saveOptions()
mSettings->setValue( QStringLiteral( "/qgis/addOracleDC" ), cbxAddOracleDC->isChecked() );
mSettings->setValue( QStringLiteral( "/qgis/compileExpressions" ), cbxCompileExpressions->isChecked() );
mSettings->setValue( QStringLiteral( "/qgis/defaultLegendGraphicResolution" ), mLegendGraphicResolutionSpinBox->value() );
mSettings->setValue( QStringLiteral( "/qgis/mapTipsDelay" ), mMapTipsDelaySpinBox->value() );
mSettings->setValue( QStringLiteral( "/qgis/copyFeatureFormat" ), mComboCopyFeatureFormat->currentData().toInt() );
QgisApp::instance()->setMapTipsDelay( mMapTipsDelaySpinBox->value() );

mSettings->setValue( QStringLiteral( "/qgis/new_layers_visible" ), chkAddedVisibility->isChecked() );
mSettings->setValue( QStringLiteral( "/qgis/enable_anti_aliasing" ), chkAntiAliasing->isChecked() );
Expand Down
54 changes: 54 additions & 0 deletions src/ui/qgsoptionsbase.ui
Expand Up @@ -3073,6 +3073,60 @@
</layout>
</widget>
</item>
<item>
<widget class="QgsCollapsibleGroupBox" name="groupBox_12">
<property name="title">
<string>Map Tips</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_22">
<item>
<widget class="QLabel" name="textLabel1_16">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Delay (ms)</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_39">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="mMapTipsDelaySpinBox">
<property name="toolTip">
<string extracomment="MAP_RESOLUTION or DPI value overloading getMap default value (set 0 to use default)"/>
</property>
<property name="whatsThis">
<string extracomment="MAP_RESOLUTION or DPI value overloading getMap default value (set 0 to use default)"/>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>1000000</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
Expand Down

0 comments on commit ccc1ac1

Please sign in to comment.