You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Dwarf007

Beginner

  • "Dwarf007" is male
  • "Dwarf007" started this thread

Posts: 26

Location: Somewhere between Germany & France

  • Send private message

1

Thursday, November 3rd 2005, 5:23pm

same *.ui for Linux AND Windows : Result

Hi,

wanted to know if someone knows a proper way to do an *.ui with Designer in order to have an identical GUI when compiling on Windows and on Linux.

For the moment I did an *.ui which looked like the following when compiling on Windows :



It looked like this when compiling on Linux (horrible Font):



and after I edited the *.ui manually and removed all the "font-family:MS Shell Dlg;" it looked like this (the Font is ok again but the size is to big).



Well.. the best would be a solution where I don't need to edit the file manually and so that I have the same ui file on both Linux and Windows with the size fiting into the frames on both versions.

Does anyone got an idea about that ?
Thank you very much !

Daniel
- The Manual said the program required Win95 or better, so I installed Linux.
- Newton was a pessimist.
- no Risk! no FuN!

This post has been edited 1 times, last edit by "Dwarf007" (Nov 3rd 2005, 5:25pm)


Posts: 2,162

Location: Graz, Austria

Occupation: Student

  • Send private message

2

Thursday, November 3rd 2005, 7:03pm

Did you set any font when creating the form?

Usually forms work flawlessly across platforms when using the default font setting (in which case designer doesn't write any font into the .ui file)

Cheers,
_
Qt/KDE Developer
Debian User

  • "wysota" is male

Posts: 4,276

Location: Warsaw, POLAND

  • Send private message

3

Thursday, November 3rd 2005, 8:05pm

Quoted

Originally posted by anda_skoa
Did you set any font when creating the form?

Usually forms work flawlessly across platforms when using the default font setting (in which case designer doesn't write any font into the .ui file)

Cheers,
_


Unfortunately this is not the case with Qt4. It writes font settings to the ui file even if one uses a default font. Another unfortunate thing is that on Windows the default font is MS Shell Dialog which is really a meta-font, so you can't copy it to a Unix box. If you manually delete font info from the ui, Qt will complain (I tried, with no success) and in 4.0.1 I didn't manage to enable font substitution using qtconfig, so there was no way to solve the font problem other than using a non-default font (one could substitute the font directly in the X server, but it is only a partial solution).

Dwarf007

Beginner

  • "Dwarf007" is male
  • "Dwarf007" started this thread

Posts: 26

Location: Somewhere between Germany & France

  • Send private message

4

Thursday, November 3rd 2005, 9:05pm

Well.. for me it worked to remove the font manually out of the ui file.
But as you said I don't see where to desactivate this MS Shell Dialog font..

It looks like there is no way to set any default font as anda_skoa said . Well at least I don't see where to config Designer in such a way that the GUI is the same on all Operating Systems !
- The Manual said the program required Win95 or better, so I installed Linux.
- Newton was a pessimist.
- no Risk! no FuN!

Posts: 2,162

Location: Graz, Austria

Occupation: Student

  • Send private message

5

Friday, November 4th 2005, 9:09am

Oh, I see.

I'd consider this a severe bug, as it makes the whole basic idea of Qt - crossplatform development - unnecessary difficult.

Cheers,
_
Qt/KDE Developer
Debian User

GreyGeek

Unregistered

6

Tuesday, November 29th 2005, 5:38pm

RE: same *.ui for Linux AND Windows : Result

I ran into this problem too.

Editing the ui file was not satisfactory to me.

I edited all of my controls and changed the font on each control to Arial 10 pt.

That solved it for me.

Troll tech could solve this "problem" by defaulting to Arial or helvetica or even introduce their OWN font which they design to behave the same way on both platforms.

  • "wysota" is male

Posts: 4,276

Location: Warsaw, POLAND

  • Send private message

7

Tuesday, November 29th 2005, 7:54pm

RE: same *.ui for Linux AND Windows : Result

Quoted

Originally posted by GreyGeek
Troll tech could solve this "problem" by defaulting to Arial or helvetica or even introduce their OWN font which they design to behave the same way on both platforms.


You can patch it yourself :)

Dwarf007

Beginner

  • "Dwarf007" is male
  • "Dwarf007" started this thread

Posts: 26

Location: Somewhere between Germany & France

  • Send private message

8

Tuesday, December 13th 2005, 8:58am

Well..

the biggest problem is actually not the font.. It's a problem as well but we can change it manually afterwards...

The big problem I can see here are the different size of lineEdits and the boxes depending on Linux or Windows the size of the widgets are different !
- The Manual said the program required Win95 or better, so I installed Linux.
- Newton was a pessimist.
- no Risk! no FuN!

  • "wysota" is male

Posts: 4,276

Location: Warsaw, POLAND

  • Send private message

9

Tuesday, December 13th 2005, 10:19am

RE: Well..

Why is that a problem? If you apply a layout to the window, it shouldn't matter at all.

It happens because you're using different styles which have different decorations.

Dwarf007

Beginner

  • "Dwarf007" is male
  • "Dwarf007" started this thread

Posts: 26

Location: Somewhere between Germany & France

  • Send private message

10

Tuesday, December 13th 2005, 1:13pm

RE: Well..

If you look at the QLineEdit and compare the one from windows to the one on linux you can see that the one on windows is larger. On linux you can not see the entire text.
I guess that if the layout would have been done under linux and then compiled on windows it would have better but again much larger on windows
- The Manual said the program required Win95 or better, so I installed Linux.
- Newton was a pessimist.
- no Risk! no FuN!

vdboor

Trainee

  • "vdboor" is male

Posts: 76

Location: The Netherlands

Occupation: Student

  • Send private message

11

Friday, December 23rd 2005, 9:28am

RE: Well..

Quoted

Originally posted by Dwarf007
If you look at the QLineEdit and compare the one from windows to the one on linux you can see that the one on windows is larger. On linux you can not see the entire text.
I guess that if the layout would have been done under linux and then compiled on windows it would have better but again much larger on windows


No you didn't get the point.. You need to constrain the widgets to a layout and use spacers for the empty area's. This allows Qt to align the widgets correctly by itself. You believe it's a problem between platforms, but the same issue would also happen if you deside to use a different theme for your Windows application.

Select multiple widgets, right click, choose a layout. That's all, and Qt aligns stuff automatically.
Working on KMess, a MSN Messenger client for Linux/KDE.

stevey

Trainee

  • "stevey" is male

Posts: 58

Location: Australia

Occupation: Software developer

  • Send private message

12

Thursday, January 12th 2006, 10:41pm

Have you tried applying a different style to the form?
You should be able to apply a Windows style and force it to look like the original.

The thing to bear in mind is that cross platform doesn't mean "looks the same".
It means it runs without the need to change code.
Why would you want an application under KDE, Gnome or whatever to look like a windows application anyway?
The idea with Qt is that it will look like it fits into the host environment because it has the style built in and you can even define your own.

The issue you should be concerned with is the font not fitting into your combo boxes.
If you still want a windows appearance under an X desktop then look at the QStyle documentation.
Specifically you'll want to use QWindowsStyle.

I haven't tried to apply styles before, so I can't give you advice on it. Sorry :(

You can also preview the forms you create in designer using other styles to see what's likely to happen.

This post has been edited 2 times, last edit by "stevey" (Jan 12th 2006, 10:46pm)