Skip to content

Commit a05c4c8

Browse files
committed
make custom widget tooltips translatable
1 parent dbf2834 commit a05c4c8

16 files changed

+59
-28
lines changed

python/core/composer/qgscomposerpicture.sip

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ class QgsComposerPicture: QgsComposerItem
5353
* @returns path to the source image
5454
* @see usePictureExpression
5555
* @see setPictureFile
56-
* @deprecated use picturePath instead
56+
* @deprecated use picturePath instead
5757
*/
5858
QString pictureFile() const /Deprecated/;
59-
59+
6060
/**Sets the source path of the image (may be svg or a raster format). Data defined
6161
* picture source may override this value. The path can either be a local path
6262
* or a remote (http) path.
@@ -74,7 +74,7 @@ class QgsComposerPicture: QgsComposerItem
7474
* @see setPicturePath
7575
* @note added in QGIS 2.5
7676
*/
77-
QString picturePath() const;
77+
QString picturePath() const;
7878

7979

8080
/**Sets this items bound in scene coordinates such that 1 item size units

python/core/qgsnetworkcontentfetcher.sip

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,17 @@ class QgsNetworkContentFetcher : QObject
2323
* @param url URL to fetch
2424
*/
2525
void fetchContent( const QUrl url );
26-
26+
2727
/**Returns a reference to the network reply
2828
* @returns QNetworkReply for fetched URL content
2929
*/
3030
QNetworkReply* reply();
31-
32-
31+
3332
/**Returns the fetched content as a string
3433
* @returns string containing network content
3534
*/
3635
QString contentAsString() const;
37-
36+
3837
signals:
3938

4039
/**Emitted when content has loaded

python/gui/qgisinterface.sip

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,15 +512,44 @@ class QgisInterface : QObject
512512

513513
/**
514514
* Open feature form
515-
* @return true when dialog was accepted
515+
* @param l vector layer
516+
* @param f feature to show/modify
517+
* @param updateFeatureOnly only update the feature update (don't change any attributes of the layer) [UNUSED]
518+
* @param showModal if true, will wait for the dialog to be executed (only shown otherwise)
516519
* @note added in 1.6
517520
*/
518521
virtual bool openFeatureForm( QgsVectorLayer *l, QgsFeature &f, bool updateFeatureOnly = false, bool showModal = true ) = 0;
519522

523+
/**
524+
* Returns a feature form for a given feature
525+
*
526+
* @param l The layer for which the dialog will be created
527+
* @param f The feature for which the dialog will be created
528+
*
529+
* @return A feature form
530+
*/
520531
virtual QgsAttributeDialog* getFeatureForm( QgsVectorLayer *l, QgsFeature &f ) = 0;
521532

533+
/**
534+
* Access the vector layer tools instance.
535+
* With the help of this you can access methods like addFeature, startEditing
536+
* or stopEditing while giving the user the appropriate dialogs.
537+
*
538+
* @return An instance of the vector layer tools
539+
*/
522540
virtual QgsVectorLayerTools* vectorLayerTools() = 0;
523541

542+
/** This method is only needed when using a UI form with a custom widget plugin and calling
543+
* openFeatureForm or getFeatureForm from Python (PyQt4) and you havn't used the info tool first.
544+
* Python will crash bringing QGIS wtih it
545+
* if the custom form is not loaded from a C++ method call.
546+
*
547+
* This method uses a QTimer to call QUiLoader in order to load the form via C++
548+
* you only need to call this once after that you can call openFeatureForm/getFeatureForm
549+
* like normal
550+
*
551+
* More information here: http://qt-project.org/forums/viewthread/27098/
552+
*/
524553
virtual void preloadForm( QString uifile ) = 0;
525554

526555
/** Return vector layers in edit mode

src/app/qgisappinterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
437437
* returns true when dialog was accepted (if shown modal, true otherwise)
438438
* @param l vector layer
439439
* @param f feature to show/modify
440-
* @param updateFeatureOnly only update the feature update (don't change any attributes of the layer)
440+
* @param updateFeatureOnly only update the feature update (don't change any attributes of the layer) [UNUSED]
441441
* @param showModal if true, will wait for the dialog to be executed (only shown otherwise)
442442
* @note added in 1.6
443443
*/

src/core/pal/layer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ namespace pal
317317
* @param xOffset map unit (+/-) to x-offset the label
318318
* @param yOffset map unit (+/-) to y-offset the label
319319
* @param alwaysShow whether to skip priority and always show the label (causes overlapping)
320+
* @param repeatDistance distance for repeating the label
320321
*
321322
* @throws PalException::FeatureExists
322323
*

src/core/qgsnetworkcontentfetcher.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class CORE_EXPORT QgsNetworkContentFetcher : public QObject
3737
Q_OBJECT
3838

3939
public:
40-
4140
QgsNetworkContentFetcher();
4241

4342
virtual ~QgsNetworkContentFetcher();

