Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How to "copy and paste"
QtWS25 Last Chance

How to "copy and paste"

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
4 Posts 2 Posters 419 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    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.

    2c4d8297-966c-44ab-8e9d-8d2a21562287-image.png

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      There is no Copy in the context menu
      2f5fefa6-1c1b-4309-b086-f067f452710f-image.png

      Copy is not enabled in the Edit menu when a menu is selected:
      274c30f9-b2ad-44d7-9184-a5ac7442eae4-image.png
      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" '?

      A 1 Reply Last reply
      0
      • C ChrisW67

        There is no Copy in the context menu
        2f5fefa6-1c1b-4309-b086-f067f452710f-image.png

        Copy is not enabled in the Edit menu when a menu is selected:
        274c30f9-b2ad-44d7-9184-a5ac7442eae4-image.png
        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" '?

        A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #3

        @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.

        C 1 Reply Last reply
        0
        • A Anonymous_Banned275

          @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.

          C Offline
          C Offline
          ChrisW67
          wrote on last edited by ChrisW67
          #4

          @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.

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved