~ubuntu-branches/ubuntu/vivid/lazarus/vivid-proposed

« back to all changes in this revision

Viewing changes to lcl/interfaces/qt/qtwscontrols.pp

  • Committer: Package Import Robot
  • Author(s): Abou Al Montacir
  • Date: 2014-07-14 20:16:50 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20140714201650-ossm36rrsdomp379
Tags: 1.2.4+dfsg-1
* New upstream release with few fixes and official support of FPC 2.6.4.
  - The detailed list of changes can be found here:
    http://wiki.lazarus.freepascal.org/Lazarus_1.2_fixes_branch#Fixes_for_1.2.4_.28Merged.29

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
{ $Id: qtwscontrols.pp 41387 2013-05-24 18:30:06Z juha $}
 
1
{ $Id: qtwscontrols.pp 45137 2014-05-21 13:18:33Z zeljko $}
2
2
{
3
3
 *****************************************************************************
4
4
 *                              QtWSControls.pp                              * 
141
141
  QtCustomControl := TQtCustomControl.Create(AWinControl, AParams);
142
142
  QtCustomControl.setFrameShape(TBorderStyleToQtFrameShapeMap[TCustomControl(AWinControl).BorderStyle]);
143
143
  QtCustomControl.viewportNeeded;
 
144
  QtCustomControl.verticalScrollBar;
 
145
  QtCustomControl.horizontalScrollBar;
144
146
  QtCustomControl.AttachEvents;
145
147
  Result := TLCLIntfHandle(QtCustomControl);
146
148
 
278
280
class procedure TQtWSWinControl.GetPreferredSize(const AWinControl: TWinControl;
279
281
  var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean);
280
282
begin
281
 
  if AWinControl.HandleAllocated then
282
 
    TQtWidget(AWinControl.Handle).PreferredSize(PreferredWidth,
283
 
      PreferredHeight, WithThemeSpace);
 
283
  Assert(AWinControl.HandleAllocated, 'GetPreferredSize: Handle not allocated');
 
284
  TQtWidget(AWinControl.Handle).PreferredSize(PreferredWidth, PreferredHeight, WithThemeSpace);
284
285
end;
285
286
 
286
287
class function TQtWSWinControl.GetText(const AWinControl: TWinControl;
346
347
  QtMaxContraint = $FFFFFF;
347
348
var
348
349
  Widget: TQtWidget;
349
 
  MaxW, MaxH: Integer;
 
350
  MW, MH: Integer;
350
351
begin
351
352
  if not WSCheckHandleAllocated(AWincontrol, 'ConstraintsChange') then
352
353
    Exit;
354
355
  Widget := TQtWidget(AWinControl.Handle);
355
356
  with AWinControl do
356
357
  begin
357
 
    Widget.setMinimumSize(Constraints.MinWidth, Constraints.MinHeight);
 
358
    MW := Constraints.MinWidth;
 
359
    MH := Constraints.MinHeight;
 
360
 
 
361
    if MW < QtMinimumWidgetSize then
 
362
      MW := 0;
 
363
    if MH < QtMinimumWidgetSize then
 
364
      MH := 0;
 
365
 
 
366
    Widget.setMinimumSize(MW, MH);
 
367
 
358
368
    if Constraints.MaxWidth = 0 then
359
 
      MaxW := QtMaxContraint
 
369
      MW := QtMaxContraint
360
370
    else
361
 
      MaxW := Constraints.MaxWidth;
 
371
      MW := Constraints.MaxWidth;
362
372
    if Constraints.MaxHeight = 0 then
363
 
      MaxH := QtMaxContraint
 
373
      MH := QtMaxContraint
364
374
    else
365
 
      MaxH := Constraints.MaxHeight;
366
 
    Widget.setMaximumSize(MaxW, MaxH);
 
375
      MH := Constraints.MaxHeight;
 
376
    Widget.setMaximumSize(MW, MH);
367
377
  end;
368
378
end;
369
379
 
437
447
var
438
448
  R: TRect;
439
449
  Box: TQtWidget;
 
450
  AForm: TCustomForm;
440
451
begin
441
452
  if not WSCheckHandleAllocated(AWincontrol, 'SetBounds') then
442
453
    Exit;
454
465
      ATop - TQtCustomControl(Box).verticalScrollBar.getValue, AWidth, AHeight);
455
466
  end;
456
467
 
 
468
  {$IFDEF QTSCROLLABLEFORMS}
 
469
  if Assigned(AWinControl.Parent) and
 
470
    (AWinControl.Parent.FCompStyle = csForm) then
 
471
  begin
 
472
    AForm := TCustomForm(AWinControl.Parent);
 
473
    if Assigned(TQtMainWindow(AForm.Handle).ScrollArea) then
 
474
    begin
 
475
      Box := TQtMainWindow(AForm.Handle).ScrollArea;
 
476
      R := Rect(ALeft - TQtWindowArea(Box).horizontalScrollBar.getValue,
 
477
        ATop - TQtWindowArea(Box).verticalScrollBar.getValue, AWidth, AHeight);
 
478
    end;
 
479
  end;
 
480
  {$ENDIF}
 
481
 
 
482
  {$IFDEF VerboseQtResize}
 
483
  DebugLn('>TQtWSWinControl.SetBounds(',dbgsName(AWinControl),') NewBounds=',dbgs(R));
 
484
  {$ENDIF}
457
485
  TQtWidget(AWinControl.Handle).BeginUpdate;
458
486
  with R do
459
487
  begin
461
489
    TQtWidget(AWinControl.Handle).resize(Right, Bottom);
462
490
  end;
463
491
  TQtWidget(AWinControl.Handle).EndUpdate;
 
492
  {$IFDEF VerboseQtResize}
 
493
  DebugLn('<TQtWSWinControl.SetBounds(',dbgsName(AWinControl),') NewBounds=',dbgs(R));
 
494
  {$ENDIF}
464
495
end;
465
496
 
466
497
{------------------------------------------------------------------------------