diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-11-06 22:38:16 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-11-06 22:38:16 -0600 |
commit | deb6f7b222e52035e99fa757e775c01e987a4eb5 (patch) | |
tree | 2691debe60a10b05656e286d8c7f5b71fd2535a1 | |
parent | 79dfe5ba7afa55306b325ddcc6cfbe6dd67cf839 (diff) | |
download | tqt3-deb6f7b222e52035e99fa757e775c01e987a4eb5.tar.gz tqt3-deb6f7b222e52035e99fa757e775c01e987a4eb5.zip |
Automated update from Qt3
-rw-r--r-- | src/kernel/qstyle.cpp | 6 | ||||
-rw-r--r-- | src/styles/qcommonstyle.cpp | 3 | ||||
-rw-r--r-- | src/widgets/ntqprogressbar.h | 8 | ||||
-rw-r--r-- | src/widgets/qprogressbar.cpp | 116 |
4 files changed, 102 insertions, 31 deletions
diff --git a/src/kernel/qstyle.cpp b/src/kernel/qstyle.cpp index ef31c25ca..f32d73b9a 100644 --- a/src/kernel/qstyle.cpp +++ b/src/kernel/qstyle.cpp @@ -2606,6 +2606,12 @@ TQPixmap TQStyle::stylePixmap(StylePixmap sp, const TQWidget *w, const TQStyleOp TQStyleControlElementData::TQStyleControlElementData() { activePainter = 0; + tickMarkSetting = 0; + comboBoxLineEditFlags = 0; + frameStyle = 0; + comboBoxListBoxFlags = 0; + parentWidgetFlags = 0; + topLevelWidgetFlags = 0; } #endif // QT_NO_STYLE diff --git a/src/styles/qcommonstyle.cpp b/src/styles/qcommonstyle.cpp index 4406346e1..a303a805d 100644 --- a/src/styles/qcommonstyle.cpp +++ b/src/styles/qcommonstyle.cpp @@ -159,7 +159,7 @@ TQStringList getObjectTypeListForObject(const TQObject* object) { } TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* object, TQStringList objectTypeList, const TQStyleOption& opt, bool populateReliantFields) { - TQStyle::ControlElementFlags cef = (TQStyle::ControlElementFlags)0; + TQStyle::ControlElementFlags cef = TQStyle::CEF_None; if (object) { if (objectTypeList.contains("TQPushButton")) { @@ -405,6 +405,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w ceData.totalSteps = pb->totalSteps(); ceData.progressText = pb->progressString(); ceData.percentageVisible = pb->percentageVisible(); + ceData.orientation = pb->orientation(); } } if (ceData.widgetObjectTypes.contains("TQHeader")) { diff --git a/src/widgets/ntqprogressbar.h b/src/widgets/ntqprogressbar.h index e4c66e99d..ca73cd8a4 100644 --- a/src/widgets/ntqprogressbar.h +++ b/src/widgets/ntqprogressbar.h @@ -60,6 +60,7 @@ class Q_EXPORT TQProgressBar : public TQFrame TQ_PROPERTY( bool centerIndicator READ centerIndicator WRITE setCenterIndicator ) TQ_PROPERTY( bool indicatorFollowsStyle READ indicatorFollowsStyle WRITE setIndicatorFollowsStyle ) TQ_PROPERTY( bool percentageVisible READ percentageVisible WRITE setPercentageVisible ) + TQ_PROPERTY( Orientation orientation READ orientation WRITE setOrientation ) public: TQProgressBar( TQWidget* parent=0, const char* name=0, WFlags f=0 ); @@ -111,6 +112,13 @@ private: // Disabled copy constructor and operator= TQProgressBar( const TQProgressBar & ); TQProgressBar &operator=( const TQProgressBar & ); #endif + +public: + virtual void setOrientation ( Orientation ); + Orientation orientation () const; + +private: + Orientation m_orientation; }; diff --git a/src/widgets/qprogressbar.cpp b/src/widgets/qprogressbar.cpp index 7a4ec3831..bf40d9e45 100644 --- a/src/widgets/qprogressbar.cpp +++ b/src/widgets/qprogressbar.cpp @@ -44,6 +44,7 @@ #include "ntqdrawutil.h" #include "ntqpixmap.h" #include "ntqstyle.h" +#include "ntqwmatrix.h" #include "../kernel/qinternal_p.h" #if defined(QT_ACCESSIBILITY_SUPPORT) #include "ntqaccessible.h" @@ -102,7 +103,8 @@ TQProgressBar::TQProgressBar( TQWidget *parent, const char *name, WFlags f ) center_indicator( TRUE ), auto_indicator( TRUE ), percentage_visible( TRUE ), - d( 0 ) + d( 0 ), + m_orientation( Horizontal ) { setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed ) ); initFrame(); @@ -133,7 +135,8 @@ TQProgressBar::TQProgressBar( int totalSteps, center_indicator( TRUE ), auto_indicator( TRUE ), percentage_visible( TRUE ), - d( 0 ) + d( 0 ), + m_orientation( Horizontal ) { setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed ) ); initFrame(); @@ -234,9 +237,15 @@ TQSize TQProgressBar::sizeHint() const constPolish(); TQFontMetrics fm = fontMetrics(); int cw = style().pixelMetric(TQStyle::PM_ProgressBarChunkWidth, this); - return style().sizeFromContents(TQStyle::CT_ProgressBar, this, + TQSize sh = style().sizeFromContents(TQStyle::CT_ProgressBar, this, TQSize( cw * 7 + fm.width( '0' ) * 4, fm.height() + 8)); + if (m_orientation == TQt::Horizontal) { + return sh; + } + else { + return TQSize(sh.height(), sh.width()); + } } @@ -321,6 +330,22 @@ void TQProgressBar::styleChange( TQStyle& old ) TQFrame::styleChange( old ); } +TQt::Orientation TQProgressBar::orientation() const +{ + return m_orientation; +} + +void TQProgressBar::setOrientation(Orientation orient) +{ + m_orientation = orient; + if (m_orientation == TQt::Horizontal) { + setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed ) ); + } + else { + setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Expanding ) ); + } +} + /*! This method is called to generate the text displayed in the center @@ -371,40 +396,71 @@ bool TQProgressBar::setIndicator( TQString & indicator, int progress, */ void TQProgressBar::drawContents( TQPainter *p ) { - const TQRect bar = contentsRect(); + const TQRect bar = contentsRect(); + + TQSharedDoubleBuffer buffer( p, bar.x(), bar.y(), bar.width(), bar.height() ); + + TQPoint pn = backgroundOffset(); + buffer.painter()->setBrushOrigin( -pn.x(), -pn.y() ); + + const TQPixmap *bpm = paletteBackgroundPixmap(); + if ( bpm ) { + buffer.painter()->fillRect( bar, TQBrush( paletteBackgroundColor(), *bpm ) ); + } + else { + buffer.painter()->fillRect( bar, paletteBackgroundColor() ); + } + buffer.painter()->setFont( p->font() ); - TQSharedDoubleBuffer buffer( p, bar.x(), bar.y(), bar.width(), bar.height() ); + TQStyle::SFlags flags = TQStyle::Style_Default; + if (isEnabled()) { + flags |= TQStyle::Style_Enabled; + } + if (hasFocus()) { + flags |= TQStyle::Style_HasFocus; + } + if (hasMouse()) { + flags |= TQStyle::Style_MouseOver; + } - TQPoint pn = backgroundOffset(); - buffer.painter()->setBrushOrigin( -pn.x(), -pn.y() ); + style().drawControl(TQStyle::CE_ProgressBarGroove, buffer.painter(), this, + TQStyle::visualRect(style().subRect(TQStyle::SR_ProgressBarGroove, this), this ), + colorGroup(), flags); - const TQPixmap *bpm = paletteBackgroundPixmap(); - if ( bpm ) - buffer.painter()->fillRect( bar, TQBrush( paletteBackgroundColor(), *bpm ) ); - else - buffer.painter()->fillRect( bar, paletteBackgroundColor() ); - buffer.painter()->setFont( p->font() ); + TQWMatrix oldMatrix = buffer.painter()->worldMatrix(); - TQStyle::SFlags flags = TQStyle::Style_Default; - if (isEnabled()) - flags |= TQStyle::Style_Enabled; - if (hasFocus()) - flags |= TQStyle::Style_HasFocus; - if (hasMouse()) - flags |= TQStyle::Style_MouseOver; + TQStyleControlElementData ceData = populateControlElementDataFromWidget(this, TQStyleOption()); + TQStyle::ControlElementFlags elementFlags = getControlElementFlagsForObject(this, ceData.widgetObjectTypes, TQStyleOption()); - style().drawControl(TQStyle::CE_ProgressBarGroove, buffer.painter(), this, - TQStyle::visualRect(style().subRect(TQStyle::SR_ProgressBarGroove, this), this ), - colorGroup(), flags); + // Draw contents + if (m_orientation == TQt::Vertical) { + // If oriented vertically, apply a 90 degree rotation matrix to the painter + TQWMatrix m; - style().drawControl(TQStyle::CE_ProgressBarContents, buffer.painter(), this, - TQStyle::visualRect(style().subRect(TQStyle::SR_ProgressBarContents, this), this ), - colorGroup(), flags); +// // Upside down +// m.rotate(90.0); +// m.translate(0, (bar.width())*(-1.0)); + + // Right side up + m.rotate(-90.0); + m.translate((bar.height())*(-1.0), 0); - if (percentageVisible()) - style().drawControl(TQStyle::CE_ProgressBarLabel, buffer.painter(), this, - TQStyle::visualRect(style().subRect(TQStyle::SR_ProgressBarLabel, this), this ), - colorGroup(), flags); + buffer.painter()->setWorldMatrix(m, TRUE); + + ceData.rect = TQRect(ceData.rect.y(), ceData.rect.x(), ceData.rect.height(), ceData.rect.width()); + } + + style().drawControl(TQStyle::CE_ProgressBarContents, buffer.painter(), ceData, elementFlags, + TQStyle::visualRect(style().subRect(TQStyle::SR_ProgressBarContents, ceData, elementFlags, this), ceData, elementFlags), + colorGroup(), flags, TQStyleOption(), this); + + buffer.painter()->setWorldMatrix(oldMatrix, TRUE); + + if (percentageVisible()) { + style().drawControl(TQStyle::CE_ProgressBarLabel, buffer.painter(), this, + TQStyle::visualRect(style().subRect(TQStyle::SR_ProgressBarLabel, this), this ), + colorGroup(), flags); + } } #endif |