Results 1 to 8 of 8

Thread: Bug in the .ui file

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Exclamation Bug in the .ui file

    Hello!

    I think I found a big problem :P

    I had some QCheckBox declared in my mainwindow.ui file and some toggled(bool) functions related to them in my mainwindow.cpp/h and I decided to change theyr names. Instead though of going to the Design interface in QtCreator and change theyr names in the specific place and than go to the .cpp and change the names of the functions, I decided to do a "replace all" in QtCreator thinking that this would be the quickest way.

    After changing some code on which seems to be the ui source code, I went back to the Designer interface in the .ui and found out that the QCheckBoxes's names weren't changed there. So I edited them mannually. Than I run the app and I found out that the toogled(bool) functions also hadn't theyr names changed, so I went to the .cpp and changed them too (in other words, my trying to be smart by using replace all went for nothing).

    But after this, I tried to enter again in the mainwindow.ui file in the Designer interface and QtCreator didn't allowed me, saying "An enconding error was encountered" in a pop up. After several times trying, I decided to do the procces Clean All - Run Qmake - Rebuild All, and than a new error appeared:

    Qt Code:
    1. 00:57:15: Running build steps for project mShare...
    2. 00:57:15: Configuration unchanged, skipping qmake step.
    3. 00:57:15: Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe"
    4. C:/QtSDK/mingw/bin/mingw32-make.exe -f Makefile.Release
    5. mingw32-make.exe[1]: Entering directory `D:/Minhas obras/Softwares/mShare/mShare 0.0.7'
    6. c:\QtSDK\Desktop\Qt\4.8.1\mingw\bin\uic.exe mainwindow.ui -o ui_mainwindow.h
    7. mingw32-make.exe[1]: Leaving directory `D:/Minhas obras/Softwares/mShare/mShare 0.0.7'
    8. uic: Error in line 1751, column 16 : Encountered incorrectly encoded content.
    9. File 'mainwindow.ui' is not valid
    10. mingw32-make.exe[1]: *** [ui_mainwindow.h] Error 1
    11. mingw32-make.exe: *** [release] Error 2
    12. 00:57:15: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
    13. Error while building project mShare (target: Desktop)
    14. When executing build step 'Make'
    To copy to clipboard, switch view to plain text mode 

    So now I can't compile my software as well as I can't have acces to the .ui file.

    How can I fix this problem? I would attach the .ui file here but the forum's limits didn't allowed me because of size limitations. I also went to this 1751 line and found nothing - I guess is because I'm looking at the mainwindow.ui file, not ui_mainwindonw.h which by the way is missing.


    Urgent help please


    Thanks in advance,

    Momergil

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Bug in the .ui file

    The way I see out is to either
    1. Revert back to some wokring code (all .cpp/.h/.ui)
    or
    2. Try to manually recover the ui file.

    I can help you out in recovering the file, if you wish to. (also mention the Qt version you are using)
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Bug in the .ui file

    Quote Originally Posted by Santosh Reddy View Post
    The way I see out is to either
    1. Revert back to some wokring code (all .cpp/.h/.ui)
    or
    2. Try to manually recover the ui file.

    I can help you out in recovering the file, if you wish to. (also mention the Qt version you are using)

    Well technically I may use both of the options. I mean, I have a backup .ui file but I'm quite unsure about to use it because I'm not sure I'll remember all the changes - and they were quite a few. And also that may take quite a considerable time.

    About the second option, I'm glad it can be solved so, but in that case what should I do? attach the .ui doesn't sees to be possible here in the forum. Besides, could it be too much difficult to find the error or this can be done quickly? Because I don't want to waste your time :T

    Using Qt 4.8.1.

  4. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Bug in the .ui file

    It should be fairly possible to fix the ui file (assuming basics of xml, and Qt Designer Properties)

    Try comparing the old and new ui files using a text compare tool.

    As I don't know to what extent your ui file is corrupted, it is difficult to say extent of recovery that can be done.

    It shoud be possible to zip the ui file the attach in the post, unless you don't want to put the ui file in public.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  5. The following user says thank you to Santosh Reddy for this useful post:

    Momergil (26th January 2013)

  6. #5
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Bug in the .ui file

    Quote Originally Posted by Santosh Reddy View Post
    It should be fairly possible to fix the ui file (assuming basics of xml, and Qt Designer Properties)

    Try comparing the old and new ui files using a text compare tool.

    As I don't know to what extent your ui file is corrupted, it is difficult to say extent of recovery that can be done.

    It shoud be possible to zip the ui file the attach in the post, unless you don't want to put the ui file in public.
    Well, it would be fairly possible if any mistake could be seen :X I tried comparying the oldest backup version with the current bugged .ui and had little success identifying differences: the greatest of them were in natural difference that came with the development, and the unique strange difference was in the encoding of special characteres (~, ç, etc..) which were some times different from one file to the other. But after changing the new .ui file to the older's way of writing theese special characters, nothing changed. In fact Qt Creator pointed out a specific line and column were the mistake is supposed to be, and I found nothing at all there:

    Qt Code:
    1. <property name="prefix">
    To copy to clipboard, switch view to plain text mode 

    (Column 16 would be the first "r" of "property")

    Edit: I tried to attach a .rar file of mainwindow.ui, but once again the forum didn't allow me affirming that it was a "invalid file".
    Last edited by Momergil; 25th January 2013 at 18:57.

  7. #6
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Bug in the .ui file

    Very interestingly, I managed to correct the problem.

    What I did was, instead of sumply looking at the .ui file in a text editor and trying to find the problem or else simply comparing the last backup version of mainwindow.ui and the bugged, newest version, I renamed the bugged one to a invalid name and copied the backup file to the project's file system and than began to ctrl+c + ctrl+v the parts from the bugged version to the backup/new one part by part, going back to QtCreator to see if a problem appeared. The unique time that this happens was, it seems, due to the question posted below, but with that exception, a simple copy-and-paste solved the problem. In other words, now I have a new mainwinwindow.ui that is essentially the same as the bugged version but that runs everything fine o.O

    So I guess that is some kind of bug in QtCreator... no reason, in terms of code, for this to happen.

    Well, last question: is there a difference between

    <widget class="QComboBox" name="GraphToolbarCharttype"/>

    and

    <widget class="QComboBox" name="GraphToolbarCharttype">

    (i.e. without / at the end)? Because it seems that the only once that the problem appeared again was because of the presence of this / at the end of a similar code. Nevertheless, the current mainwindow.ui, that runs fine, is using the first and not the second case.


    Thanks,

    Momergil

  8. #7
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Bug in the .ui file

    That makes sense.

    The second xml node is not closed/terminated or it would throw error in ui file parsing..
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  9. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Bug in the .ui file

    Quote Originally Posted by Momergil View Post
    So I guess that is some kind of bug in QtCreator... no reason, in terms of code, for this to happen.
    It's not a bug in Qt Creator. Somewhere in your file you used a character that is invalid in context of XML. While copy&pasting, your system somehow corrected it to the proper character or discarded the (possibly not-printable) character.

    Well, last question: is there a difference between

    <widget class="QComboBox" name="GraphToolbarCharttype"/>

    and

    <widget class="QComboBox" name="GraphToolbarCharttype">
    Yes. The second one opens a tag called widget while the first one both opens and closes a tag called widget.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 3
    Last Post: 1st November 2010, 16:33
  2. Replies: 0
    Last Post: 21st July 2010, 10:32
  3. Replies: 4
    Last Post: 9th May 2010, 16:18
  4. Replies: 3
    Last Post: 28th March 2009, 15:37
  5. Replies: 3
    Last Post: 25th May 2007, 07:49

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.