Developer documentation | Axl-2.5.1

axlInspectorSeparator.cpp
Go to the documentation of this file.
1 /* axlInspectorSeparator.cpp ---
2  *
3  * Author: Meriadeg Perrinel
4  * Copyright (C) 2008 - Julien Wintz, Inria.
5  * Created: Tue Mar 15 14:09:00 2011 (+0100)
6  * Version: $Id$
7  * Last-Updated: Thu Mar 17 23:58:44 2011 (+0100)
8  * By: Meriadeg Perrinel
9  * Update #: 50
10  */
11 
12 /* Commentary:
13  *
14  */
15 
16 /* Change log:
17  *
18  */
19 
20 #include "axlInspectorSeparator.h"
21 
22 #include <dtkCoreSupport/dtkGlobal.h>
23 
24 #include <QtGui>
25 
26 class axlInspectorSeparatorPrivate
27 {
28 public:
29  Qt::Orientations orientation;
30 
31 };
32 
33 
34 axlInspectorSeparator::axlInspectorSeparator(QWidget *parent, Qt::Orientation orientation) : QWidget(parent), d(new axlInspectorSeparatorPrivate)
35 {
36  d->orientation = orientation;
37 
38  if(d->orientation == Qt::Horizontal)
39  this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
40  else
41  this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
42 
43 }
44 
46 {
47  delete d;
48 
49  d = NULL;
50 }
51 
53 {
54  if(d->orientation == Qt::Horizontal)
55  return QSize(100, 2);
56  else
57  return QSize(2, 100);
58 }
59 
60 void axlInspectorSeparator::paintEvent(QPaintEvent *event)
61 {
62  if(d->orientation == Qt::Horizontal)
63  {
64  QRect r = event->rect();
65  QPainter painter(this);
66  painter.setPen(QPen(QColor("#9b9b9b")));
67  painter.drawLine(r.topLeft(), r.topRight());
68  painter.setPen(QPen(QColor("#ffffff")));
69  painter.drawLine(r.bottomLeft(), r.bottomRight());
70  }
71  else
72  {
73  QRect r = event->rect();
74  QPainter painter(this);
75  painter.setPen(QPen(QColor("#9b9b9b")));
76  painter.drawLine(r.topLeft(), r.bottomLeft());
77  painter.setPen(QPen(QColor("#ffffff")));
78  painter.drawLine(r.topRight(), r.bottomRight());
79  }
80 }
void paintEvent(QPaintEvent *event)
axlInspectorSeparator(QWidget *parent=0, Qt::Orientation orientation=Qt::Horizontal)