Automated update from Qt3

pull/1/head
Timothy Pearson 12 years ago
parent 79dfe5ba7a
commit deb6f7b222

@ -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

@ -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")) {

@ -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;
};

@ -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

Loading…
Cancel
Save