[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdebase/kicker/libkicker
From: Benoit Minisini <gambas () users ! sourceforge ! net>
Date: 2008-07-30 10:12:07
Message-ID: 1217412727.455687.6975.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 839546 by bminisini:
Use the SimpleArrowButton class for panel scroll buttons.
M +33 -14 panner.cpp
M +8 -3 panner.h
--- branches/KDE/3.5/kdebase/kicker/libkicker/panner.cpp #839545:839546
@@ -23,15 +23,19 @@
#include <qlayout.h>
#include <qtooltip.h>
+#include <qtimer.h>
+#include <qpainter.h>
+#include <qstyle.h>
-#include <karrowbutton.h>
#include <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
+#include "simplebutton.h"
#include "panner.h"
#include "panner.moc"
+
Panner::Panner( QWidget* parent, const char* name )
: QScrollView( parent, name ),
_luSB(0),
@@ -41,6 +45,9 @@
setBackgroundOrigin( AncestorOrigin );
viewport()->setBackgroundOrigin( AncestorOrigin );
+ _updateScrollButtonsTimer = new QTimer(this);
+ connect(_updateScrollButtonsTimer, SIGNAL(timeout()), this, SLOT(reallyUpdateScrollButtons()));
+
setResizePolicy(Manual);
setVScrollBarMode( QScrollView::AlwaysOff );
setHScrollBarMode( QScrollView::AlwaysOff );
@@ -53,12 +60,12 @@
setOrientation(Horizontal);
}
-Panner::~Panner() {}
+Panner::~Panner()
+{
+}
-void Panner::setOrientation(Orientation o)
+void Panner::setupButtons()
{
- _orient = o;
-
if (orientation() == Horizontal)
{
if (_luSB)
@@ -96,6 +103,13 @@
}
}
+void Panner::setOrientation(Orientation o)
+{
+ _orient = o;
+ setupButtons();
+ reallyUpdateScrollButtons();
+}
+
void Panner::resizeEvent( QResizeEvent* e )
{
QScrollView::resizeEvent( e );
@@ -126,7 +140,7 @@
}
// left/up scroll button
- _luSB = new KArrowButton(this);
+ _luSB = new SimpleArrowButton(this);
_luSB->installEventFilter(this);
_luSB->setAutoRepeat(true);
_luSB->setMinimumSize(12, 12);
@@ -135,7 +149,7 @@
connect(_luSB, SIGNAL(clicked()), SLOT(scrollLeftUp()));
// right/down scroll button
- _rdSB = new KArrowButton(this);
+ _rdSB = new SimpleArrowButton(this);
_rdSB->installEventFilter(this);
_rdSB->setAutoRepeat(true);
_rdSB->setMinimumSize(12, 12);
@@ -144,12 +158,14 @@
connect(_rdSB, SIGNAL(clicked()), SLOT(scrollRightDown()));
// set up the buttons
- setOrientation(orientation());
+ setupButtons();
}
-void Panner::updateScrollButtons()
+void Panner::reallyUpdateScrollButtons()
{
int delta = 0;
+
+ _updateScrollButtonsTimer->stop();
if (orientation() == Horizontal)
{
@@ -171,23 +187,26 @@
if (orientation() == Horizontal)
{
- setMargins(leftMargin(), topMargin(),
- _luSB->width() + _rdSB->width(), bottomMargin());
+ setMargins(0, 0, _luSB->width() + _rdSB->width(), 0);
}
else
{
- setMargins(leftMargin(), topMargin(),
- rightMargin(), _luSB->height() + _rdSB->height());
+ setMargins(0, 0, 0, _luSB->height() + _rdSB->height());
}
}
else if (_luSB && _luSB->isVisibleTo(this))
{
_luSB->hide();
_rdSB->hide();
- setMargins(leftMargin(), topMargin(), leftMargin(), topMargin());
+ setMargins(0, 0, 0, 0);
}
}
+void Panner::updateScrollButtons()
+{
+ _updateScrollButtonsTimer->start(200, true);
+}
+
void Panner::resizeContents( int w, int h )
{
QScrollView::resizeContents( w, h );
--- branches/KDE/3.5/kdebase/kicker/libkicker/panner.h #839545:839546
@@ -26,8 +26,10 @@
#include <qscrollview.h>
+#include "simplebutton.h"
+
class QBoxLayout;
-class KArrowButton;
+class QTimer;
class KDE_EXPORT Panner : public QScrollView
{
@@ -46,6 +48,7 @@
virtual void resizeContents( int w, int h );
void scrollRightDown();
void scrollLeftUp();
+ void reallyUpdateScrollButtons();
protected:
void resizeEvent(QResizeEvent *ev);
@@ -53,13 +56,15 @@
void viewportWheelEvent(QWheelEvent *){;}
private:
+ void setupButtons();
void createScrollButtons();
void updateScrollButtons();
Orientation _orient;
QBoxLayout *_layout;
- KArrowButton *_luSB; // Left Scroll Button
- KArrowButton *_rdSB; // Right Scroll Button
+ SimpleArrowButton *_luSB; // Left Scroll Button
+ SimpleArrowButton *_rdSB; // Right Scroll Button
+ QTimer *_updateScrollButtonsTimer;
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic