Merge pull request #6607 from michaelgregorius/ImproveReadabilityOfTextFloat
Improve readability of text floats
This commit is contained in:
@@ -70,7 +70,7 @@ QToolTip {
|
||||
color: #4afd85;
|
||||
}
|
||||
|
||||
lmms--gui--TextFloat {
|
||||
lmms--gui--TextFloat, lmms--gui--SimpleTextFloat {
|
||||
border-radius: 4px;
|
||||
background: qlineargradient(spread:reflect, x1:0.5, y1:0.5, x2:0.5, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(50, 50, 50, 220));
|
||||
opacity: 175;
|
||||
|
||||
@@ -100,7 +100,7 @@ QToolTip {
|
||||
color: #d1d8e4;
|
||||
}
|
||||
|
||||
lmms--gui--TextFloat {
|
||||
lmms--gui--TextFloat, lmms--gui--SimpleTextFloat {
|
||||
background: #040506;
|
||||
color: #d1d8e4;
|
||||
}
|
||||
|
||||
@@ -54,10 +54,11 @@
|
||||
|
||||
#include "AutomatableModelView.h"
|
||||
|
||||
|
||||
namespace lmms::gui
|
||||
{
|
||||
|
||||
class TextFloat;
|
||||
class SimpleTextFloat;
|
||||
|
||||
|
||||
class LMMS_EXPORT Fader : public QWidget, public FloatModelView
|
||||
@@ -163,7 +164,7 @@ private:
|
||||
int m_moveStartPoint;
|
||||
float m_startValue;
|
||||
|
||||
static TextFloat * s_textFloat;
|
||||
static SimpleTextFloat * s_textFloat;
|
||||
|
||||
QColor m_peakGreen;
|
||||
QColor m_peakRed;
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace lmms::gui
|
||||
{
|
||||
|
||||
|
||||
class TextFloat;
|
||||
class SimpleTextFloat;
|
||||
|
||||
enum knobTypes
|
||||
{
|
||||
@@ -174,7 +174,7 @@ private:
|
||||
}
|
||||
|
||||
|
||||
static TextFloat * s_textFloat;
|
||||
static SimpleTextFloat * s_textFloat;
|
||||
|
||||
QString m_label;
|
||||
bool m_isHtmlLabel;
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace gui
|
||||
|
||||
class ComboBox;
|
||||
class PositionLine;
|
||||
class TextFloat;
|
||||
class SimpleTextFloat;
|
||||
class TimeLineWidget;
|
||||
|
||||
|
||||
@@ -347,7 +347,7 @@ private:
|
||||
|
||||
static std::array<PianoRollKeyTypes, 12> prKeyOrder;
|
||||
|
||||
static TextFloat * s_textFloat;
|
||||
static SimpleTextFloat * s_textFloat;
|
||||
|
||||
ComboBoxModel m_zoomingModel;
|
||||
ComboBoxModel m_zoomingYModel;
|
||||
|
||||
61
include/SimpleTextFloat.h
Normal file
61
include/SimpleTextFloat.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* TextFloat.h - class textFloat, a floating text-label
|
||||
*
|
||||
* Copyright (c) 2023 LMMS team
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SIMPLE_TEXT_FLOAT_H
|
||||
#define SIMPLE_TEXT_FLOAT_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "lmms_export.h"
|
||||
|
||||
class QLabel;
|
||||
|
||||
namespace lmms::gui
|
||||
{
|
||||
|
||||
class LMMS_EXPORT SimpleTextFloat : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SimpleTextFloat();
|
||||
~SimpleTextFloat() override = default;
|
||||
|
||||
void setText(const QString & text);
|
||||
|
||||
void setVisibilityTimeOut(int msecs);
|
||||
|
||||
void moveGlobal(QWidget * w, const QPoint & offset)
|
||||
{
|
||||
move(w->mapToGlobal(QPoint(0, 0)) + offset);
|
||||
}
|
||||
|
||||
private:
|
||||
QLabel * m_textLabel;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lmms::gui
|
||||
|
||||
#endif
|
||||
@@ -26,10 +26,11 @@
|
||||
#define LMMS_GUI_TEXT_FLOAT_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPixmap>
|
||||
|
||||
#include "lmms_export.h"
|
||||
|
||||
class QLabel;
|
||||
|
||||
namespace lmms::gui
|
||||
{
|
||||
|
||||
@@ -40,41 +41,34 @@ public:
|
||||
TextFloat();
|
||||
~TextFloat() override = default;
|
||||
|
||||
void setTitle( const QString & _title );
|
||||
void setText( const QString & _text );
|
||||
void setPixmap( const QPixmap & _pixmap );
|
||||
void setTitle(const QString & title);
|
||||
void setText(const QString & text);
|
||||
void setPixmap(const QPixmap & pixmap);
|
||||
|
||||
void setVisibilityTimeOut( int _msecs );
|
||||
void setVisibilityTimeOut(int msecs);
|
||||
|
||||
static TextFloat * displayMessage(const QString & title,
|
||||
const QString & msg,
|
||||
const QPixmap & pixmap = QPixmap(),
|
||||
int timeout = 2000,
|
||||
QWidget * parent = nullptr);
|
||||
|
||||
static TextFloat * displayMessage( const QString & _msg,
|
||||
int _timeout = 2000,
|
||||
QWidget * _parent = nullptr,
|
||||
int _add_y_margin = 0 );
|
||||
static TextFloat * displayMessage( const QString & _title,
|
||||
const QString & _msg,
|
||||
const QPixmap & _pixmap =
|
||||
QPixmap(),
|
||||
int _timeout = 2000,
|
||||
QWidget * _parent = nullptr );
|
||||
|
||||
void moveGlobal( QWidget * _w, const QPoint & _offset )
|
||||
void moveGlobal(QWidget * w, const QPoint & offset)
|
||||
{
|
||||
move( _w->mapToGlobal( QPoint( 0, 0 ) )+_offset );
|
||||
move(w->mapToGlobal(QPoint(0, 0)) + offset);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
void paintEvent( QPaintEvent * _me ) override;
|
||||
void mousePressEvent( QMouseEvent * _me ) override;
|
||||
void mousePressEvent(QMouseEvent * me) override;
|
||||
|
||||
|
||||
private:
|
||||
void updateSize();
|
||||
TextFloat(const QString & title, const QString & text, const QPixmap & pixmap);
|
||||
|
||||
QString m_title;
|
||||
QString m_text;
|
||||
QPixmap m_pixmap;
|
||||
QLabel * m_pixmapLabel;
|
||||
QLabel * m_titleLabel;
|
||||
QLabel * m_textLabel;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -112,6 +112,7 @@ SET(LMMS_SRCS
|
||||
gui/widgets/NStateButton.cpp
|
||||
gui/widgets/Oscilloscope.cpp
|
||||
gui/widgets/PixmapButton.cpp
|
||||
gui/widgets/SimpleTextFloat.cpp
|
||||
gui/widgets/TabBar.cpp
|
||||
gui/widgets/TabWidget.cpp
|
||||
gui/widgets/TempoSyncKnob.cpp
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
#include "PatternStore.h"
|
||||
#include "PianoView.h"
|
||||
#include "PositionLine.h"
|
||||
#include "SimpleTextFloat.h"
|
||||
#include "SongEditor.h"
|
||||
#include "StepRecorderWidget.h"
|
||||
#include "TextFloat.h"
|
||||
@@ -127,7 +128,7 @@ QPixmap * PianoRoll::s_toolMove = nullptr;
|
||||
QPixmap * PianoRoll::s_toolOpen = nullptr;
|
||||
QPixmap* PianoRoll::s_toolKnife = nullptr;
|
||||
|
||||
TextFloat * PianoRoll::s_textFloat = nullptr;
|
||||
SimpleTextFloat * PianoRoll::s_textFloat = nullptr;
|
||||
|
||||
static std::array<QString, 12> s_noteStrings {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"};
|
||||
|
||||
@@ -290,7 +291,7 @@ PianoRoll::PianoRoll() :
|
||||
// init text-float
|
||||
if( s_textFloat == nullptr )
|
||||
{
|
||||
s_textFloat = new TextFloat;
|
||||
s_textFloat = new SimpleTextFloat;
|
||||
}
|
||||
|
||||
setAttribute( Qt::WA_OpaquePaintEvent, true );
|
||||
|
||||
@@ -54,13 +54,13 @@
|
||||
#include "embed.h"
|
||||
#include "CaptionMenu.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "TextFloat.h"
|
||||
#include "SimpleTextFloat.h"
|
||||
|
||||
namespace lmms::gui
|
||||
{
|
||||
|
||||
|
||||
TextFloat * Fader::s_textFloat = nullptr;
|
||||
SimpleTextFloat * Fader::s_textFloat = nullptr;
|
||||
QPixmap * Fader::s_back = nullptr;
|
||||
QPixmap * Fader::s_leds = nullptr;
|
||||
QPixmap * Fader::s_knob = nullptr;
|
||||
@@ -83,7 +83,7 @@ Fader::Fader( FloatModel * _model, const QString & _name, QWidget * _parent ) :
|
||||
{
|
||||
if( s_textFloat == nullptr )
|
||||
{
|
||||
s_textFloat = new TextFloat;
|
||||
s_textFloat = new SimpleTextFloat;
|
||||
}
|
||||
if( ! s_back )
|
||||
{
|
||||
@@ -125,7 +125,7 @@ Fader::Fader( FloatModel * model, const QString & name, QWidget * parent, QPixma
|
||||
{
|
||||
if( s_textFloat == nullptr )
|
||||
{
|
||||
s_textFloat = new TextFloat;
|
||||
s_textFloat = new SimpleTextFloat;
|
||||
}
|
||||
|
||||
m_back = back;
|
||||
@@ -328,7 +328,8 @@ void Fader::updateTextFloat()
|
||||
{
|
||||
s_textFloat->setText( m_description + " " + QString("%1 ").arg( model()->value() * m_conversionFactor ) + " " + m_unit );
|
||||
}
|
||||
s_textFloat->moveGlobal( this, QPoint( width() - ( *m_knob ).width() - 5, knobPosY() - 46 ) );
|
||||
|
||||
s_textFloat->moveGlobal(this, QPoint(width() + 2, knobPosY() - s_textFloat->height() / 2));
|
||||
}
|
||||
|
||||
|
||||
@@ -483,4 +484,4 @@ void Fader::setPeakYellow( const QColor & c )
|
||||
}
|
||||
|
||||
|
||||
} // namespace lmms::gui
|
||||
} // namespace lmms::gui
|
||||
|
||||
@@ -45,14 +45,14 @@
|
||||
#include "LocaleHelper.h"
|
||||
#include "MainWindow.h"
|
||||
#include "ProjectJournal.h"
|
||||
#include "SimpleTextFloat.h"
|
||||
#include "StringPairDrag.h"
|
||||
#include "TextFloat.h"
|
||||
|
||||
|
||||
namespace lmms::gui
|
||||
{
|
||||
|
||||
TextFloat * Knob::s_textFloat = nullptr;
|
||||
SimpleTextFloat * Knob::s_textFloat = nullptr;
|
||||
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ void Knob::initUi( const QString & _name )
|
||||
{
|
||||
if( s_textFloat == nullptr )
|
||||
{
|
||||
s_textFloat = new TextFloat;
|
||||
s_textFloat = new SimpleTextFloat;
|
||||
}
|
||||
|
||||
setWindowTitle( _name );
|
||||
|
||||
62
src/gui/widgets/SimpleTextFloat.cpp
Normal file
62
src/gui/widgets/SimpleTextFloat.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* TextFloat.cpp - class textFloat, a floating text-label
|
||||
*
|
||||
* Copyright (c) LMMS team
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "SimpleTextFloat.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QStyleOption>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
#include "GuiApplication.h"
|
||||
#include "MainWindow.h"
|
||||
|
||||
namespace lmms::gui
|
||||
{
|
||||
|
||||
|
||||
SimpleTextFloat::SimpleTextFloat() :
|
||||
QWidget(getGUI()->mainWindow(), Qt::ToolTip)
|
||||
{
|
||||
QHBoxLayout * layout = new QHBoxLayout(this);
|
||||
layout->setMargin(3);
|
||||
setLayout(layout);
|
||||
|
||||
m_textLabel = new QLabel(this);
|
||||
layout->addWidget(m_textLabel);
|
||||
}
|
||||
|
||||
void SimpleTextFloat::setText(const QString & text)
|
||||
{
|
||||
m_textLabel->setText(text);
|
||||
}
|
||||
|
||||
|
||||
void SimpleTextFloat::setVisibilityTimeOut(int msecs)
|
||||
{
|
||||
QTimer::singleShot(msecs, this, SLOT(hide()));
|
||||
show();
|
||||
}
|
||||
|
||||
} // namespace lmms::gui
|
||||
@@ -22,12 +22,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "TextFloat.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QPainter>
|
||||
#include <QStyleOption>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
#include "TextFloat.h"
|
||||
#include "gui_templates.h"
|
||||
#include "GuiApplication.h"
|
||||
#include "MainWindow.h"
|
||||
|
||||
@@ -36,170 +39,97 @@ namespace lmms::gui
|
||||
|
||||
|
||||
TextFloat::TextFloat() :
|
||||
QWidget( getGUI()->mainWindow(), Qt::ToolTip ),
|
||||
m_title(),
|
||||
m_text(),
|
||||
m_pixmap()
|
||||
TextFloat("", "", QPixmap())
|
||||
{
|
||||
resize( 20, 20 );
|
||||
hide();
|
||||
|
||||
setAttribute( Qt::WA_TranslucentBackground, true );
|
||||
setStyle( QApplication::style() );
|
||||
setFont( pointSize<8>( font() ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void TextFloat::setTitle( const QString & _title )
|
||||
TextFloat::TextFloat(const QString & title, const QString & text, const QPixmap & pixmap) :
|
||||
QWidget(getGUI()->mainWindow(), Qt::ToolTip)
|
||||
{
|
||||
m_title = _title;
|
||||
updateSize();
|
||||
QHBoxLayout * mainLayout = new QHBoxLayout();
|
||||
setLayout(mainLayout);
|
||||
|
||||
// Create the label that displays the pixmap
|
||||
m_pixmapLabel = new QLabel(this);
|
||||
mainLayout->addWidget(m_pixmapLabel);
|
||||
|
||||
// Create the widget that displays the title and the text
|
||||
QWidget * titleAndTextWidget = new QWidget(this);
|
||||
QVBoxLayout * titleAndTextLayout = new QVBoxLayout();
|
||||
titleAndTextWidget->setLayout(titleAndTextLayout);
|
||||
|
||||
m_titleLabel = new QLabel(titleAndTextWidget);
|
||||
m_titleLabel->setStyleSheet("font-weight: bold;");
|
||||
titleAndTextLayout->addWidget(m_titleLabel);
|
||||
|
||||
m_textLabel = new QLabel(titleAndTextWidget);
|
||||
titleAndTextLayout->addWidget(m_textLabel);
|
||||
|
||||
mainLayout->addWidget(titleAndTextWidget);
|
||||
|
||||
// Call the setters so that the hidden state is updated
|
||||
setTitle(title);
|
||||
setText(text);
|
||||
setPixmap(pixmap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void TextFloat::setText( const QString & _text )
|
||||
void TextFloat::setTitle(const QString & title)
|
||||
{
|
||||
m_text = _text;
|
||||
updateSize();
|
||||
m_titleLabel->setText(title);
|
||||
m_titleLabel->setHidden(title.isEmpty());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void TextFloat::setPixmap( const QPixmap & _pixmap )
|
||||
void TextFloat::setText(const QString & text)
|
||||
{
|
||||
m_pixmap = _pixmap;
|
||||
updateSize();
|
||||
m_textLabel->setText(text);
|
||||
m_textLabel->setHidden(text.isEmpty());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void TextFloat::setVisibilityTimeOut( int _msecs )
|
||||
void TextFloat::setPixmap(const QPixmap & pixmap)
|
||||
{
|
||||
QTimer::singleShot( _msecs, this, SLOT(hide()));
|
||||
m_pixmapLabel->setPixmap(pixmap);
|
||||
m_pixmapLabel->setHidden(pixmap.isNull());
|
||||
}
|
||||
|
||||
void TextFloat::setVisibilityTimeOut(int msecs)
|
||||
{
|
||||
QTimer::singleShot(msecs, this, SLOT(hide()));
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
TextFloat * TextFloat::displayMessage( const QString & _msg, int _timeout,
|
||||
QWidget * _parent, int _add_y_margin )
|
||||
TextFloat * TextFloat::displayMessage(const QString & title,
|
||||
const QString & msg,
|
||||
const QPixmap & pixmap,
|
||||
int timeout, QWidget * parent)
|
||||
{
|
||||
QWidget * mw = getGUI()->mainWindow();
|
||||
auto tf = new TextFloat;
|
||||
if( _parent != nullptr )
|
||||
{
|
||||
tf->moveGlobal( _parent, QPoint( _parent->width() + 2, 0 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
tf->moveGlobal( mw, QPoint( 32, mw->height() - tf->height() - 8 - _add_y_margin ) );
|
||||
}
|
||||
tf->setText( _msg );
|
||||
auto tf = new TextFloat(title, msg, pixmap);
|
||||
|
||||
// Show the widget so that the correct height is calculated in the code that follows
|
||||
tf->show();
|
||||
if( _timeout > 0 )
|
||||
|
||||
if(parent != nullptr)
|
||||
{
|
||||
tf->setAttribute( Qt::WA_DeleteOnClose, true );
|
||||
QTimer::singleShot( _timeout, tf, SLOT(close()));
|
||||
}
|
||||
return( tf );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
TextFloat * TextFloat::displayMessage( const QString & _title,
|
||||
const QString & _msg,
|
||||
const QPixmap & _pixmap,
|
||||
int _timeout, QWidget * _parent )
|
||||
{
|
||||
TextFloat * tf = displayMessage( _msg, _timeout, _parent, 16 );
|
||||
tf->setTitle( _title );
|
||||
tf->setPixmap( _pixmap );
|
||||
return( tf );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
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( 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() );*/
|
||||
|
||||
if( m_title.isEmpty() )
|
||||
{
|
||||
p.drawText( opt.rect, Qt::AlignCenter, m_text );
|
||||
tf->moveGlobal(parent, QPoint(parent->width() + 2, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
int text_x = opt.rect.left() + 2;
|
||||
int text_y = opt.rect.top() + 12;
|
||||
if( m_pixmap.isNull() == false )
|
||||
{
|
||||
p.drawPixmap( opt.rect.topLeft() + QPoint( 5, 5 ), m_pixmap );
|
||||
text_x += m_pixmap.width() + 8;
|
||||
}
|
||||
p.drawText( text_x, text_y + 16, m_text );
|
||||
QFont f = p.font();
|
||||
f.setBold( true );
|
||||
p.setFont( f );
|
||||
p.drawText( text_x, text_y, m_title );
|
||||
// If no parent is given move the window to the lower left area of the main window
|
||||
QWidget * mw = getGUI()->mainWindow();
|
||||
tf->moveGlobal(mw, QPoint(32, mw->height() - tf->height() - 8));
|
||||
}
|
||||
|
||||
if (timeout > 0)
|
||||
{
|
||||
tf->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
QTimer::singleShot(timeout, tf, SLOT(close()));
|
||||
}
|
||||
|
||||
return tf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void TextFloat::mousePressEvent( QMouseEvent * )
|
||||
void TextFloat::mousePressEvent(QMouseEvent *)
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void TextFloat::updateSize()
|
||||
{
|
||||
QFontMetrics metrics( pointSize<8>( font() ) );
|
||||
QRect textBound = metrics.boundingRect( m_text );
|
||||
if( !m_title.isEmpty() )
|
||||
{
|
||||
QFont f = pointSize<8>( font() );
|
||||
f.setBold( true );
|
||||
int title_w = QFontMetrics( f ).boundingRect( m_title ).width();
|
||||
if( title_w > textBound.width() )
|
||||
{
|
||||
textBound.setWidth( title_w );
|
||||
}
|
||||
textBound.setHeight( textBound.height() * 2 + 8 );
|
||||
}
|
||||
if( m_pixmap.isNull() == false )
|
||||
{
|
||||
textBound.setWidth( textBound.width() + m_pixmap.width() + 10 );
|
||||
}
|
||||
resize( textBound.width() + 5, textBound.height()+2 );
|
||||
//move( QPoint( parentWidget()->width() + 5, 5 ) );
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace lmms::gui
|
||||
|
||||
Reference in New Issue
Block a user