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

KDEUI

  • 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
33class KMenu;
34class KCalendarSystem;
35class KColorScheme;
36
41class KDEUI_EXPORT KPopupFrame : public QFrame
42{
43 Q_OBJECT
44protected:
48 virtual void keyPressEvent( QKeyEvent *e );
49
50public Q_SLOTS:
55 void close( int r );
56
57public:
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
98Q_SIGNALS:
99 void leaveModality();
100
101private:
102 class KPopupFramePrivate;
103 friend class KPopupFramePrivate;
104 KPopupFramePrivate * const d;
105
106 Q_DISABLE_COPY( KPopupFrame )
107};
108
112class KDEUI_EXPORT KDateValidator : public QValidator
113{
114public:
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;
119private:
120 class KDateValidatorPrivate;
121 friend class KDateValidatorPrivate;
122 KDateValidatorPrivate * const d;
123};
124
139class 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
146public:
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
249protected:
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
278Q_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
304private:
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
312private:
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
KCalendarSystem
KColorScheme
A set of methods used to work with colors.
Definition: kcolorscheme.h:71
KDateTable
Date selection table.
Definition: kdatetable.h:140
KDateTable::dateChanged
void dateChanged(const QDate &cur, const QDate &old)
This function behaves essentially like the one above.
KDateTable::aboutToShowContextMenu
void aboutToShowContextMenu(KMenu *menu, const QDate &date)
A popup menu for a given date is about to be shown (as when the user right clicks on that date and th...
KDateTable::dateChanged
void dateChanged(const QDate &date)
The selected date changed.
KDateTable::tableClicked
void tableClicked()
A date has been selected by clicking on the table.
KDateTable::BackgroundMode
BackgroundMode
Definition: kdatetable.h:235
KDateValidator
Validates user-entered dates.
Definition: kdatetable.h:113
KLocale::CalendarSystem
CalendarSystem
KMenu
A menu with keyboard searching.
Definition: kmenu.h:42
KPopupFrame
Frame with popup menu behavior.
Definition: kdatetable.h:42
KPopupFrame::leaveModality
void leaveModality()
QFrame
QValidator
QWidget
kdeui_export.h
klocale.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
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