Qt-interest Archive, January 2008
QSplashScreen mousePress()
Pages: Prev | 1 | 2 | Next
Message 16 in thread
Hi Rohit :)
rohitj@xxxxxxxxxxxxxx wrote:
> Thanks alot alot for your detailed reply...
>
> I implemented in the same way as you suggested but i wanted to know in my
> last question , why it is needed to pass the type not the value.....
>
> I am new to QT and even after reading documentation of Signal Slot, i dint
> understand ,how it works internally as passing only a type but not
> value!!!?????
>
> So i asked that question....but i am alot thankful for your reply.....but
> still curious!!
>
>
Let's see if I can explain this clearly,
If you look at a connect statement like this example below:
connect(&a, SIGNAL(valueChanged(int)), &b, SLOT(setValue(int)));
Say something happens in object a, and the valueChanged() signal is
triggered. We want to match the parameters such that whatever is sent
through valueChanged() must be received by setValue(). So, we match the
"signatures" in this case - int with int. It is important to know that
_type_ of parameter you will receive, so you write (int) instead of
(number) or the variable name.
In other words, when valueChanged() is triggered, an integer is received
via the parameter, and this parameter is then sent to setValue(), which
is programmed to receive an integer too. We handle what value is in the
parameter, in the slot - setValue().
Think of it as a way to match method signatures - its name and parameter
type.
Hope this helps,
Kavindra.
--
[ signature omitted ]
Message 17 in thread
Dear Kavindra
Good Morning...
Thanks alot again dear Kavindra and sorry for not replying yesterday, as i
stuck in some work so couldnt reply yesterday..
Your detailed reply has solved my most of the queries for now :)
Have a nice day
Thanks again..
Rohit
> Hi Rohit :)
>
>
> rohitj@xxxxxxxxxxxxxx wrote:
>> Thanks alot alot for your detailed reply...
>>
>> I implemented in the same way as you suggested but i wanted to know in
>> my
>> last question , why it is needed to pass the type not the value.....
>>
>> I am new to QT and even after reading documentation of Signal Slot, i
>> dint
>> understand ,how it works internally as passing only a type but not
>> value!!!?????
>>
>> So i asked that question....but i am alot thankful for your
>> reply.....but
>> still curious!!
>>
>>
>
> Let's see if I can explain this clearly,
>
> If you look at a connect statement like this example below:
>
> connect(&a, SIGNAL(valueChanged(int)), &b, SLOT(setValue(int)));
>
> Say something happens in object a, and the valueChanged() signal is
> triggered. We want to match the parameters such that whatever is sent
> through valueChanged() must be received by setValue(). So, we match the
> "signatures" in this case - int with int. It is important to know that
> _type_ of parameter you will receive, so you write (int) instead of
> (number) or the variable name.
>
> In other words, when valueChanged() is triggered, an integer is received
> via the parameter, and this parameter is then sent to setValue(), which
> is programmed to receive an integer too. We handle what value is in the
> parameter, in the slot - setValue().
>
> Think of it as a way to match method signatures - its name and parameter
> type.
>
> Hope this helps,
> Kavindra.
>
> --
> Kavindra Palaraja - kdpalara at trolltech.com
> Trolltech ASA - Sandakerveien 116, NO-0484 Oslo, Norway
>
> --
> 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 18 in thread
Please,
reply only to the list....
I suggest to read the signals/slots chapter in Qt web pages.
you'll win a lot of time understanding this Qt widgets communcation
system, rules of usage and limitations....
search and read chapter "Meta-Object Information".
function name and parameters defined in SIGNAL and SLOT macros are
memorized as strings.
this strings are used by metaobject system to collect and manage signals
and slots.
if function name , paramaeters TYPE is not correct, widgets
comunicatrion mechanism can't work.
the function is not found if name is not the real name of function or
parameter type is not the same.
another suggestion to understand, open moc file of a class that conatin
a slot, you'll see slots in table that list slots defined in header file
of the class.
if you define a signal, you'll see too this signal in moc file.
this strings are used by Qt widgets communication system to know what
slot of an instance of an object may be called
when a signal of an instance of an object is emitted.
rohitj@xxxxxxxxxxxxxx a écrit :
> Thanks alot alot for your detailed reply...
>
> I implemented in the same way as you suggested but i wanted to know in my
> last question , why it is needed to pass the type not the value.....
>
> I am new to QT and even after reading documentation of Signal Slot, i dint
> understand ,how it works internally as passing only a type but not
> value!!!?????
>
> So i asked that question....but i am alot thankful for your reply.....but
> still curious!!
>
>
>> Hi Rohit,
>>
>> rohitj@xxxxxxxxxxxxxx wrote:
>>
>>> Thanks alot for your reply, now it is working fine.....
>>>
>>> but sorry i dint understand one thing, what do you mean by..
>>> "you may check this value in slot to remove or not selection"
>>>
>>> One thing more..
>>>
>>> "If i put only type as a parameter then the signal is emitted in both
>>> cases, means get focus and lost focus....and if i need only this signal
>>> for lost focus, how it will work"
>>>
>>> Sorry for my this curious question!!!!
>>>
>>>
>>>
>>>
>> When you connect a signal to a slot, it means that if that signal is
>> triggered, do something in the slot. The line of code you need is not :
>>
>> connect(dwProj,SIGNAL(visibilityChanged(true)),m_contentsProject,SLOT(removeSelection()));
>>
>> but
>>
>> connect(dwProj,SIGNAL(visibilityChanged(bool)),m_contentsProject,SLOT(removeSelection()));
>>
>> I understand that removeSelection() is your own slot...
>>
>> In removeSelection, since you only want to do something when your dock
>> widget loses focus, you can write an if statement like this:
>>
>> if (dockwidget->isVisible())
>> do something
>> else
>> do something else
>>
>>
>> If you check the dock widget's isVisible property when the
>> visibilityChanged() signal is triggered, you will know whether the dock
>> widget is visible or not...
>>
>> Hope this helps,
>> Kavindra.
>>
>> --
>> Kavindra Palaraja - kdpalara at trolltech.com
>> Trolltech ASA - Sandakerveien 116, NO-0484 Oslo, Norway
>>
>>
>
>
> --
> 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/
>
>
>
Message 19 in thread
Good Morning...
Thanks alot for your detailed reply..
I understood alot from the way you suggested...
Thanks 10000 ...
> Please,
> reply only to the list....
>
> I suggest to read the signals/slots chapter in Qt web pages.
> you'll win a lot of time understanding this Qt widgets communcation
> system, rules of usage and limitations....
>
> search and read chapter "Meta-Object Information".
> function name and parameters defined in SIGNAL and SLOT macros are
> memorized as strings.
> this strings are used by metaobject system to collect and manage signals
> and slots.
> if function name , paramaeters TYPE is not correct, widgets
> comunicatrion mechanism can't work.
> the function is not found if name is not the real name of function or
> parameter type is not the same.
> another suggestion to understand, open moc file of a class that conatin
> a slot, you'll see slots in table that list slots defined in header file
> of the class.
> if you define a signal, you'll see too this signal in moc file.
> this strings are used by Qt widgets communication system to know what
> slot of an instance of an object may be called
> when a signal of an instance of an object is emitted.
>
>
>
>
> rohitj@xxxxxxxxxxxxxx a écrit :
>> Thanks alot alot for your detailed reply...
>>
>> I implemented in the same way as you suggested but i wanted to know in
>> my
>> last question , why it is needed to pass the type not the value.....
>>
>> I am new to QT and even after reading documentation of Signal Slot, i
>> dint
>> understand ,how it works internally as passing only a type but not
>> value!!!?????
>>
>> So i asked that question....but i am alot thankful for your
>> reply.....but
>> still curious!!
>>
>>
>>> Hi Rohit,
>>>
>>> rohitj@xxxxxxxxxxxxxx wrote:
>>>
>>>> Thanks alot for your reply, now it is working fine.....
>>>>
>>>> but sorry i dint understand one thing, what do you mean by..
>>>> "you may check this value in slot to remove or not selection"
>>>>
>>>> One thing more..
>>>>
>>>> "If i put only type as a parameter then the signal is emitted in both
>>>> cases, means get focus and lost focus....and if i need only this
>>>> signal
>>>> for lost focus, how it will work"
>>>>
>>>> Sorry for my this curious question!!!!
>>>>
>>>>
>>>>
>>>>
>>> When you connect a signal to a slot, it means that if that signal is
>>> triggered, do something in the slot. The line of code you need is not :
>>>
>>> connect(dwProj,SIGNAL(visibilityChanged(true)),m_contentsProject,SLOT(removeSelection()));
>>>
>>> but
>>>
>>> connect(dwProj,SIGNAL(visibilityChanged(bool)),m_contentsProject,SLOT(removeSelection()));
>>>
>>> I understand that removeSelection() is your own slot...
>>>
>>> In removeSelection, since you only want to do something when your dock
>>> widget loses focus, you can write an if statement like this:
>>>
>>> if (dockwidget->isVisible())
>>> do something
>>> else
>>> do something else
>>>
>>>
>>> If you check the dock widget's isVisible property when the
>>> visibilityChanged() signal is triggered, you will know whether the dock
>>> widget is visible or not...
>>>
>>> Hope this helps,
>>> Kavindra.
>>>
>>> --
>>> Kavindra Palaraja - kdpalara at trolltech.com
>>> Trolltech ASA - Sandakerveien 116, NO-0484 Oslo, Norway
>>>
>>>
>>
>>
>> --
>> 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 20 in thread
Hello Andy,
>> thanks a lot... after your mail I've play a little with flags and found that
You're welcome, I just feel bad you had to take so much time on a splash screen. You must have a very picky QA department ;)
I myself, out of curiousity, tried the flags you found and; the mouse event just is'nt called under my settings. I guess the thing is, with these kind of things, you're kind of always at the mercy of the X-server settings and the window manager. So I am not even sure that that magic flag WX11BypassWM will always work the way you wanted.
Anyways, let me know how it goes.
Christopher
_________________________________________________________________
Exercise your brain! Try Flexicon!
http://puzzles.sympatico.msn.ca/chicktionary/index.html?icid=htmlsig
#include <qsplashscreen.h>
#include <qevent.h>
#include <qlabel.h>
#include <qwidget.h>
#include <qapplication.h>
class XSplashScreen : public QWidget
{
public:
XSplashScreen(QWidget * parent, const char * name = 0);
~XSplashScreen();
protected:
void mousePressEvent ( QMouseEvent * e ); // this is not called
// bool event(QEvent *event); // this function is ALWAYS called, if implemented
private:
};
// -----------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
XSplashScreen::XSplashScreen( QWidget * parent, const char * name ) : QWidget(parent, name, Qt::WStyle_NoBorder | Qt::WX11BypassWM )
{
QPixmap pixmap("splah.jpg");
resize( pixmap.size() );
setPaletteBackgroundPixmap ( pixmap );
qDebug("contructor");
}
XSplashScreen::~XSplashScreen()
{
qDebug("destructor");
}
void XSplashScreen::mousePressEvent(QMouseEvent *event)
{
// event->accept();
// event->ignore();
// qFatal("mouse press on splashscreen");
qDebug("mouse press on splashscreen");
// if (event->button() != Qt::LeftButton) return;
}
class XMainWindow: public QWidget
{
public:
XMainWindow();
~XMainWindow();
void show ();
};
XMainWindow::XMainWindow()
:QWidget(0)
{
}
XMainWindow::~XMainWindow()
{
}
void XMainWindow::show ()
{
QWidget::show();
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
XSplashScreen *splashscreen = new XSplashScreen(0);
splashscreen->show();
XMainWindow mainWindow;
mainWindow.show();
return app.exec();
}
Message 21 in thread
Hi Christopher
On 1/10/08, Christopher Probst <probst_christopher@xxxxxxxxxxx> wrote:
>
> Hello Andy,
> ...
> You're welcome, I just feel bad you had to take so much time on a splash
> screen. You must have a very picky QA department ;)
you are right... I'm not so busy working at the moment :-)
Anyway, investigating all problems you found while trying to do
something is always the best way to learn, expecially when you have
time to do so :-)
In this case, I was thinking to use the splash screen to show the
start-up process of the system, with things like configuration loading
and checking, hardware detecting and machine warm-up... and it was not
acceptable that the user simply close the splash screen with a
mouse-click...
> I myself, out of curiousity, tried the flags you found and; the mouse event
> just is'nt called under my settings. I guess the thing is, with these kind
> of things, you're kind of always at the mercy of the X-server settings and
> the window manager. So I am not even sure that that magic flag WX11BypassWM
> will always work the way you wanted.
> Anyways, let me know how it goes.
it's still working... I'll back to you when I have the opportunity to
test it on other platforms.
thanks again and have a nice day
Andy
--
[ signature omitted ]