Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Sunday, February 7, 2016

ugly Qt app look under ubuntu

ugly Qt app look under ubuntu


I'm involed in developing some Qt application build under Linux. I have downloaded the source code and compiled it under Windows 7 firstly, but then I decided to work under Ubuntu. The problem is, the application in Linux looks like in Win95 times. I have installed Qt4 Settings and chosen GTK+ style, but this improved the look only a little bit, though it still looks very ugly (like 256 collors pallette, font is italic). I have also installed many gtk libraries, but nothing helped. I use Qt-4.7.4. I know that it should look different, beacuse on Windows the problem doesn't appear, even on my boss' computer, who is also using Ubuntu, the application looks much better.

The app changes style to QPlasticStyle itself.

Thanks in advance for every answer.


Well, another lot of tries, but nothing changed. Maybe I will show you the problem. How the app should look like (more or less) (ss made by one of my co): http://postimage.org/image/70p6sw7xd/full/

and how it actually looks like (ss made by me): http://postimage.org/image/48psktnuj/full/

There are two things that I haven't done so far:
1) At the beginning, I installed Qt-4.8.1, but it was generating some OpenGL errors with make so I then downloaded 4.7.4 version (the one that my boss and cos are using) and was strugling with installation. Finally, I just overwrote qt-make from 4.8.1 with the one from 4.7.4 and it compiled fine. But then I encountered the 'Question thing'. The point - all Qt applications tells (Help-> About Qt) that they are using Qt-4.8.1 and I wonder if it has some connection with the problem.

2) Second thing is my graphics. I have MSI CX640 notebook with Nvidia Optimus on board. After installing Ubuntu I had to make it using the integrated Intel HD3000 instead of the dedicated GT520M (it was making the fan behave noisely unnecessary). I have googled for the way to do so and actually succeded in disabling GT520M. What is the point of it - I'm not sure, but I remember some OpenGL things were mentioned on sites where I was searching for the solution). I think this has nothing in common with the problem, but I'm so frustraded tha now I'm insighting everything.

Maybe these can give better overview of the problem.

PS. Thanks for your attemps, I appreciate them.

Answer by F?lix Galindo Allu for ugly Qt app look under ubuntu


Have you tried to clean the project?

Delete everything except .cpp, .h and .pro

This includes a file with extension .pro.user that must be also deleted. Also remove the debug and release folder.

Then run qmake and make as usual from the command line.

Are you "sudoing" your application when executed? That also calls another style.

Answer by dschulz for ugly Qt app look under ubuntu


Try installing the qt4-qtconfig package. Use the qtconfig tool to customize the look n' feel.

sudo apt-get install qt4-qtconfig  qtconfig &  

Edit:

If it looks really bad, try deleting (or temporarily rename) the ~/.config/Trolltech.conf file. Then use Qt4 Settings to start again. Also, I'd suggest you to try installing the Oxygen and QtCurve styles.

Answer by F?lix Galindo Allu for ugly Qt app look under ubuntu


FIRST PROPOSED APPROACH

Have you tried to change manually the style of the application by command line? Go to the application folder, where you have the compiled version of the program, and execute it by appending -style cleanlooks or any other of the predefined styles (windows, motif, cde, plastique, cleanlooks or gtk+). If the program is named foo, then you must write:

foo -style gtk+  

Compare the appearance with your boss' computer. This will indicate if the problem is with the styles or with the selection of the predefined style in Qt.

ANOTHER POSSIBLE APPROACH

Knowing that you have overwritten a previous installation, maybe some library file has been corrupted or lost or not overwritten by Qt4.7.4.

If that's the case, you would discover which files have gotten corrupted or misleading by executing a diff on some directories, between your boss' computer and yours.

The Qt libraries are normally at /usr/lib/i386-linux-gnu/ (there's where live the predefined styles, precompiled) and the filenames are in the form libQt...

You could verify the path of the libraries if you examine a Makefile of some of your projects and search for the -L switch. Maybe yours are in another folder, like /usr/lib directly.

So, you could make the list of libraries and their names and sizes with:

ls -l /usr/lib/i386-linux-gnu/libQt*  

If you see some links pointing at the wrong place, or version numbers scrambled, then you have found the problem. If not, then compare the list with another one from your boss (problably the file sizes may indicate a remnant of Qt4.8).

I don't know if you can replace the library files from one computer to the other. Try. The least could happen is that you have to reinstall Qt.

Answer by joval for ugly Qt app look under ubuntu


Well, few days have passed and I'm still struggling.

But, I have reinstalled properly Qt 4.7.4 and, if build on it, the application looks good, despite of font, which is like Monotype instead of Ubuntu's one. Unfortunately, this is Qt issue and is hard to compensate it. Maybe you now how to do that? I'm on the last part of way to solve my problem.

EDIT: Hurray! Solved! I stacked with 4.8.1 made compatible with my project with use of http://qt-project.org/forums/viewthread/14269/#74232 and http://ubuntuforums.org/showthread.php?t=1559654

Thanks everyone.

Answer by michaelmoo for ugly Qt app look under ubuntu


If using Qt 4, you probably just need to set the graphics system to 'raster'. I don't know if it's possible to do in Qt 5 (try the command line switch, because the setGraphicsSystem function is gone).

There are a few ways to do this. See http://qt-project.org/doc/qt-4.8/qapplication.html#setGraphicsSystem

void QApplication::setGraphicsSystem ( const QString & system ) [static]

Sets the default graphics backend to system, which will be used for on-screen widgets and QPixmaps. The available systems are "native", "raster" and "opengl".

There are several ways to set the graphics backend, in order of decreasing precedence:

  • the application commandline -graphicssystem switch
  • QApplication::setGraphicsSystem()
  • the QT_GRAPHICSSYSTEM environment variable
  • the Qt configure -graphicssystem switch

If the highest precedence switch sets an invalid name, the error will be ignored and the default backend will be used.

Warning: This function is only effective before the QApplication constructor is called.

Answer by frmdstryr for ugly Qt app look under ubuntu


With ubuntu 14.04, the app looked fine when running as a normal user but when running as root it was using the motif theme which is very ugly.

I was able to make the app use the nice looking default radiance theme by using:

app.setStyle("gtk")

where app is the QApplication instance.

see http://doc.qt.io/qt-4.8/qapplication.html#setStyle-2


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.