Marble/MarbleDesigner: Difference between revisions

From KDE TechBase
No edit summary
 
(15 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Template:I18n/Language Navigation Bar|Editing Projects/Marble/MarbleDesigner}}
 
{{TutorialBrowser|
{{TutorialBrowser|


series=Marble Widget Plugin for Qt Designer |
series=Marble Widget Plugin for Qt Designer |


name=Look Mom, No Code!|
name=Marble Qt Designer Plugin: Look Mom, No Code!|


pre=[http://doc.trolltech.com/designer-manual.html Qt Designer]|
pre=[http://doc.trolltech.com/designer-manual.html Qt Designer]|
}}
}}


== Using the MarbleWidget Plugin for Qt Designer ==
== The Marble Widget Plugin for Qt Designer ==
 
=== Compiling the MarbleWidget Plugin ===
 
The Marble Widget is also offered as a Qt Designer plugin. If you compile Marble yourself you probably need to enable the compilation of the Qt Designer plugin.
 
First you need to [http://doc.qt.digia.com/qtcreator-2.4/adding-plugins.html#locating-qt-designer-plugins locate Qt Designer plugins directory]. Let's say it is ~/QtSDK/plugins/designer


The MarbleWidget is also offered as a designer plugin. If you compile Marble yourself you probably need to enable the compilation of the designer plugin:
If your source directory is "~/marble" and your build directory is "~/marble_build" then you can enable compilation of the Qt Designer plugin via the cmake call:


If your source directory is "~/marble" and your build directory is "~/marble_build" then you can enable compilation of the designer plugin via the cmake call:
<syntaxhighlight lang="text">
cmake -DQTONLY=OFF -DWITH_DESIGNER_PLUGIN=ON -DQT_PLUGINS_DIR=~/QtSDK/plugins ../marble
</syntaxhighlight>


<code>
cmake -DWITH_DESIGNER_PLUGIN=ON ../marble
</code>


Once you have compiled marble using make you can install everything using "make install". This should install the file
Choose "-DQTONLY=ON" as a parameter if you don't have KDE installed.
Once you have compiled Marble using "make" you can install everything using "make install". This should install the file


<code>
<syntaxhighlight lang="text">
MarbleWidgetPlugin.so
MarbleWidgetPlugin.so
</code>
</syntaxhighlight>
 
 
into Qt's designer plugin directory (please check this in case things don't work out). If you compile the Qt-Only version then the file name is called <b>libMarbleWidgetPlugin.so</b>.
 
Once you start Qt Designer you should spot a new "Marble Desktop Globe" category in the widget box on the left:
 
 
[[Image:designer1_thumb.png]]
 
On Windows you must keep in mind that your MarbleWidget.dll must be in the PATH when the designer executable is called. Otherwise the marble plugins will result in a loading error.


into Qt's designer plugin directory (please check this in case things don't work out).
=== Using the MarbleWidget Plugin ===


Once you start Qt Designer you should spot a new "Marble Desktop Globe" category in the widget box on the left. You can just use this MarbleWidget like all other widgets by dragging it onto your form and by adjusting the properties of the MarbleWidget.
You can use this Marble Widget just like all other widgets inside Qt Designer: Once you have started Qt Designer you can choose a new form from the ready-made templates (e.g. a QWidget). Now you can just drag and drop the Marble Widget from the widget box onto your form:


As a ready-made example you can load the two examples in:


<code>
[[Image:designer2_thumb.png]]
 
 
Alternatively we also provide other widget plugins that allow controlling the Marble Widget: e.g. the navigation widget plugin and the latitude-longitude widget plugin.
 
The map properties of the Marble Widget can be adjusted in the Property Editor on the right: all properties get assigned and displayed immediately on the map without having to press the "Preview" menu entry.
 
 
[[Image:designer3_thumb.png]]
 
 
There are two ready-made examples available inside the example directory of the Marble source code:
 
<syntaxhighlight lang="text">
marble/examples/example1.ui
marble/examples/example1.ui
marble/examples/example2.ui
marble/examples/example2.ui
</code>
</syntaxhighlight>
 
 
The file example2.ui nicely demonstrate how signals and slots work with the MarbleWidget:
 
 
[[Image:designer4_thumb.png]]
 


The examples nicely demonstrate how signals and slots work with the MarbleWidget.
You can preview the widget by choosing "Preview" from the "Form" menu. Inside the preview it's possible to pan and zoom the map. Of course the signal-slot connections can be tested inside the preview as well.

Latest revision as of 21:01, 10 March 2016

Marble Qt Designer Plugin: Look Mom, No Code!
Tutorial Series   Marble Widget Plugin for Qt Designer
Previous   Qt Designer
What's Next   n/a
Further Reading   n/a

The Marble Widget Plugin for Qt Designer

Compiling the MarbleWidget Plugin

The Marble Widget is also offered as a Qt Designer plugin. If you compile Marble yourself you probably need to enable the compilation of the Qt Designer plugin.

First you need to locate Qt Designer plugins directory. Let's say it is ~/QtSDK/plugins/designer

If your source directory is "~/marble" and your build directory is "~/marble_build" then you can enable compilation of the Qt Designer plugin via the cmake call:

cmake -DQTONLY=OFF -DWITH_DESIGNER_PLUGIN=ON -DQT_PLUGINS_DIR=~/QtSDK/plugins ../marble


Choose "-DQTONLY=ON" as a parameter if you don't have KDE installed. Once you have compiled Marble using "make" you can install everything using "make install". This should install the file

MarbleWidgetPlugin.so


into Qt's designer plugin directory (please check this in case things don't work out). If you compile the Qt-Only version then the file name is called libMarbleWidgetPlugin.so.

Once you start Qt Designer you should spot a new "Marble Desktop Globe" category in the widget box on the left:


On Windows you must keep in mind that your MarbleWidget.dll must be in the PATH when the designer executable is called. Otherwise the marble plugins will result in a loading error.

Using the MarbleWidget Plugin

You can use this Marble Widget just like all other widgets inside Qt Designer: Once you have started Qt Designer you can choose a new form from the ready-made templates (e.g. a QWidget). Now you can just drag and drop the Marble Widget from the widget box onto your form:



Alternatively we also provide other widget plugins that allow controlling the Marble Widget: e.g. the navigation widget plugin and the latitude-longitude widget plugin.

The map properties of the Marble Widget can be adjusted in the Property Editor on the right: all properties get assigned and displayed immediately on the map without having to press the "Preview" menu entry.



There are two ready-made examples available inside the example directory of the Marble source code:

marble/examples/example1.ui
marble/examples/example2.ui


The file example2.ui nicely demonstrate how signals and slots work with the MarbleWidget:



You can preview the widget by choosing "Preview" from the "Form" menu. Inside the preview it's possible to pan and zoom the map. Of course the signal-slot connections can be tested inside the preview as well.