Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 7

Qt-interest Archive, March 2007
Position of form window


Message 1 in thread

Hello,

I am new to Qt programming. Can anyone tell me how I could position the form window, created by the Qt Designer, at the given x and y values.

Thank you,

Best Regards,
Pankaj.

Message 2 in thread

Pankaj wrote:
> I am new to Qt programming. Can anyone tell me how I could 
> position the form window, created by the Qt Designer, at the 
> given x and y values.

QWidget * w = new YourWidget;
w->move(x, y);
[and possibly w->show(), depending on context]

Andre'

--
 [ signature omitted ] 

Message 3 in thread

Hello Andre,

Thanks a lot for your reply. I am now able to position the form window at
the given x,y co-ordinates. I have a small question:

In my Qt application, I am reading data from the serial port. I am creating
a thread that first checks the data received from the serial port and
process it. If the data is available at the serial port, then I should be
able to generate an event (user defined event) and call an event handler for
displaying the data read.

How can I generate a user defined event in Qt?

Could you please help in this regard.

Thank you,

Regards,
Pankaj.

----- Original Message ----- 
From: "André Pönitz" <andre@xxxxxxx>
To: <qt-interest@xxxxxxxxxxxxx>
Sent: Tuesday, March 27, 2007 10:56 PM
Subject: RE: Position of form window


Pankaj wrote:
> I am new to Qt programming. Can anyone tell me how I could
> position the form window, created by the Qt Designer, at the
> given x and y values.

QWidget * w = new YourWidget;
w->move(x, y);
[and possibly w->show(), depending on context]

Andre'

--
 [ signature omitted ] 

Message 4 in thread

Pankaj wrote:
> Hello Andre,

Hi Pankaj.

> Thanks a lot for your reply. I am now able to position the 
> form window at the given x,y co-ordinates. 

Fine.

> In my Qt application, I am reading data from the serial port.  I am creating
> a thread that first checks the data received from the serial port and
> process it. If the data is available at the serial port, then 
> I should be able to generate an event (user defined event) and call an 
> event handler for displaying the data read.
> 
> How can I generate a user defined event in Qt?
> 
> Could you please help in this regard.

I think the canonical solution is to have a signal-slot
connection between the data thread and the GUI thread.
This works nicely over thread boundaries, since 4.3 it
is even possible to have that synchronized if needed.

Subclass QThread, add a signal, connect this on thread
construction time to some slot in the GUI. 
The data thread should emit the signal when data is available,
the GUI slot will be activated and can display whatever it
wants in response.

Andre'

--
 [ signature omitted ] 

Message 5 in thread

Thanks again, Andre. I have already created a data thread and established
connection with the GUI. All I need to do is add a new signal in the
subclass of QThread to make the GUI respond to data received at the serial
port.

How can I create a new signal and add it to the data thread? I know how to
create my own slots and handle pre-defined events such as clicked(), close()
etc.

Thank you,

Regards,
Pankaj.


----- Original Message ----- 
From: "André Pönitz" <andre@xxxxxxx>
To: <qt-interest@xxxxxxxxxxxxx>
Sent: Wednesday, March 28, 2007 2:36 AM
Subject: RE: Position of form window


Pankaj wrote:
> Hello Andre,

Hi Pankaj.

> Thanks a lot for your reply. I am now able to position the
> form window at the given x,y co-ordinates.

Fine.

> In my Qt application, I am reading data from the serial port.  I am
creating
> a thread that first checks the data received from the serial port and
> process it. If the data is available at the serial port, then
> I should be able to generate an event (user defined event) and call an
> event handler for displaying the data read.
>
> How can I generate a user defined event in Qt?
>
> Could you please help in this regard.

I think the canonical solution is to have a signal-slot
connection between the data thread and the GUI thread.
This works nicely over thread boundaries, since 4.3 it
is even possible to have that synchronized if needed.

Subclass QThread, add a signal, connect this on thread
construction time to some slot in the GUI.
The data thread should emit the signal when data is available,
the GUI slot will be activated and can display whatever it
wants in response.

Andre'

--
 [ signature omitted ] 

Message 6 in thread

Pankaj wrote:
> I have already created a data thread and established
> connection with the GUI. All I need to do is add a new signal in the
> subclass of QThread to make the GUI respond to data received 
> at the serial port.

add
 
class YourThread : public QThread
{
  Q_OBJECT

public:
  ...
signals:
  void dataReady();
};

The dataReady function will look like a protected member
function of YourThread to your "user code". You won't need
to implement this function as moc takes care of that.

Whenever you want to emit that signal, just call 'dataReady()'
(or 'emit dataReady();' as some prefer (emit is an empty macro))

Andre'

--
 [ signature omitted ] 

Message 7 in thread

Thanks a lot, Andre. Will try and let you know.

Regards,
Pankaj.

