[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/krecipes/src/widgets
From:       Jason Kivlighn <confederacy2 () excite ! com>
Date:       2003-09-30 0:35:33
[Download RAW message or body]

CVS commit by jkivlighn: 

setWidget() function
emit a widgetClicked() signal


  M +17 -1     dragarea.cpp   1.3
  M +7 -0      dragarea.h   1.2


--- kdenonbeta/krecipes/src/widgets/dragarea.cpp  #1.2:1.3
@@ -26,4 +26,9 @@ DragArea::~DragArea()
 }
 
+void DragArea::setWidget( QWidget *w )
+{
+        selection->setWidget(w);
+}
+
 void DragArea::mousePressEvent( QMouseEvent *e )
 {
@@ -32,5 +37,11 @@ void DragArea::mousePressEvent( QMouseEv
         m_current_box = childAt(e->pos());
 
-        if ( m_current_box )
+        e->ignore();
+        emit widgetClicked( e, (m_current_box) ? m_current_box : this ); //we'll say \
'this' was clicked if no widget was clicked +        if ( e->isAccepted() )
+                mouse_down = false;
+        e->accept();
+
+        if ( m_current_box && m_current_box->isEnabled() )
         {
                 m_current_box->raise();
@@ -39,4 +50,9 @@ void DragArea::mousePressEvent( QMouseEv
                 m_last_point = m_current_box->mapFromGlobal( e->globalPos() );
                 m_begin_point = m_last_point;
+        }
+        else
+        {
+                m_current_box = 0;
+                mouse_down = false;
         }
 

--- kdenonbeta/krecipes/src/widgets/dragarea.h  #1.1:1.2
@@ -25,7 +25,14 @@ class WidgetSelection;
 class DragArea : public QWidget
 {
+Q_OBJECT
+
 public:
         DragArea( QWidget *parent = 0, const char *name = 0 );
         ~DragArea();
+
+        void setWidget( QWidget * );
+
+signals:
+        void widgetClicked( QMouseEvent *, QWidget* );
 
 protected:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic