Default program for opening .pro Qt project files

6,087

You can change the default application this way:

  1. Right click a .pro file.
  2. Click "Properties".
  3. Select the "Open With" tab.
  4. Click "Show other applications" if needed.
  5. Select the application you want from the list.
  6. Click "Set as default".

This should change the default application used for all .pro files.

Edit:

This won't work with .pro files, as they are associated with the "text/plain" type. The steps above are provided by air-dex in a comment.

  1. Write an XML file like the shinythings-shiny.xml file in the xdg-mime man page (http://linux.die.net/man/1/xdg-mime). The type can be called, for example, "text/qt-project-file". Set the pattern to "*.pro". Add a tag saying that the custom MIME type is a subtype of text/plain too.
  2. Execute the following command : sudo xdg-mime install <path to XML file>. Sudo must be used.
  3. Select the default program just like explained above.

These steps can be used for any file extension. Just replace .pro with the extension and choose a suitable name to replace "text/qt-project-file".

Share:
6,087

Related videos on Youtube

air-dex
Author by

air-dex

Updated on September 18, 2022

Comments

  • air-dex
    air-dex over 1 year

    I would like to set Qt Creator (the one which is in the Nokia Qt SDK, not the one in Canonical PPAs) as the default program to open .pro Qt project files. But it appears that my Ubuntu install (12.04 while I am writing the question) recognizes .pro files as plain text files instead of Qt project files. I know that I could fix the problem by setting Qt Creator as the default program for opening plain text files but I want to keep on opening plain text files with the program I currently use for this (gedit).

    So my question is : how can I do for making my Ubuntu install recognizing .pro files as Qt project files instead of plain text files ?

    NB : I have already looked at Ubuntu Tweak to associate Qt project files with Qt Creator but I did not find anything relevant (perhaps I missed it too).

    EDIT : the solution is in the Edit of Kalle Elmér's answer.

  • air-dex
    air-dex over 11 years
    I have already tried this but it sets the new default application (Qt Creator in my case) as the default application for .pro files and for ALL plain text files too (.txt files for example). I want to keep the old defalut application (gedit in my case) for the other plain text files. This is what I explained in the question ("I know that I could fix the problem by setting Qt Creator as the default program for opening plain text files but I want to keep on opening plain text files with the program I currently use for this (gedit).").
  • Kalle Elmér
    Kalle Elmér over 11 years
    After digging around, I found references to config files here: libre-software.net/change-the-default-application-ubuntu-lin‌​ux. However, these lists still reference file types such as "text/plain" instead of actual file extensions. The question is what makes ubuntu consider a .pro file to be "text/plain". Perhaps somebody around here knows?
  • air-dex
    air-dex over 11 years
    I looked at it. To determine the MIME type, Linux looked at extensions (which may be associated to a MIME type) and at some elements in the file that might determine it (magic). For .pro files, I think that I must be magic since the .pro extension is not linked to a MIME type. So to solve the problem, I created a custom MIME type for files with the .pro file-extension and then I chose Qt Creator for opening files with this MIME type. Thanks for your help !
  • Kalle Elmér
    Kalle Elmér over 11 years
    I'm glad I could help. How exactly did you create this custom MIME type?
  • air-dex
    air-dex over 11 years
    I created it with xdg-mime install (man page here : linux.die.net/man/1/xdg-mime ). Perhaps I should write more clearly what I did on a separate answer ?
  • Kalle Elmér
    Kalle Elmér over 11 years
    If you post some steps here, I can edit my existing answer and add those instructions. It's a shame you can't do this using the properties page in ubuntu. I think I'll file some kind of improvement request about this.
  • air-dex
    air-dex over 11 years
    Here are my steps : 1°) Writing a XML file like the shinythings-shiny.xml file in the xdg-mime man page (cf. the link I gave in my previous comment). I called my type "text/qt-project-file". I set the <glob> pattern to "*.pro". I add a <sub-class-of type="text/plain"/> tag saying that my custom MIME type is a subtype of text/plain too. 2°) Executing the following command : sudo xdg-mime install <the shinythings-shiny.xml equivalent for text/qt-project-file>. I don't know why but it only works with sudo. 3°) Select the default program just like you explain in your answer.
  • l --marc l
    l --marc l over 8 years
    FYI: Qt Creator 3.5.1 > Tools > Options > MIME Types shows application/vnd.qt.qmakeprofile as the "Registered MIME Type" for the *.pro pattern.