Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef QXTSCHEDULEVIEW_H_INCLUDED
00026 #define QXTSCHEDULEVIEW_H_INCLUDED
00027
00028 #include <QAbstractScrollArea>
00029 #include <QTime>
00030 #include <QDate>
00031 #include <QDateTime>
00032 #include <QHeaderView>
00033 #include <QRect>
00034
00035 #include "qxtpimpl.h"
00036 #include "qxtglobal.h"
00037 #include "qxtnamespace.h"
00038
00039 QT_FORWARD_DECLARE_CLASS(QAbstractItemModel)
00040 class QxtScheduleItemDelegate;
00041 class QxtScheduleViewPrivate;
00042 class QxtScheduleInternalItem;
00043
00044 #if 0
00045 enum
00046 {
00047 TIMERANGEPERCOL = 86400,
00048 TIMESTEP = 900
00049 };
00050 #endif
00051
00052
00053 class QXT_GUI_EXPORT QxtScheduleView : public QAbstractScrollArea
00054 {
00055 Q_OBJECT
00056
00057 QXT_DECLARE_PRIVATE(QxtScheduleView);
00058 friend class QxtScheduleInternalItem;
00059 friend class QxtScheduleViewHeaderModel;
00060
00061 public:
00062
00063 enum ViewMode
00064 {
00065 MinuteView,
00066 HourView,
00067 DayView,
00068 CustomView
00069 };
00070
00071 QxtScheduleView(QWidget *parent = 0);
00072
00073 void setModel(QAbstractItemModel *model);
00074 QAbstractItemModel* model() const;
00075
00076 void setViewMode(const QxtScheduleView::ViewMode mode);
00077 QxtScheduleView::ViewMode viewMode() const;
00078
00079 void setDateRange(const QDate & fromDate , const QDate & toDate);
00080 void setTimeRange(const QDateTime &fromDateTime , const QDateTime &toTime);
00081
00082 QxtScheduleItemDelegate* delegate () const;
00083 void setItemDelegate (QxtScheduleItemDelegate * delegate);
00084
00085 void setZoomStepWidth(const int zoomWidth , const Qxt::Timeunit unit = Qxt::Second);
00086 void setCurrentZoomDepth(const int depth , const Qxt::Timeunit unit = Qxt::Second);
00087 int currentZoomDepth(const Qxt::Timeunit unit = Qxt::Second);
00088
00089 QPoint mapFromViewport(const QPoint& point) const;
00090 QPoint mapToViewport(const QPoint& point) const;
00091
00092 QModelIndex indexAt(const QPoint &pt);
00093 void raiseItem(const QModelIndex &index);
00094 void handleItemConcurrency(const QModelIndex &index);
00095 QModelIndex currentIndex();
00096 int rows() const;
00097 int cols() const;
00098
00099 Q_SIGNALS:
00100 void itemMoved(int rows, int cols, QModelIndex index);
00101 void indexSelected(QModelIndex index);
00102 void indexDoubleClicked(QModelIndex index);
00103 void contextMenuRequested(QModelIndex index);
00104 void newZoomDepth(const int newDepthInSeconds);
00105 void viewModeChanged(const int newViewMode);
00106
00107
00108 protected:
00109 virtual int timePerColumn() const;
00110 virtual void adjustRangeToViewMode(QDateTime *startTime, QDateTime *endTime) const;
00111
00112 virtual void scrollContentsBy(int dx, int dy);
00113 virtual void paintEvent(QPaintEvent *e);
00114 virtual void mouseMoveEvent(QMouseEvent * e);
00115 virtual void mousePressEvent(QMouseEvent * e);
00116 virtual void mouseReleaseEvent(QMouseEvent * e);
00117 virtual void mouseDoubleClickEvent ( QMouseEvent * e );
00118 virtual void resizeEvent(QResizeEvent * e);
00119 virtual void wheelEvent(QWheelEvent * e);
00120
00121 public Q_SLOTS:
00122 void dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight);
00123 void updateGeometries();
00124 void zoomIn();
00125 void zoomOut();
00126
00127 protected Q_SLOTS:
00128 virtual void rowsAboutToBeRemoved(const QModelIndex & parent, int start, int end);
00129 virtual void rowsAboutToBeInserted(const QModelIndex & parent, int start, int end);
00130 virtual void rowsRemoved(const QModelIndex & parent, int start, int end);
00131 virtual void rowsInserted(const QModelIndex & parent, int start, int end);
00132 };
00133
00134 #endif //QXTSCHEDULEVIEW_H_INCLUDED