Fix styling of textFloat & whatsthis, make text floats consistent in style with tooltips

Should fix #925
This commit is contained in:
Vesa
2014-07-03 14:09:31 +03:00
parent 3ca971f9e7
commit 06b47a52a2
5 changed files with 46 additions and 23 deletions

View File

@@ -43,7 +43,9 @@ LmmsPalette::LmmsPalette( QWidget * parent, QStyle * stylearg ) :
m_buttonText( 0,0,0 ),
m_brightText( 74, 253, 133 ),
m_highlight( 100, 100, 100 ),
m_highlightedText( 255, 255, 255 )
m_highlightedText( 255, 255, 255 ),
m_toolTipText( 0, 0, 0 ),
m_toolTipBase( 128, 128, 128 )
{
setStyle( stylearg );
stylearg->polish( this );
@@ -70,7 +72,8 @@ LmmsPalette::~LmmsPalette()
ACCESSMET( brightText, setBrightText )
ACCESSMET( highlight, setHighlight )
ACCESSMET( highlightedText, setHighlightedText )
ACCESSMET( toolTipText, setToolTipText )
ACCESSMET( toolTipBase, setToolTipBase )
QPalette LmmsPalette::palette() const
@@ -87,7 +90,8 @@ QPalette LmmsPalette::palette() const
pal.setColor( QPalette::Shadow, shadow() );
pal.setColor( QPalette::Highlight, highlight() );
pal.setColor( QPalette::HighlightedText, highlightedText() );
pal.setBrush( QPalette::ToolTipText, QBrush( toolTipText() ) );
pal.setBrush( QPalette::ToolTipBase, QBrush( toolTipBase() ) );
return pal;
}

View File

@@ -24,6 +24,7 @@
#include <QtCore/QTimer>
#include <QtGui/QPainter>
#include <QtGui/QStyleOption>
#include "text_float.h"
#include "gui_templates.h"
@@ -41,6 +42,8 @@ textFloat::textFloat() :
resize( 20, 20 );
hide();
setAttribute( Qt::WA_TranslucentBackground, true );
setStyle( QApplication::style() );
setFont( pointSize<8>( font() ) );
}
@@ -125,35 +128,38 @@ textFloat * textFloat::displayMessage( const QString & _title,
void textFloat::paintEvent( QPaintEvent * _pe )
{
QStyleOption opt;
opt.init( this );
QPainter p( this );
p.fillRect( 0, 0, width(), height(), QColor( 0, 0, 0, 0 ) );
p.setPen( QColor( 0, 0, 0 ) );
p.setBrush( QColor( 224, 224, 224 ) );
/* p.setPen( p.pen().brush().color() );
p.setBrush( p.background() );*/
p.setFont( pointSize<8>( p.font() ) );
style()->drawPrimitive( QStyle::PE_Widget, &opt, &p, this );
p.drawRect( 0, 0, rect().right(), rect().bottom() );
/* p.drawRect( 0, 0, rect().right(), rect().bottom() );*/
// p.setPen( Qt::black );
// small message?
if( m_title.isEmpty() )
{
p.drawText( 2, p.fontMetrics().height()-2, m_text );
p.drawText( opt.rect, Qt::AlignCenter, m_text );
}
else
{
int text_x = 2;
int text_x = opt.rect.left() + 2;
int text_y = opt.rect.top() + 12;
if( m_pixmap.isNull() == false )
{
p.drawPixmap( 5, 5, m_pixmap );
p.drawPixmap( opt.rect.topLeft() + QPoint( 5, 5 ), m_pixmap );
text_x += m_pixmap.width() + 8;
}
p.drawText( text_x, 28, m_text );
p.drawText( text_x, text_y + 16, m_text );
QFont f = p.font();
f.setBold( true );
p.setFont( f );
p.drawText( text_x, 12, m_title );
p.drawText( text_x, text_y, m_title );
}
}
@@ -194,4 +200,4 @@ void textFloat::updateSize()
#include "moc_text_float.cxx"