2 Copyright 2007 Robert Knight <robertknight@gmail.com>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
34 class TabBar
: public QTabBar
39 TabBar(QWidget
*parent
);
41 QSize
sizeHint() const;
42 /** Like the setCurrentIndex() method but switches the tab without using any
43 animation. This is used e.g. within Launcher::reset() to switch back to the
44 favorite tab before Kickoff got shown. */
45 void setCurrentIndexWithoutAnimation(int index
);
47 /** Specifies whether hovering switches between tabs or if a click is required to switch the tabs. */
48 void setSwitchTabsOnHover(bool switchOnHover
);
49 bool switchTabsOnHover() const;
50 void setAnimateSwitch(bool animateSwitch
);
52 void setShape(Shape shape
);
55 int lastIndex() const;
57 // reimplemented from QTabBar
58 virtual QSize
tabSizeHint(int index
) const;
59 virtual void paintEvent(QPaintEvent
*event
);
60 virtual void leaveEvent(QEvent
*event
);
61 virtual void mouseMoveEvent(QMouseEvent
*event
);
62 virtual void resizeEvent(QResizeEvent
* event
);
64 bool isHorizontal() const;
65 bool isVertical() const;
68 void switchToHoveredTab();
69 void animationFinished();
70 void startAnimation();
71 void onValueChanged(qreal val
);
74 QPainterPath
tabPath(const QRect
&r
);
76 static const int TAB_CONTENTS_MARGIN
= 6;
77 int m_hoveredTabIndex
;
78 QTimer m_tabSwitchTimer
;
81 QRect m_currentAnimRect
;
84 Plasma::FrameSvg
*background
;
86 QSize
tabSize(int index
) const;
87 void storeLastIndex();