Small update of DynamicLabel for Isis.

This commit is contained in:
Jean-Paul Chaput 2012-12-31 11:52:42 +00:00
parent 3daf4d6ac2
commit ceda10e523
7 changed files with 47 additions and 110 deletions

View File

@ -2,14 +2,9 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved // Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved
// //
// =================================================================== // +-----------------------------------------------------------------+
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S | // | C O R I O L I S |
// | V L S I B a c k e n d D a t a - B a s e | // | V L S I B a c k e n d D a t a - B a s e |
// | | // | |
@ -17,10 +12,7 @@
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Module : "./ControllerWidget.cpp" | // | C++ Module : "./ControllerWidget.cpp" |
// | *************************************************************** | // +-----------------------------------------------------------------+
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <QAction> #include <QAction>

View File

@ -2,14 +2,9 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved // Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved
// //
// =================================================================== // +-----------------------------------------------------------------+
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E | // | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e | // | V L S I B a c k e n d D a t a - B a s e |
// | | // | |
@ -17,10 +12,7 @@
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Module : "./DynamicLabel.cpp" | // | C++ Module : "./DynamicLabel.cpp" |
// | *************************************************************** | // +-----------------------------------------------------------------+
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include <QFontMetrics> # include <QFontMetrics>
@ -47,18 +39,16 @@ namespace Hurricane {
//_staticLabel->setFrameStyle (QFrame::Panel | QFrame::Raised ); //_staticLabel->setFrameStyle (QFrame::Panel | QFrame::Raised );
QFont font = Graphics::getFixedFont(QFont::Bold); QFont font = Graphics::getFixedFont(QFont::Bold);
int cwidth = QFontMetrics(font).width('X');
_dynamicLabel = new QLabel (); _dynamicLabel = new QLabel ();
_dynamicLabel->setText ( "vvv.vu" ); _dynamicLabel->setText ( "vvv.vu" );
_dynamicLabel->setIndent ( cwidth/2 );
_dynamicLabel->setMinimumSize ( QSize(cwidth*10,QFontMetrics(font).height()) );
_dynamicLabel->setAlignment ( Qt::AlignRight ); _dynamicLabel->setAlignment ( Qt::AlignRight );
_dynamicLabel->setFont ( font ); _dynamicLabel->setFont ( font );
setDynamicWidth ( 10 );
QHBoxLayout* layout = new QHBoxLayout (); QHBoxLayout* layout = new QHBoxLayout ();
layout->addWidget ( _staticLabel ); layout->addWidget ( _staticLabel );
layout->addWidget ( _dynamicLabel ); layout->addWidget ( _dynamicLabel );
layout->setSpacing ( 0 );
layout->setContentsMargins ( 0, 0, 0, 0 ); layout->setContentsMargins ( 0, 0, 0, 0 );
setLayout ( layout ); setLayout ( layout );
@ -77,6 +67,17 @@ namespace Hurricane {
} }
void DynamicLabel::setDynamicWidth ( int chars, int flags )
{
QFont font = Graphics::getFixedFont(QFont::Bold);
int cwidth = QFontMetrics(font).width('X');
if ( flags|NoIndent ) _dynamicLabel->setIndent( 0 );
if ( flags|HalfIndent ) _dynamicLabel->setIndent( cwidth/2 );
_dynamicLabel->setMinimumSize( QSize(cwidth*chars,QFontMetrics(font).height()) );
}
void DynamicLabel::setStaticText ( const QString& text ) void DynamicLabel::setStaticText ( const QString& text )
{ {
_staticLabel->setText ( text ); _staticLabel->setText ( text );

View File

@ -2,14 +2,9 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved // Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved
// //
// =================================================================== // +-----------------------------------------------------------------+
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E | // | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e | // | V L S I B a c k e n d D a t a - B a s e |
// | | // | |
@ -17,10 +12,7 @@
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Module : "./GraphicsWidget.cpp" | // | C++ Module : "./GraphicsWidget.cpp" |
// | *************************************************************** | // +-----------------------------------------------------------------+
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <QLabel> #include <QLabel>

View File

@ -67,7 +67,7 @@ namespace Hurricane {
inline void setEnableRedrawInterrupt ( bool ); inline void setEnableRedrawInterrupt ( bool );
inline void setApplicationName ( const QString& ); inline void setApplicationName ( const QString& );
Cell* getCell () const; Cell* getCell () const;
void setCell ( Cell* ); virtual void setCell ( Cell* );
void renameCell ( const char* ); void renameCell ( const char* );
virtual Cell* getCellFromDb ( const char* ); virtual Cell* getCellFromDb ( const char* );
inline CellWidget* getCellWidget (); inline CellWidget* getCellWidget ();

View File

@ -2,25 +2,17 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved // Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved
// //
// =================================================================== // +-----------------------------------------------------------------+
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S | // | C O R I O L I S |
// | V L S I B a c k e n d D a t a - B a s e | // | V L S I B a c k e n d D a t a - B a s e |
// | | // | |
// | Author : Jean-Paul CHAPUT | // | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Header : "./ControllerWidget.h" | // | C++ Header : "./hurricane/viewer/ControllerWidget.h" |
// | *************************************************************** | // +-----------------------------------------------------------------+
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_CONTROLLER_WIDGET__ #ifndef __HURRICANE_CONTROLLER_WIDGET__

View File

@ -1,53 +1,18 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Project. // This file is part of the Coriolis Software.
// Copyright (C) Laboratoire LIP6 - Departement ASIM // Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved
// Universite Pierre et Marie Curie
// //
// Main contributors : // +-----------------------------------------------------------------+
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
// Hugo Clément <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Damien Dupuis <Damien.Dupuis@lip6.fr>
// Christian Masson <Christian.Masson@lip6.fr>
// Marek Sroka <Marek.Sroka@lip6.fr>
//
// The Coriolis Project is free software; you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// The Coriolis Project is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the Coriolis Project; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
// License-Tag
// Authors-Tag
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E | // | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e | // | V L S I B a c k e n d D a t a - B a s e |
// | | // | |
// | Author : Jean-Paul CHAPUT | // | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Header : "./DynamicLabel.h" | // | C++ Header : "./hurricane/viewer/DynamicLabel.h" |
// | *************************************************************** | // +-----------------------------------------------------------------+
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __DYNAMIC_LABEL_H__ # ifndef __DYNAMIC_LABEL_H__
@ -68,12 +33,15 @@ namespace Hurricane {
class DynamicLabel : public QWidget { class DynamicLabel : public QWidget {
Q_OBJECT; Q_OBJECT;
public:
enum Indent { NoIndent=1, HalfIndent=2 };
public: public:
// Constructor. // Constructor.
DynamicLabel ( QWidget* parent=NULL ); DynamicLabel ( QWidget* parent=NULL );
// Methods. // Methods.
QString getStaticText () const; QString getStaticText () const;
QString getDynamicText () const; QString getDynamicText () const;
void setDynamicWidth ( int chars, int flags=HalfIndent );
void setStaticText ( const QString& text ); void setStaticText ( const QString& text );
void setDynamicText ( const QString& text ); void setDynamicText ( const QString& text );
void setDynamicText ( DbU::Unit u ); void setDynamicText ( DbU::Unit u );

View File

@ -2,14 +2,9 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved // Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved
// //
// =================================================================== // +-----------------------------------------------------------------+
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E | // | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e | // | V L S I B a c k e n d D a t a - B a s e |
// | | // | |
@ -17,10 +12,7 @@
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Header : "./GraphicsWidget.h" | // | C++ Header : "./GraphicsWidget.h" |
// | *************************************************************** | // +-----------------------------------------------------------------+
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_GRAPHICS_WIDGET__ #ifndef __HURRICANE_GRAPHICS_WIDGET__