[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/kdgantt
From: Dag Andersen <danders () get2net ! dk>
Date: 2008-10-14 8:41:00
Message-ID: 1223973660.244814.15120.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 871231 by danders:
Add a zoom dialog.
M +3 -0 CMakeLists.txt
M +17 -1 kdganttdatetimegrid.cpp
M +4 -0 kdganttdatetimegrid.h
M +15 -2 kdganttgraphicsview.cpp
A kdgantttimescalezoomdialog.cpp [License: LGPL (v2+)]
A kdgantttimescalezoomdialog.h [License: LGPL (v2+)]
--- trunk/KDE/kdepim/kdgantt/CMakeLists.txt #871230:871231
@@ -20,6 +20,8 @@
${CMAKE_SOURCE_DIR}/kdgantt/kdganttabstractgrid.cpp
${CMAKE_SOURCE_DIR}/kdgantt/kdganttdatetimegrid.cpp
${CMAKE_SOURCE_DIR}/kdgantt/kdganttlegend.cpp
+
+ ${CMAKE_SOURCE_DIR}/kdgantt/kdgantttimescalezoomdialog.cpp
)
add_definitions(-DKDAB_NO_UNIT_TESTS)
@@ -40,6 +42,7 @@
kdganttsummaryhandlingproxymodel
kdganttview
kdganttlegend
+ kdgantttimescalezoomdialog
)
foreach(it ${libkdgantt_mocable_files})
qt4_generate_moc(${CMAKE_SOURCE_DIR}/kdgantt/${it}.h \
${CMAKE_BINARY_DIR}/kdgantt/moc_${it}.cpp)
--- trunk/KDE/kdepim/kdgantt/kdganttdatetimegrid.cpp #871230:871231
@@ -118,7 +118,7 @@
void DateTimeGrid::setDayWidth( qreal w )
{
qDebug()<<"DateTimeGrid::setDayWidth"<<w;
- d->dayWidth = qMax( w, qreal(1.0) );
+ d->dayWidth = qMax( w, qreal(0.1) );
emit gridChanged();
}
@@ -144,6 +144,22 @@
return d->scale;
}
+/*! \param factor The zoom factor
+ *
+ */
+void DateTimeGrid::zoomIn( qreal factor )
+{
+ setDayWidth( d->dayWidth * factor );
+}
+
+/*! \param factor The zoom factor
+ *
+ */
+void DateTimeGrid::zoomOut( qreal factor )
+{
+ setDayWidth( d->dayWidth * factor );
+}
+
/*! \param ws The start day of the week.
*
* A solid line is drawn on the grid to mark the beginning of a new week.
--- trunk/KDE/kdepim/kdgantt/kdganttdatetimegrid.h #871230:871231
@@ -67,6 +67,10 @@
void render( QPainter* painter, const QRectF &target, const QRectF& \
headerRect, const QRectF& exposedRect, QWidget *widget, Qt::AspectRatioMode \
aspectRatioMode = Qt::KeepAspectRatio );
+ public Q_SLOTS:
+ void zoomIn( qreal factor = 1.25 );
+ void zoomOut( qreal factor = 0.25 );
+
protected:
virtual void paintHourGrid( QPainter* painter, const QRectF& sceneRect, \
const QRectF& exposedRect, AbstractRowController* rowController = 0, QWidget* \
widget=0 );
--- trunk/KDE/kdepim/kdgantt/kdganttgraphicsview.cpp #871230:871231
@@ -25,6 +25,7 @@
#include "kdganttabstractrowcontroller.h"
#include "kdganttgraphicsitem.h"
#include "kdganttconstraintmodel.h"
+#include "kdgantttimescalezoomdialog.h"
#include <QMenu>
#include <QPainter>
@@ -32,6 +33,7 @@
#include <QResizeEvent>
#include <QScrollBar>
#include <QAbstractProxyModel>
+#include <QToolButton>
#include <cassert>
@@ -84,6 +86,7 @@
QAction* actionScaleWeek = 0;
QAction* actionScaleDay = 0;
QAction* actionScaleHour = 0;
+ QAction* actionZoom = 0;
QAction* actionZoomIn = 0;
QAction* actionZoomOut = 0;
if( grid != 0 )
@@ -127,6 +130,8 @@
contextMenu.addSeparator();
+ actionZoom = new QAction( tr( "Zoom..." ), &contextMenu );
+ contextMenu.addAction( actionZoom );
actionZoomIn = new QAction( tr( "Zoom In" ), &contextMenu );
contextMenu.addAction( actionZoomIn );
actionZoomOut = new QAction( tr( "Zoom Out" ), &contextMenu );
@@ -166,15 +171,23 @@
assert( grid != 0 );
grid->setScale( DateTimeGrid::ScaleHour );
}
+ else if( action == actionZoom )
+ {
+ assert( grid != 0 );
+ TimeScaleZoomDialog dlg;
+ connect( dlg.zoomIn, SIGNAL( pressed() ), grid, SLOT( zoomIn() ) );
+ connect( dlg.zoomOut, SIGNAL( pressed() ), grid, SLOT( zoomOut() ) );
+ dlg.exec();
+ }
else if( action == actionZoomIn )
{
assert( grid != 0 );
- grid->setDayWidth( grid->dayWidth() * 1.25 );
+ grid->zoomIn();
}
else if( action == actionZoomOut )
{
assert( grid != 0 );
- grid->setDayWidth( grid->dayWidth() * 0.75 );
+ grid->zoomOut();
}
event->accept();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic