mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 23:31:32 +08:00
Merge branch 'auto_hide_feature' of github.com:duerr-ndt/Qt-Advanced-Docking-System into auto_hide_feature
This commit is contained in:
commit
54b9a8dc50
@ -118,7 +118,7 @@ Qt::TextElideMode CElidingLabel::elideMode() const
|
||||
void CElidingLabel::setElideMode(Qt::TextElideMode mode)
|
||||
{
|
||||
d->ElideMode = mode;
|
||||
d->elideText(size().width());
|
||||
d->elideText(availableWidthForText());
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -155,12 +155,26 @@ void CElidingLabel::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
if (!d->isModeElideNone())
|
||||
{
|
||||
d->elideText(event->size().width());
|
||||
d->elideText(availableWidthForText(event));
|
||||
}
|
||||
Super::resizeEvent(event);
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
int CElidingLabel::availableWidthForText() const
|
||||
{
|
||||
return size().width();
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
int CElidingLabel::availableWidthForText(QResizeEvent* event) const
|
||||
{
|
||||
return event->size().width();
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
QSize CElidingLabel::minimumSizeHint() const
|
||||
{
|
||||
@ -216,7 +230,7 @@ void CElidingLabel::setText(const QString &text)
|
||||
else
|
||||
{
|
||||
internal::setToolTip(this, text);
|
||||
d->elideText(this->size().width());
|
||||
d->elideText(availableWidthForText());
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,7 +252,7 @@ void CVerticalElidingLabel::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.rotate(90);
|
||||
painter.drawText(0,0, text());
|
||||
painter.drawText(0,0, QLabel::text());
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@ -254,6 +268,18 @@ QSize CVerticalElidingLabel::minimumSizeHint() const
|
||||
QSize s = CElidingLabel::sizeHint();
|
||||
return QSize(s.height(), s.width());
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
int CVerticalElidingLabel::availableWidthForText() const
|
||||
{
|
||||
return size().height();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
int CVerticalElidingLabel::availableWidthForText(QResizeEvent* event) const
|
||||
{
|
||||
return event->size().height();
|
||||
}
|
||||
} // namespace QtLabb
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -55,6 +55,9 @@ protected:
|
||||
virtual void resizeEvent( QResizeEvent *event ) override;
|
||||
virtual void mouseDoubleClickEvent( QMouseEvent *ev ) override;
|
||||
|
||||
virtual int availableWidthForText() const;
|
||||
virtual int availableWidthForText(QResizeEvent* event) const;
|
||||
|
||||
public:
|
||||
using Super = QLabel;
|
||||
|
||||
@ -109,6 +112,8 @@ protected:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
QSize sizeHint() const override;
|
||||
QSize minimumSizeHint() const override;
|
||||
int availableWidthForText() const override;
|
||||
int availableWidthForText(QResizeEvent* event) const override;
|
||||
|
||||
public:
|
||||
CVerticalElidingLabel(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags ());
|
||||
|
Loading…
Reference in New Issue
Block a user