[Gambas-user] Strange way of working about form dimensions
ron
ronstk at ...239...
Fri May 26 17:37:40 CEST 2006
----8<---
>
> The desktop resolution isn't the only problem. I'm practically going
> mad here trying to make an app that works in at least the 3 main
> resolutions (640x480, 800x600 and 1024x768). First I tried fitting the
> window to the desktop, but that caused untold resizing problems,
> specially with fonts and buttons. Then i decided to work with a fixed
> 640x480 size window (size set in startup code, to avoid the same
> problem as Leonardo), centered in the display at larger resolutions.
> When the resolution is 640x480, I remove the window borders in code.
> This seemed to be working more or less, though I did have to implement
> scrollbars in the TexLlabels, as the font doesn't fit at the 2 lower
> resolutions. Now I just found out that if I use an external monitor
> instead of the notebook's LCD (both set at the same resolution, mind
> you), fonts and buttons look much larger in the monitor and now a lot
> of stuff doesn't fit in the window anymore! I'm guessing it's
> something to do with the dpi setting that probably differs between LCD
> and monitor, but I don't understand why, as both are set to 1024x768
> and even the horizontal size is very similar.
>
> Regards,
> Joe1962
>
I feel your madness here in Holland :) What about me?
I'm making a project that should work on a monitor 90' turned, AKA portrait.
Resolution landscape 1280x1024 but portrait 1024x1280
In the upper 1024x768 the project window and the lower part
1024x512 some lookup information for the user. :) (me?)
I found in source code MAIN_SCALE=fm.height()/2 and initial a MAIN_SCALE=8
fm is here the font_metrics and asumed as 8x16 ?
I must/want use a 8x12 font.
During MoveScaled X, Y, W and H are multiplied by same MAIN_SCALE.
I believe MAIN_SCALE should be "(fm.width()/fm.height()) x fm.width()"
in the first place. But should it not be more correct to use
"(screen.width()/screen.height()) x screen.width()" as that is the intension ?
The character dimensions are in no way related to the screen dimensions for
width/height values.
The idea behind it is not bad but it works out not always to be a wanted side effect.
Now I understand the form size problems between the to machines/monitor I'm using.
Could it not be made a option for the project in gb.Application or gb.qt.Desktop
to use xxxScaled or not ?
When I use MyForm.Height = MyForm.Width * DeskTop.Scale there is now something
wrong with the height :(
I thought [object].Width * DeskTop.Scale = [object].Height
My 2 x DeskTop.Scale Cents
Ron
PS
For Joe1962:
As I asume the Fontmetrics are used as reference I asume a 8x16 font is
used as default metrics.
You can try in gb.qt/src/main.cpp at line 117:
int MAIN_in_wait = 0;
int MAIN_loop_level = 0;
int MAIN_scale = 8; //<---- Change this to MAIN_scale = 16; (the height)
static bool in_event_loop = false;
and at line 366:
void MAIN_update_scale(void)
{
QFontMetrics fm(QApplication::font());
MAIN_scale = fm.height() / 2; // <--- change this to fm.height() / 1;
}
This should effective disable the xxxScale but I have not tested this.
Do not forget the "make; make install"
Ron
More information about the User
mailing list