1 / 16

Qt and Slicer

Qt and Slicer. A short introduction September 16 th , 2009. Once upon a time …. Slicer developer got an awesome idea !. Slicer. Slicer developer contacted KWWidget. Slicer : I need this awesome Widget KWW :Will do my best … 3 to 4 weeks . Bottleneck !. Slicer. KWWidgets.

dympna
Download Presentation

Qt and Slicer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Qt and Slicer A short introduction September 16th, 2009

  2. Once upon a time … • Slicer developer got an awesome idea ! Slicer

  3. Slicer developer contacted KWWidget Slicer: I need this awesome Widget KWW :Will do my best … 3 to 4 weeks Bottleneck ! Slicer KWWidgets

  4. In the mean time … QT Community QT Library Slicer: I need this awesome Widget KWW :Will do my best … 3 to 4 weeks Slicer & KWW: Ohhhhhhhh Slicer KWWidgets

  5. They are a new kind of widgets Qt Double Slider Qt Color Picker Qt Thumbwheel • Super easy to derive, extend, customize, … • Super easy to learn • Plenty of documentation • Huge and active world wide community Slicer Bottleneck !

  6. Outline • QT/Signal overview • VTK/QT interactions • UI creator - QtDesigner • Extending widget family • Using widget

  7. QT signal/slot overview Class AppleTree: public Qobject Q_OBJECT signals: void ageChanged(int value);public slots: void incrementAge(); Private: int age; Connect(timer, SIGNAL(valueChanged()), tree, SLOT(incrementAge())) Connect(tree, SIGNAL(ageChanged(int)), jack, SLOT(checkTreeAge(int))) Class Lumberjack: public Qobject Q_OBJECT signals: void cutTreeDone(int value);public slots: void checkTreeAge(int v);

  8. QT signal/slot overview (2) • Cmake provides a QObject wrapper SET(qSlicerGUI_SRCS main.cxx qSlicerMainWindow.h qSlicerMainWindow.cxx … ) # Headers that should run through moc SET(qSlicerGUI_MOC_SRCS qSlicerMainWindow.h … ) QT4_WRAP_CPP(qSlicerGUI_SRCS ${qSlicerGUI_MOC_SRCS})

  9. VTK/QT interactions • VTK can call QT slot • QT can connect signal and slot • Slot is a regular C++ function • Slot can interact with any VTK objects • Connector = vtkEventQtSlotConnect::New() • Connector->Connect( representation, vtkCommand::PropertyModifiedEvent, • this,SLOT(onRepresentationPropertyModifiedEvent(vtkObject*, unsigned long, void*, void*)));

  10. UI Creator: QtDesigner • QtDesigner -> XML File -> ui_MyWidget.h • Setup the graphic layout of widget • Possible to extend QtDesigner capabilities • Widget promotion • QtDesignerplugin • qSlicerAwesomeWidget: public Ui::Mywidget • Connect the widget with the application

  11. UI Creator: Widget promotion • See http://doc.trolltech.com/4.5/designer-using-custom-widgets.html

  12. UI Creator: Maverick and QtDesigner • A collection of opensource Qt Widgets • See http://www.vtk.org/Wiki/Maverick • See http://doc.trolltech.com/4.5/designer-creating-custom-widgets.html

  13. Extending a widget family • Example: QmDoubleRangeWidget • Extend from QSlider • Overload paintEvent( QPaintEvent* ) • Set of convenient methods provided by Qt API • QStylePainter::drawComplexControl(…) • Cross Platform

  14. Using widget from ‘others’ • Example QmDoubleRangeWidget • Developed by Karthik Krishnan • Self-documented interface • Signals and slots separation: Easy to understand • Cons: Handle only integers • Solution • Sub-classed into qSlicerDoubleRangeWidget

  15. Slicer and Qt

  16. Let’s do it Thanks for your attention Question ? QT Community Slicer Qt Double Slider Qt Color Picker Qt Thumbwheel KWWidgets And they lived happily forever after …

More Related