Index: src/qwt_scale_widget.cpp
===================================================================
--- src/qwt_scale_widget.cpp (revision 2242)
+++ src/qwt_scale_widget.cpp (working copy)
@@ -670,6 +670,20 @@
}
}
+ if ( d_data->layoutFlags & TitleHorizontal )
+ {
+ {
+ angle += 90;
+ r.setRect( r.x (), r.y () - r.width (), r.height (), r.width () );
+ }
+ {
+ angle -= 90;
+ r.setRect( d_data->titleOffset, r.y (), r.height (), r.width () );
+ }
+ }
+
painter->save();
painter->setFont( font() );
painter
->setPen
( palette
().
color( QPalette::Text ) );
@@ -747,7 +761,8 @@
{
- return qCeil( d_data->title.heightForWidth( width, font() ) );
+ if ( d_data->layoutFlags & TitleHorizontal ) return qCeil ( d_data->title.textSize ().width () );
+ else return qCeil( d_data->title.heightForWidth( width, font() ) );
}
/*!
Index: src/qwt_scale_widget.h
===================================================================
--- src/qwt_scale_widget.h (revision 2242)
+++ src/qwt_scale_widget.h (working copy)
@@ -42,7 +42,8 @@
The title of vertical scales is painted from top to bottom.
Otherwise it is painted from bottom to top.
*/
- TitleInverted = 1
+ TitleInverted = 1,
+ TitleHorizontal = 2
};
//! Layout flags of the title
Index: src/qwt_scale_widget.cpp
===================================================================
--- src/qwt_scale_widget.cpp (revision 2242)
+++ src/qwt_scale_widget.cpp (working copy)
@@ -670,6 +670,20 @@
}
}
+ if ( d_data->layoutFlags & TitleHorizontal )
+ {
+ if ( align == QwtScaleDraw::LeftScale )
+ {
+ angle += 90;
+ r.setRect( r.x (), r.y () - r.width (), r.height (), r.width () );
+ }
+ else if ( align == QwtScaleDraw::RightScale )
+ {
+ angle -= 90;
+ r.setRect( d_data->titleOffset, r.y (), r.height (), r.width () );
+ }
+ }
+
painter->save();
painter->setFont( font() );
painter->setPen( palette().color( QPalette::Text ) );
@@ -747,7 +761,8 @@
int QwtScaleWidget::titleHeightForWidth( int width ) const
{
- return qCeil( d_data->title.heightForWidth( width, font() ) );
+ if ( d_data->layoutFlags & TitleHorizontal ) return qCeil ( d_data->title.textSize ().width () );
+ else return qCeil( d_data->title.heightForWidth( width, font() ) );
}
/*!
Index: src/qwt_scale_widget.h
===================================================================
--- src/qwt_scale_widget.h (revision 2242)
+++ src/qwt_scale_widget.h (working copy)
@@ -42,7 +42,8 @@
The title of vertical scales is painted from top to bottom.
Otherwise it is painted from bottom to top.
*/
- TitleInverted = 1
+ TitleInverted = 1,
+ TitleHorizontal = 2
};
//! Layout flags of the title
To copy to clipboard, switch view to plain text mode
Bookmarks