Why is QDialog not centered over its parent?

860 views
Skip to first unread message

AlphaPapa

unread,
Feb 25, 2012, 4:31:13 PM2/25/12
to android-qt
Hi,

I'm new here and I have a question. When a QDialog is opened in my
application and the dialog has a parent, it is never centered over its
parent. The dialog is always positioned in the left upper corner of
the screen. On my Linux Desktop the behavior is ok. What must I do
under Android that it works too?

br AP

Enrico Miglino

unread,
Feb 25, 2012, 5:05:42 PM2/25/12
to andro...@googlegroups.com
Hi,
 
I have recently experienced the dialog posioning problem on the mobile devices. The general concept - in the hope that maybe useful - is that the dialog if no special parameters are set occup all the screen and is a modal semitransparent window over the application. Then every object group, usually title, components and buttons are automatically managed by the dialog component. This is true but only for some aspects. The best thing maybe to create a column or a column of rows with te elements that are part of every section.
 
[Note: Using the dialog I have also discovered that it does no matter if all the elements are defined in the title or the button section. Some useful - not well documented - aspects for dialog positioneers.]
 
The distance that should be kept for every dialog section e.g. title and buttons has effect specifying the height parameter in th section. Then to have the entire section centered you can set width the same as parent of horizontal center. The same the Item { ... } you should create for every section.
 
Thus, if you create something like
 
title: Item { width: value; Column { etc... } ... }
 
you can arrange the objects in the dialog as you need. If I was not clear please post few lines of your dialog and I will try to give you an example.
 
Enrico

Reply all
Reply to author
Forward
0 new messages