void ContentWindowGraphicsItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event)
{
    // on Mac we've seen that mouse events can go to the wrong graphics item
    // this is due to the bug: https://bugreports.qt.nokia.com/browse/QTBUG-20493
    // here we ignore the event if it shouldn't have been sent to us, which ensures
    // it will go to the correct item...
    if(boundingRect().contains(event->pos()) == false)
    {
        event->ignore();
        return;
    }

    toggleWindowState();

    QGraphicsItem::mouseDoubleClickEvent(event);
}
/**
********************************************************************************
\brief	constructor

Constructor of main window class.

\param		parent			pointer parent window
*******************************************************************************/
MainWindow::MainWindow(QWidget *parent)
    : QWidget(parent)
{
    pEplApi = NULL;

    resize(1000, 600);

    QVBoxLayout *pWindowLayout = new QVBoxLayout();
    pWindowLayout->setObjectName("MainLayout");
    setLayout(pWindowLayout);

    // ---------------------------------------------------------------------
    // Head Region
    // ---------------------------------------------------------------------
    pHeadBackground = new QFrame();
    pHeadBackground->setContentsMargins(0,0,0,0);
    QPalette tmpPal(pHeadBackground->palette());
    tmpPal.setColor(QPalette::Window, Qt::white);
    pHeadBackground->setPalette(tmpPal);
    pHeadBackground->setAutoFillBackground(true);

    pHeadRegion = new QHBoxLayout();
    pHeadRegion->setObjectName("HeadRegion");

    pRightLogo  = new QPixmap(":/img/powerlink_open_source.png");
    pRightLabel = new QLabel();
    pHeadRegion->addWidget(pRightLabel, 1, Qt::AlignLeft);

    pHeadBackground->setLayout(pHeadRegion);
    pWindowLayout->addWidget(pHeadBackground, 0);

    pWindowLayout->addSpacing(10);

    pFrameSepHeadMiddle = new QFrame();
    pFrameSepHeadMiddle->setFrameStyle(QFrame::HLine);
    pWindowLayout->addWidget(pFrameSepHeadMiddle);

    // ---------------------------------------------------------------------
    // Middle Region
    // ---------------------------------------------------------------------

    // separate in left and right side
    QHBoxLayout *pMiddleRegion = new QHBoxLayout();
    pMiddleRegion->setObjectName("MiddleRegion");

    pEplCnState = new EplCnState;
    pMiddleRegion->addWidget(pEplCnState);

    pFrameSepMiddle = new QFrame();
    pFrameSepMiddle->setFrameStyle(QFrame::VLine);
    pMiddleRegion->addWidget(pFrameSepMiddle);

    pEplInput = new EplInput;
    pMiddleRegion->addWidget(pEplInput);

    pFrameSepMiddle2 = new QFrame();
    pFrameSepMiddle2->setFrameStyle(QFrame::VLine);
    pMiddleRegion->addWidget(pFrameSepMiddle2);


    pEplOutput = new EplOutput;
    pMiddleRegion->addWidget(pEplOutput);

    pWindowLayout->addLayout(pMiddleRegion, 8);
    pWindowLayout->addStretch(10);

    pFrameSepMiddleStatus = new QFrame();
    pFrameSepMiddleStatus->setFrameStyle(QFrame::HLine);
    pWindowLayout->addWidget(pFrameSepMiddleStatus);

    // ---------------------------------------------------------------------
    // Status Region
    // ---------------------------------------------------------------------
    QHBoxLayout *pStatusRegion = new QHBoxLayout();
    pStatusRegion->setObjectName("StatusRegion");

    // EPL network state
    pEplState = new EplState;
    pStatusRegion->addWidget(pEplState);

    pWindowLayout->addLayout(pStatusRegion, 0);

    pFrameSepStatusFoot = new QFrame();
    pFrameSepStatusFoot->setFrameStyle(QFrame::HLine);
    pWindowLayout->addWidget(pFrameSepStatusFoot);

    // ---------------------------------------------------------------------
    // Foot Region
    // ---------------------------------------------------------------------

    QHBoxLayout *pFootRegion = new QHBoxLayout();
    pFootRegion->setObjectName("FootRegion");

    QLabel* pNodeIdLabel = new QLabel("Node-ID:");
    pFootRegion->addWidget(pNodeIdLabel);

    QString sNodeId;
    sNodeId.setNum(EplApi::defaultNodeId());

    QValidator *pValidator = new QIntValidator(1, 254, this);
    pNodeIdEdit = new QLineEdit(sNodeId);
    pNodeIdEdit->setValidator(pValidator);
    pFootRegion->addWidget(pNodeIdEdit);

    pFootRegion->addSpacing(20);

    pStartStopEpl = new QPushButton(tr("Start POWERLINK"));
    pFootRegion->addWidget(pStartStopEpl);
    connect(pStartStopEpl, SIGNAL(clicked()), this, SLOT(startPowerlink()));

    pFootRegion->addStretch();

    pToggleMax = new QPushButton(tr("Full Screen"));
    pFootRegion->addWidget(pToggleMax);
    connect(pToggleMax, SIGNAL(clicked()),
            this, SLOT(toggleWindowState()));

    QPushButton *pQuit = new QPushButton(tr("Quit"));
    pFootRegion->addWidget(pQuit);
    connect(pQuit, SIGNAL(clicked()), qApp, SLOT(quit()));

    pWindowLayout->addLayout(pFootRegion, 0);
}