[Qt-creator] extracting path/filename from selected file in navigationwidget(Project)

Hermann Fieger hermann.fieger at t-online.de
Thu Apr 9 14:17:03 CEST 2015


Meanwhile i've included (imported) my python files into a "Qt Generic
project" ( "test.creator" ).
Now the example works on an "open" project.

  QString           qs_path;
  QString           qs_file;

  ProjectExplorer::Project *p_pro  =
ProjectExplorerPlugin::instance()->currentProject();

  if( p_pro == NULL ) {

    QMessageBox::information( Core::ICore::mainWindow(),
                              tr("Information"),
                              tr("There is no open project!") );
    return;
  }

  ProjectExplorer::Node    *p_nod  =
ProjectExplorerPlugin::instance()->currentNode();

  qs_path = p_nod->path();
  qs_file = qs_path.section( QLatin1String("/"),-1,-1);               
// get only file name

  f_dlg_conv *wdg_conv = new f_dlg_conv( qs_file );
  wdg_conv->exec();


It has also  now a more professional look to display all used files in
an open project tree,
though a wouldn't need it, because all my dependencies starts all from
one single file.


Thank you very much for answering,

Hermann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20150409/28e2b3fc/attachment.html>


More information about the Qt-creator mailing list