Re: signal clicked()

2009-01-19 Thread David Baron
On Sunday 18 January 2009 12:12:49 Toussis Manolis wrote:
 On Sunday 18 January 2009 09:34:49 David Baron wrote:
  void MyApplet::mousePressEvent ( QGraphicsSceneMouseEvent *ev ) {
  if  ( signalsBlocked() ) {
  Plasma::Applet::mousePressEvent( ev );
  return;
  }..

 I tried what you proposed... but the above doesn't work with drag/move
 operations... :-(
 If I click and hold on the applet , instead of moving my popup menu
 appears...

I cannot vouch for when and if the signalsBocked will return true.
Mouse pressed is not really a click -- this would be press  release. 
However, 
this is all we have.

I notice that some applets/icons will change there color/birghtness a bit on 
hover. The device-monitor applet does this as do any shortcuts or folders I 
placed on the panel. How do I do this?

___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: signal clicked()

2009-01-19 Thread Aaron J. Seigo
On Monday 19 January 2009, David Baron wrote:
 I notice that some applets/icons will change there color/birghtness a bit
 on hover. The device-monitor applet does this as do any shortcuts or
 folders I placed on the panel. How do I do this?

it's part of Plasma::IconWidget. 

you can also do it yourself for custom items by reacting on hover events and 
starting an animation that uses one of the KPixmapEffects. take a look at the 
code in IconWidget to see how it does it if you're interested.

generally, though, just use the Plasma widget classes. you'll save yourself a 
lot of grief. there are rather few reasons to do all your painting.

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Software



signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: signal clicked()

2009-01-19 Thread David Baron
On Monday 19 January 2009 19:04:56 Aaron J. Seigo wrote:
 On Monday 19 January 2009, David Baron wrote:
  I notice that some applets/icons will change there color/birghtness a bit
  on hover. The device-monitor applet does this as do any shortcuts or
  folders I placed on the panel. How do I do this?

 it's part of Plasma::IconWidget.

 you can also do it yourself for custom items by reacting on hover events
 and starting an animation that uses one of the KPixmapEffects. take a look
 at the code in IconWidget to see how it does it if you're interested.

 generally, though, just use the Plasma widget classes. you'll save yourself
 a lot of grief. there are rather few reasons to do all your painting.

Functionality in QIcon as well (iconWidget might get it from there). Since I 
am using KIcon, well, very easy!

Both myself and the original correspondent might have been best off starting 
with the iconWidget and that has a bona-fide clicked() signal! Without better 
docs, we start out with the sample code which is a bare applet subclass and no 
hints of other or added possibilities.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: signal clicked()

2009-01-18 Thread Toussis Manolis
On Sunday 18 January 2009 09:34:49 David Baron wrote:
 void MyApplet::mousePressEvent ( QGraphicsSceneMouseEvent *ev ) {
 if  ( signalsBlocked() ) {
 Plasma::Applet::mousePressEvent( ev );
 return;
 }..

I tried what you proposed... but the above doesn't work with drag/move 
operations... :-(
If I click and hold on the applet , instead of moving my popup menu appears... 
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: signal clicked()

2009-01-18 Thread Toussis Manolis
After some messing around I used mouseDoubleClickedEvent()
as it is not used by plasma...as a workaround

___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: signal clicked()

2009-01-18 Thread Toussis Manolis
On Sunday 18 January 2009 12:52:58 Toussis Manolis wrote:
 After some messing around I used mouseDoubleClickedEvent()
 as it is not used by plasma...as a workaround


and the strange thing is the double click doesn't work without your code... 
:-)
If I remove mousepressEvent , doubleClickEvent does not occur

void PlasmaTvGr::mousePressEvent ( QGraphicsSceneMouseEvent * event )
{
if(signalsBlocked()) 
{
Plasma::Applet::mousePressEvent(event);
return;
};
if(event-button()==Qt::LeftButton)
{
}else Plasma::Applet::mousePressEvent(event);
};

void PlasmaTvGr::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent * event )
{
execMenu();
};

___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: signal clicked()

2009-01-18 Thread David Baron
On Sunday 18 January 2009 12:12:49 Toussis Manolis wrote:
 On Sunday 18 January 2009 09:34:49 David Baron wrote:
  void MyApplet::mousePressEvent ( QGraphicsSceneMouseEvent *ev ) {
  if  ( signalsBlocked() ) {
  Plasma::Applet::mousePressEvent( ev );
  return;
  }..

 I tried what you proposed... but the above doesn't work with drag/move
 operations... :-(
 If I click and hold on the applet , instead of moving my popup menu
 appears...

I cannot vouch for when and if the signalsBocked will return true.
Mouse pressed is not really a click -- this would be press  release. However, 
this is all we have.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: signal clicked()

2009-01-18 Thread Aaron J. Seigo
On Sunday 18 January 2009, David Baron wrote:
 On Sunday 18 January 2009 12:12:49 Toussis Manolis wrote:
  On Sunday 18 January 2009 09:34:49 David Baron wrote:
   void MyApplet::mousePressEvent ( QGraphicsSceneMouseEvent *ev ) {
   if  ( signalsBlocked() ) {
   Plasma::Applet::mousePressEvent( ev );
   return;
   }..
 
  I tried what you proposed... but the above doesn't work with drag/move
  operations... :-(
  If I click and hold on the applet , instead of moving my popup menu
  appears...

 I cannot vouch for when and if the signalsBocked will return true.
 Mouse pressed is not really a click -- this would be press  release.
 However, this is all we have.

that's because there is no defined behaviour for clicking on an applet, 
really, unlike say a PushButton where the behaviour is quite well defined and 
therefore there is a signal and it does all of the 
mousePress/mouseReleaseEvent stuff for you.

this is exactly how it works with QWidget as well, of course.

Applet is a lot more like QWidget than, say, QPushButton


-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Software



signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: signal clicked()

2009-01-18 Thread Aaron J. Seigo
On Sunday 18 January 2009, Toussis Manolis wrote:
 On Sunday 18 January 2009 12:52:58 Toussis Manolis wrote:
  After some messing around I used mouseDoubleClickedEvent()
  as it is not used by plasma...as a workaround

 and the strange thing is the double click doesn't work without your code...

in QGraphicsView, unless you accept the press event, you don't get further 
mouse interaction. this allows items to be mouse transparent by simply not 
implementing any mouse interaction; then items underneath those items can do 
the mouse related stuff.

very neat and very handy when trying to do various interesting things. adds a 
small amount of complexity, though not much.

it's just something to get used to with QGraphicsView

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Software



signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: signal clicked()

2009-01-18 Thread Aaron J. Seigo
On Saturday 17 January 2009, Toussis Manolis wrote:
 I want my plasma to react on left click on it.
 What signal/object should I connect to my slot?
 I tried MyApplet::clicked() , but there is no such signal...

what, exactly, are you trying to accomplish? reading the thread, i get the 
feeling you are trying to do something quite specific and probably going about 
it in the most difficult way possible. but i don't know what you are trying to 
do, specifically, so can't really help guide you. =)

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Software



signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: signal clicked()

2009-01-18 Thread Toussis Manolis
On Sunday 18 January 2009 20:09:53 Aaron J. Seigo wrote:
 On Sunday 18 January 2009, Toussis Manolis wrote:
  On Sunday 18 January 2009 12:52:58 Toussis Manolis wrote:
   After some messing around I used mouseDoubleClickedEvent()
   as it is not used by plasma...as a workaround
 
  and the strange thing is the double click doesn't work without your
  code...

 in QGraphicsView, unless you accept the press event, you don't get further
 mouse interaction. this allows items to be mouse transparent by simply
 not implementing any mouse interaction; then items underneath those items
 can do the mouse related stuff.

 very neat and very handy when trying to do various interesting things. adds
 a small amount of complexity, though not much.

 it's just something to get used to with QGraphicsView
This is what I worked on:

http://www.kde-
look.org/content/preview.php?preview=1id=75728file1=75728-1.pngfile2=file3=name=plasmatvgr

I wanted a pop up menu to select a tv channel instead of pressing  many 
times.
To just click on applet , seemed a good idea... and a third Pushbutton was to 
much from a applet's look point of view.
So I used double-clicking as a solution
.


___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: signal clicked()

2009-01-18 Thread Aaron J. Seigo
On Sunday 18 January 2009, Toussis Manolis wrote:
 I wanted a pop up menu to select a tv channel instead of pressing  many
 times.

my suggestion in that case would be to us a Plasma::ComboBox for the logo at 
the top in between the  buttons. you can then just use addItem(logoPixmap) 
and the connect to its signals to switch between channels =)

that would seem, to me at least, to be the least surprising way to offer 
this functionality.

and so much easier too =)

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Software



signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: signal clicked()

2009-01-17 Thread David Baron
On Saturday 17 January 2009 09:48:55 Toussis Manolis wrote:
 I want my plasma to react on left click on it.
 What signal/object should I connect to my slot?
 I tried MyApplet::clicked() , but there is no such signal...

I used a mouse click event, wrote my own implementation for that function. 
This is not the qt way but no suitable signals are provided. This is what I 
did (I am not saying this is a preferred way, simply had no other):

void MyApplet::mousePressEvent ( QGraphicsSceneMouseEvent *ev ) {
if  ( signalsBlocked() ) {
Plasma::Applet::mousePressEvent( ev );
return;
}

if  ( ev-button() == Qt::LeftButton )
proc_click();
else
Plasma::Applet::mousePressEvent( ev );
}

The first if (I believe) prevents the UI from exercising while the applet is 
being moved about.

Right-clicks are handled by the applet's methods, i.e. to place the 
context/config menu. There are also hover functions available. No signals.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


signal clicked()

2009-01-16 Thread Toussis Manolis
I want my plasma to react on left click on it.
What signal/object should I connect to my slot?
I tried MyApplet::clicked() , but there is no such signal...

___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel