From 22ea0608435f554f15875bcefddbc9d17438156c Mon Sep 17 00:00:00 2001 From: san Date: Mon, 1 Nov 2010 16:16:21 +0000 Subject: [PATCH] Label item taken from V5_1_5_BR version for KALLISTO needs --- src/Qtx/QtxPagePrefMgr.cxx | 65 ++++++++++++++++++++++++++++++++++++++ src/Qtx/QtxPagePrefMgr.h | 20 ++++++++++++ 2 files changed, 85 insertions(+) diff --git a/src/Qtx/QtxPagePrefMgr.cxx b/src/Qtx/QtxPagePrefMgr.cxx index 30a08cea6..5ace6c4d7 100644 --- a/src/Qtx/QtxPagePrefMgr.cxx +++ b/src/Qtx/QtxPagePrefMgr.cxx @@ -1720,6 +1720,71 @@ void QtxPagePrefGroupItem::updateGroup() } } +/*! + \class QtxPagePrefLabelItem + \brief Label item which can be used in the preferences editor dialog box. +*/ + +/*! + \brief Constructor. + + Creates label item with specified title. + + \param text label text + \param parent parent preference item +*/ +QtxPagePrefLabelItem::QtxPagePrefLabelItem( const QString& text, QtxPreferenceItem* parent ) +: QtxPagePrefItem( text, parent ) +{ + setWidget( myLabel = new QLabel( text ) ); +} + +QtxPagePrefLabelItem::QtxPagePrefLabelItem( Qt::Alignment align, const QString& text, QtxPreferenceItem* parent ) +: QtxPagePrefItem( text, parent ) +{ + setWidget( myLabel = new QLabel( text ) ); + myLabel->setAlignment( align ); +} + +QtxPagePrefLabelItem::~QtxPagePrefLabelItem() +{ +} + +void QtxPagePrefLabelItem::setTitle( const QString& text ) +{ + QtxPagePrefItem::setTitle( text ); + + if ( myLabel ) + myLabel->setText( text ); +} + +Qt::Alignment QtxPagePrefLabelItem::alignment() const +{ + return myLabel->alignment(); +} + +void QtxPagePrefLabelItem::setAlignment( Qt::Alignment align ) +{ + myLabel->setAlignment( align ); +} + +QVariant QtxPagePrefLabelItem::optionValue( const QString& name ) const +{ + QVariant val; + if ( name == "alignment" ) + val = (int)alignment(); + return val; +} + +void QtxPagePrefLabelItem::setOptionValue( const QString& name, const QVariant& val ) +{ + if ( name == "alignment" ) + { + if ( val.canConvert( QVariant::Int ) ) + setAlignment( (Qt::Alignment)val.toInt() ); + } +} + /*! \class QtxPagePrefSpaceItem \brief Simple spacer item which can be used in the preferences diff --git a/src/Qtx/QtxPagePrefMgr.h b/src/Qtx/QtxPagePrefMgr.h index 40d0dd992..2169bfe42 100644 --- a/src/Qtx/QtxPagePrefMgr.h +++ b/src/Qtx/QtxPagePrefMgr.h @@ -326,6 +326,26 @@ private: QtxGroupBox* myGroup; }; +class QTX_EXPORT QtxPagePrefLabelItem : public QtxPagePrefItem +{ +public: + QtxPagePrefLabelItem( const QString&, QtxPreferenceItem* = 0 ); + QtxPagePrefLabelItem( Qt::Alignment, const QString&, QtxPreferenceItem* = 0 ); + virtual ~QtxPagePrefLabelItem(); + + virtual void setTitle( const QString& ); + + Qt::Alignment alignment() const; + void setAlignment( Qt::Alignment ); + +protected: + virtual QVariant optionValue( const QString& ) const; + virtual void setOptionValue( const QString&, const QVariant& ); + +private: + QPointer myLabel; +}; + class QTX_EXPORT QtxPagePrefSpaceItem : public QtxPagePrefItem { public: -- 2.39.2