Edit ui files with CLion
Asked Answered
D

4

11

I am developing a QT application in C++. Since i like CLion, I would like to use this IDE to write my code. My problem: I cannot open the .ui - files. CLion just ignores my double-click on the files. I do not want a graphical editor like in QT creator, editing the XML as text would be perfectly fine.

How can I tell CLion, that it should open *.ui - files as xml?

Dryly answered 12/12, 2017 at 9:59 Comment(0)
S
11

You can go to Settings -> Editor -> File Types and choose XML to add *.ui files below.

What you can also do is register an external tool to edit the UI files with the Qt UI Designer: https://www.jetbrains.com/help/clion/external-tools.html

Saccharine answered 12/12, 2017 at 12:33 Comment(3)
Can't thank you enough for this answer. Didn't understand why the .ui files wouldn't load or give any error message of any kind. I'm surprised it doesn't attempt to treat them as plaintext.Koeninger
@Fields, I created youtrack.jetbrains.com/issue/CPP-17197, please provide your feedback on that ticket.Lumpy
Still can't open ui file with double click in clonJurat
M
2

Go to Settings / Preferences | Editor | File Types, select Qt UI Designer Form from the Recognized File Types list, and delete the associated file extension.

Next time you click a .ui file for opening, set the Open in associated application checkbox, and the files of this type will always open in Qt Designer.

See also:
https://www.jetbrains.com/help/clion/qt-tutorial.html#edit-ui

Manta answered 5/8, 2020 at 14:24 Comment(2)
"Open in associated application" doesn't seem to exist in CLion, at least not anymoreHaycock
@EthanMcTague Right click the file and click "Associate with File Type...". It opens a dialog with a checkbox at the bottom "Open matching files in associated application". Check this box and click OK.Xuthus
R
2

You can associate the file with the XML editor from context menu enter image description here

Ricer answered 30/9, 2021 at 9:52 Comment(0)
B
0

Right click on any *.ui file. From context menu , select "Open with..." and browse for QT editor. View attached image for reference

Billbug answered 14/8, 2023 at 16:18 Comment(1)
Didn't the OP say they did not want to use Qt Editor?Arellano

© 2022 - 2024 — McMap. All rights reserved.