- minor changes for menu
- cleanup

git-svn-id: trunk@12156 -
This commit is contained in:
paul 2007-09-24 07:49:58 +00:00
parent 0dc2093687
commit a22f679f0d
3 changed files with 24 additions and 9 deletions

View File

@ -155,6 +155,7 @@ type
procedure raiseWidget;
procedure resize(ANewWidth, ANewHeight: Integer);
procedure releaseMouse;
procedure setAttribute(const Attr: QtWidgetAttribute; const TurnOn: Boolean = True);
procedure setColor(const Value: PQColor); virtual;
procedure setCursor(const ACursor: QCursorH);
procedure setEnabled(p1: Boolean);
@ -2239,6 +2240,12 @@ begin
QWidget_releaseMouse(AGrabWidget);
end;
procedure TQtWidget.setAttribute(const Attr: QtWidgetAttribute;
const TurnOn: Boolean);
begin
QWidget_setAttribute(Widget, Attr, TurnOn);
end;
procedure TQtWidget.setEnabled(p1: Boolean);
begin
QWidget_setEnabled(Widget, p1);
@ -6415,7 +6422,7 @@ begin
FillChar(AParams, SizeOf(AParams), #0);
FViewPortWidget := TQtWidget.Create(LCLObject, AParams);
{$ifdef QtGraphicsSpeedUp}
QWidget_setAttribute(Widget, QtWA_OpaquePaintEvent);
setAttribute(QtWA_OpaquePaintEvent);
QWidget_setBackgroundRole(FViewPortWidget.Widget, QPaletteNoRole);
{$endif}
FViewPortWidget.AttachEvents;

View File

@ -145,8 +145,6 @@ class function TQtWSCustomForm.CreateHandle(const AWinControl: TWinControl;
var
QtMainWindow: TQtMainWindow;
Str: WideString;
R: TRect;
R1: TRect;
begin
{$ifdef VerboseQt}
WriteLn('[TQtWSCustomForm.CreateHandle] Height: ', IntToStr(AWinControl.Height),

View File

@ -222,7 +222,7 @@ begin
WriteLn('[TQtWSMenuItem.SetCaption] Caption: ' + AMenuItem.Caption + ' NewCaption: ', ACaption);
{$endif}
if not WSCheckMenuItem(AMenuItem, 'SetCaption') then
if not WSCheckMenuItem(AMenuItem, 'SetEnable') then
Exit;
Widget := TQtWidget(AMenuItem.Handle);
@ -243,7 +243,7 @@ begin
WriteLn('[TQtWSMenuItem.SetCaption] SetShortCut: ' + AMenuItem.Caption);
{$endif}
if not WSCheckMenuItem(AMenuItem, 'SetShortCut') then
if not WSCheckMenuItem(AMenuItem, 'SetEnable') then
Exit;
Widget := TQtWidget(AMenuItem.Handle);
@ -261,7 +261,7 @@ begin
{$ifdef VerboseQt}
WriteLn('[TQtWSMenuItem.SetVisible] SetShortCut: ' + AMenuItem.Caption + ' Visible: ', Visible);
{$endif}
if not WSCheckMenuItem(AMenuItem, 'SetVisible') then
if not WSCheckMenuItem(AMenuItem, 'SetEnable') then
Exit;
TQtMenu(AMenuItem.Handle).setVisible(Visible);
@ -276,7 +276,7 @@ class function TQtWSMenuItem.SetCheck(const AMenuItem: TMenuItem; const Checked:
begin
Result := False;
if not WSCheckMenuItem(AMenuItem, 'SetCheck') then
if not WSCheckMenuItem(AMenuItem, 'SetEnable') then
Exit;
TQtMenu(AMenuItem.Handle).setChecked(Checked);
@ -308,7 +308,15 @@ end;
------------------------------------------------------------------------------}
class function TQtWSMenuItem.SetRadioItem(const AMenuItem: TMenuItem; const RadioItem: boolean): boolean;
begin
Result := SetCheck(AMenuItem, AMenuItem.Checked);
Result := False;
if not WSCheckMenuItem(AMenuItem, 'SetEnable') then
Exit;
TQtMenu(AMenuItem.Handle).setCheckable(RadioItem);
SetCheck(AMenuItem, AMenuItem.Checked);
Result := True;
end;
{------------------------------------------------------------------------------
@ -318,9 +326,11 @@ end;
------------------------------------------------------------------------------}
class function TQtWSMenuItem.SetRightJustify(const AMenuItem: TMenuItem; const Justified: boolean): boolean;
begin
if not WSCheckMenuItem(AMenuItem, 'SetRightJustify') then
if not WSCheckMenuItem(AMenuItem, 'SetEnable') then
Exit;
// what should be done here? maybe this?
TQtMenu(AMenuItem.Handle).setAttribute(QtWA_RightToLeft, Justified);
Result := True;
end;