mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-16 00:05:45 -04:00
Highlight today's date in date time calendar popup
This commit is contained in:
parent
692a17efd6
commit
62c86f038e
@ -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>
|
||||
|
||||
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 )
|
||||
|
Loading…
x
Reference in New Issue
Block a user