mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 21:25:44 +08:00
set title bar and title toggle view action
This commit is contained in:
parent
653f475e72
commit
c33dddbd47
@ -62,11 +62,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;
|
||||
@ -497,7 +497,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);
|
||||
}
|
||||
|
@ -466,6 +466,14 @@ void CDockWidgetTab::setVisible(bool visible)
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockWidgetTab::setText(const QString& title)
|
||||
{
|
||||
d->TitleLabel->setText(title);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//============================================================================
|
||||
bool CDockWidgetTab::isClosable() const
|
||||
{
|
||||
|
@ -125,6 +125,12 @@ public:
|
||||
*/
|
||||
QString text() const;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the tab text
|
||||
*/
|
||||
void setText(const QString& title);
|
||||
|
||||
/**
|
||||
* This function returns true if the assigned dock widget is closeable
|
||||
*/
|
||||
@ -133,6 +139,7 @@ public:
|
||||
public slots:
|
||||
virtual void setVisible(bool visible);
|
||||
|
||||
|
||||
signals:
|
||||
void activeTabChanged();
|
||||
void clicked();
|
||||
|
Loading…
Reference in New Issue
Block a user