rename "text" to "title" in NotebookTab

This commit is contained in:
Rasmus Karlsson
2017-01-29 11:39:16 +01:00
parent c0b4035e6a
commit 199e87896b
2 changed files with 12 additions and 12 deletions
+7 -7
View File
@@ -14,7 +14,7 @@ NotebookTab::NotebookTab(Notebook *notebook)
, posAnimated(false) , posAnimated(false)
, posAnimationDesired() , posAnimationDesired()
, notebook(notebook) , notebook(notebook)
, text("<no title>") , title("<no title>")
, selected(false) , selected(false)
, mouseOver(false) , mouseOver(false)
, mouseDown(false) , mouseDown(false)
@@ -52,9 +52,9 @@ void
NotebookTab::calcSize() NotebookTab::calcSize()
{ {
if (Settings::getInstance().hideTabX.get()) { if (Settings::getInstance().hideTabX.get()) {
this->resize(this->fontMetrics().width(this->text) + 8, 24); this->resize(this->fontMetrics().width(this->title) + 8, 24);
} else { } else {
this->resize(this->fontMetrics().width(this->text) + 8 + 24, 24); this->resize(this->fontMetrics().width(this->title) + 8 + 24, 24);
} }
} }
@@ -115,7 +115,7 @@ NotebookTab::paintEvent(QPaintEvent *)
width() - (Settings::getInstance().hideTabX.get() ? 0 : 16), width() - (Settings::getInstance().hideTabX.get() ? 0 : 16),
height()); height());
painter.drawText(rect, this->text, QTextOption(Qt::AlignCenter)); painter.drawText(rect, this->title, QTextOption(Qt::AlignCenter));
if (!Settings::getInstance().hideTabX.get() && if (!Settings::getInstance().hideTabX.get() &&
(this->mouseOver || this->selected)) { (this->mouseOver || this->selected)) {
@@ -207,9 +207,9 @@ NotebookTab::mouseMoveEvent(QMouseEvent *event)
void void
NotebookTab::load(const boost::property_tree::ptree &tree) NotebookTab::load(const boost::property_tree::ptree &tree)
{ {
// Load tab text // Load tab title
try { try {
this->setText(QString::fromStdString(tree.get<std::string>("text"))); this->setTitle(QString::fromStdString(tree.get<std::string>("title")));
} catch (boost::property_tree::ptree_error) { } catch (boost::property_tree::ptree_error) {
} }
} }
@@ -219,7 +219,7 @@ NotebookTab::save()
{ {
boost::property_tree::ptree tree; boost::property_tree::ptree tree;
tree.put("text", this->getText().toStdString()); tree.put("title", this->getTitle().toStdString());
return tree; return tree;
} }
+5 -5
View File
@@ -30,15 +30,15 @@ public:
NotebookPage *page; NotebookPage *page;
const QString & const QString &
getText() const getTitle() const
{ {
return this->text; return this->title;
} }
void void
setText(const QString &text) setTitle(const QString &title)
{ {
this->text = text; this->title = title;
} }
bool bool
@@ -95,7 +95,7 @@ private:
Notebook *notebook; Notebook *notebook;
QString text; QString title;
bool selected; bool selected;
bool mouseOver; bool mouseOver;