Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hand editing .ui files inside Qt editor

Tags:

qt

qt-creator

I've been tweaking my .ui files by hand a lot recently and I'm curious, does anyone know how to turn off read only mode for .ui files in Qt Creator?

In case that's not immediately clear, what I mean is that .ui files (by default) are view-able inside Qt Creator but not write-able... and it's a minor nuisance to go boot up some other xml editor :/

Thanks!

like image 458
WestleyArgentum Avatar asked Aug 27 '12 18:08

WestleyArgentum


People also ask

What is .UI file in Qt?

ui file is used to create a ui_calculatorform. h file that can be used by any file listed in the SOURCES declaration. Note: You can use Qt Creator to create the Calculator Form project. It automatically generates the main.

What is setupUi in Qt?

setupUi() creates the actual instances of widgets for you. A form that you create in QtDesigner is stored just as XML file.

How do you make a .UI file?

To create a . ui file go to File -> New File or Project... In the window that appears select Qt under Files and Classes on the left, then select Qt Designer Form on the right. You'll notice the icon has "ui" on it, showing the type of file you're creating.

What is difference between Qt Designer and Qt Creator?

Qt Creator is Qt's IDE. You don't have to use it, but it greatly simplifies Qt development. Qt Designer is a graphical tool that lets you build QWidget GUIs. Qt Quick Designer is similar, but for building QML GUIs.


1 Answers

In the context menu of any .ui file in the project explorer, click Open With and then Plain Text Editor. This gives you the same editor but with write mode.

Note that the disabled write mode for ui files when double clicking and changing to "Edit" mode rather than "Design" mode isn't a bug but a feature. Editing ui files by hand can destroy your file. At least, this is what the Qt guys think...

like image 136
leemes Avatar answered Sep 20 '22 01:09

leemes