VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.cpp@ 35740

Last change on this file since 35740 was 28800, checked in by vboxsync, 14 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 1.8 KB
Line 
1/* $Id: QITreeWidget.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */
2/** @file
3 *
4 * VBox frontends: Qt GUI ("VirtualBox"):
5 * VirtualBox Qt extensions: QITreeWidget class implementation
6 */
7
8/*
9 * Copyright (C) 2008-2009 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20/* Global includes */
21#include <QPainter>
22#include <QResizeEvent>
23
24/* Local includes */
25#include "QITreeWidget.h"
26
27QITreeWidget::QITreeWidget (QWidget *aParent)
28 : QTreeWidget (aParent)
29{
30}
31
32void QITreeWidget::paintEvent (QPaintEvent *aEvent)
33{
34 /* Opens Items Painter */
35 QPainter painter;
36 painter.begin (viewport());
37
38 /* Notify connected objects about painting */
39 QTreeWidgetItemIterator it (this);
40 while (*it)
41 {
42 emit painted (*it, &painter);
43 ++ it;
44 }
45
46 /* Close Items Painter */
47 painter.end();
48
49 /* Base-class paint-event */
50 QTreeWidget::paintEvent (aEvent);
51}
52
53void QITreeWidget::resizeEvent (QResizeEvent *aEvent)
54{
55 /* Base-class resize-event */
56 QTreeWidget::resizeEvent (aEvent);
57
58 /* Notify connected objects about resize */
59 emit resized (aEvent->size(), aEvent->oldSize());
60}
61
62void QITreeWidget::addTopBottomMarginToItems (int aMargin)
63{
64 for (int i = 0; i < topLevelItemCount(); ++ i)
65 {
66 QTreeWidgetItem *item = topLevelItem (i);
67 QSize s = item->sizeHint (0);
68 item->setSizeHint (0, QSize (s.width(), s.height() + 2 * aMargin));
69 }
70}
71
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use