Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Highlight today's date in date time calendar popup
- Loading branch information
1 parent
692a17e
commit 62c86f0
Showing
1 changed file
with
12 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
nyalldawson
Author
Collaborator
|
||
|
||
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 ) | ||
|
Just wondering, why did you move these down?