src/customwidgets/qgscollapsiblegroupboxplugin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ void QgsCollapsibleGroupBoxPlugin::initialize( QDesignerFormEditorInterface *cor
7171

7272
QString QgsCollapsibleGroupBoxPlugin::toolTip() const
7373
{
74-
return "A collapsible group box";
74+
return tr( "A collapsible group box" );
7575
}
7676

7777
QString QgsCollapsibleGroupBoxPlugin::whatsThis() const
7878
{
79-
return "A collapsible group box with save state capability";
79+
return tr( "A collapsible group box with save state capability" );
8080
}
8181

8282
QString QgsCollapsibleGroupBoxPlugin::domXml() const

src/customwidgets/qgscolorbuttonplugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void QgsColorButtonPlugin::initialize( QDesignerFormEditorInterface *core )
7171

7272
QString QgsColorButtonPlugin::toolTip() const
7373
{
74-
return "Select color";
74+
return tr( "Select color" );
7575
}
7676

7777
QString QgsColorButtonPlugin::whatsThis() const

src/customwidgets/qgscolorbuttonv2plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void QgsColorButtonV2Plugin::initialize( QDesignerFormEditorInterface *core )
7171

7272
QString QgsColorButtonV2Plugin::toolTip() const
7373
{
74-
return "Select color";
74+
return tr( "Select color" );
7575
}
7676

7777
QString QgsColorButtonV2Plugin::whatsThis() const

src/customwidgets/qgsdatadefinedbuttonplugin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ void QgsDataDefinedButtonPlugin::initialize( QDesignerFormEditorInterface *core
7171

7272
QString QgsDataDefinedButtonPlugin::toolTip() const
7373
{
74-
return "A widget to define the scale range";
74+
return tr( "A widget to define the scale range" );
7575
}
7676

7777
QString QgsDataDefinedButtonPlugin::whatsThis() const
7878
{
79-
return "A widget to define the scale range.";
79+
return tr( "A widget to define the scale range." );
8080
}
8181

8282
QString QgsDataDefinedButtonPlugin::domXml() const

src/customwidgets/qgsfieldcomboboxplugin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ void QgsFieldComboBoxPlugin::initialize( QDesignerFormEditorInterface *core )
7171

7272
QString QgsFieldComboBoxPlugin::toolTip() const
7373
{
74-
return "A combo box to list the fields of a layer";
74+
return tr( "A combo box to list the fields of a layer" );
7575
}
7676

7777
QString QgsFieldComboBoxPlugin::whatsThis() const
7878
{
79-
return "A combo box to list the field of a layer.";
79+
return tr( "A combo box to list the field of a layer." );
8080
}
8181

8282
QString QgsFieldComboBoxPlugin::domXml() const

src/customwidgets/qgsfieldexpressionwidgetplugin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ void QgsFieldExpressionWidgetPlugin::initialize( QDesignerFormEditorInterface *c
7171

7272
QString QgsFieldExpressionWidgetPlugin::toolTip() const
7373
{
74-
return "An editable combo box to enter an expression";
74+
return tr( "An editable combo box to enter an expression" );
7575
}
7676

7777
QString QgsFieldExpressionWidgetPlugin::whatsThis() const
7878
{
79-
return "An editable combo box to enter an expression. A button allows opening the expression dialog. Expression are evaluated to detect errors.";
79+
return tr( "An editable combo box to enter an expression. A button allows opening the expression dialog. Expression are evaluated to detect errors." );
8080
}
8181

8282
QString QgsFieldExpressionWidgetPlugin::domXml() const

src/customwidgets/qgsmaplayercomboboxplugin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ void QgsMapLayerComboBoxPlugin::initialize( QDesignerFormEditorInterface *core )
7171

7272
QString QgsMapLayerComboBoxPlugin::toolTip() const
7373
{
74-
return "A combo box to list the layers";
74+
return tr( "A combo box to list the layers" );
7575
}
7676

7777
QString QgsMapLayerComboBoxPlugin::whatsThis() const
7878
{
79-
return "A combo box to list the layers registered in QGIS. Layers might be filtered according to their type.";
79+
return tr( "A combo box to list the layers registered in QGIS. Layers might be filtered according to their type." );
8080
}
8181

8282
QString QgsMapLayerComboBoxPlugin::domXml() const

src/customwidgets/qgsrelationreferencewidgetplugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void QgsRelationReferenceWidgetPlugin::initialize( QDesignerFormEditorInterface
7171

7272
QString QgsRelationReferenceWidgetPlugin::toolTip() const
7373
{
74-
return "Relation reference";
74+
return tr( "Relation reference" );
7575
}
7676

7777
QString QgsRelationReferenceWidgetPlugin::whatsThis() const

src/customwidgets/qgsscalerangewidgetplugin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ void QgsScaleRangeWidgetPlugin::initialize( QDesignerFormEditorInterface *core )
7171

7272
QString QgsScaleRangeWidgetPlugin::toolTip() const
7373
{
74-
return "A widget to define the scale range";
74+
return tr( "A widget to define the scale range" );
7575
}
7676

7777
QString QgsScaleRangeWidgetPlugin::whatsThis() const
7878
{
79-
return "A widget to define the scale range.";
79+
return tr( "A widget to define the scale range." );
8080
}
8181

8282
QString QgsScaleRangeWidgetPlugin::domXml() const

src/gui/qgisinterface.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,16 +567,19 @@ class GUI_EXPORT QgisInterface : public QObject
567567

568568
/**
569569
* Open feature form
570-
* @return true when dialog was accepted
570+
* @param l vector layer
571+
* @param f feature to show/modify
572+
* @param updateFeatureOnly only update the feature update (don't change any attributes of the layer) [UNUSED]
573+
* @param showModal if true, will wait for the dialog to be executed (only shown otherwise)
571574
* @note added in 1.6
572575
*/
573576
virtual bool openFeatureForm( QgsVectorLayer *l, QgsFeature &f, bool updateFeatureOnly = false, bool showModal = true ) = 0;
574577

575578
/**
576579
* Returns a feature form for a given feature
577580
*
578-
* @param layer The layer for which the dialog will be created
579-
* @param feature The feature for which the dialog will be created
581+
* @param l The layer for which the dialog will be created
582+
* @param f The feature for which the dialog will be created
580583
*
581584
* @return A feature form
582585
*/

0 commit comments

Comments
 (0)