Fixed ElidingLabel to properly support Qt::ElideNone

added setElideMode function to CDockWidgetTab
This commit is contained in:
Uwe Kindler 2020-04-10 21:06:43 +02:00
parent 19331ebe2b
commit dbf90a4233
4 changed files with 17 additions and 3 deletions

View File

@ -176,7 +176,7 @@ DockWidgetTabPrivate::DockWidgetTabPrivate(CDockWidgetTab* _public) :
void DockWidgetTabPrivate::createLayout()
{
TitleLabel = new tTabLabel();
TitleLabel->setElideMode(Qt::ElideRight);
TitleLabel->setElideMode(Qt::ElideNone);
TitleLabel->setText(DockWidget->windowTitle());
TitleLabel->setObjectName("dockWidgetTabLabel");
TitleLabel->setAlignment(Qt::AlignCenter);
@ -578,6 +578,8 @@ void CDockWidgetTab::setText(const QString& title)
d->TitleLabel->setText(title);
}
//============================================================================
bool CDockWidgetTab::isTitleElided() const
{
return d->TitleLabel->isElided();
@ -630,6 +632,13 @@ void CDockWidgetTab::onDockWidgetFeaturesChanged()
}
//============================================================================
void CDockWidgetTab::setElideMode(Qt::TextElideMode mode)
{
d->TitleLabel->setElideMode(mode);
}
} // namespace ads

View File

@ -147,6 +147,11 @@ public:
*/
virtual bool event(QEvent *e) override;
/**
* Sets the text elide mode
*/
void setElideMode(Qt::TextElideMode mode);
public slots:
virtual void setVisible(bool visible) override;

View File

@ -197,13 +197,13 @@ QSize CElidingLabel::sizeHint() const
//============================================================================
void CElidingLabel::setText(const QString &text)
{
d->Text = text;
if (d->isModeElideNone())
{
Super::setText(text);
}
else
{
d->Text = text;
internal::setToolTip(this, text);
d->elideText(this->size().width());
}

View File

@ -66,7 +66,7 @@ namespace ads
{
enum eStateFileVersion
{
InitialVerison = 0,
InitialVersion = 0,
Version1 = 1,
CurrentVersion = Version1
};