[Interest] [interest] UITools - how to modify the GUI?

Tamás Nagy tamas.nagy.001 at gmail.com
Tue Apr 14 09:42:22 CEST 2015


Hi,

Ok, I added the mainwindow.ui to a resource file, now it can be opened.

With your solution it works and finds the tabs:

if (!file.open(QIODevice::ReadOnly | QIODevice::Text));

But I also have to modify the GUI, so I have to set it ReadWrite:

if (!file.open(QIODevice::ReadWrite | QIODevice::Text))

With this I get "Unknown Error" for trying to open the file.
I checked the file: it is not read only.

Tamas


2015-04-13 18:48 GMT+02:00 Alejandro Exojo <suy at badopi.org>:
> El Monday 13 April 2015, Tamás Nagy escribió:
>> Hi,
>>
>> It was almost impossible, but it does not load the UI file:
>>
>> GuiParser::GuiParser(QTreeWidget *tree)
>> {
>>     treeWidget = tree;
>>
>>     QUiLoader uiLoader;
>>     QFile file("mainwindow.ui");   // I also copied file to C: root
>> and wrote fix path here
>>     // I also wrote here a file.open, but it does not help to change
>> it from unknown error to a better one
>
> I don't understand that sentence. Were you able to open the file with QFile
> and confirm that the application can read it?
>
>>     QMessageBox msgBox0;
>>     msgBox0.setText( file.errorString() );  // gives UNKNOWN ERROR
>
> Well, in this code, you didn't call file.open().
>
> Try just this:
>
> QFile file("mainwindow.ui");
> if (!file.open(QIODevice::ReadOnly | QIODevice::Text));
>     qWarning() << "Could not open the file" << file.errorString();
> else
>     qDebug() << file.readLine(50);
>
> Then just look at the output in the console, or the "output" panel in creator,
> or whatever you are using. If you see the warning, you have the explanation
> there. If you see garbage output instead of text, your file is not how it
> should be. If you see something like the UI file contents (<?xml version="1.0"
> encoding="UTF-8"?> for example), then the problem is in the code below. But at
> least let's confirm this first.
>
> --
> Alex (a.k.a. suy) | GPG ID 0x0B8B0BC2
> http://barnacity.net/ | http://disperso.net
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list