5

In Qt creator whenever you open a ui.qml file by double clicking or CTRL + TAB the file normally opens in design mode. To see the code, you need to hit ESC to go the text editor. I want that the ui.qml files should open by default in the editor. How can I do that in settings?

6
  • 2
    If you want to edit ui.qml files by hand, don't use ui.qml files? These are made to be edited by the designer and are limited to a small subset of qml because of that. Just use the normal qml extension! Commented Jun 3, 2016 at 6:13
  • @rubenvb I never thought of it this way! Can we use the editor on simple .qml files without a problem? Commented Jun 3, 2016 at 13:22
  • yes, of course, .ui.qml files are "new", .qml. files have existed since the beginning of QML. For more information, see doc.qt.io/qtcreator/creator-quick-ui-forms.html. Commented Jun 3, 2016 at 13:24
  • @rubenvb Thank you, this was useful. Learning QT is kinda tough. I couldn't find a 'serial guide' to learn it. Could you please point me to a reference that you think may help me out? Also, if I don't get a better answer, I'd like to accept yours. Commented Jun 3, 2016 at 13:28
  • it helped me a lot to define a simple/intermediate project that could be attacked step by step and covered a lot of different things and just start writing bits and pieces of it. It helps if you focus on a single thing in the Qt documentation, preferably with an example. Qt is the best documented framework of them all (no kidding), but step one is to learn to use the documentation. Load up a simple example, e.g. the Basic Layouts, or Application example) which can be loaded from Qt Creator. read the examples' explanation, the code, and the associated documentation. Commented Jun 3, 2016 at 13:40

2 Answers 2

7

In Qt Creator:

  1. Tools >>> Options;
  2. Open Environment;
  3. Go to MIME Types;
  4. Find (by filter, for ex.) application/x-qt.ui+qml;
  5. Delete or change Pattern field in Details.
Sign up to request clarification or add additional context in comments.

7 Comments

In details there are no pattern fields. I tried the solution before posting the question.
I'm on QT Creator 3.6.1, what version are you using?
As I can see you don't have anything in the Details box too.
Cause I deleted a pattern already. Don't you forget select a MIME type firsly?
I followed all 4 steps and 5th is the one which I can't because there never existed one. I'll try to update and see if that works.
|
5
+50

If you want to edit .ui.qml files by hand, don't use .ui.qml files? These are made to be edited by the designer and are limited to a small subset of QML because of that. Just use the normal .qml extension in this case.

More info on QML UI files here.

1 Comment

Couldn't find a better answer, thanks for your guide in comments as well!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.