Qt,Qt5,Qt6: Implemented TComboBox.AdjustDropDown - TQtWidgetSet.SetComboMinDropDownSize.

This commit is contained in:
Željan Rikalo 2023-09-06 14:37:49 +02:00
parent 05fbbfe042
commit a7e90edd46
6 changed files with 60 additions and 0 deletions

View File

@ -887,6 +887,25 @@ begin
QSocketNotifier_setEnabled(wheh^.qsn[QSocketNotifierException], do_error);
end;
function TQtWidgetSet.SetComboMinDropDownSize(Handle: HWND; MinItemsWidth, MinItemsHeight, MinItemCount: integer): boolean;
var
ACombo: QComboBoxH;
AView: QAbstractItemViewH;
begin
Result := False;
if not IsValidHandle(Handle) then
exit;
ACombo := QComboBoxH(TQtComboBox(Handle).Widget);
AView := QListWidgetH(QComboBox_view(ACombo));
if Assigned(AView) then
begin
QWidget_setMinimumWidth(AView, MinItemsWidth);
QWidget_setMinimumHeight(AView, MinItemsHeight);
QComboBox_setMaxVisibleItems(ACombo, MinItemCount);
Result := True;
end;
end;
procedure TQtWidgetSet.SetRubberBandRect(const ARubberBand: HWND; const ARect: TRect);
begin
if ARubberBand = 0 then

View File

@ -74,6 +74,7 @@ procedure RemovePipeEventHandler(var AHandler: PPipeEventHandler); override;
procedure RemoveProcessEventHandler(var AHandler: PProcessEventHandler); override;
procedure SetEventHandlerFlags(AHandler: PEventHandler; NewFlags: dword); override;
function SetComboMinDropDownSize(Handle: HWND; MinItemsWidth, MinItemsHeight, MinItemCount: integer): boolean; override;
procedure SetRubberBandRect(const ARubberBand: HWND; const ARect: TRect); override;
function TextUTF8Out(DC: HDC; X, Y: Integer; Str: PChar; Count: Longint): Boolean; override;

View File

@ -884,6 +884,25 @@ begin
QSocketNotifier_setEnabled(wheh^.qsn[QSocketNotifierException], do_error);
end;
function TQtWidgetSet.SetComboMinDropDownSize(Handle: HWND; MinItemsWidth, MinItemsHeight, MinItemCount: integer): boolean;
var
ACombo: QComboBoxH;
AView: QAbstractItemViewH;
begin
Result := False;
if not IsValidHandle(Handle) then
exit;
ACombo := QComboBoxH(TQtComboBox(Handle).Widget);
AView := QListWidgetH(QComboBox_view(ACombo));
if Assigned(AView) then
begin
QWidget_setMinimumWidth(AView, MinItemsWidth);
QWidget_setMinimumHeight(AView, MinItemsHeight);
QComboBox_setMaxVisibleItems(ACombo, MinItemCount);
Result := True;
end;
end;
procedure TQtWidgetSet.SetRubberBandRect(const ARubberBand: HWND; const ARect: TRect);
begin
if ARubberBand = 0 then

View File

@ -73,6 +73,7 @@ procedure RemovePipeEventHandler(var AHandler: PPipeEventHandler); override;
procedure RemoveProcessEventHandler(var AHandler: PProcessEventHandler); override;
procedure SetEventHandlerFlags(AHandler: PEventHandler; NewFlags: dword); override;
function SetComboMinDropDownSize(Handle: HWND; MinItemsWidth, MinItemsHeight, MinItemCount: integer): boolean; override;
procedure SetRubberBandRect(const ARubberBand: HWND; const ARect: TRect); override;
function TextUTF8Out(DC: HDC; X, Y: Integer; Str: PChar; Count: Longint): Boolean; override;

View File

@ -905,6 +905,25 @@ begin
QSocketNotifier_setEnabled(wheh^.qsn[QSocketNotifierException], do_error);
end;
function TQtWidgetSet.SetComboMinDropDownSize(Handle: HWND; MinItemsWidth, MinItemsHeight, MinItemCount: integer): boolean;
var
ACombo: QComboBoxH;
AView: QAbstractItemViewH;
begin
Result := False;
if not IsValidHandle(Handle) then
exit;
ACombo := QComboBoxH(TQtComboBox(Handle).Widget);
AView := QListWidgetH(QComboBox_view(ACombo));
if Assigned(AView) then
begin
QWidget_setMinimumWidth(AView, MinItemsWidth);
QWidget_setMinimumHeight(AView, MinItemsHeight);
QComboBox_setMaxVisibleItems(ACombo, MinItemCount);
Result := True;
end;
end;
procedure TQtWidgetSet.SetRubberBandRect(const ARubberBand: HWND; const ARect: TRect);
begin
if ARubberBand = 0 then

View File

@ -73,6 +73,7 @@ procedure RemovePipeEventHandler(var AHandler: PPipeEventHandler); override;
procedure RemoveProcessEventHandler(var AHandler: PProcessEventHandler); override;
procedure SetEventHandlerFlags(AHandler: PEventHandler; NewFlags: dword); override;
function SetComboMinDropDownSize(Handle: HWND; MinItemsWidth, MinItemsHeight, MinItemCount: integer): boolean; override;
procedure SetRubberBandRect(const ARubberBand: HWND; const ARect: TRect); override;
function TextUTF8Out(DC: HDC; X, Y: Integer; Str: PChar; Count: Longint): Boolean; override;