mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 16:40:32 +02:00
Qt: Removed focuspolicy workarounds, TQtPrinter is now TObject instead of TQtObject, workaround for pushbutton autosizes on macosx caused by qt43,qt44 fontmetrics bug.
git-svn-id: trunk@17323 -
This commit is contained in:
parent
d2912fb92b
commit
ac5664685a
@ -292,26 +292,6 @@ var
|
||||
begin
|
||||
Result := False;
|
||||
case QEvent_type(Event) of
|
||||
{$IFNDEF DARWIN}
|
||||
QEventFocusIn:
|
||||
begin
|
||||
if QObject_isWidgetType(Sender) then
|
||||
begin
|
||||
if QWidget_focusPolicy(QWidgetH(Sender)) = QtTabFocus then
|
||||
begin
|
||||
// remove tab from focus policy
|
||||
{$ifdef VerboseTabbedControls}
|
||||
WriteLn('found Taabed widget ', PtrUInt(Sender));
|
||||
{$endif}
|
||||
QWidget_setFocusPolicy(QWidgetH(Sender), QtClickFocus);
|
||||
if FOldFocusWidget <> nil then
|
||||
QWidget_setFocus(FOldFocusWidget);
|
||||
end
|
||||
else
|
||||
FOldFocusWidget := QWidgetH(Sender);
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
LCLQt_Destroy:
|
||||
begin
|
||||
AObject := TQtObject(Pointer(QLCLMessageEvent_getWParam(QLCLMessageEventH(Event))));
|
||||
|
@ -476,7 +476,7 @@ type
|
||||
|
||||
{ TQtPrinter }
|
||||
|
||||
TQtPrinter = class(TQtObject)
|
||||
TQtPrinter = class(TObject)
|
||||
protected
|
||||
FHandle: QPrinterH;
|
||||
FPrinterContext: TQtDeviceContext;
|
||||
@ -522,7 +522,7 @@ type
|
||||
procedure setNumCopies(const AValue: Integer);
|
||||
function getPrinterState: QPrinterPrinterState;
|
||||
public
|
||||
constructor Create; override;
|
||||
constructor Create; virtual;
|
||||
destructor Destroy; override;
|
||||
|
||||
procedure beginDoc;
|
||||
@ -2981,7 +2981,6 @@ end;
|
||||
|
||||
constructor TQtPrinter.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
FPrinterActive := False;
|
||||
FHandle := QPrinter_create();
|
||||
end;
|
||||
|
@ -1354,7 +1354,7 @@ begin
|
||||
if (LCLObject <> nil) and not (Self is TQtMainWindow) then
|
||||
begin
|
||||
if LCLObject.TabStop then
|
||||
setFocusPolicy(QtClickFocus)
|
||||
setFocusPolicy(QtStrongFocus)
|
||||
else
|
||||
setFocusPolicy(QtNoFocus);
|
||||
end;
|
||||
@ -1397,7 +1397,7 @@ begin
|
||||
if (LCLObject <> nil) and not (Self is TQtMainWindow) then
|
||||
begin
|
||||
if LCLObject.TabStop then
|
||||
setFocusPolicy(QtClickFocus)
|
||||
setFocusPolicy(QtStrongFocus)
|
||||
else
|
||||
setFocusPolicy(QtNoFocus);
|
||||
end;
|
||||
@ -3791,6 +3791,13 @@ begin
|
||||
AMetrics := QFontMetrics_create(QWidget_font(Widget));
|
||||
PreferredWidth := QFontMetrics_width(AMetrics, @W, -1);
|
||||
PreferredHeight := QFontMetrics_height(AMetrics);
|
||||
{$note there's a bug with QFontMetrics_width() & QFontMetrics_height()
|
||||
on MacOSX (qt-4.3,qt-4.4)
|
||||
so we must increase PrefW & PrefH for some reasonable value.}
|
||||
{$IFDEF DARWIN}
|
||||
PreferredWidth := PreferredWidth + (PreferredWidth div 4);
|
||||
PreferredHeight := PreferredHeight + (PreferredHeight div 2);
|
||||
{$ENDIF}
|
||||
QFontMetrics_destroy(AMetrics);
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user