Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switching between .ui and .cpp in Qt Creator

Tags:

ide

qt

qt-creator

In Qt Creator, is there an easy way to directly switch between the Design view and the .cpp file associated with the form (and vice-versa)?

When I go from Design mode to Edit mode (Ctrl-2), it annoyingly shows me the XML code of the .ui file, so I have to manually pick the .cpp file.

When I'm in the .cpp file of a form, the Design mode icon and shortcut (Ctrl-3) are disabled, so I have to manually pick the .ui file.

There must be a better way to switch between ui <--> cpp.

like image 559
Emile Cormier Avatar asked Apr 11 '13 13:04

Emile Cormier


1 Answers

Buried in the menu, is the Tools -> Form Editor -> Switch Source / Form command. It has the Shift-F4 hotkey and does exactly what I was looking for.

F7 doesn't seem to be bound to any command, so I rebound the FormEditor/FormSwitchSource command to use F7 as the keyboard shortcut. I can now switch between ui <--> cpp with a single keypress!

EDIT:

There's a known bug with Qt Creator where it doesn't save the keyboard shortcut for the FormEditor/FormSwitchSource command.

like image 95
Emile Cormier Avatar answered Nov 14 '22 04:11

Emile Cormier