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

Alejandro Exojo suy at badopi.org
Mon Apr 13 18:48:29 CEST 2015


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



More information about the Interest mailing list