• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • sources
  • kde-4.14
  • kdelibs
  • kdeui
  • widgets
kdatetable.h
Go to the documentation of this file.
1 /* -*- C++ -*-
2  This file is part of the KDE libraries
3  Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org)
4  (C) 1998-2001 Mirko Boehm (mirko@kde.org)
5  (C) 2007 John Layt <john@layt.net>
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef KDATETABLE_H
23 #define KDATETABLE_H
24 
25 #include <kdeui_export.h>
26 
27 #include <QtGui/QValidator>
28 #include <QtGui/QLineEdit>
29 #include <QtCore/QDateTime>
30 
31 #include <klocale.h>
32 
33 class KMenu;
34 class KCalendarSystem;
35 class KColorScheme;
36 
41 class KDEUI_EXPORT KPopupFrame : public QFrame
42 {
43  Q_OBJECT
44 protected:
48  virtual void keyPressEvent( QKeyEvent *e );
49 
50 public Q_SLOTS:
55  void close( int r );
56 
57 public:
61  KPopupFrame( QWidget *parent = 0 );
62 
66  ~KPopupFrame();
67 
75  void setMainWidget( QWidget* m );
76 
81  virtual void resizeEvent( QResizeEvent *resize );
82 
86  void popup( const QPoint &pos );
87 
91  int exec( const QPoint &p );
92 
96  int exec( int x, int y );
97 
98 Q_SIGNALS:
99  void leaveModality();
100 
101 private:
102  class KPopupFramePrivate;
103  friend class KPopupFramePrivate;
104  KPopupFramePrivate * const d;
105 
106  Q_DISABLE_COPY( KPopupFrame )
107 };
108 
112 class KDEUI_EXPORT KDateValidator : public QValidator
113 {
114 public:
115  KDateValidator( QWidget *parent = 0 );
116  virtual State validate( QString &text, int &e ) const;
117  virtual void fixup ( QString &input ) const;
118  State date( const QString &text, QDate &date ) const;
119 private:
120  class KDateValidatorPrivate;
121  friend class KDateValidatorPrivate;
122  KDateValidatorPrivate * const d;
123 };
124 
139 class KDEUI_EXPORT KDateTable : public QWidget
140 {
141  Q_OBJECT
142  Q_PROPERTY( QDate date READ date WRITE setDate )
143 //FIXME Q_PROPERTY( KCalendarSystem calendar READ calendar WRITE setCalendar USER true )
144  Q_PROPERTY( bool popupMenu READ popupMenuEnabled WRITE setPopupMenuEnabled )
145 
146 public:
150  explicit KDateTable( QWidget* parent = 0 );
151 
155  explicit KDateTable( const QDate&, QWidget *parent = 0 );
156 
160  ~KDateTable();
161 
169  virtual QSize sizeHint() const;
170 
174  void setFontSize( int size );
175 
179  bool setDate( const QDate &date );
180 
181  // KDE5 remove the const & from the returned QDate
185  const QDate &date() const;
186 
192  const KCalendarSystem *calendar() const;
193 
201  bool setCalendar( KCalendarSystem *calendar = 0 );
202 
210  bool setCalendar( const QString &calendarType );
211 
220  bool setCalendarSystem( KLocale::CalendarSystem calendarSystem );
221 
228  void setPopupMenuEnabled( bool enable );
229 
233  bool popupMenuEnabled() const;
234 
235  enum BackgroundMode { NoBgMode = 0, RectangleMode, CircleMode };
236 
241  void setCustomDatePainting( const QDate &date, const QColor &fgColor,
242  BackgroundMode bgMode = NoBgMode, const QColor &bgColor = QColor() );
243 
247  void unsetCustomDatePainting( const QDate &date );
248 
249 protected:
254  virtual int posFromDate( const QDate &date );
255 
260  virtual QDate dateFromPos( int pos );
261 
262  virtual void paintEvent( QPaintEvent *e );
263 
267  virtual void mousePressEvent( QMouseEvent *e );
268  virtual void wheelEvent( QWheelEvent *e );
269  virtual void keyPressEvent( QKeyEvent *e );
270  virtual void focusInEvent( QFocusEvent *e );
271  virtual void focusOutEvent( QFocusEvent *e );
272 
276  virtual bool event(QEvent *e);
277 
278 Q_SIGNALS:
282  void dateChanged( const QDate &date );
283 
290  void dateChanged( const QDate &cur, const QDate &old );
291 
295  void tableClicked();
296 
302  void aboutToShowContextMenu( KMenu *menu, const QDate &date );
303 
304 private:
305  Q_PRIVATE_SLOT( d, void nextMonth() )
306  Q_PRIVATE_SLOT( d, void previousMonth() )
307  Q_PRIVATE_SLOT( d, void beginningOfMonth() )
308  Q_PRIVATE_SLOT( d, void endOfMonth() )
309  Q_PRIVATE_SLOT( d, void beginningOfWeek() )
310  Q_PRIVATE_SLOT( d, void endOfWeek() )
311 
312 private:
313  class KDateTablePrivate;
314  friend class KDateTablePrivate;
315  KDateTablePrivate * const d;
316 
317  void init( const QDate &date );
318  void initAccels();
319  void paintCell( QPainter *painter, int row, int col, const KColorScheme &colorScheme );
320 
321  Q_DISABLE_COPY( KDateTable )
322 };
323 
324 #endif // KDATETABLE_H
QWidget::close
bool close()
QEvent
QResizeEvent
QWidget
QValidator::fixup
virtual void fixup(QString &input) const
KDateTable
Date selection table.
Definition: kdatetable.h:139
KMenu
A menu with keyboard searching.
Definition: kmenu.h:42
QWheelEvent
KDateTable::BackgroundMode
BackgroundMode
Definition: kdatetable.h:235
QPoint
QMouseEvent
klocale.h
QWidget::focusOutEvent
virtual void focusOutEvent(QFocusEvent *event)
KCalendarSystem
QWidget::paintEvent
virtual void paintEvent(QPaintEvent *event)
QWidget::mousePressEvent
virtual void mousePressEvent(QMouseEvent *event)
QPainter
QWidget::focusInEvent
virtual void focusInEvent(QFocusEvent *event)
QDate
QString
QColor
KDateValidator
Validates user-entered dates.
Definition: kdatetable.h:112
QValidator::validate
virtual State validate(QString &input, int &pos) const =0
QSize
QWidget::wheelEvent
virtual void wheelEvent(QWheelEvent *event)
QFrame
QKeyEvent
KLocale
KColorScheme
A set of methods used to work with colors.
Definition: kcolorscheme.h:71
KPopupFrame
Frame with popup menu behavior.
Definition: kdatetable.h:41
QWidget::keyPressEvent
virtual void keyPressEvent(QKeyEvent *event)
kdeui_export.h
QPaintEvent
QWidget::resizeEvent
virtual void resizeEvent(QResizeEvent *event)
QWidget::event
virtual bool event(QEvent *event)
QFocusEvent
KDateTable::RectangleMode
Definition: kdatetable.h:235
QValidator
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal