mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-03 00:38:15 +02:00
Qt:
- complete TQtWSCustomCheckBox, TQtWSToggleBox, TQtWSRadioButton - fixed typos in TQtWSCustomFloatSpinEdit declaration - temporary removed TQtWsButton.GetPrefferedSize due to non adequate return values git-svn-id: trunk@11988 -
This commit is contained in:
parent
a41d43cb80
commit
9f7f8da245
@ -267,8 +267,11 @@ type
|
||||
procedure setShortcut(AShortcut: TShortcut);
|
||||
procedure setText(text: PWideString);
|
||||
procedure Text(retval: PWideString);
|
||||
function isChecked: Boolean;
|
||||
procedure Toggle;
|
||||
function isChecked: Boolean;
|
||||
function isDown: Boolean;
|
||||
procedure setChecked(p1: Boolean);
|
||||
procedure setDown(p1: Boolean);
|
||||
procedure SignalPressed; cdecl;
|
||||
procedure SignalReleased; cdecl;
|
||||
procedure SignalClicked(Checked: Boolean = False); cdecl;
|
||||
@ -2551,6 +2554,11 @@ begin
|
||||
QAbstractButton_text(QAbstractButtonH(Widget), retval);
|
||||
end;
|
||||
|
||||
procedure TQtAbstractButton.Toggle;
|
||||
begin
|
||||
QAbstractButton_toggle(QAbstractButtonH(Widget));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: TQtAbstractButton.isChecked
|
||||
Params: None
|
||||
@ -2561,6 +2569,11 @@ begin
|
||||
Result := QAbstractButton_isChecked(QAbstractButtonH(Widget));
|
||||
end;
|
||||
|
||||
function TQtAbstractButton.isDown: Boolean;
|
||||
begin
|
||||
Result := QAbstractButton_isDown(QAbstractButtonH(Widget));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: TQtAbstractButton.setChecked
|
||||
Params: None
|
||||
@ -2571,6 +2584,11 @@ begin
|
||||
QAbstractButton_setChecked(QAbstractButtonH(Widget), p1);
|
||||
end;
|
||||
|
||||
procedure TQtAbstractButton.setDown(p1: Boolean);
|
||||
begin
|
||||
QAbstractButton_setDown(QAbstractButtonH(Widget), p1);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: TQtAbstractButton.SignalPressed
|
||||
Params: None
|
||||
@ -3891,7 +3909,8 @@ end;
|
||||
|
||||
procedure TQtLineEdit.setSelection(const AStart, ALength: Integer);
|
||||
begin
|
||||
QLineEdit_setSelection(QLineEditH(Widget), AStart, ALength);
|
||||
if AStart >= 0 then
|
||||
QLineEdit_setSelection(QLineEditH(Widget), AStart, ALength);
|
||||
end;
|
||||
|
||||
procedure TQtLineEdit.setText(const AText: WideString);
|
||||
@ -4007,13 +4026,16 @@ procedure TQtTextEdit.setSelection(const AStart, ALength: Integer);
|
||||
var
|
||||
TextCursor: QTextCursorH;
|
||||
begin
|
||||
TextCursor := QTextCursor_create();
|
||||
QTextEdit_textCursor(QTextEditH(Widget), TextCursor);
|
||||
QTextCursor_clearSelection(TextCursor);
|
||||
QTextCursor_setPosition(TextCursor, AStart);
|
||||
QTextCursor_setPosition(TextCursor, AStart + ALength, QTextCursorKeepAnchor);
|
||||
QTextEdit_setTextCursor(QTextEditH(Widget), TextCursor);
|
||||
QTextCursor_destroy(TextCursor);
|
||||
if AStart >= 0 then
|
||||
begin
|
||||
TextCursor := QTextCursor_create();
|
||||
QTextEdit_textCursor(QTextEditH(Widget), TextCursor);
|
||||
QTextCursor_clearSelection(TextCursor);
|
||||
QTextCursor_setPosition(TextCursor, AStart);
|
||||
QTextCursor_setPosition(TextCursor, AStart + ALength, QTextCursorKeepAnchor);
|
||||
QTextEdit_setTextCursor(QTextEditH(Widget), TextCursor);
|
||||
QTextCursor_destroy(TextCursor);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TQtTextEdit.setTabChangesFocus(const AValue: Boolean);
|
||||
|
@ -51,15 +51,15 @@ type
|
||||
const AParams: TCreateParams): HWND; override;
|
||||
class procedure UpdateControl(const ACustomFloatSpinEdit: TCustomFloatSpinEdit); override;
|
||||
|
||||
class function GetSelStart(const ACustomFloatSpinEdit: TCustomFloatSpinEdit): integer; virtual;
|
||||
class function GetSelLength(const ACustomFloatSpinEdit: TCustomFloatSpinEdit): integer; virtual;
|
||||
class function GetSelStart(const ACustomEdit: TCustomEdit): integer; override;
|
||||
class function GetSelLength(const ACustomEdit: TCustomEdit): integer; override;
|
||||
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
||||
class function GetValue(const ACustomFloatSpinEdit: TCustomFloatSpinEdit): single; override;
|
||||
|
||||
class procedure SetCharCase(const ACustomEdit: TCustomEdit; NewCase: TEditCharCase); override;
|
||||
class procedure SetReadOnly(const ACustomEdit: TCustomEdit; NewReadOnly: boolean); override;
|
||||
class procedure SetSelLength(const ACustomFloatSpinEdit: TCustomFloatSpinEdit; NewLength: integer); virtual;
|
||||
class procedure SetSelStart(const ACustomFloatSpinEdit: TCustomFloatSpinEdit; NewStart: integer); virtual;
|
||||
class procedure SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer); override;
|
||||
class procedure SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer); override;
|
||||
class procedure SetText(const AWinControl: TWinControl; const AText: string); override;
|
||||
|
||||
(*TODO: seperation into properties instead of bulk update
|
||||
@ -154,14 +154,14 @@ begin
|
||||
end;
|
||||
|
||||
class function TQtWSCustomFloatSpinEdit.GetSelStart(
|
||||
const ACustomFloatSpinEdit: TCustomFloatSpinEdit): integer;
|
||||
const ACustomEdit: TCustomEdit): integer;
|
||||
begin
|
||||
{$note implement}
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
class function TQtWSCustomFloatSpinEdit.GetSelLength(
|
||||
const ACustomFloatSpinEdit: TCustomFloatSpinEdit): integer;
|
||||
const ACustomEdit: TCustomEdit): integer;
|
||||
begin
|
||||
{$note implement}
|
||||
Result := 0;
|
||||
@ -185,13 +185,13 @@ begin
|
||||
end;
|
||||
|
||||
class procedure TQtWSCustomFloatSpinEdit.SetSelLength(
|
||||
const ACustomFloatSpinEdit: TCustomFloatSpinEdit; NewLength: integer);
|
||||
const ACustomEdit: TCustomEdit; NewLength: integer);
|
||||
begin
|
||||
{$note implement}
|
||||
end;
|
||||
|
||||
class procedure TQtWSCustomFloatSpinEdit.SetSelStart(
|
||||
const ACustomFloatSpinEdit: TCustomFloatSpinEdit; NewStart: integer);
|
||||
const ACustomEdit: TCustomEdit; NewStart: integer);
|
||||
begin
|
||||
{$note implement}
|
||||
end;
|
||||
|
@ -234,8 +234,8 @@ type
|
||||
class procedure SetDefault(const AButton: TCustomButton; ADefault: Boolean); override;
|
||||
class procedure SetShortcut(const AButton: TCustomButton; const OldShortcut, NewShortcut: TShortcut); override;
|
||||
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
|
||||
class procedure GetPreferredSize(const AWinControl: TWinControl;
|
||||
var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); override;
|
||||
{class procedure GetPreferredSize(const AWinControl: TWinControl;
|
||||
var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); override;}
|
||||
class procedure SetColor(const AWinControl: TWinControl); override;
|
||||
end;
|
||||
|
||||
@ -245,17 +245,17 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
class function RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState; override;
|
||||
class function CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||
|
||||
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
||||
|
||||
class procedure SetShortCut(const ACustomCheckBox: TCustomCheckBox;
|
||||
const OldShortCut, NewShortCut: TShortCut); override;
|
||||
class procedure SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState); override;
|
||||
public
|
||||
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
||||
|
||||
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
|
||||
|
||||
class function CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||
class function RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState; override;
|
||||
end;
|
||||
|
||||
{ TQtWSCheckBox }
|
||||
@ -272,18 +272,17 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
public
|
||||
class function RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState; override;
|
||||
class function CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||
|
||||
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
||||
|
||||
class procedure SetShortCut(const ACustomCheckBox: TCustomCheckBox;
|
||||
const OldShortCut, NewShortCut: TShortCut); override;
|
||||
class procedure SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState); override;
|
||||
public
|
||||
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
||||
|
||||
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
|
||||
|
||||
class function CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||
class function RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState; override;
|
||||
end;
|
||||
|
||||
{ TQtWSRadioButton }
|
||||
@ -292,16 +291,17 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
class function RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState; override;
|
||||
class function CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||
|
||||
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
||||
|
||||
class procedure SetShortCut(const ACustomCheckBox: TCustomCheckBox;
|
||||
const OldShortCut, NewShortCut: TShortCut); override;
|
||||
class procedure SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState); override;
|
||||
public
|
||||
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
||||
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
|
||||
|
||||
class function CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||
class function RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState; override;
|
||||
end;
|
||||
|
||||
{ TQtWSCustomStaticText }
|
||||
@ -1080,12 +1080,12 @@ begin
|
||||
TQtAbstractButton(AWinControl.Handle).SetText(@Str);
|
||||
end;
|
||||
|
||||
class procedure TQtWSButton.GetPreferredSize(const AWinControl: TWinControl;
|
||||
{class procedure TQtWSButton.GetPreferredSize(const AWinControl: TWinControl;
|
||||
var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean);
|
||||
begin
|
||||
PreferredWidth := QStyle_pixelMetric(QApplication_style(), QStylePM_DialogButtonsButtonWidth);
|
||||
PreferredHeight := QStyle_pixelMetric(QApplication_style(), QStylePM_DialogButtonsButtonHeight);
|
||||
end;
|
||||
end;}
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TQtWSButton.SetColor
|
||||
@ -1124,8 +1124,8 @@ end;
|
||||
class function TQtWSCustomCheckBox.RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState;
|
||||
begin
|
||||
case TQtCheckBox(ACustomCheckBox.Handle).CheckState of
|
||||
QtPartiallyChecked: Result := cbGrayed;
|
||||
QtChecked: Result := cbChecked;
|
||||
QtPartiallyChecked: Result := cbGrayed;
|
||||
QtChecked: Result := cbChecked;
|
||||
else
|
||||
Result := cbUnchecked;
|
||||
end;
|
||||
@ -1139,7 +1139,9 @@ end;
|
||||
class procedure TQtWSCustomCheckBox.SetShortCut(const ACustomCheckBox: TCustomCheckBox;
|
||||
const OldShortCut, NewShortCut: TShortCut);
|
||||
begin
|
||||
inherited SetShortCut(ACustomCheckBox, OldShortCut, NewShortCut);
|
||||
if not WSCheckHandleAllocated(ACustomCheckBox, 'SetShortcut') then Exit;
|
||||
|
||||
TQtCheckBox(ACustomCheckBox.Handle).setShortcut(NewShortcut);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -1150,8 +1152,8 @@ end;
|
||||
class procedure TQtWSCustomCheckBox.SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState);
|
||||
begin
|
||||
case NewState of
|
||||
cbGrayed: TQtCheckBox(ACustomCheckBox.Handle).setCheckState(QtPartiallyChecked);
|
||||
cbChecked: TQtCheckBox(ACustomCheckBox.Handle).setCheckState(QtChecked);
|
||||
cbGrayed: TQtCheckBox(ACustomCheckBox.Handle).setCheckState(QtPartiallyChecked);
|
||||
cbChecked: TQtCheckBox(ACustomCheckBox.Handle).setCheckState(QtChecked);
|
||||
else
|
||||
TQtCheckBox(ACustomCheckBox.Handle).setCheckState(QtUnchecked);
|
||||
end;
|
||||
@ -1182,7 +1184,7 @@ class procedure TQtWSCustomCheckBox.SetText(const AWinControl: TWinControl; cons
|
||||
var
|
||||
Str: WideString;
|
||||
begin
|
||||
Str := UTF8Decode(AText);
|
||||
Str := GetUtf8String(AText);
|
||||
|
||||
TQtAbstractButton(AWinControl.Handle).SetText(@Str);
|
||||
end;
|
||||
@ -1216,7 +1218,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
class function TQtWSRadioButton.RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState;
|
||||
begin
|
||||
if TQtAbstractButton(ACustomCheckBox.Handle).isChecked then
|
||||
if TQtRadioButton(ACustomCheckBox.Handle).isChecked then
|
||||
Result := cbChecked
|
||||
else
|
||||
Result := cbUnchecked;
|
||||
@ -1230,7 +1232,7 @@ end;
|
||||
class procedure TQtWSRadioButton.SetShortCut(const ACustomCheckBox: TCustomCheckBox;
|
||||
const OldShortCut, NewShortCut: TShortCut);
|
||||
begin
|
||||
inherited SetShortCut(ACustomCheckBox, OldShortCut, NewShortCut);
|
||||
TQtRadioButton(ACustomCheckBox.Handle).setShortcut(NewShortCut);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -1242,10 +1244,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
class procedure TQtWSRadioButton.SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState);
|
||||
begin
|
||||
case NewState of
|
||||
cbUnchecked: TQtAbstractButton(ACustomCheckBox.Handle).setChecked(False);
|
||||
cbChecked: TQtAbstractButton(ACustomCheckBox.Handle).setChecked(true);
|
||||
end;
|
||||
TQtRadioButton(ACustomCheckBox.Handle).setChecked(NewState = cbChecked);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -1275,7 +1274,7 @@ class procedure TQtWSRadioButton.SetText(const AWinControl: TWinControl; const A
|
||||
var
|
||||
Str: WideString;
|
||||
begin
|
||||
Str := UTF8Decode(AText);
|
||||
Str := GetUtf8String(AText);
|
||||
|
||||
TQtAbstractButton(AWinControl.Handle).SetText(@Str);
|
||||
end;
|
||||
@ -1597,11 +1596,10 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
class function TQtWSToggleBox.RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState;
|
||||
begin
|
||||
if QAbstractButton_isDown(QAbstractButtonH(TQtPushButton(ACustomCheckBox.Handle).Widget))
|
||||
then
|
||||
Result := cbChecked
|
||||
if TQtPushButton(ACustomCheckBox.Handle).isDown then
|
||||
Result := cbChecked
|
||||
else
|
||||
Result := cbUnChecked;
|
||||
Result := cbUnChecked;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -1612,7 +1610,7 @@ end;
|
||||
class procedure TQtWSToggleBox.SetShortCut(const ACustomCheckBox: TCustomCheckBox;
|
||||
const OldShortCut, NewShortCut: TShortCut);
|
||||
begin
|
||||
inherited SetShortCut(ACustomCheckBox, OldShortCut, NewShortCut);
|
||||
TQtPushButton(ACustomCheckBox.Handle).setShortcut(NewShortCut);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -1621,17 +1619,8 @@ end;
|
||||
Returns: Nothing
|
||||
------------------------------------------------------------------------------}
|
||||
class procedure TQtWSToggleBox.SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState);
|
||||
var
|
||||
AState: TCheckBoxState;
|
||||
begin
|
||||
if QAbstractButton_isDown(QAbstractButtonH(TQtPushButton(ACustomCheckBox.Handle).Widget))
|
||||
then
|
||||
AState := cbChecked
|
||||
else
|
||||
AState := cbUnChecked;
|
||||
|
||||
if AState <> NewState then
|
||||
QAbstractButton_toggle(QAbstractButtonH(TQtPushButton(ACustomCheckBox.Handle).Widget));
|
||||
TQtPushButton(ACustomCheckBox.Handle).setDown(NewState = cbChecked)
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -1675,7 +1664,6 @@ class function TQtWSToggleBox.CreateHandle(const AWinControl: TWinControl; const
|
||||
var
|
||||
QtToggleBox: TQtPushButton;
|
||||
begin
|
||||
|
||||
QtToggleBox := TQtPushButton.Create(AWinControl, AParams);
|
||||
|
||||
QAbstractButton_setCheckable(QAbstractButtonH(QtToggleBox.Widget), True);
|
||||
|
Loading…
Reference in New Issue
Block a user