----- Original Message ----- 
From: "André Pönitz" <andre@xxxxxxx>
To: <qt-interest@xxxxxxxxxxxxx>
Sent: Wednesday, March 28, 2007 3:27 AM
Subject: RE: Position of form window


Pankaj wrote:
> I have already created a data thread and established
> connection with the GUI. All I need to do is add a new signal in the
> subclass of QThread to make the GUI respond to data received
> at the serial port.

add

class YourThread : public QThread
{
  Q_OBJECT

public:
  ...
signals:
  void dataReady();
};

The dataReady function will look like a protected member
function of YourThread to your "user code". You won't need
to implement this function as moc takes care of that.

Whenever you want to emit that signal, just call 'dataReady()'
(or 'emit dataReady();' as some prefer (emit is an empty macro))

Andre'

--
 [ signature omitted ] 

Message 8 in thread

hai,

I am working on Qt3.3.4.

I have an application which requires to display a html file in QTextBrowser. 
This works perfectly using the QTextBrowser.

Now, based on some condition I have to show two html files one after the 
other. Can some one help me out how to go abt it?

Thanks & Regards
DP


DISCLAIMER

âThe information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you"
--
 [ signature omitted ] 

Message 9 in thread

hi,
It should be cool modifying the subjet of your mails to be the good
subject. this to simplify the work for people (I'm one of them) that
use filters to manage archives folders.
your last question has no relation with position of form window.

thank you for next mails.
have a nice day! :o)

Veronique.


Le 28/3/2007, "Pankaj" <pankaj@xxxxxxxxxxxxx> a écrit:

>Thanks again, Andre. I have already created a data thread and established
>connection with the GUI. All I need to do is add a new signal in the
>subclass of QThread to make the GUI respond to data received at the serial
>port.
>
>How can I create a new signal and add it to the data thread? I know how to
>create my own slots and handle pre-defined events such as clicked(), close()
>etc.
>
>Thank you,
>
>Regards,
>Pankaj.
>
>
>----- Original Message ----- 
>From: "André Pönitz" <andre@xxxxxxx>
>To: <qt-interest@xxxxxxxxxxxxx>
>Sent: Wednesday, March 28, 2007 2:36 AM
>Subject: RE: Position of form window
>
>
>Pankaj wrote:
>> Hello Andre,
>
>Hi Pankaj.
>
>> Thanks a lot for your reply. I am now able to position the
>> form window at the given x,y co-ordinates.
>
>Fine.
>
>> In my Qt application, I am reading data from the serial port.  I am
>creating
>> a thread that first checks the data received from the serial port and
>> process it. If the data is available at the serial port, then
>> I should be able to generate an event (user defined event) and call an
>> event handler for displaying the data read.
>>
>> How can I generate a user defined event in Qt?
>>
>> Could you please help in this regard.
>
>I think the canonical solution is to have a signal-slot
>connection between the data thread and the GUI thread.
>This works nicely over thread boundaries, since 4.3 it
>is even possible to have that synchronized if needed.
>
>Subclass QThread, add a signal, connect this on thread
>construction time to some slot in the GUI.
>The data thread should emit the signal when data is available,
>the GUI slot will be activated and can display whatever it
>wants in response.
>
>Andre'
>
>--
>To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
>"unsubscribe" in the subject or the body.
>List archive and information: http://lists.trolltech.com/qt-interest/
>
>
>
>--
>To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
>List archive and information: http://lists.trolltech.com/qt-interest/
>

--
 [ signature omitted ] 

Message 10 in thread

Am Mittwoch, 28. März 2007 13:12 schrieb Pankaj:
> Hello Andre,
>
> Thanks a lot for your reply. I am now able to position the form window at
> the given x,y co-ordinates. I have a small question:
>
> In my Qt application, I am reading data from the serial port. I am creating
> a thread that first checks the data received from the serial port and
> process it. If the data is available at the serial port, then I should be
> able to generate an event (user defined event) and call an event handler
> for displaying the data read.
>
> How can I generate a user defined event in Qt?

I think you should read about and try to utilize Signals and Slots for this 
purpose.

>
> Could you please help in this regard.
>
> Thank you,
>
> Regards,
> Pankaj.
>
> ----- Original Message -----
> From: "André Pönitz" <andre@xxxxxxx>
> To: <qt-interest@xxxxxxxxxxxxx>
> Sent: Tuesday, March 27, 2007 10:56 PM
> Subject: RE: Position of form window
>
> Pankaj wrote:
> > I am new to Qt programming. Can anyone tell me how I could
> > position the form window, created by the Qt Designer, at the
> > given x and y values.
>
> QWidget * w = new YourWidget;
> w->move(x, y);
> [and possibly w->show(), depending on context]
>
> Andre'
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/

-- 
 [ signature omitted ]