Skip to content
Permalink
Browse files

Highlight today's date in date time calendar popup

  • Loading branch information
nyalldawson committed Mar 29, 2016
1 parent 692a17e commit 62c86f038e7a1a1aa18bc7d48959e09df4e4e324
Showing with 12 additions and 6 deletions.
  1. +12 −6 src/gui/editorwidgets/qgsdatetimeeditwrapper.cpp
@@ -13,17 +13,16 @@
* *
***************************************************************************/


#include <QDateTimeEdit>
#include <QDateEdit>
#include <QTimeEdit>


#include "qgsdatetimeeditwrapper.h"
#include "qgsdatetimeeditfactory.h"
#include "qgsmessagelog.h"
#include "qgslogger.h"

#include <QDateTimeEdit>
#include <QDateEdit>
#include <QTimeEdit>
#include <QTextCharFormat>
#include <QCalendarWidget>

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Mar 30, 2016

Member

Just wondering, why did you move these down?

This comment has been minimized.

Copy link
@nyalldawson

nyalldawson Mar 30, 2016

Author Collaborator

No particular reason... I just think it's good practice to put the system includes at the end. I had to add some new ones so I took the opportunity to move stuff!


QgsDateTimeEditWrapper::QgsDateTimeEditWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent )
: QgsEditorWidgetWrapper( vl, fieldIdx, editor, parent )
@@ -67,6 +66,13 @@ void QgsDateTimeEditWrapper::initWidget( QWidget *editor )

const bool calendar = config( "calendar_popup", false ).toBool();
mQDateTimeEdit->setCalendarPopup( calendar );
if ( calendar )
{
// highlight today's date
QTextCharFormat todayFormat;
todayFormat.setBackground( QColor( 160, 180, 200 ) );
mQDateTimeEdit->calendarWidget()->setDateTextFormat( QDate::currentDate(), todayFormat );
}

const bool allowNull = config( "allow_null", true ).toBool();
if ( mQgsDateTimeEdit )

0 comments on commit 62c86f0

Please sign in to comment.
You can’t perform that action at this time.