Hi,

the Module::GetResource() method will make the resources of the module 
object you call that method with accessible. It does not search across 
modules. My guess is you are trying to retrieve the "body.stl" resource 
from your own module, not from the QtWidgets module.

Cheers,
Sascha

On 07/28/2015 04:28 AM, Sebastian Ordas wrote:
> Hi Team,
>
> How can I load an .stl resource file in a class located in QtWidgets
> module? (QmitkStdMultiWidget.cpp)
> 1) My STL file, "body.stl" is located in
> D:\sources\MITK\Modules\QtWidgets\resource (note, there is no
> "resources" folder)
> 2) It is not listed in Qmitk.qrc
> 3) but it is indicated in D:\sources\MITK\Modules\QtWidgets\files.cmake as:
>
> ...
>
> set(QRC_FILES
>     resource/Qmitk.qrc
> )
>
> set(RESOURCE_FILES
>     body.stl
> )
>
> 4) finally, in the code:
>
> us::Module* module = us::GetModuleContext()->GetModule();
> us::ModuleResource resource = module->GetResource("body.stl");
> std::vector<mitk::BaseData::Pointer> data = mitk::IOUtil::Load(resource);
>
>      if(!data.empty())
>      {
>        mitk::Surface::Pointer fileoutput =
> dynamic_cast<mitk::Surface*>(data[0].GetPointer());
>        if (fileoutput->GetVtkPolyData())
>         ...
>      }
>
> thank you for any hint,
> sebastian
>
> ------------------------------------------------------------------------------
> _______________________________________________
> mitk-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mitk-users


------------------------------------------------------------------------------
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to