-Removed unneeded code from QEventResize

*Some extra statusBar code removed, we must find why it isn't visible
 until parent form resized for the first time.

git-svn-id: trunk@11641 -
This commit is contained in:
zeljko 2007-07-26 22:04:43 +00:00
parent 49096e2c1d
commit 56e56e0914
2 changed files with 13 additions and 45 deletions

View File

@ -1085,29 +1085,7 @@ begin
QEventMouseButtonDblClick: SlotMouse(Event);
QEventMouseMove: SlotMouseMove(Event);
QEventWheel: SlotMouseWheel(Event);
QEventResize:
begin
SlotResize;
if (Self is TQtMainWindow) and
Assigned(TQtMainWindow(Self).MenuBar) and
Assigned(TCustomForm(LCLObject).Menu) then
begin
w := nil;
if TQtMainWindow(Self).IsMainForm then
w := QMainWindow_menuWidget(QMainWindowH(Widget));
if w = nil then
begin
MenuRect := TQtMainWindow(Self).MenuBar.getGeometry;
QWidget_rect(Widget, @FormRect);
if MenuRect.Right <> FormRect.Right then
begin
MenuRect.Right := FormRect.Right;
TQtMainWindow(Self).MenuBar.setGeometry(MenuRect);
end;
end;
end;
end;
QEventResize: SlotResize;
QEventPaint: SlotPaint(Event);
QEventContextMenu: SlotContextMenu;
else

View File

@ -22,7 +22,7 @@
}
unit QtWSComCtrls;
{$mode delphi}{$H+}
{$mode objfpc}{$H+}
interface
@ -35,7 +35,7 @@ uses
{$endif}
qtwidgets, qtprivate, qtobjects,
// LCL
Classes, ComCtrls, Controls, LCLType, Graphics, LCLProc, LCLIntf, Forms,
SysUtils, Classes, Types, ComCtrls, Controls, LCLType, Graphics, LCLProc, LCLIntf, Forms,
// Widgetset
WSProc, WSComCtrls, WSLCLClasses;
@ -54,7 +54,6 @@ type
class procedure Update(const AStatusBar: TStatusBar); override;
class procedure GetPreferredSize(const AWinControl: TWinControl;
var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); override;
class procedure AddControl(const AControl: TControl); override;
end;
{ TQtWSTabSheet }
@ -307,7 +306,7 @@ begin
Color:=ColorToRGB(AWinControl.Color);
// Fill QColor
QColor_setRgb(@QColor,Red(Color),Green(Color),Blue(Color));
QColor_setRgb(QColorH(@QColor),Red(Color),Green(Color),Blue(Color));
// Set color of the widget to QColor
TQtAbstractButton(AWinControl.Handle).SetColor(@QColor);
@ -344,7 +343,7 @@ begin
Color:=ColorToRGB(AWinControl.Color);
// Fill QColor
QColor_setRgb(@QColor,Red(Color),Green(Color),Blue(Color));
QColor_setRgb(QColorH(@QColor),Red(Color),Green(Color),Blue(Color));
// Set color of the widget to QColor
TQtToolBar(AWinControl.Handle).SetColor(@QColor);
@ -523,12 +522,12 @@ begin
// QWidget_setContentsMargins(QtStatusBar.APanels[i], 0, 0, 2, 0);
QWidget_frameGeometry(QtStatusBar.Widget, @R);
QWidget_geometry(QtStatusBar.Widget, @R);
QWidget_setGeometry(QtStatusBar.APanels[i], 0, 0, TStatusBar(AWinControl).Panels[i].Width, R.Bottom);
QStatusBar_addWidget(QStatusBarH(QtStatusBar.Widget),QtStatusBar. APanels[i], 100);
end;
end;
// Return handle
Result := THandle(QtStatusBar);
@ -695,24 +694,15 @@ end;
class procedure TQtWSStatusBar.GetPreferredSize(const AWinControl: TWinControl;
var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean);
begin
end;
class procedure TQtWSStatusBar.AddControl(const AControl: TControl);
var
QtStatusBar: TQtStatusBar;
PrefSize: TSize;
begin
inherited AddControl(AControl);
{some systems doesn't show statusbar inside mainwindow
(linux tested on FC3,FC4,FC7,Ubuntu 7.04 ).}
if Assigned(AControl.Parent)
and (AControl.Parent.Handle = Application.MainForm.Handle)
then
QWidget_sizeHint(TQtStatusBar(AWinControl.Handle).Widget, @PrefSize);
if (PrefSize.cx >= 0)
and (PrefSize.cy >=0) then
begin
QtStatusBar := TQtStatusBar(TWinControl(AControl).Handle);
QMainWindow_setStatusBar(QMainWindowH(TQtMainWindow(AControl.Parent.Handle).Widget), QStatusBarH(QtStatusBar.Widget));
PreferredWidth := PrefSize.cx;
PreferredHeight := PrefSize.cy;
end;
end;