Merge pull request #1 from githubuser0xFFFF/master

merge base
This commit is contained in:
Andreev Alexander 2019-01-17 10:54:30 +05:00 committed by GitHub
commit 1ad6caeb8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 4 deletions

View File

@ -61,11 +61,11 @@ struct DockWidgetPrivate
CDockWidget* _this;
QBoxLayout* Layout;
QWidget* Widget = nullptr;
CDockWidgetTab* TabWidget;
CDockWidgetTab* TabWidget = nullptr;
CDockWidget::DockWidgetFeatures Features = CDockWidget::AllDockWidgetFeatures;
CDockManager* DockManager = nullptr;
CDockAreaWidget* DockArea = nullptr;
QAction* ToggleViewAction;
QAction* ToggleViewAction = nullptr;
bool Closed = false;
QScrollArea* ScrollArea = nullptr;
QToolBar* ToolBar = nullptr;
@ -507,7 +507,16 @@ bool CDockWidget::event(QEvent *e)
{
if (e->type() == QEvent::WindowTitleChange)
{
emit titleChanged(windowTitle());
const auto title = windowTitle();
if (d->TabWidget)
{
d->TabWidget->setText(title);
}
if (d->ToggleViewAction)
{
d->ToggleViewAction->setText(title);
}
emit titleChanged(title);
}
return QFrame::event(e);
}

View File

@ -482,6 +482,14 @@ void CDockWidgetTab::setVisible(bool visible)
}
//============================================================================
void CDockWidgetTab::setText(const QString& title)
{
d->TitleLabel->setText(title);
}
//============================================================================
bool CDockWidgetTab::isClosable() const
{

View File

@ -125,14 +125,22 @@ public:
*/
QString text() const;
/**
* Sets the tab text
*/
void setText(const QString& title);
/**
* This function returns true if the assigned dock widget is closeable
*/
bool isClosable() const;
public slots:
virtual void setVisible(bool visible) override;
signals:
void activeTabChanged();
void clicked();