aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/browsertabbar.cpp
diff options
context:
space:
mode:
authorMike Skec <skec@protonmail.ch>2021-01-21 21:30:50 +1100
committerFelix Queißner <felix@ib-queissner.de>2021-01-21 13:49:54 +0100
commit17a90d8dde55c5f0adc230c1a78da3dd2f8af995 (patch)
tree6773b5090e669535b7279cefee75f6d231ca4fac /src/widgets/browsertabbar.cpp
parent2091b038ef2a23a85d30d056307b3c405c416256 (diff)
downloadkristall-17a90d8dde55c5f0adc230c1a78da3dd2f8af995.tar.gz
new-tab button: add preference
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);
}
}