mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 20:40:56 +02:00
(Qt): workaround for adding items into combobox on DropDown event
git-svn-id: trunk@11646 -
This commit is contained in:
parent
e186a969f2
commit
5f5b46fe5d
@ -597,8 +597,10 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCustomComboBox.SetDropDownCount(const AValue: Integer);
|
||||
begin
|
||||
FDropDownCount:=AValue;
|
||||
FDropDownCount := AValue;
|
||||
// ToDo
|
||||
if (HandleAllocated) then
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetDropDownCount(Self, AValue);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -455,9 +455,11 @@ type
|
||||
procedure SetColor(const Value: PQColor); override;
|
||||
function currentIndex: Integer;
|
||||
function getEditable: Boolean;
|
||||
function getMaxVisibleItems: Integer;
|
||||
procedure insertItem(AIndex: Integer; AText: String); overload;
|
||||
procedure insertItem(AIndex: Integer; AText: PWideString); overload;
|
||||
procedure setCurrentIndex(index: Integer);
|
||||
procedure setMaxVisibleItems(ACount: Integer);
|
||||
procedure setEditable(AValue: Boolean);
|
||||
procedure removeItem(AIndex: Integer);
|
||||
|
||||
@ -4007,6 +4009,11 @@ begin
|
||||
Result := QComboBox_isEditable(QComboBoxH(Widget));
|
||||
end;
|
||||
|
||||
function TQtComboBox.getMaxVisibleItems: Integer;
|
||||
begin
|
||||
Result := QComboBox_maxVisibleItems(QComboboxH(Widget));
|
||||
end;
|
||||
|
||||
procedure TQtComboBox.insertItem(AIndex: Integer; AText: String);
|
||||
var
|
||||
Str: WideString;
|
||||
@ -4016,8 +4023,19 @@ begin
|
||||
end;
|
||||
|
||||
procedure TQtComboBox.insertItem(AIndex: Integer; AText: PWideString);
|
||||
var
|
||||
maxCount, itemHeight: Integer;
|
||||
R: TRect;
|
||||
begin
|
||||
QComboBox_insertItem(QComboBoxH(WIdget), AIndex, AText, QVariant_create());
|
||||
maxCount := getMaxVisibleItems;
|
||||
if QWidget_isVisible(DropList) then
|
||||
begin
|
||||
BeginUpdate;
|
||||
QComboBox_hidePopup(QComboboxH(Widget));
|
||||
QComboBox_showPopup(QComboboxH(Widget));
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -4030,6 +4048,11 @@ begin
|
||||
QComboBox_setCurrentIndex(QComboBoxH(Widget), index);
|
||||
end;
|
||||
|
||||
procedure TQtComboBox.setMaxVisibleItems(ACount: Integer);
|
||||
begin
|
||||
QComboBox_setMaxVisibleItems(QComboboxH(Widget), ACount);
|
||||
end;
|
||||
|
||||
procedure TQtComboBox.setEditable(AValue: Boolean);
|
||||
begin
|
||||
QComboBox_setEditable(QComboBoxH(Widget), AValue);
|
||||
@ -4141,6 +4164,9 @@ const
|
||||
var
|
||||
Message : TLMCommand;
|
||||
begin
|
||||
if InUpdate then
|
||||
Exit;
|
||||
|
||||
FillChar(Message, SizeOf(Message), 0);
|
||||
Message.Msg := CN_COMMAND;
|
||||
Message.NotifyCode := VisibilityToCodeMap[AVisible];
|
||||
|
@ -91,6 +91,7 @@ type
|
||||
|
||||
class procedure SetArrowKeysTraverseList(const ACustomComboBox: TCustomComboBox;
|
||||
NewTraverseList: boolean); virtual;
|
||||
class procedure SetDropDownCount(const ACustomComboBox: TCustomComboBox; NewCount: Integer); override;
|
||||
class procedure SetSelStart(const ACustomComboBox: TCustomComboBox; NewStart: integer); override;
|
||||
class procedure SetSelLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); override;
|
||||
class procedure SetItemIndex(const ACustomComboBox: TCustomComboBox; NewIndex: integer); override;
|
||||
@ -1403,6 +1404,12 @@ begin
|
||||
// TODO: implement me ???
|
||||
end;
|
||||
|
||||
class procedure TQtWSCustomComboBox.SetDropDownCount(
|
||||
const ACustomComboBox: TCustomComboBox; NewCount: Integer);
|
||||
begin
|
||||
TQtComboBox(ACustomComboBox.Handle).setMaxVisibleItems(NewCount);
|
||||
end;
|
||||
|
||||
class procedure TQtWSCustomComboBox.SetSelStart(
|
||||
const ACustomComboBox: TCustomComboBox; NewStart: integer);
|
||||
var
|
||||
|
@ -76,6 +76,7 @@ type
|
||||
|
||||
class procedure SetArrowKeysTraverseList(const ACustomComboBox: TCustomComboBox;
|
||||
NewTraverseList: boolean); virtual;
|
||||
class procedure SetDropDownCount(const ACustomComboBox: TCustomComboBox; NewCount: Integer); virtual;
|
||||
class procedure SetSelStart(const ACustomComboBox: TCustomComboBox; NewStart: integer); virtual;
|
||||
class procedure SetSelLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); virtual;
|
||||
class procedure SetItemIndex(const ACustomComboBox: TCustomComboBox; NewIndex: integer); virtual;
|
||||
@ -314,6 +315,11 @@ class procedure TWSCustomComboBox.SetArrowKeysTraverseList(
|
||||
begin
|
||||
end;
|
||||
|
||||
class procedure TWSCustomComboBox.SetDropDownCount(
|
||||
const ACustomComboBox: TCustomComboBox; NewCount: Integer);
|
||||
begin
|
||||
end;
|
||||
|
||||
class procedure TWSCustomComboBox.SetMaxLength(const ACustomComboBox: TCustomComboBox;
|
||||
NewLength: integer);
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user