PyQt, designer, and directional flow

B

borntonetwork

I am creating a simple form using designer (qt4) on Ubuntu. I use pyuic
to create a python script from the form. I run the script and the form
shows up fine. The idiosyncrasy occurs when I try to type text into a
QTextEntry widget. The text is right-aligned, not left-aligned as I had
set it up in the property editor in designer.

This behavior is not limited to alignment in text fields. If I insert a
QTableWidget and add items to it, the items appear from right to left,
not left to right. For example, if I create a 4-column table and use
setItem() to insert the numbers 1, 2, 3, and 4 into columns 0, 1, 2, 3
respectively, I get this:

4 3 2 1

The same thing goes with the headers. I create a QStringList ("1", "2",
"3", "4") and add it using setHorizontalHeaderLabels() then the headers
show up as 4 3 2 1.

This is my first qt app using python instead of C++, so I may be doing
something wrong.

I am grateful for any ideas someone might have.

By the way I've compiled pyqt and qt4 from the latest stable sources.
 
D

David Boddie

borntonetwork said:
I am creating a simple form using designer (qt4) on Ubuntu. I use pyuic
to create a python script from the form. I run the script and the form
shows up fine. The idiosyncrasy occurs when I try to type text into a
QTextEntry widget. The text is right-aligned, not left-aligned as I had
set it up in the property editor in designer.

This behavior is not limited to alignment in text fields. If I insert a
QTableWidget and add items to it, the items appear from right to left,
not left to right. For example, if I create a 4-column table and use
setItem() to insert the numbers 1, 2, 3, and 4 into columns 0, 1, 2, 3
respectively, I get this:

4 3 2 1

The same thing goes with the headers. I create a QStringList ("1", "2",
"3", "4") and add it using setHorizontalHeaderLabels() then the headers
show up as 4 3 2 1.

This sounds like something to do with right-to-left layouts for
internationalisation rather than just "normal" right-aligned text and
layouts.
This is my first qt app using python instead of C++, so I may be doing
something wrong.

Not necessarily, though we should probably run through some checks. :)

* Do Qt applications written in C++ work fine on your system?
* Is your system configured to use a right-to-left language, such as
Arabic or Hebrew?
* Have you tried previewing the form in Qt Designer and entering text,
just to see if it behaves the same way there?
I am grateful for any ideas someone might have.

Well, it sounds like a strange bug or configuration issue, but we can
probably figure out what's happening.

David
 
P

Phil Thompson

I am creating a simple form using designer (qt4) on Ubuntu. I use pyuic
to create a python script from the form. I run the script and the form
shows up fine. The idiosyncrasy occurs when I try to type text into a
QTextEntry widget. The text is right-aligned, not left-aligned as I had
set it up in the property editor in designer.

This behavior is not limited to alignment in text fields. If I insert a
QTableWidget and add items to it, the items appear from right to left,
not left to right. For example, if I create a 4-column table and use
setItem() to insert the numbers 1, 2, 3, and 4 into columns 0, 1, 2, 3
respectively, I get this:

4 3 2 1

The same thing goes with the headers. I create a QStringList ("1", "2",
"3", "4") and add it using setHorizontalHeaderLabels() then the headers
show up as 4 3 2 1.

This is my first qt app using python instead of C++, so I may be doing
something wrong.

I am grateful for any ideas someone might have.

By the way I've compiled pyqt and qt4 from the latest stable sources.

Can you send me the .ui file?

Phil
 
B

borntonetwork

Something simple, of course. I must have errantly clicked the field in
the property editor.

Thanks very much for you help.

On 12/7/06, Phil Thompson wrote:

> I meant QLineEdit in my original post. Sorry about that. Every single one
> of them in the ui file exibits the same behavior on my machine.

It's because you have set the layout direction on the QTabWidget.
Normally you
would only set this explicitly if you wanted part of your GUI in a
left to
right language (like Engish) and part it a right to left language
(like
Arabic).

Phil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top