You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to qtcon...@googlegroups.com
Hi Pritpal,
In a classic browse dialog with some buttons, I create some Qlabel objects and wanted to set their size and position.
ex.
.
oLabel:resize( 20, 300 )
oLabel:move( 0, oLabel:geometry():y() ))
oDlg:label&ak:setText( "Some text" )
...
I have noticed that, if I omit :resize(), the label is moved exactly at the left edge of the dialog, what is ok, but If I use :resize() before of after :move() the label is positioned about 200 pix from the left dialog edge.
Any opinion?
Zoran
Dušan D. Majkić
unread,
May 8, 2014, 7:17:16 AM5/8/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to qtcon...@googlegroups.com
> if I omit :resize(), the label is moved exactly at the left edge of the
> dialog, what is ok, but If I use :resize() before of after :move() the
> label is positioned about 200 pix from the left dialog edge.
Geometry is relative to parent widget.
How do you create QLabels?
Regards,
Dusan Majkic
Wings Software
Zoran Sibinovic
unread,
May 8, 2014, 7:33:26 AM5/8/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to qtcon...@googlegroups.com
Hi Dušane,
I used UI created labels in this case.
Zoran
Dušan D. Majkić
unread,
May 8, 2014, 8:16:34 AM5/8/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to qtcon...@googlegroups.com
> I used UI created labels in this case.
I don't know what is going on.
But if you are using Qt Designer there is one neat trick to try:
Resize your control in Designer, and click on the Form->View code...
There is full code for component creation. You can compare that
C++ code directly to your Harbour code. Method calls are the same.
I used Designer that way for help with right way to place Qt user
interface via Harbour code.
Zoran Sibinovic
unread,
May 8, 2014, 8:50:44 AM5/8/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to qtcon...@googlegroups.com
Hi Dusane,
I know that, just to notice of some "bug" if you want to resize the label and then move it at runtime.
:)
Thanks
Zoran
Dušan D. Majkić
unread,
May 8, 2014, 10:01:43 AM5/8/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to qtcon...@googlegroups.com
> I know that, just to notice of some "bug" if you want to resize the label
> and then move it at runtime.
When I create QDialog with one QLabel, and resize label there,
I get this code:
label = new QLabel(Dialog);
label->setGeometry(QRect(50, 50, 181, 16));
So the label is parented to dialog - coordinates are relative to that dialog.
Designer is using setGeometry() instead of resize() for label sizing.
Pritpal Bedi
unread,
May 8, 2014, 1:46:36 PM5/8/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to qtcon...@googlegroups.com
Hi
label = new QLabel(Dialog);
label->setGeometry(QRect(50, 50, 181, 16));
So the label is parented to dialog - coordinates are relative to that dialog.
Designer is using setGeometry() instead of resize() for label sizing.
Any controls coodinates are relative to its parent.
If Qdialog is its parent above statement holds good.
Suppose you have a groupbox and then a pushbutton within
that groupbox then coordinates will refer to groupbox instead
of dialog.
Pritpal Bedi
Zoran Sibinovic
unread,
May 8, 2014, 2:35:57 PM5/8/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to qtcon...@googlegroups.com
Hi to all,
Sorry for have bothered you, found the cause.
Since I created the label in UI with no border and starting text I haven't seen that it is aligned to center.
Also in the app when I resize it, and set the text, the label starts from the dialog edge, but the text goes at the center of the label, that'is why I've got this effect.
I just had. in Designer to set the alignment to Left, now the display is ok even resized.