[OpendTect_Developers] Qt's widget embedding (2)

Bruno Chaintreuil bruno.chaintreuil at dgbes.com
Fri Aug 5 09:23:51 CEST 2011


Dear all,

This is a second post on how to work with QT's embedded widgets to
create dynamic 2D displays. In an earlier post I talked about how to
embed QT widgets and display them on a scene
(http://lists.opendtect.org/pipermail/developers/2010-August/000198.html).
Due to the increasing interest on this topic, I would like now to
introduce recently developed functionalities that make this QT's widget
embedding easier and quicker to use in OpendTect. These functionalities
are part of OpendTect 4.3. that should be released very soon on our website.

Previously in order to build some dynamic 2D displays (where items can
be redrawn after their creation) of uiObjects or uiGroups, you had to
create a uiMainWin (the standard QT based window in OpendTect) holding a
uiGraphicsView with a uiGraphicsObjectScene. Then you had to make some
uiObjectItems containing the uiObjects and manage them yourself on the
scene. In OpendTect 4.3. you do not have to worry anymore about
creating, positioning and resizing the uiObjectItems in a uiMainWin
yourself, since this is now taken over by a new window, the
uiObjectItemViewWin (uiTools/uiobjectitemviewwin.h). This new class
holds a couple of specific tools to display and handle the QT's embedded
widgets, such as zoom sliders, view control, info bars, and axis drawers.

Once you have implemented some uiObjects or uiGroups that you want to
display dynamically on a 2D scene, you can create a new
uiObjectItemViewWin and pass it directly the objects to be embedded,
using the addObject or addGroup functions respectively. These objects
will be displayed side by side on the window in the same order as you
added them. After the window creation you can add, remove or insert some
new objects at your convenience by using the corresponding remove and
insert functions.

Some sliders will enable you to zoom into the objects in both horizontal
and vertical directions. When moving the sliders, the objects are
resized the same way, thus resizing the whole content as if it was a big
image. A hand drag and some scrollbars have been added to enable an easy
navigation through the objects.

In addition to that, if you would like to give some headers to your
embedded object (say a title, or a description ...), you can create a
small uiObject, containing for instance uiLabels, and pass it with the
main uiObject. The addObject and addGroup functions have an extra
parameter for it. The window will then allocate an extra space on top of
the viewer to display the uiObject of the information. It will also take
care of the coupling of the header with its object when resizing or
navigate through the objects.

You will find enclosed a picture of the new multi Pre-Stack 2D Viewer
that depicts pretty well this uiObjectItemViewWin. Staying in the same
window, the user is able to change dynamically the number of pre-stack
viewers, as well as the content and position of the pre-stack data. The
code for this viewer is available in OpendTect 4.3. in the
uiPreStackViewer plugin directory. It is based on a specific
uiObjectItemViewWin (plugins/uiPreStackViewer/uipsviewer2dmainwin.h).


Please feel free to contact me for any question on this topic.
Best Regards,
Bruno


-------------- next part --------------
A non-text attachment was scrubbed...
Name: multi_PreStack_Viewer.png
Type: image/png
Size: 896186 bytes
Desc: not available
URL: <http://lists.opendtect.org/pipermail/developers/attachments/20110805/138c2981/attachment.png>


More information about the Developers mailing list