diff --git a/lcl/interfaces/qt/qtobjects.pas b/lcl/interfaces/qt/qtobjects.pas index aa8a0dd85e..6758479a76 100644 --- a/lcl/interfaces/qt/qtobjects.pas +++ b/lcl/interfaces/qt/qtobjects.pas @@ -284,19 +284,31 @@ type { TQtPixmap } TQtPixmap = class(TObject) - private - public - Handle: QPixmapH; + protected + FHandle: QPixmapH; public constructor Create(p1: PSize); virtual; destructor Destroy; override; public - procedure grabWindow(p1: Cardinal; x: Integer = 0; y: Integer = 0; w: Integer = -1; h: Integer = -1); + property Handle: QPixmapH read FHandle; + procedure grabWindow(p1: Cardinal; x: Integer = 0; y: Integer = 0; w: Integer = -1; h: Integer = -1); procedure toImage(retval: QImageH); class procedure fromImage(retval: QPixmapH; image: QImageH; flags: QtImageConversionFlags = QtAutoColor); end; + { TQtIcon } + + TQtIcon = class(TObject) + protected + FHandle: QIconH; + public + constructor Create; + destructor Destroy; override; + public + property Handle: QIconH read FHandle; + end; + { TQtSystemTrayIcon } TQtSystemTrayIcon = class(TObject) @@ -1743,24 +1755,25 @@ end; constructor TQtPixmap.Create(p1: PSize); begin - Handle := QPixmap_create(p1); + FHandle := QPixmap_create(p1); end; destructor TQtPixmap.Destroy; begin - if handle <> nil then QPixmap_destroy(handle); + if FHandle <> nil then + QPixmap_destroy(FHandle); inherited Destroy; end; procedure TQtPixmap.grabWindow(p1: Cardinal; x: Integer; y: Integer; w: Integer; h: Integer); begin - QPixmap_grabWindow(Handle, p1, x, y, w, h); + QPixmap_grabWindow(FHandle, p1, x, y, w, h); end; procedure TQtPixmap.toImage(retval: QImageH); begin - QPixmap_toImage(Handle, retval); + QPixmap_toImage(FHandle, retval); end; class procedure TQtPixmap.fromImage(retval: QPixmapH; image: QImageH; flags: QtImageConversionFlags = QtAutoColor); @@ -2104,5 +2117,20 @@ begin end; end; +{ TQtIcon } + +constructor TQtIcon.Create; +begin + FHandle := QIcon_create(); +end; + +destructor TQtIcon.Destroy; +begin + if FHandle <> nil then + QIcon_destroy(FHandle); + + inherited Destroy; +end; + end. diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index 40a9ea02cc..b43ee01054 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -95,9 +95,6 @@ type procedure Activate; procedure BringToFront; procedure OffsetMousePos(APoint: PQtPoint); virtual; - procedure SetColor(const Value: PQColor); virtual; - procedure SetTextColor(const Value: PQColor); virtual; - procedure SetCursor(const ACursor: QCursorH); virtual; procedure Update(ARect: PRect = nil); procedure Repaint(ARect: PRect = nil); procedure setWindowTitle(Str: PWideString); @@ -115,17 +112,23 @@ type procedure grabMouse; function hasFocus: Boolean; procedure releaseMouse; + procedure setColor(const Value: PQColor); virtual; + procedure setCursor(const ACursor: QCursorH); virtual; procedure setEnabled(p1: Boolean); procedure setGeometry(ARect: TRect); overload; - procedure setVisible(visible: Boolean); virtual; - procedure setWindowModality(windowModality: QtWindowModality); + procedure setMaximumSize(AWidth, AHeight: Integer); + procedure setMinimumSize(AWidth, AHeight: Integer); procedure setParent(parent: QWidgetH); virtual; + procedure setTextColor(const Value: PQColor); virtual; + procedure setVisible(visible: Boolean); virtual; procedure setWindowFlags(_type: QtWindowFlags); - function windowFlags: QtWindowFlags; + procedure setWindowIcon(AIcon: QIconH); + procedure setWindowModality(windowModality: QtWindowModality); procedure setWidth(p1: Integer); procedure setHeight(p1: Integer); procedure setTabOrder(p1, p2: TQtWidget); procedure setWindowState(AState: QtWindowStates); + function windowFlags: QtWindowFlags; function windowModality: QtWindowModality; property Props[AnIndex:String]:pointer read GetProps write SetProps; @@ -1832,6 +1835,16 @@ begin QWidget_setGeometry(Widget, @ARect); end; +procedure TQtWidget.setMaximumSize(AWidth, AHeight: Integer); +begin + QWidget_setMaximumSize(Widget, AWidth, AHeight); +end; + +procedure TQtWidget.setMinimumSize(AWidth, AHeight: Integer); +begin + QWidget_setMinimumSize(Widget, AWidth, AHeight); +end; + procedure TQtWidget.setVisible(visible: Boolean); begin QWidget_setVisible(Widget, visible); @@ -1857,6 +1870,11 @@ begin QWidget_setWindowFlags(Widget, _type); end; +procedure TQtWidget.setWindowIcon(AIcon: QIconH); +begin + QWidget_setWindowIcon(Widget, AIcon); +end; + function TQtWidget.windowFlags: QtWindowFlags; begin Result := QWidget_windowFlags(Widget); diff --git a/lcl/interfaces/qt/qtwscontrols.pp b/lcl/interfaces/qt/qtwscontrols.pp index c817d6a782..dce0dfbfbe 100644 --- a/lcl/interfaces/qt/qtwscontrols.pp +++ b/lcl/interfaces/qt/qtwscontrols.pp @@ -94,7 +94,7 @@ type const AOldPos, ANewPos: Integer; const AChildren: TFPList); override;} - //class procedure ConstraintsChange(const AWinControl: TWinControl); override; + class procedure ConstraintsChange(const AWinControl: TWinControl); override; end; { TQtWSGraphicControl } @@ -334,6 +334,18 @@ begin end; end; +class procedure TQtWSWinControl.ConstraintsChange(const AWinControl: TWinControl); +var + Widget: TQtWidget; +begin + Widget := TQtWidget(AWinControl.Handle); + with AWinControl do + begin + Widget.setMinimumSize(Constraints.MinWidth, Constraints.MinHeight); + Widget.setMaximumSize(Constraints.MaxWidth, Constraints.MaxHeight); + end; +end; + {------------------------------------------------------------------------------ Method: TQtWSWinControl.SetBounds Params: AWinControl - the calling object