Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Whoopps I done it again - how to rename "MainWindow" ?
Qt 6.11 is out! See what's new in the release blog

Whoopps I done it again - how to rename "MainWindow" ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 596 Views 2 Watching
  • 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 Anonymous_Banned275
    #1

    I did not pay attentions and build a standard "MainWindow" project.
    It saves time and it is easier to debug to build a project and ad it as subproject / library to the main project later...
    Now I have to rename all "MainWindow" to something else...
    I am planning to do it BEFORE I add the project to the main project - which already has "MainWindow"...

    Not that easy task when QDesigner is used to manage forms.

    Of course I make few backups...

    Any helpful suggestions how to make the job easier would be appreciated.
    Thanks

    Here is what I mean - it is NOT that easy to "serch and re-place "

    467cbeaa-f1ee-4cd8-9e17-cffd8e54b724-image.png

    J.HilkJ 1 Reply Last reply
    0
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on last edited by Kent-Dorfman
      #2

      If using an IDE that supports refactoring then there is sometimes a command to do it for you, otherwise...brute force

      in linux

      for i in $(rgrep -H MainWindow . | awk '{ FS=":"; print $1; }'); do
      sed -i .bak 's/$i/new_name/g' $i
      done
      

      The dystopian literature that served as a warning in my youth has become an instruction manual in my elder years.

      1 Reply Last reply
      0
      • A Anonymous_Banned275

        I did not pay attentions and build a standard "MainWindow" project.
        It saves time and it is easier to debug to build a project and ad it as subproject / library to the main project later...
        Now I have to rename all "MainWindow" to something else...
        I am planning to do it BEFORE I add the project to the main project - which already has "MainWindow"...

        Not that easy task when QDesigner is used to manage forms.

        Of course I make few backups...

        Any helpful suggestions how to make the job easier would be appreciated.
        Thanks

        Here is what I mean - it is NOT that easy to "serch and re-place "

        467cbeaa-f1ee-4cd8-9e17-cffd8e54b724-image.png

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #3

        @AnneRanch I would suggest:

        • Right click on your project
        • Choose Qt Files and Classes template
        • Choose Qt Designer Form Class
        • Select Main Window
        • This time, name it like you want it to
        • Finish the wizard
        • Delete old "MainWindow" from project

        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        1 Reply Last reply
        0

        • Login

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