From 7439c8df1ee889e6aa0a73ac140cdc4b2cbfda19 Mon Sep 17 00:00:00 2001 From: zeljko Date: Tue, 17 Jul 2007 07:11:27 +0000 Subject: [PATCH] + Implemented multiselection in TFileDialogs * Fixed some compiler warnings, removed some unused variables. git-svn-id: trunk@11536 - --- lcl/interfaces/qt/qtwidgets.pas | 10 ++++------ lcl/interfaces/qt/qtwsdialogs.pp | 17 +++++++++++++++-- lcl/interfaces/qt/qtwsextctrls.pp | 4 ++-- lcl/interfaces/qt/qtwsspin.pp | 3 ++- lcl/interfaces/qt/qtwsstdctrls.pp | 3 --- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index 0b1796df48..eb25c65c95 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -1082,8 +1082,6 @@ end; message, you won�t be able to show a form twice. ------------------------------------------------------------------------------} procedure TQtWidget.SlotClose; cdecl; -var - Msg: TLMessage; begin {$ifdef VerboseQt} WriteLn('TQtWidget.SlotClose'); @@ -3840,7 +3838,6 @@ end; function TQtComboBox.CreateWidget(const AParams: TCreateParams): QWidgetH; var Parent: QWidgetH; - Str: WideString; begin // Creates the widget {$ifdef VerboseQt} @@ -4542,7 +4539,7 @@ begin NMLV.iItem := QTreeWidget_indexOfTopLevelItem(QTreeWidgetH(Widget), Item); NMLV.iSubItem := Column; - NMLV.uNewState := NM_KEYDOWN; + NMLV.uNewState := UINT(NM_KEYDOWN); NMLV.uChanged := LVIS_SELECTED; Msg.NMHdr := @NMLV.hdr; @@ -4574,7 +4571,7 @@ begin NMLV.iItem := QTreeWidget_indexOfTopLevelItem(QTreeWidgetH(Widget), Item); NMLV.iSubItem := Column; - NMLV.uNewState := NM_CLICK; + NMLV.uNewState := UINT(NM_CLICK); NMLV.uChanged := LVIS_SELECTED; QTreeWidget_visualItemRect(QTreeWidgetH(Widget), @R, Item); @@ -4610,7 +4607,7 @@ begin NMLV.iItem := QTreeWidget_indexOfTopLevelItem(QTreeWidgetH(Widget), Item); NMLV.iSubItem := Column; - NMLV.uNewState := NM_DBLCLK; + NMLV.uNewState := UINT(NM_DBLCLK); NMLV.uChanged := LVIS_SELECTED; // LVIF_STATE; @@ -5317,6 +5314,7 @@ begin if FViewPortWidget <> niL then exit; + FillChar(AParams, SizeOf(AParams), #0); FViewPortWidget := TQtWidget.Create(LCLObject, AParams); FViewPortWidget.AttachEvents; diff --git a/lcl/interfaces/qt/qtwsdialogs.pp b/lcl/interfaces/qt/qtwsdialogs.pp index 171243ffd1..d74cc72917 100644 --- a/lcl/interfaces/qt/qtwsdialogs.pp +++ b/lcl/interfaces/qt/qtwsdialogs.pp @@ -269,9 +269,22 @@ begin begin if ofAllowMultiSelect in TOpenDialog(ACommonDialog).Options then begin - QFileDialog_getOpenFileNames(ReturnList, Parent, @Caption, @Dir, @Filter, @selectedFilter, options) + ReturnList := QStringList_create; + try + + QFileDialog_getOpenFileNames(ReturnList, Parent, @Caption, @Dir, @Filter, @selectedFilter, options); - // TODO: Convert ReturnList into a WideString and then into a utf-8 string and return that + for i := 0 to QStringList_size(ReturnList) - 1 do + begin + QStringList_at(ReturnList, @ReturnText, i); + FileDialog.Files.Add(UTF8Encode(ReturnText)); + end; + + ReturnText := FileDialog.Files.Text; + + finally + QStringList_destroy(ReturnList); + end; end else begin diff --git a/lcl/interfaces/qt/qtwsextctrls.pp b/lcl/interfaces/qt/qtwsextctrls.pp index 2a47da446a..b2c1735b49 100644 --- a/lcl/interfaces/qt/qtwsextctrls.pp +++ b/lcl/interfaces/qt/qtwsextctrls.pp @@ -433,7 +433,7 @@ begin QtGroupBox.BoxLayout := QGridLayout_create(QtGroupBox.Widget); QWidget_setLayout(QtGroupBox.Widget, QtGroupBox.BoxLayout); - QtGroupBox.ButtonGroup := TQtButtonGroup.Create(QObjectH(QtGroupBox.BoxLayout)); + QtGroupBox.ButtonGroup := TQtButtonGroup.Create(QtGroupBox.Widget); {QGridLayout don't know anything about TCustomRadioGroup Col count so initialize cols } for i := 0 to TCustomRadioGroup(AWinControl).Columns - 1 do @@ -534,7 +534,7 @@ begin QtGroupBox.BoxLayout := QGridLayout_create(QtGroupBox.Widget); QWidget_setLayout(QtGroupBox.Widget, QtGroupBox.BoxLayout); - QtGroupBox.ButtonGroup := TQtButtonGroup.Create(QObjectH(QtGroupBox.BoxLayout)); + QtGroupBox.ButtonGroup := TQtButtonGroup.Create(QtGroupBox.Widget); {QGridLayout don't know anything about TCustomCheckGroup Col count so initialize cols } for i := 0 to TCustomCheckGroup(AWinControl).Columns - 1 do diff --git a/lcl/interfaces/qt/qtwsspin.pp b/lcl/interfaces/qt/qtwsspin.pp index 23640caa3e..3813a249f0 100644 --- a/lcl/interfaces/qt/qtwsspin.pp +++ b/lcl/interfaces/qt/qtwsspin.pp @@ -22,7 +22,7 @@ } unit QtWSSpin; -{$mode delphi}{$H+} +{$mode objfpc}{$H+} interface @@ -166,6 +166,7 @@ end; class function TQtWSCustomFloatSpinEdit.GetText(const AWinControl: TWinControl; var AText: String): Boolean; begin {$note implement} + Result := True; end; class procedure TQtWSCustomFloatSpinEdit.SetText(const AWinControl: TWinControl; const AText: string); diff --git a/lcl/interfaces/qt/qtwsstdctrls.pp b/lcl/interfaces/qt/qtwsstdctrls.pp index 0e98a31146..0f99705b59 100644 --- a/lcl/interfaces/qt/qtwsstdctrls.pp +++ b/lcl/interfaces/qt/qtwsstdctrls.pp @@ -1539,9 +1539,6 @@ end; class function TQtWSToggleBox.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; var QtToggleBox: TQtPushButton; - ATextWidth: Integer; - FM: QFontMetricsH; - Str: WideString; begin QtToggleBox := TQtPushButton.Create(AWinControl, AParams);