PDA

View Full Version : Query about the mouseReleaseEvent of a control on a Widget



adyb
28th January 2011, 15:35
Hi,

I am a complete novice to both C++ and QT Creator so please bear with me on this. I have, however, been using Visual Basic for some years but that is not suitable for this minor project.

I have a program which will allow the user to dump a file and examine the contants using various data types. The central widget, amongst other things, contains two QTextEdit boxes. I would like to be able to trap the mouseReleaseEvent in one of these to allow for automatic data range selection. I can trap the main widgets event but don't see a way of trapping the TextEdit event.

Any help you could give would be appreciated, preferably with a brief example if possible.

Thanks,

AdyB

high_flyer
28th January 2011, 16:02
I can trap the main widgets event but don't see a way of trapping the TextEdit event.
The same way?
Both widgets derive the mouse handlers from QWidget.

Or I just don't understand what you mean by that.

adyb
28th January 2011, 16:36
Hi,

I probably just don't know how to access derived functions etc. My books aren't too helpful on the subject. I am probably also confusing slots with events as described by Qt. That's VB for ya!

If I declare the slot in the widget class and supply the code in the widgets code section, I can click anywhere on the blank form and get a reaction (in my case at the moment a simple qDebug() message). I just can't see a way of accessing the event on the QTextBox. It's probably because I'm completely new to this and should go away and read through some C++ books too but any help you can supply here would be appreciated.

AdyB

high_flyer
28th January 2011, 18:19
It's probably because I'm completely new to this and should go away and read through some C++ books
I am afraid it will be hard to do it otherwise, since even if we help you with this specific problem you will encounter many many more, which is not practical over a forum.
Get some basic knowledge of how C++ works first.
Then Qt and what signals and slots are.

adyb
29th January 2011, 01:56
I'm afraid you disappiont me. I have spent the last 25 years in IT software support and have never given such an arogant response to anyone who required help. OK, my skills are now seen as 'legacy' but I am fluent in C, BASIC, COBOL, Fortran, Pascal and Assembler (on the specific O/S I work with). To me, my request is a simple one - an example of where I am going wrong. If it is beneath you to point this out, maybe I should go back to the standard Microsoft solution and recomment to my employers that the support base is 'unreliable'. You are seen as the experts, don't destroy your reputation 'because you can'.

Disgruntaled,

AdyB

high_flyer
30th January 2011, 13:37
I don't understand what is arrogant about my answer?

In my second post I answered your question.
But you don't know what to do with the answer - that is because you don't have the basic understanding of C++.
That is not said with arrogance, its just a fact.
So what exactly do you want?
That I'll teach you what are the OOP principals, and how they are being realized in C++ - and what is the syntax for it - over few posts on a forum?
Don't you think its a bit arrogant on your part to expect a solution when you don't have the tools to used it - and then you blame those who did attempt to help you for your inability to use their help?

I gave you the solution to your simple question.
Don't blame me being arrogant just because you can't do with it anything.

Besides, C++ basic understanding is off topic for this forum.
This is a Qt help forum, and it is assumed you are at least to some degree proficient with C++ or the language with which you are suing Qt.
Instead of closing the thread for being off topic I answered it.
And what you have to say is that you are disappointed?


If it is beneath you to point this out, maybe I should go back to the standard Microsoft solution and recomment to my employers that the support base is 'unreliable'.
LOL.
That's a good one.
How much did you pay this site for support?
This site is a community site.
None of us are Nokia employees - and we are doing this on our free time.
So that you can complain.
You can pay Nokia for support, and get any question answered to your satisfaction.
And you are welcome to go back to MS solutions, if it works better for you.
And it will be on your head to have suggested to your colleagues something worse then Qt, just for your lack of knowledge.


I will allow you to respond to this (for fairness sake), and then this thread will be closed.

Before you get similar and less reserved answers to other posts in the future, and blame others for not giving you what you want, be sure to read the forum rules (http://www.qtcentre.org/rules/).

You might take some good hints from this link too:
http://www.catb.org/~esr/faqs/smart-questions.html

P.S

Disgruntaled,

AdyB

I guess you meant disgruntled - which is a new word for me.
I learned something new today! :)