mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-25 23:40:51 +08:00
refactor and windowheader title
This commit is contained in:
parent
7637243b43
commit
b29113f70b
@ -69,7 +69,6 @@ BookmarkEditor::BookmarkEditor(size_t bookmarkIndex, bool isNew, QWidget* parent
|
||||
, m_isNewBookmark(isNew)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
//setWindowFlags(Qt::Dialog);
|
||||
setSizeGripEnabled(EASY_GLOBALS.use_custom_window_header);
|
||||
|
||||
const auto& bookmark = EASY_GLOBALS.bookmarks[m_bookmarkIndex];
|
||||
@ -135,6 +134,8 @@ BookmarkEditor::BookmarkEditor(size_t bookmarkIndex, bool isNew, QWidget* parent
|
||||
const WindowHeader::Buttons buttons {WindowHeader::MaximizeButton | WindowHeader::CloseButton};
|
||||
auto header = new WindowHeader(isNew ? "New bookmark" : "Edit bookmark", buttons, *this);
|
||||
mainLayout->addWidget(header, 0, Qt::AlignTop);
|
||||
#else
|
||||
setWindowTitle(isNew ? "New bookmark" : "Edit bookmark");
|
||||
#endif
|
||||
|
||||
mainLayout->addWidget(content, 1);
|
||||
|
@ -74,6 +74,8 @@ WindowHeader::WindowHeader(const QString& title, Buttons buttons, QWidget& paren
|
||||
{
|
||||
auto parent = &parentRef;
|
||||
|
||||
parent->setWindowTitle(title);
|
||||
|
||||
m_title->installEventFilter(this);
|
||||
m_pixmap->installEventFilter(this);
|
||||
|
||||
@ -181,6 +183,12 @@ WindowHeader::~WindowHeader()
|
||||
void WindowHeader::setTitle(const QString& title)
|
||||
{
|
||||
m_title->setText(title);
|
||||
parentWidget()->setWindowTitle(title);
|
||||
}
|
||||
|
||||
QString WindowHeader::title() const
|
||||
{
|
||||
return m_title->text();
|
||||
}
|
||||
|
||||
void WindowHeader::setWindowIcon(const QIcon& icon)
|
||||
|
@ -97,6 +97,13 @@ public:
|
||||
setTitle(title);
|
||||
}
|
||||
|
||||
QString title() const;
|
||||
|
||||
QString windowTitle() const
|
||||
{
|
||||
return title();
|
||||
}
|
||||
|
||||
private slots:
|
||||
|
||||
void onWindowStateChanged();
|
||||
|
Loading…
x
Reference in New Issue
Block a user