QM  6.2.3
Model-Based Design Tool
Loading...
Searching...
No Matches
Working with Diagrams

Working with EventsWorking with Code Editors

In order to work with a diagram, you must first create it. For example, to create a State Machine diagram (Statechart), please refer to Section Adding a Statechart.

Note
Currently QM™ supports only State Diagrams, but it might support other diagram types in the future. This section describes generic operations applicable to any diagram type.

Opening a Diagram

Once a diagram exists, you can open it in the following ways:

  • in the Model Explorer, you can double-click on the class item with the diagram
  • in the Model Explorer, you can double-click on the diagram item (nested in the class)
  • in the Model Explorer, you can right-click on the class item or the diagram item to open up the popup menu, and then choose the first action from this menu, which is Show Diagram.
Opening a Diagram

Closing a Diagram

To close a diagram, click on the X button in the top-right corner of the diagram window, or in the MDI tab (if you use the Tabs View mode), as shown in the picture below.

Closing a Diagram

Alternatively, the current active MDI window can be closed by means of the keyboard shortcut: Ctrl-W.

Note
Closing a diagram does not delete the diagram, it merely hides the diagram window from view.

The Drawing Canvas

Every diagram in QM™ is drawn on the canvas, which is a rectangular background area behind the various shapes. Even though you can actually draw outside the canvas, QM™ will export to a graphic format (see Exporting Diagrams) only the part of the diagram enclosed by the canvas.

As shown in the screen shot below, you can easily resize the Drawing Canvas by dragging its right or bottom edges, or by dragging the resize handle in the bottom-right corner of the canvas. In each case the mouse cursor indicates the possible direction of resizing.

Resizing the Drawing Canvas

The Grid

All elements of any QM™ diagram are aligned with the grid. You can position the diagram nodes and route the connectors only along the grid nodes, and in fact, the geometry of any shape is stored in the grid coordinates, so you cannot achieve any finer positioning granularity than the grid size, which is currently 8 pixels horizontally and 8 pixels vertically.

Grid viewing options

However, even though you cannot remove the alignment of all shapes to the grid, you can show or hide the grid lines in the diagram. You can select various presentations of the grid by means of the "Grid Options" selection in the View Menu, or by means of the grid drop-box (grid) in the View Toolbar.

Selecting Diagram Shapes

Typically, when you simply click on a shape in a diagram you select that shape and clear any previous selection, so that only one shape is selected at a time. The model item corresponding to the selected shape becomes Current Item.

However, QM™ also offers you the convenience of selecting and manipulating multiple shapes simultaneously. QM™ provides a special select & lasso tool on the Diagram Toolbox:

Diagram Toolbox/Generic Tools

The two options of selecting multiple diagram shapes are the lasso tool and mouse selection-toggle. These two methods can be combined to fine-tune the selection.

Selecting Shapes with the Mouse-Toggle

Click the select & lasso tool in the Diagram Toolbox .

  When you hover the mouse over the diagram (hover means just moving the mouse cursor without depressing any mouse buttons), the cursor changes to "select shapes".

  Whenever you hover over an active part of a shape, the mouse cursor changes to a hand-pointer with "+". You can then click the left mouse button to select the shape, if it is not selected, or deselect it, if it was already selected.

Selecting/deselecting shapes with mouse toggle

Selecting Shapes with the Lasso

Click the select & lasso tool in the Diagram Toolbox.

  When you hover the mouse over the diagram (hover means just moving the mouse cursor without depressing any mouse buttons), the cursor changes to "select shapes".

  When you press the left mouse button, the cursor changes to a hand-pointer with a lasso and you can start dragging the lasso from that point.

Selecting multiple shapes with a lasso

Moving the Selected Shapes

To move and re-position the selected shapes, choose the default pointing tool in the Diagram Toolbox.

  When you hover the mouse over the diagram (hover means just moving the mouse cursor without depressing any mouse buttons), the cursor has the normal arrow shape.

  Whenever you hover over a movable part of a shape, the mouse cursor changes to "move shape". You can start dragging all the selected shapes from that point.

Moving selected shapes

Panning Diagrams

Click the panning tool in the Diagram Toolbox.

  To pan the diagram with the mouse, press the Shift key. At this point the mouse cursor changes to the open hand:

  When you press the left mouse button, you "grab" the diagram and the cursor changes to closed hand:

Hold down the left mouse button and drag the whole diagram under the viewing window.

Panning a Diagram
See also
Bird's Eye View

Scrolling Diagrams

When the diagram window is smaller than the diagram canvas, QM™ displays scroll bars, which allow you to scroll the diagram horizontally and vertically.

Scrolling a Diagram

Scrolling with the Keyboard

You can scroll the diagram using the keyboard. As expected, the "up" key (key-up) scrolls the diagram up, the "down" key (key-down) scrolls the diagram down, the "left" key (key-left) scrolls the diagram left, and the "right" key (key-right) scrolls the diagram right.

Scrolling with the Mouse Wheel

You can also scroll the diagram using the mouse wheel. As expected, rotating the wheel forward scrolls the diagram down and rotating the wheel backward scrolls the diagram up. By pressing the Ctrl key, you can also scroll the diagram horizontally. When the Ctrl is pressed, rotating the wheel forward scrolls the diagram right and rotating the wheel backward scrolls the diagram left.

Zooming Diagrams

You can zoom a diagram in and out using several methods.

Zooming a Diagram

Zooming with the Status Bar

You can zoom a diagram by clicking on the zoom buttons (zoom-in, zoom-out, and zoom to 100%) in the Status Bar. The zoom-1 button (zoom to 100%)restores the zoom of 100%.

Zoom Slider in the Status Bar

Alternatively, you can use the zoom slider in the Status Bar. Shifting the slider left towards zoom-out zooms out, towards zoom-in zooms in the diagram.

Zooming with the View Menu

You can zoom the active diagram with the View Menu actions zoom-in, zoom-out, and zoom to 100%.

Zooming with the Keyboard

You can zoom a diagram in and out with the keyboard shortcuts, which are the same as those used in web browsers for zooming websites. The shortcut Ctrl - (Ctrl-minus) zooms out, Ctrl + (Ctrl-plus) zooms in, and Ctr 0 (Ctrl-zero) zooms the diagram to 100%.

Zooming with the Mouse Wheel

Finally, you can zoom the active diagram with the mouse wheel, in the same way as you zoom in or out on Google maps. To activate zoom by the mouse wheel, press the Shift key on your keyboard. Now, rotating the mouse wheel forward zooms out and rotating the wheel backward zooms the diagram in, which is the same convention used in mapping applications.

Exporting Diagrams

QM™ provides a very useful feature of exporting the active diagram to a graphic format, such as Scalable Vector Graphics↑ and Portable Network Graphics↑ (PNG) raster format. The SVG format is particularly interesting, because this vector format is supported by most web browsers and Microsoft Office/Open Office.


Attention
If any shapes are selected in the active diagram, QM™ renders only the selected shapes to the graphic format and clips the image size to the smallest bounding rectangle that encompasses all selected shapes. If no shapes are selected, QM™ exports the entire diagram to the graphic format and uses the drawing canvas as the bounding rectangle.

Exporting Active Diagram to a Graphic File

You can export the selected items or the whole active diagram to a graphic file by means of the File->Export Diagram... menu. This menu opens up the File Save dialog box to choose the graphic file name and format (currently SVG or PNG) to save.


Copying active diagram to the Clipboard in SVG

You can also copy the selected items or the whole diagram to the Clipboard in SVG by means of the (export to SVG) button in the Edit Toolbar. Once the SVG image is stored in the Clipboard, you can conveniently paste it directly to Microsoft Office, Open Office, or any other application that accepts SVG.

Working with EventsWorking with Code Editors