mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
Fixed ElidingLabel to properly support Qt::ElideNone
added setElideMode function to CDockWidgetTab
This commit is contained in:
parent
19331ebe2b
commit
dbf90a4233
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ namespace ads
|
||||
{
|
||||
enum eStateFileVersion
|
||||
{
|
||||
InitialVerison = 0,
|
||||
InitialVersion = 0,
|
||||
Version1 = 1,
|
||||
CurrentVersion = Version1
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user