Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[Qt] Add more docs #7594

Merged
merged 4 commits into from
Jan 9, 2017
Merged

[Qt] Add more docs #7594

merged 4 commits into from
Jan 9, 2017

Conversation

tmpsantos
Copy link
Contributor

Add even more docs to QMapboxGL.

@mention-bot
Copy link

@tmpsantos, thanks for your PR! By analyzing this pull request, we identified @jfirebaugh to be potential reviewers.

@tmpsantos tmpsantos self-assigned this Jan 4, 2017
@tmpsantos tmpsantos requested a review from 1ec5 January 4, 2017 17:29
@tmpsantos tmpsantos added the Qt Mapbox Maps SDK for Qt, aka Qt Location Mapbox GL label Jan 4, 2017
{
d_ptr->mapObj->setLatLng(mbgl::LatLng { coordinate_.first, coordinate_.second }, d_ptr->margins);
}

/*!
Convenience method for setting the \a coordinate and \a zoom simultaneously.
Convenience method for setting the \a coordinate_ and \a zoom_ simultaneously.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Public _ variables are kind of unfortunate. Any chance you could rename these variables and explicitly use this inside the implementation where there’s ambiguity?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is true. I've been trying when possible and being creative with the names.

In this case, the Qt standard is to use coordinate() as a getter instead of getCoordinate() and this often overlaps with parameters names. For Qt itself it is not a problem because it doesn't care about parameter shadowing.

One solution would be do a post processing of the generated documentation or disable this warning for the Qt build.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that’s unfortunate. In Objective-C and Swift, it’s also possible for a getter and a variable to share the same namespace, and _ always denotes an internal implementation detail that shouldn’t be touched. So one old convention is to say e.g. theCoordinate or aZoom, but I don’t know if that looks reasonable in Qt code.

Is it possible to document this method on its declaration rather than its implementation? Then you can give the parameter two different names, coordinate in the header (which shouldn’t conflict with coordinate()) and coordinate_ here in the implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent idea, it works! We can get rid of the _.

/*!
Sets the \a duration and \a delay of style class transitions. An animation
morphing a style property value to another value is performed when a new
class is set.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use active voice:

Style property values transition to new values with animation when a new class is set.

This example hides the layer \b "route":

\code
map->setLayoutProperty("makerBackground", "visibility", "none");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: makermarker.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be "route" actually.

\value MapChangeRegionDidChangeAnimated Not in use by QMapboxGL.

\value MapChangeWillStartLoadingMap The map is getting loaded. This state
is set only once right after QMapboxGL is created and a style is set.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link QMapboxGL?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@1ec5 1ec5 Jan 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh, I keep forgetting that tools other than jazzy can autolink without any markup. 👍

@@ -657,19 +716,30 @@ void QMapboxGL::setPitch(double pitch_)
d_ptr->mapObj->setPitch(pitch_);
}

/*!
Returns the North Orientation mode.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lowercase “north orientation”.

valid GL context is expected with an appropriated GL viewport state set
for the size of the canvas.

This function should be called only after the signal needsRendering() is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this documentation being generated by Doxygen or something along those lines? This sounds like a good case for Doxygen’s \pre command.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needsRendering() gets detected and linked by qtdoc automatically because it is a signal of the same class.

Copy link
Contributor

@1ec5 1ec5 Jan 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I was referring to the paragraph as a whole, not the reference to needsRendering(). In Doxygen syntax, \pre means “precondition” and is given special prominence in the generated output.

@@ -1085,11 +1346,42 @@ void QMapboxGL::render()
}
#endif

/*!
Informs the map that the network connection was established, causing
all timeouted network requests to retry immediately.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/was established/has been established/
s/timeouted network requests/network requests that previously timed out/
s/to retry/to be retried/

\fn void QMapboxGL::copyrightsChanged(const QString &copyrightsHtml);

This signal is emitted when the copyrights of the current content of the map
has change. This can be caused by a style change or adding a new data source.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/has change/have changed/

@@ -366,6 +366,54 @@ void QMapboxGLSettings::setAccessToken(const QString &token)
*/

/*!
\enum QMapboxGL::MapChange

This enum represents the last changed occurred on the map state.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/last change occurred on/last change that occurred to/

is set only once right after QMapboxGL is created and a style is set.

\value MapChangeDidFinishLoadingMap All the resources were loaded and parsed
and the map is fully rendered. This is the final state of the map.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“Final” implies that the state will never change again, doesn’t it? This enum value sort of represents a quiescent state, but the map state can continue changing if for instance the user starts panning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, I will reword this. What I was trying to say here is this is the most complete state of the map in terms of things rendered and resources loaded.

morphing a style property value to another value is performed when a new
class is set.

\deprecated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, global transition options are not deprecated and not under consideration for removal.

as defined by \l {https://www.mapbox.com/mapbox-gl-style-spec/} {the vector tiles specification}
for paint properties.

The argument \a klass_ is deprecated and is used for defining the style class for the paint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point was that you’d have two methods:

void setPaintProperty(const QString& layer, const QString& property, const QVariant& value);
//! \deprecated
void setPaintProperty(const QString& layer, const QString& property, const QVariant& value, const QString& klass) __attribute__((deprecated));

This works in C++03; is there a Qt-specific reason why we can’t overload the method like this?

@tmpsantos tmpsantos force-pushed the tmpsantos-qt_docs2 branch 2 times, most recently from 82d1148 to 07ad792 Compare January 6, 2017 22:07
@tmpsantos
Copy link
Contributor Author

@1ec5 thanks a lot for pushing this documentation to the next level: https://tmpsantos.com.br/qmapboxgl/qmapboxgl.html

\endtable

For a giver layer \c route, setting the property \c line-dasharray that requires
a Mabpox Style type \b Array can be done as follows using a QVariantList:
Copy link
Contributor

@1ec5 1ec5 Jan 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/giver/given/, and avoid passive voice:

If the style specification defines the property’s type as Array, use a QVariantList. For example, the following code sets a route layer’s line-dasharray property:

\endcode

This table describes the mapping between \l {https://www.mapbox.com/mapbox-gl-style-spec/#types}
{style types} and Qt types accepted by setLayoutProperty():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table also applies to setPaintProperty(), so copy this table to that method’s documentation. (In particular, color-typed properties are paint properties.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did that ;)

But I'm going to remove Color.

They will never return true because Qt only does client side animations.
It propagated via copy & paste. :-P
Showing how to add numbers in an array.
Copy link
Member

@brunoabinader brunoabinader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@tmpsantos tmpsantos merged commit eaf03f4 into master Jan 9, 2017
@tmpsantos tmpsantos deleted the tmpsantos-qt_docs2 branch January 9, 2017 15:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Qt Mapbox Maps SDK for Qt, aka Qt Location Mapbox GL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants