2010 Summer Project Week Breakout: Getting Started with Qt

Jump to: navigation, search
Home < 2010 Summer Project Week Breakout: Getting Started with Qt
 Back to  Project Week Agenda

Session Leader: Adam Weinrich, Nokia


Nokia, in collaboration with [ICS http://www.ics.com/products/qt/] will provide an overview of the Qt software ecosystem. This brief tour is intended to give the NA-MIC community a taste of some of the important technologies that are likely to have a strong impact on the medical image computing software development community in coming years.

Attendees of various skill levels are encouraged to attend. Reading material from the Nokia Qt web site ahead of time will help you prepare and get the most out of the presentation. Downloading and installing the SDK and trying tutorials is encouraged.

Organizational Background


Steve, Tina (or anyone else from NA-MIC to rate the following agenda items on a scale of 1-10 in terms of suitability for this session, with 10 being most suitable)

  1. 5 Nokia's angle
  2. 6 Qt Products and How They All Fit Together
  3. 9 GUI Toolkits and Cross-Platform Libraries
  4. 10 Getting Started with Qt ("Hello World")
  5. 8 Parent/Child Relationship
  6. 10 Linking User Interaction to Application Functionality (signal/slots)
  7. 6 Different Qt Libraries,
  8. 7 Various Widgets,
  9. 8 Model/View Classes
  10. 5 Dialogs
  11. 7 Geometry Management
  12. 3 file I/O
  13. 4 Networking
  14. 6 Graphics
  15. 3 Printing
  16. 3 Database
  17. 3 Multithreading
  18. 3 Multimedia
  19. 8 Painting - Basic Drawing
  20. 7 Main Window and Actions
  21. 7 Multi-window docking & open/close animation
  22. 7 Cursor control
  23. 3 Printing,
  24. 8 Scrolled Areas
  25. 8 Predefined Dialogs
  26. 8 Custom Dialogs
  27. 7 Geometry Management
  28. 8 Qt Designer (can be left out in the interest of time)
  29. 4 Customized Drawings (Colors, Transparency, Clipping, Coordinate System Transformation)
  30. 3 Text Processing
  31. 8 The Qt Event System (Internal Details, Synthetic Events, Delayed Invocation, Event Filters)
  32. 7 Container Classes
  33. 9 Debugging
  34. 4 Writing Your Own Widget
  35. 7 Help Systems
  36. 7 Tool Tips and What's This
  37. 4 Using Rich Text
  38. 5 Portability
  39. 3 System Resources (Sound, Saving Settings, the System Clipboard, Drag and Drop, Network Programming, External Processes with QProcess)
  40. 4 Emulating MDI with QWorkspace
  41. 7 QGraphicsView
  42. 7 QScrollView
  43. 10 Model/View Programming
    1. 9 Using Convenience Classes (QListWidget, QTreeWidget, QTableWidget)
    2. 9 Stacked Widgets or Layouts
  44. 7 Using OpenGL with Qt
  45. 8 Widget Styles
  46. 5 qmake — Automating Makefile Creation
  47. 7 CMAKE -
  48. 4 Internationalization
  49. 4 XML in Qt
  50. 4 Mulitithreading
  51. 3 SQL
  52. 6 Integrating with Visual Studio
  53. 6 Development Tools for Linux (KDevelop, ...)
  54. 7 Licensing
  55. 6 Deploying Qt Applications
  56. 6 Plugins
  1. 2 Qt4 vs Qt3
  2. 2 Qt vs other toolkits
  3. 7 Qt with Python
  4. 5 Qt Scripting using Javascript
  5. 1 Qt embedded
  6. 1 Qt on Nokia devices

Sample Scenarios

These are examples of the type of programming the NA-MIC community would be interested using Qt to accomplish.

Simple Image Viewer

The program would display a floating point 2D image mapped through a window/level function to display in an 8 bit grayscale graphics window. For example the original floating point data could have a dynamic range of -100 to 800 and to enhance the contrast in the image we may want to concentrate the grayscale to the range of 300 to 500. In this case the 'window' would be 200 and the 'level' would be 400. For display we would create an unsigned char buffer where the pixels would be defined as:

min = level-(window/2.);
max = min + window;
slope = 255./window;
if (floats[i] < min) bytes[i] = 0;
else if (floats[i] > max) bytes[i] = 255;
else bytes[i] = int ((floats[i] - min) * slope);

The user should be given sliders for window and level or, even better, a ctkRangeWidget as shown here.

Things to describe with this example:

  • hooking up signals and slots from the slider
  • integrating the custom range widget
  • drawing an image with Qt graphics

Dynamic GUI Layout

Sometimes our modules will need to present different information depending on the underlying data type of the nodes associated with the modules. The Volumes module currently encapsulates information for grey scale scalar volumes, label map scalar volumes, DWI volumes, DTI volumes and the GUI updates when you select a specific volume from the scene. For instance, a label map volume version of the GUI will only show one piece of information (the colour map used for display), while the grey scale volume version will show the colour map, as well as a historgram, window and level range widgets. How can we best manage the disparate gui elements that must be shown and then hidden depending on the properties of a selector widget?

Layout for complex GUIs, with consistent cross platform appearance

For some of the more complex GUIs in Slicer, we have a combination of information to display and operations to expose. For example in the Fiducials GUI, we display information about the points in the list, and allow users to click on the point information to perform functions with them (such as jumping to that location). There are multiple lists available to display, and operations that can work on all lists or just the one selected.

We want to be able to use the Qt designer to quickly lay out complex guis with both information and operations, and to ensure that the GUIs look uniform across different platforms. It would be useful to have a detailed list of which widgets will take on radically different appearances depending on the platform on which Slicer is running.

Day-to-Day Code Development

  • What are the best ways to debug Qt data structures from within visual studio?
  • How to customize IDEs to produce code that conforms to Qt style?
  • (for the Kitware and Qt developers:) conventions for mixing VTK and Qt
    • file naming (.cxx vs .cpp)
    • method naming (Get/Set vs set)
    • Macros and private implementation conventions