From 05b9d41eaf34aaaf6040b7d516c0f47391342351 Mon Sep 17 00:00:00 2001 From: paul Date: Tue, 10 Jul 2007 06:01:58 +0000 Subject: [PATCH] QT: - cleanup (remove unused variables) - implemented AppMinimize, AppRestore, AppBringToFront git-svn-id: trunk@11454 - --- lcl/interfaces/qt/qtint.pp | 1 + lcl/interfaces/qt/qtobject.inc | 10 +++++++++- lcl/interfaces/qt/qtobjects.pas | 12 ++--------- lcl/interfaces/qt/qtprivate.pp | 8 ++------ lcl/interfaces/qt/qtthemes.pas | 2 +- lcl/interfaces/qt/qtwidgets.pas | 33 ++++++++++++++++++++----------- lcl/interfaces/qt/qtwinapi.inc | 9 +-------- lcl/interfaces/qt/qtwscomctrls.pp | 11 +++++------ lcl/interfaces/qt/qtwscontrols.pp | 1 - lcl/interfaces/qt/qtwsdialogs.pp | 1 - lcl/interfaces/qt/qtwsspin.pp | 3 ++- lcl/interfaces/qt/qtwsstdctrls.pp | 11 +++++------ 12 files changed, 49 insertions(+), 53 deletions(-) diff --git a/lcl/interfaces/qt/qtint.pp b/lcl/interfaces/qt/qtint.pp index 3ad0c24221..a06fed0c0a 100644 --- a/lcl/interfaces/qt/qtint.pp +++ b/lcl/interfaces/qt/qtint.pp @@ -65,6 +65,7 @@ type procedure AppProcessMessages; override; procedure AppTerminate; override; procedure AppMinimize; override; + procedure AppRestore; override; procedure AppBringToFront; override; // procedure AppSetTitle(const ATitle: string); override; public diff --git a/lcl/interfaces/qt/qtobject.inc b/lcl/interfaces/qt/qtobject.inc index 98e7fcb5bf..3ca81b3a57 100644 --- a/lcl/interfaces/qt/qtobject.inc +++ b/lcl/interfaces/qt/qtobject.inc @@ -142,12 +142,20 @@ end; procedure TQtWidgetSet.AppMinimize; begin + if (Application.MainForm <> nil) and (Application.MainForm.HandleAllocated) then + TQtMainWindow(Application.MainForm.Handle).ShowMinimized; +end; +procedure TQtWidgetSet.AppRestore; +begin + if (Application.MainForm <> nil) and (Application.MainForm.HandleAllocated) then + TQtMainWindow(Application.MainForm.Handle).ShowNormal; end; procedure TQtWidgetSet.AppBringToFront; begin - + if (Application.MainForm <> nil) and (Application.MainForm.HandleAllocated) then + TQtMainWindow(Application.MainForm.Handle).BringToFront; end; function TQtWidgetSet.CreateThemeServices: TThemeServices; diff --git a/lcl/interfaces/qt/qtobjects.pas b/lcl/interfaces/qt/qtobjects.pas index db1a07b2a5..534f4ee78b 100644 --- a/lcl/interfaces/qt/qtobjects.pas +++ b/lcl/interfaces/qt/qtobjects.pas @@ -714,15 +714,13 @@ end; Returns: Nothing ------------------------------------------------------------------------------} constructor TQtPen.Create(CreateHandle: Boolean); -var - MyColor: TQColor; begin - {$ifdef VerboseQt} WriteLn('TQtPen.Create CreateHandle: ', dbgs(CreateHandle)); {$endif} - if CreateHandle then Widget := QPen_create; + if CreateHandle then + Widget := QPen_create; end; {------------------------------------------------------------------------------ @@ -938,7 +936,6 @@ end; procedure TQtDeviceContext.DebugClipRect(const msg: string); var Rgn: QRegionH; - R: TRect; ok: boolean; begin ok := QPainter_hasClipping(Widget); @@ -987,8 +984,6 @@ end; (x: 0 y: 0 w: 50 h: 50) ------------------------------------------------------------------------------} procedure TQtDeviceContext.CorrectCoordinates(var ARect: TRect); -var - Buffer: Integer; begin if ARect.Left < 0 then ARect.Left := 0; @@ -1487,9 +1482,6 @@ end; { TQtButtonGroup } constructor TQtButtonGroup.Create(AParent: QObjectH); -var - Hook: QObject_hookH; - Method: TMethod; begin inherited Create; diff --git a/lcl/interfaces/qt/qtprivate.pp b/lcl/interfaces/qt/qtprivate.pp index 9fb99ee0e6..7286bb5e97 100644 --- a/lcl/interfaces/qt/qtprivate.pp +++ b/lcl/interfaces/qt/qtprivate.pp @@ -193,8 +193,6 @@ end; Contructor for the class. ------------------------------------------------------------------------------} constructor TQtListStrings.Create(ListWidgetH: QListWidgetH; TheOwner: TWinControl); -var - i: Integer; begin inherited Create; @@ -475,8 +473,8 @@ end; Clears all. ------------------------------------------------------------------------------} procedure TQtMemoStrings.Clear; -var - Mess: TLMessage; +{var + Mess: TLMessage;} begin FUpdating := True; FStringList.Clear; @@ -607,8 +605,6 @@ begin end; constructor TQtComboStrings.Create(ComboBoxH: QComboBoxH; TheOwner: TWinControl); -var - i: Integer; begin inherited Create; diff --git a/lcl/interfaces/qt/qtthemes.pas b/lcl/interfaces/qt/qtthemes.pas index 166cc15931..7b291d8295 100644 --- a/lcl/interfaces/qt/qtthemes.pas +++ b/lcl/interfaces/qt/qtthemes.pas @@ -116,7 +116,7 @@ var opt: QStyleOptionH; ARect: QRectH; Element: TQtDrawElement; - QVariant: QVariantH; + //QVariant: QVariantH; Features: QStyleOptionButtonButtonFeatures; begin if (Context <> nil) then diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index bc7b94d357..5bbebc5cdd 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -174,6 +174,10 @@ type function EventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl; override; procedure SlotWindowStateChange; cdecl; procedure setShowInTaskBar(AValue: Boolean); + public + procedure BringToFront; + procedure ShowMinimized; + procedure ShowNormal; end; { TQtStaticText } @@ -2000,10 +2004,8 @@ end; function TQtMainWindow.CreateWidget(const AParams: TCreateParams): QWidgetH; var w: QWidgetH; - r: TRect; {$ifdef USE_QT_4_3} mdihandle: QMdiAreaH; - toolbar: QToolBarH; {$endif} begin // Creates the widget @@ -2258,11 +2260,26 @@ begin end; end; +procedure TQtMainWindow.BringToFront; +begin + QWidget_activateWindow(Widget); + QWidget_raise(Widget); +end; + +procedure TQtMainWindow.ShowMinimized; +begin + QWidget_showMinimized(Widget); +end; + +procedure TQtMainWindow.ShowNormal; +begin + QWidget_showNormal(Widget); +end; + { TQtStaticText } function TQtStaticText.CreateWidget(const AParams: TCreateParams): QWidgetH; var - Str: WideString; Parent: QWidgetH; begin // Creates the widget @@ -2373,7 +2390,6 @@ end; function TQtCheckBox.CreateWidget(const AParams: TCreateParams): QWidgetH; var - Str: WideString; Parent: QWidgetH; begin // Creates the widget @@ -2397,7 +2413,6 @@ begin Parent := TQtWidget(LCLObject.Parent.Handle).GetContainerWidget; Result := QCheckBox_create(Parent); end; - end; procedure TQtCheckBox.SetGeometry; @@ -2474,7 +2489,6 @@ end; function TQtRadioButton.CreateWidget(const AParams: TCreateParams): QWidgetH; var - Str: WideString; Parent: QWidgetH; begin // Creates the widget @@ -2551,8 +2565,6 @@ end; function TQtGroupBox.CreateWidget(const AParams: TCreateParams): QWidgetH; var Parent: QWidgetH; - R: TRect; - Method: TMethod; begin // Creates the widget {$ifdef VerboseQt} @@ -3495,8 +3507,7 @@ end; procedure TQtAbstractSpinBox.SignalEditingFinished; cdecl; var - Msg: TLMessage; - s: WideString; + Msg: TLMessage; begin {$ifdef VerboseQt} WriteLn('TQtAbstractSpinBox.SignalEditingFinished'); @@ -4047,7 +4058,6 @@ var Msg: TLMNotify; NMLV: TNMListView; AParent: QTreeWidgetItemH; - AIndex: Integer; ASubIndex: Integer; begin @@ -4278,7 +4288,6 @@ end; function TQtProgressBar.CreateWidget(const AParams: TCreateParams): QWidgetH; var Parent: QWidgetH; - Text: WideString; begin // Creates the widget {$ifdef VerboseQt} diff --git a/lcl/interfaces/qt/qtwinapi.inc b/lcl/interfaces/qt/qtwinapi.inc index 188093b94c..9d6b938e49 100644 --- a/lcl/interfaces/qt/qtwinapi.inc +++ b/lcl/interfaces/qt/qtwinapi.inc @@ -816,7 +816,6 @@ function TQtWidgetSet.ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; var WideStr: WideString; - Painter: QPainterH; begin {$ifdef VerboseQtWinAPI} WriteLn('[WinAPI ExtTextOut]'); @@ -1211,7 +1210,7 @@ end; function TQtWidgetSet.GetObject(GDIObj: HGDIOBJ; BufSize: Integer; Buf: Pointer): Integer; var aObject: TObject; - NumColors, Width, Height: Longint; + Width, Height: Longint; BitmapSection : TDIBSECTION; {$ifdef VerboseQtWinAPI} ObjType: string; @@ -2248,8 +2247,6 @@ end; ------------------------------------------------------------------------------} function TQtWidgetSet.InvalidateRect(aHandle: HWND; Rect: pRect; bErase: Boolean): Boolean; -var - R: TRect; begin {$ifdef VerboseQtWinAPI} WriteLn('[WinAPI Invalidate Rect]'); @@ -2622,8 +2619,6 @@ end; ------------------------------------------------------------------------------} function TQtWidgetSet.SetBKColor(DC: HDC; Color: TColorRef): TColorRef; -var - Brush: TQtBrush; begin {$ifdef VerboseQtWinAPI} WriteLn('Trace:> [WinAPI SetBkColor]', @@ -2716,8 +2711,6 @@ end; ------------------------------------------------------------------------------} function TQtWidgetSet.SetFocus(hWnd: HWND): HWND; -var - Widget: QWidgetH; begin if hwnd<>0 then begin diff --git a/lcl/interfaces/qt/qtwscomctrls.pp b/lcl/interfaces/qt/qtwscomctrls.pp index 86de78219a..11c61b2ba1 100644 --- a/lcl/interfaces/qt/qtwscomctrls.pp +++ b/lcl/interfaces/qt/qtwscomctrls.pp @@ -654,7 +654,6 @@ class procedure TQtWSStatusBar.PanelUpdate(const AStatusBar: TStatusBar; PanelIn var QtStatusBar: TQtStatusBar; Str: Widestring; - R: TRect; i: Integer; begin QtStatusBar := TQtStatusBar(AStatusBar.Handle); @@ -946,7 +945,6 @@ class procedure TQtWSCustomListView.ColumnSetAlignment(const ALV: TCustomListVie var TW: QTreeWidgetH; TWI: QTreeWidgetItemH; - TWIChild: QTreeWidgetItemH; FAlign: QtAlignment; begin @@ -1075,7 +1073,8 @@ var TWI: QTreeWidgetItemH; begin TW := QTreeWidgetH(TQtTreeWidget(ALV.Handle).Widget); - QTreeWidget_takeTopLevelItem(TW, AIndex); + TWI := QTreeWidget_takeTopLevelItem(TW, AIndex); + {$note implement} end; {------------------------------------------------------------------------------ @@ -1153,14 +1152,13 @@ class procedure TQtWSCustomListView.ItemSetChecked(const ALV: TCustomListView; c var TW: QTreeWidgetH; TWI: QTreeWidgetItemH; - AState: QtCheckState; begin TW := QTreeWidgetH(TQtTreeWidget(ALV.Handle).Widget); TWI := QTreeWidget_topLevelItem(TW, AIndex); if AChecked then - QTreeWidgetItem_setCheckState(TWI, 0, QtChecked) + QTreeWidgetItem_setCheckState(TWI, 0, QtChecked) else - QTreeWidgetItem_setCheckState(TWI, 0, QtUnChecked); + QTreeWidgetItem_setCheckState(TWI, 0, QtUnChecked); end; {------------------------------------------------------------------------------ @@ -1354,6 +1352,7 @@ begin TW := QTreeWidgetH(TQtTreeWidget(ALV.Handle).Widget); if AType <> stNone then begin + {$note implement} // QTreeWidget_setSortingEnabled(TW, True); // QTreeView_sortByColumn(QTreeViewH(TW), AColumn); end; diff --git a/lcl/interfaces/qt/qtwscontrols.pp b/lcl/interfaces/qt/qtwscontrols.pp index 3ed0946bcf..fe6a1f8260 100644 --- a/lcl/interfaces/qt/qtwscontrols.pp +++ b/lcl/interfaces/qt/qtwscontrols.pp @@ -132,7 +132,6 @@ class function TQtWSCustomControl.CreateHandle(const AWinControl: TWinControl; var QtAbstractScrollArea: TQtAbstractScrollArea; Method: TMethod; - AHook : QAbstractScrollArea_hookH; Hook: QObject_hookH; begin {$ifdef VerboseQt} diff --git a/lcl/interfaces/qt/qtwsdialogs.pp b/lcl/interfaces/qt/qtwsdialogs.pp index 8ac2005669..171243ffd1 100644 --- a/lcl/interfaces/qt/qtwsdialogs.pp +++ b/lcl/interfaces/qt/qtwsdialogs.pp @@ -155,7 +155,6 @@ var Parent: QWidgetH; ReturnList: QStringListH; ParserState, Position, i: Integer; - Strings: TStringList; begin {------------------------------------------------------------------------------ Initialization of variables diff --git a/lcl/interfaces/qt/qtwsspin.pp b/lcl/interfaces/qt/qtwsspin.pp index ee01950a5a..e5be988a4d 100644 --- a/lcl/interfaces/qt/qtwsspin.pp +++ b/lcl/interfaces/qt/qtwsspin.pp @@ -191,12 +191,13 @@ end; class function TQtWSCustomFloatSpinEdit.GetText(const AWinControl: TWinControl; var AText: String): Boolean; begin - + {$note implement} end; class procedure TQtWSCustomFloatSpinEdit.SetText(const AWinControl: TWinControl; const AText: string); begin // perhaps QSpinBox_setSuffix() goes here one day (if we get LCL support) + {$note implement} end; class procedure TQtWSCustomFloatSpinEdit.SetReadOnly(const ACustomEdit: TCustomEdit; NewReadOnly: boolean); diff --git a/lcl/interfaces/qt/qtwsstdctrls.pp b/lcl/interfaces/qt/qtwsstdctrls.pp index 62b0e8db56..bd3128fb3b 100644 --- a/lcl/interfaces/qt/qtwsstdctrls.pp +++ b/lcl/interfaces/qt/qtwsstdctrls.pp @@ -526,7 +526,10 @@ var ListWidgetH: QListWidgetH; begin if not Assigned(TQtListWidget(ACustomListBox.Handle).FList) then - TQtListWidget(ACustomListBox.Handle).FList := TQtListStrings.Create(ListWidgetH, ACustomListBox); + begin + ListWidgetH := QListWidgetH(TQtListWidget(ACustomListBox.Handle).Widget); + TQtListWidget(ACustomListBox.Handle).FList := TQtListStrings.Create(ListWidgetH, ACustomListBox); + end; Result := TQtListWidget(ACustomListBox.Handle).FList; end; @@ -764,8 +767,6 @@ class function TQtWSCustomEdit.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND; var QtLineEdit: TQtLineEdit; - QColor: TQColor; - Color: TColor; Method: TMethod; Hook : QLineEdit_hookH; begin @@ -1428,8 +1429,6 @@ var QtComboBox: TQtComboBox; Method: TMethod; Hook : QObject_hookH; - QColor: TQColor; - Color: TColor; begin QtComboBox := TQtComboBox.Create(AWinControl, AParams); @@ -1453,7 +1452,7 @@ begin QComboBox_currentIndexChanged_Event(Method) := QtComboBox.SlotSelect; QComboBox_hook_hook_currentIndexChanged( - QComboBox_hook_create(QtComboBox.Widget), Method); + QComboBox_hook_create(QtComboBox.Widget), Method); Result := THandle(QtComboBox); end;