diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-03-20 01:56:32 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-03-20 01:56:32 +0100 |
commit | 987eca7269ebac1d820914919b3ed93f1c6e9b84 (patch) | |
tree | 1232e593323a9102de533842efdc9a03adf6a993 | |
parent | Forgot header.. ;) (diff) | |
download | rekonq-987eca7269ebac1d820914919b3ed93f1c6e9b84.tar.xz |
Fixed tabs dimension && reduced tabbar font
-rw-r--r-- | src/tabbar.cpp | 32 | ||||
-rw-r--r-- | src/tabbar.h | 3 |
2 files changed, 21 insertions, 14 deletions
diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 8f648f28..ac18d7e8 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -35,33 +35,25 @@ #include <KMessageBox> #include <KAction> #include <KDebug> +#include <KGlobalSettings> // Qt Includes #include <QtGui> -#include <QDebug> TabBar::TabBar(QWidget *parent) : KTabBar(parent) + , m_parent(parent) { setElideMode(Qt::ElideRight); setContextMenuPolicy(Qt::CustomContextMenu); setAcceptDrops(true); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenuRequested(const QPoint &))); -// FIXME: not sure we need this.. -// QString alt = QLatin1String("Alt+%1"); -// for (int i = 1; i <= 10; ++i) -// { -// int key = i; -// if (key == 10) -// { -// key = 0; -// } -// QShortcut *shortCut = new QShortcut(alt.arg(key), this); -// m_tabShortcuts.append(shortCut); -// connect(shortCut, SIGNAL(activated()), this, SLOT(selectTabAction())); -// } + QFont standardFont = KGlobalSettings::generalFont(); + QString fontFamily = standardFont.family(); + int dim = standardFont.pointSize(); + setFont( QFont(fontFamily, dim-2) ); } @@ -70,6 +62,18 @@ TabBar::~TabBar() } +QSize TabBar::tabSizeHint (int index) const +{ + Q_UNUSED(index); + QSize s = m_parent->sizeHint(); + int w = s.width() / 5; + int h = s.height() / 20; + + QSize ts = QSize(w,h); + return ts; +} + + void TabBar::selectTabAction() { if (QShortcut *shortCut = qobject_cast<QShortcut*>(sender())) diff --git a/src/tabbar.h b/src/tabbar.h index 0dbdd004..8b670def 100644 --- a/src/tabbar.h +++ b/src/tabbar.h @@ -56,6 +56,8 @@ protected: void dragEnterEvent(QDragEnterEvent *event); void dropEvent(QDropEvent *event); + virtual QSize tabSizeHint (int index) const; + private slots: void selectTabAction(); void cloneTab(); @@ -68,6 +70,7 @@ private: QList<QShortcut*> m_tabShortcuts; friend class MainView; + QWidget *m_parent; QPoint m_dragStartPos; int m_dragCurrentIndex; int m_actualIndex; // the index in which we are seeing a Context menu |