mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 11:10:16 +02:00
QT(4) Implement TQtWSCustomCalendar.SetMinMaxDate.
This commit is contained in:
parent
abb8e19732
commit
756ae8d6d5
@ -1855,6 +1855,8 @@ type
|
||||
function GetDateTime: TDateTime;
|
||||
procedure SetDateTime(const AValue: TDateTime);
|
||||
procedure SetSelectedDate(const AValue: QDateH);
|
||||
procedure SetMinDate(AMinDate: TDateTime);
|
||||
procedure SetMaxDate(AMaxDate: TDateTime);
|
||||
protected
|
||||
function CreateWidget(const AParams: TCreateParams):QWidgetH; override;
|
||||
public
|
||||
@ -1876,6 +1878,8 @@ type
|
||||
procedure SignalSelectionChanged; cdecl;
|
||||
procedure SignalCurrentPageChanged(p1, p2: Integer); cdecl;
|
||||
property DateTime: TDateTime read GetDateTime write SetDateTime;
|
||||
property MinDate: TDateTime write SetMinDate;
|
||||
property MaxDate: TDateTime write SetMaxDate;
|
||||
end;
|
||||
|
||||
// for page control / notebook
|
||||
@ -17615,6 +17619,26 @@ begin
|
||||
QCalendarWidget_setSelectedDate(QCalendarWidgetH(Widget), AValue);
|
||||
end;
|
||||
|
||||
procedure TQtCalendar.SetMinDate(AMinDate: TDateTime);
|
||||
var
|
||||
Date: QDateH;
|
||||
begin
|
||||
DecodeDate(AMinDate, AYear, AMonth, ADay);
|
||||
Date := QDate_create(AYear, AMonth, ADay);
|
||||
QCalendarWidget_setMinimumDate(QCalendarWidgetH(Widget),Date);
|
||||
QDate_destroy(Date);
|
||||
end;
|
||||
|
||||
procedure TQtCalendar.SetMaxDate(AMaxDate: TDateTime);
|
||||
var
|
||||
Date: QDateH;
|
||||
begin
|
||||
DecodeDate(AMaxDate, AYear, AMonth, ADay);
|
||||
Date := QDate_create(AYear, AMonth, ADay);
|
||||
QCalendarWidget_setMaximumDate(QCalendarWidgetH(Widget),Date);
|
||||
QDate_destroy(Date);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: TQtCalendar.CreateWidget
|
||||
Params: None
|
||||
@ -17971,7 +17995,7 @@ end;
|
||||
with pure Qt C++ app this works ok, but via bindings get
|
||||
impossible year & month values ...
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TQtCalendar.signalCurrentPageChanged(p1, p2: Integer); cdecl;
|
||||
procedure TQtCalendar.SignalCurrentPageChanged(p1, p2: Integer); cdecl;
|
||||
var
|
||||
Msg: TLMessage;
|
||||
ADate: QDateH;
|
||||
|
@ -43,6 +43,7 @@ type
|
||||
class procedure SetDateTime(const ACalendar: TCustomCalendar; const ADateTime: TDateTime); override;
|
||||
class procedure SetDisplaySettings(const ACalendar: TCustomCalendar; const ADisplaySettings: TDisplaySettings); override;
|
||||
class procedure SetFirstDayOfWeek(const ACalendar: TCustomCalendar; const ADayOfWeek: TCalDayOfWeek); override;
|
||||
class procedure SetMinMaxDate(const ACalendar: TCustomCalendar; AMinDate, AMaxDate: TDateTime); override;
|
||||
end;
|
||||
|
||||
|
||||
@ -137,4 +138,15 @@ begin
|
||||
QtCalendar.EndUpdate;
|
||||
end;
|
||||
|
||||
class procedure TQtWSCustomCalendar.SetMinMaxDate(const ACalendar: TCustomCalendar; AMinDate, AMaxDate: TDateTime);
|
||||
var
|
||||
QtCalendar: TQtCalendar;
|
||||
begin
|
||||
QtCalendar := TQtCalendar(ACalendar.Handle);
|
||||
QtCalendar.BeginUpdate;
|
||||
QtCalendar.MinDate := AMinDate;
|
||||
QtCalendar.MaxDate := AMaxDate;
|
||||
QtCalendar.EndUpdate;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user