mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-26 08:01:32 +08:00
Merge pull request #18 from yozka/feature
set title bar and title toggle view action
This commit is contained in:
commit
4dde545c8f
@ -61,11 +61,11 @@ struct DockWidgetPrivate
|
|||||||
CDockWidget* _this;
|
CDockWidget* _this;
|
||||||
QBoxLayout* Layout;
|
QBoxLayout* Layout;
|
||||||
QWidget* Widget = nullptr;
|
QWidget* Widget = nullptr;
|
||||||
CDockWidgetTab* TabWidget;
|
CDockWidgetTab* TabWidget = nullptr;
|
||||||
CDockWidget::DockWidgetFeatures Features = CDockWidget::AllDockWidgetFeatures;
|
CDockWidget::DockWidgetFeatures Features = CDockWidget::AllDockWidgetFeatures;
|
||||||
CDockManager* DockManager = nullptr;
|
CDockManager* DockManager = nullptr;
|
||||||
CDockAreaWidget* DockArea = nullptr;
|
CDockAreaWidget* DockArea = nullptr;
|
||||||
QAction* ToggleViewAction;
|
QAction* ToggleViewAction = nullptr;
|
||||||
bool Closed = false;
|
bool Closed = false;
|
||||||
QScrollArea* ScrollArea = nullptr;
|
QScrollArea* ScrollArea = nullptr;
|
||||||
QToolBar* ToolBar = nullptr;
|
QToolBar* ToolBar = nullptr;
|
||||||
@ -507,7 +507,16 @@ bool CDockWidget::event(QEvent *e)
|
|||||||
{
|
{
|
||||||
if (e->type() == QEvent::WindowTitleChange)
|
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);
|
return QFrame::event(e);
|
||||||
}
|
}
|
||||||
|
@ -482,6 +482,14 @@ void CDockWidgetTab::setVisible(bool visible)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
|
void CDockWidgetTab::setText(const QString& title)
|
||||||
|
{
|
||||||
|
d->TitleLabel->setText(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
bool CDockWidgetTab::isClosable() const
|
bool CDockWidgetTab::isClosable() const
|
||||||
{
|
{
|
||||||
|
@ -125,13 +125,21 @@ public:
|
|||||||
*/
|
*/
|
||||||
QString text() const;
|
QString text() const;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the tab text
|
||||||
|
*/
|
||||||
|
void setText(const QString& title);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns true if the assigned dock widget is closeable
|
* This function returns true if the assigned dock widget is closeable
|
||||||
*/
|
*/
|
||||||
bool isClosable() const;
|
bool isClosable() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void setVisible(bool visible) override;
|
|
||||||
|
virtual void setVisible(bool visible) override;
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void activeTabChanged();
|
void activeTabChanged();
|
||||||
|
Loading…
Reference in New Issue
Block a user