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 <[email protected]>: > 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 > [email protected] > http://lists.qt-project.org/mailman/listinfo/interest _______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
