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:
zeljko 2008-11-10 18:28:23 +00:00
parent d2912fb92b
commit ac5664685a
3 changed files with 11 additions and 25 deletions

View File

@ -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))));

View File

@ -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;

View File

@ -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;