How to "copy and paste"
-
I want to reuse QMenuBar / QMenu - using copy and paste.
I can select / highlight the QMenu - and do "copy" ,however, I cannot figure out how to paste
it back to the desired position in QMenuBar. -
There is no Copy in the context menu
Copy is not enabled in the Edit menu when a menu is selected:
Since that is not enabled, its shortcut key, Control-C, is also not enabled.
I cannot see any way to copy a menu in Designer/Qt Creator (9.0.1). It follows that there is no way to paste one either.Perhaps you can tell us how you 'do "copy" '?
-
There is no Copy in the context menu
Copy is not enabled in the Edit menu when a menu is selected:
Since that is not enabled, its shortcut key, Control-C, is also not enabled.
I cannot see any way to copy a menu in Designer/Qt Creator (9.0.1). It follows that there is no way to paste one either.Perhaps you can tell us how you 'do "copy" '?
@ChrisW67 This is one of the goofiest "feature" of QT. I have to highlight the menu , actual text , and then "type in" the submenu. There is no way to duplicate the menu and edit it. That works fine when one is not sure how it works, hence doing "baby steps" so mistakes can be corrected immediately. But it is a pain when it would make sense to duplicate large menu.
-
@ChrisW67 This is one of the goofiest "feature" of QT. I have to highlight the menu , actual text , and then "type in" the submenu. There is no way to duplicate the menu and edit it. That works fine when one is not sure how it works, hence doing "baby steps" so mistakes can be corrected immediately. But it is a pain when it would make sense to duplicate large menu.
@AnneRanch If you are that concerned with duplication of an existing menu then feel free to edit the UI file.
Transform this:
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>800</width> <height>600</height> </rect> </property> <property name="windowTitle"> <string>MainWindow</string> </property> <widget class="QWidget" name="centralwidget"> <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QWidget" name="widget" native="true"/> </item> </layout> </widget> <widget class="QMenuBar" name="menubar"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>800</width> <height>22</height> </rect> </property> <widget class="QMenu" name="menuA"> <property name="title"> <string>A</string> </property> <addaction name="actionA1"/> <addaction name="actionA2"/> </widget> <addaction name="menuA"/> </widget> <widget class="QStatusBar" name="statusbar"/> <action name="actionA1"> <property name="text"> <string>A1</string> </property> </action> <action name="actionA2"> <property name="text"> <string>A2</string> </property> </action> </widget> <resources/> <connections/> </ui>
in the Plain Text Editor, by copy-and-paste, followed by renaming this chunk:
... <widget class="QMenu" name="menuA"> <property name="title"> <string>A</string> </property> <addaction name="actionA1"/> <addaction name="actionA2"/> </widget> <addaction name="menuA"/> <widget class="QMenu" name="menuB"> <property name="title"> <string>B</string> </property> <addaction name="actionA1"/> <addaction name="actionA2"/> </widget> <addaction name="menuB"/> ...
I do not see a "Perfectly duplicate a menu" use case common enough to warrant implementation. Most menus in the same program differ wildly.