aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/browsertabbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/browsertabbar.cpp')
-rw-r--r--src/widgets/browsertabbar.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/widgets/browsertabbar.cpp b/src/widgets/browsertabbar.cpp
index 97fc1a1..541ee96 100644
--- a/src/widgets/browsertabbar.cpp
+++ b/src/widgets/browsertabbar.cpp
@@ -1,4 +1,5 @@
#include "browsertabbar.hpp"
+#include "kristall.hpp"
#include <QMouseEvent>
@@ -9,10 +10,10 @@ static const int NEWTAB_BTN_SIZE = 22,
BrowserTabBar::BrowserTabBar(QWidget *parent) :
QTabBar(parent)
{
- newTabBtn = new QPushButton("+", this);
- newTabBtn->setFixedSize(NEWTAB_BTN_SIZE, NEWTAB_BTN_SIZE);
- connect(newTabBtn, &QPushButton::clicked, this, &BrowserTabBar::on_newTabClicked);
- this->newTabBtn->setVisible(true);
+ new_tab_btn = new QPushButton("+", this);
+ new_tab_btn->setFixedSize(NEWTAB_BTN_SIZE, NEWTAB_BTN_SIZE);
+ connect(new_tab_btn, &QPushButton::clicked, this, &BrowserTabBar::on_newTabClicked);
+ this->new_tab_btn->setVisible(kristall::options.enable_newtab_btn);
}
void BrowserTabBar::mouseReleaseEvent(QMouseEvent *event)
@@ -26,6 +27,11 @@ void BrowserTabBar::mouseReleaseEvent(QMouseEvent *event)
void BrowserTabBar::moveNewTabButton()
{
+ if (!kristall::options.enable_newtab_btn)
+ {
+ return;
+ }
+
// Find width of all tabs
int size = 0;
for (int i = 0; i < this->count(); ++i)
@@ -36,13 +42,13 @@ void BrowserTabBar::moveNewTabButton()
int w = this->width();
if ((size + NEWTAB_BTN_SIZE + NEWTAB_BTN_PAD_X) > w)
{
- this->newTabBtn->setVisible(false);
- //this->newTabBtn->move(w - 54, h + 22 / 4);
+ this->new_tab_btn->setVisible(false);
+ //this->new_tab_btn->move(w - 54, h + 22 / 4);
}
else
{
- this->newTabBtn->setVisible(true);
- this->newTabBtn->move(size + NEWTAB_BTN_PAD_X,
+ this->new_tab_btn->setVisible(true);
+ this->new_tab_btn->move(size + NEWTAB_BTN_PAD_X,
h + NEWTAB_BTN_SIZE / 4);
}
}