PDA

View Full Version : qpainter "drawText() problem



impeteperry
19th March 2007, 18:12
Hi I have just installed linux on a new computer.
I am using Kubuntu 610 (and 704 on an another HD in the same box)
same problem on both installations .

I had intalled "g++" , "gliv, glutq3" ,"glut.doc" and nothing else before I Installed Qt4.
I did all the prescribed updates etc. I installed
Qt4-4.2.2 on the disk with 610
Qt4-4.2.3 on the disk with 704

Both installations were text book clean.

I have a graphic program which uses QPainter to draw lines and text on the screen.

when compiled on either disks , the lines draw fine, but the "p.drawText(int, int, QString);" command locks up the computer for a short time then kicks me out sets up the "User input" screen.

Now I have another computer that is also running Kubuntu 610 using "Qt-4.2.1" or "Qt-4.2.2, (not sure which) "Running the exact same program. It has no problem with the "p.drawText(int, int, QString);"

I used the same "tar" of the program on each installations, ran "qmake -project", added "CONFIG += opengl qt warn_on debug" in the generated ".pro" file. Ran "qmake foo.pro" and the "make".
No errors or significant warnings on any of the 3 installations.

If I optioned out the one "p.drawText(...)" line in the two new installations, everything everything else ran
the same on all three installations.

Am I missing some other packages?

I certainly would appreciate help, thanks

wysota
19th March 2007, 20:41
Do all the demos bundled with Qt work fine? If so, then the problem is probably within your application. Do you use threads? What does your ~/.xsession-errors contain (last few lines)?

impeteperry
24th March 2007, 04:03
Thanks , sorry about the delay
all the Demos run fine
I don't think I am using "threads"
I don't know how to get "~/.xsession-errors"

I have just tried to compile some of the examples and I get
pete@myComputer:/usr/local/Trolltech/Qt-4.2.3/examples/dialogs$ qmake dialogs.pro
Failure to open file: /usr/local/Trolltech/Qt-4.2.3/examples/dialogs/Makefile
Unable to generate makefile for: dialogs.pro
pete@myComputer:/usr/local/Trolltech/Qt-4.2.3/examples/dialogs$
I do have
PATH=/usr/local/Trolltech/Qt-4.2.3/bin:$PATH
export PATHin my .bash_profile file.
so I must be missing something in my "Qt" installation.

My program generates "Makefile" files OK, however

Thank for any help and your patience with an old man.

wysota
24th March 2007, 09:23
I don't know how to get "~/.xsession-errors"
"less ~/.xsession-errors" - make sure to do it before you restart the X server.


I have just tried to compile some of the examples and I get I do have
PATH=/usr/local/Trolltech/Qt-4.2.3/bin:$PATH
export PATHin my .bash_profile file.
so I must be missing something in my "Qt" installation.

Did you install Qt from an RPM?

impeteperry
24th March 2007, 14:24
Thanks
i ran the less... command and the first time through I got a request to install "kpersoni..." which I did and then ran the less.. command again and got
Xsession: X session started for pete at Sat Mar 24 09:32:30 EDT 2007
startkde: Starting up...
startkde: Running kpersonalizer...
X Error: BadDevice, invalid or uninitialized input device 167
Major opcode: 144
Minor opcode: 3
Resource id: 0x0
Failed to open device
X Error: BadDevice, invalid or uninitialized input device 167
Major opcode: 144
Minor opcode: 3
Resource id: 0x0
Failed to open device
X Error: BadDevice, invalid or uninitialized input device 167
Major opcode: 144
Minor opcode: 3
Resource id: 0x0
Failed to open device
X Error: BadDevice, invalid or uninitialized input device 167
Major opcode: 144
Minor opcode: 3
Resource id: 0x0
Failed to open device
X Error: BadDevice, invalid or uninitialized input device 167
Major opcode: 144
Minor opcode: 3
Resource id: 0x0
Failed to open device
X Error: BadDevice, invalid or uninitialized input device 167
Major opcode: 144
Minor opcode: 3
Resource id: 0x0
Failed to open device
X Error: BadDevice, invalid or uninitialized input device 167

I installed Qt as I always have by downloading it from the Trolltech "mirror", and then the "tar", "./configure -xshape", "make", "sudo make install" and entered the "path..." text item in my "profile" as instructed
All without errors of course.

wysota
24th March 2007, 17:07
Is that the last screen of errors from the file?

Try to see if you can install Qt using an rpm. This will make sure you have all needed dependencies.

Do I understand correctly that the X server crashes when you run the application?

impeteperry
24th March 2007, 17:37
yes it is. I shall try the "rpm" I will delete the present installation first.

wysota
24th March 2007, 19:51
You don't have to delete it, just make sure the RPM based one comes before the compiled one in your $PATH.

impeteperry
24th March 2007, 21:44
Thanks for all your help. I know I've been a pest.

i tried to find an RPM download. but gave up. (I really didn't spend too much time as I had so much trouble with RPM packages when I was using RH/Fedora before I switched to Ubuntu/Bubuntu.)

I did, however install a debian version of Qt4. and had even more problems.

I went back to my original thought and installed all the "gcc" packages that seemed reasonable.

Re-installed Qt4 from the downloaded source code.

Restarted my computer. re-compiled my program. NOW IT RUNS!!!

I went back to the installed Qt examples in /usr/local/Trolltech/examples and tried "qmake examples.pro" and got
pete@myComputer:/usr/local/Trolltech/Qt-4.2.3/examples$ qmake examples.pro
Failure to open file: /usr/local/Trolltech/Qt-4.2.3/examples/Makefile
Unable to generate makefile for: examples.pro
pete@myComputer:/usr/local/Trolltech/Qt-4.2.3/examples$
so now i want to fix that, but it is not criticca at this point.

Thanks again

I tried the examples in the Trolltech documentation . they all compiled and ran OK.

wysota
24th March 2007, 22:13
Do you have file access permissions for that directory? You may need to compile the example as root.

impeteperry
25th March 2007, 00:46
Do you have file access permissions for that directory? You may need to compile the example as root.
That did it, thanks