<commit_before>/*=========================================================================

Program:   Medical Imaging & Interaction Toolkit
Language:  C++
Date:      $Date: 2010-01-14 14:20:26 +0100 (Thu, 14 Jan 2010) $
Version:   $Revision: 21047 $

Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.

This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#include "QmitkScalarBar.h"

#include <QPainter>
#include <QPaintEvent>

QmitkScalarBar::QmitkScalarBar(QWidget* parent): 
QWidget( parent, Qt::Tool | Qt::FramelessWindowHint ), m_Alignment(vertical)
{
  this->setAttribute(Qt::WA_PaintOnScreen, true);
  this->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
  this->SetupGeometry( m_Alignment );
  this->setBackgroundRole(QPalette::Base);
  this->setAttribute( Qt::WA_TranslucentBackground, true );
  this->setAutoFillBackground(false);

  this->resize( 20,60 );
  this->setFixedWidth( 20 );
  this->setFixedHeight( 60 );


  m_Pen = QPen( Qt::red, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin );
}

QmitkScalarBar::~QmitkScalarBar()
{
}

void QmitkScalarBar::SetupGeometry( alignment align )
{
  m_HorizontalLines.clear();<commit_msg>ENH (#3463): added X11 and MAC-specific widget-attributes <commit_after>/*=========================================================================

Program:   Medical Imaging & Interaction Toolkit
Language:  C++
Date:      $Date: 2010-01-14 14:20:26 +0100 (Thu, 14 Jan 2010) $
Version:   $Revision: 21047 $

Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.

This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#include "QmitkScalarBar.h"

#include <QPainter>
#include <QPaintEvent>

QmitkScalarBar::QmitkScalarBar(QWidget* parent): 
QWidget( parent, Qt::Tool | Qt::FramelessWindowHint ), m_Alignment(vertical)
{
  this->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
  this->SetupGeometry( m_Alignment );
  this->setBackgroundRole(QPalette::Base);
  this->setAttribute( Qt::WA_TranslucentBackground, true );
  this->setAutoFillBackground(false);

  // X11 specific attributes
  this->setAttribute( Qt::WA_X11NetWmWindowTypeUtility, true );

  // mac-specific attributes:
  // making sure overlays are even visible if RenderWindow does not have the focus (not default for Qt::Tool on mac)
  this->setAttribute( Qt::WA_MacAlwaysShowToolWindow, true );
  // testing something
  this->setAttribute( Qt::WA_MacShowFocusRect, false );


  this->resize( 20,60 );
  this->setFixedWidth( 20 );
  this->setFixedHeight( 60 );


  m_Pen = QPen( Qt::red, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin );
}

QmitkScalarBar::~QmitkScalarBar()
{
}

void QmitkScalarBar::SetupGeometry( alignment align )
{
  m_HorizontalLines.clear();
{'fraction_non_alphanumeric': 0.19381443298969073, 'fraction_numerical': 0.02533136966126657, 'mean_word_length': 5.987654320987654, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '794178', 'n_tokens_mistral': 1070, 'n_tokens_neox': 971, 'n_words': 265}