6#include "private/qapplication_p.h"
7#include "private/qwidget_p.h"
8#include "private/qtabbar_p.h"
204 q->setTabBar(tabBar);
208#ifdef QT_KEYPAD_NAVIGATION
209 if (QApplicationPrivate::keypadNavigationEnabled())
214 q->setFocusProxy(
tabs);
227 bool has =
d->size_policy.hasHeightForWidth();
228 if (!has &&
d->stack)
229 has =
d->stack->hasHeightForWidth();
244 if (
q->documentMode())
268 option->tabBarRect =
q->tabBar()->geometry();
284 d->initBasicStyleOption(
option);
287 QSize t(0,
d->stack->frameWidth());
288 if (
d->tabs->isVisibleTo(
const_cast<QTabWidget *
>(
this))) {
289 t =
d->tabs->sizeHint();
299 if (
d->rightCornerWidget) {
300 const QSize rightCornerSizeHint =
d->rightCornerWidget->sizeHint();
301 const QSize bounds(rightCornerSizeHint.
width(),
t.height() - exth);
307 if (
d->leftCornerWidget) {
308 const QSize leftCornerSizeHint =
d->leftCornerWidget->sizeHint();
309 const QSize bounds(leftCornerSizeHint.
width(),
t.height() - exth);
319 option->selectedTabRect = selectedTabRect;
475 return d->tabs->tabText(
index);
495 return d->tabs->tabIcon(
index);
507 return d->tabs->isTabEnabled(
index);
542 return d->tabs->isTabVisible(
index);
557 bool currentVisible =
d->tabs->isTabVisible(
d->tabs->currentIndex());
562 }
else if (!currentVisible) {
599 if (
d->rightCornerWidget)
600 d->rightCornerWidget->hide();
603 if (
d->leftCornerWidget)
604 d->leftCornerWidget->hide();
617 return d->rightCornerWidget;
618 return d->leftCornerWidget;
631 d->stack->removeWidget(
w);
645 return d->stack->currentWidget();
674 return d->tabs->currentIndex();
680 d->tabs->setCurrentIndex(
index);
691 return d->stack->indexOf(
w);
724 this,
SLOT(_q_showTab(
int)));
726 this,
SLOT(_q_tabMoved(
int,
int)));
731 if (
d->tabs->tabsClosable())
784void QTabWidget::setUpLayout(
bool onlyCheck)
787 if (onlyCheck && !
d->dirty)
792 QStyleOptionTabWidgetFrame basicOption;
793 d->initBasicStyleOption(&basicOption);
799 QStyleOptionTabWidgetFrame
option;
809 d->tabs->setGeometry(tabRect);
811 if (
d->leftCornerWidget)
812 d->leftCornerWidget->setGeometry(leftCornerRect);
813 if (
d->rightCornerWidget)
814 d->rightCornerWidget->setGeometry(rightCornerRect);
840 QSize lc(0, 0), rc(0, 0);
841 QStyleOptionTabWidgetFrame
opt;
845 if (
d->leftCornerWidget)
846 lc =
d->leftCornerWidget->sizeHint();
847 if (
d->rightCornerWidget)
848 rc =
d->rightCornerWidget->sizeHint();
851 that->setUpLayout(
true);
854 for (
int i=0;
i<
d->stack->count(); ++
i) {
856 if (
d->tabs->isTabVisible(
i))
857 s =
s.expandedTo(
w->sizeHint());
861 if (!
d->isAutoHidden()) {
862 t =
d->tabs->sizeHint();
864 t =
t.boundedTo(
QSize(200,200));
883 QSize lc(0, 0), rc(0, 0);
885 if (
d->leftCornerWidget)
886 lc =
d->leftCornerWidget->minimumSizeHint();
887 if (
d->rightCornerWidget)
888 rc =
d->rightCornerWidget->minimumSizeHint();
891 that->setUpLayout(
true);
893 QSize s(
d->stack->minimumSizeHint());
895 if (!
d->isAutoHidden())
896 t =
d->tabs->minimumSizeHint();
900 QStyleOptionTabWidgetFrame
opt;
913 QStyleOptionTabWidgetFrame
opt;
920 QSize lc(0, 0), rc(0, 0);
921 if (
d->leftCornerWidget)
922 lc =
d->leftCornerWidget->sizeHint();
923 if (
d->rightCornerWidget)
924 rc =
d->rightCornerWidget->sizeHint();
927 that->setUpLayout(
true);
930 if (!
d->isAutoHidden()) {
931 t =
d->tabs->sizeHint();
933 t =
t.boundedTo(
QSize(200,200));
938 const bool tabIsHorizontal = (
d->pos ==
North ||
d->pos ==
South);
939 const int contentsWidth =
width - padding.
width();
940 int stackWidth = contentsWidth;
941 if (!tabIsHorizontal)
944 int stackHeight =
d->stack->heightForWidth(stackWidth);
945 QSize s(stackWidth, stackHeight);
948 return (contentSize + padding).height();
1007 d->updateTabBarPosition();
1080 d->updateTabBarPosition();
1116#ifdef QT_KEYPAD_NAVIGATION
1120 int pageCount =
d->tabs->count();
1123#ifdef QT_KEYPAD_NAVIGATION
1127 for (
int pass = 0; pass < pageCount; ++pass) {
1130#ifdef QT_KEYPAD_NAVIGATION
1131 && !
e->isAutoRepeat()
1135 }
else if (
page >= pageCount
1136#ifdef QT_KEYPAD_NAVIGATION
1137 && !
e->isAutoRepeat()
1142 if (
d->tabs->isTabEnabled(
page)) {
1148 d->tabs->setFocus();
1161 return d->stack->widget(
index);
1173 return d->tabs->count();
1176#if QT_CONFIG(tooltip)
1182void QTabWidget::setTabToolTip(
int index,
const QString & tip)
1185 d->tabs->setTabToolTip(
index, tip);
1197 return d->tabs->tabToolTip(
index);
1201#if QT_CONFIG(whatsthis)
1223 return d->tabs->tabWhatsThis(
index);
1260 QStyleOptionTabBarBase
opt;
1267 QStyleOptionTabBarBase
opt;
1277 QStyleOptionTabWidgetFrame
opt;
1296 return d_func()->tabs->iconSize();
1301 d_func()->tabs->setIconSize(
size);
1318 return d_func()->tabs->elideMode();
1323 d_func()->tabs->setElideMode(
mode);
1341 return d_func()->tabs->usesScrollButtons();
1346 d_func()->tabs->setUsesScrollButtons(useButtons);
1364 return d->tabs->documentMode();
1390 return d->tabs->autoHide();
1396 return d->tabs->setAutoHide(
enabled);
1426#include "moc_qtabwidget.cpp"
static QWidget * focusWidget()
Returns the application widget that has the keyboard input focus, or \nullptr if no widget in this ap...
Type type() const
Returns the event type.
QScreen * primaryScreen
the primary (or default) screen of the application.
The QIcon class provides scalable icons in different modes and states.
The QKeyEvent class describes a key event.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Q_WEAK_OVERLOAD void setObjectName(const QString &name)
Sets the object's name to name.
The QPaintEvent class contains event parameters for paint events.
\inmodule QtCore\reentrant
constexpr void moveTopLeft(const QPoint &p) noexcept
Moves the rectangle, leaving the top-left corner at the given position.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr void moveLeft(int pos) noexcept
Moves the rectangle horizontally, leaving the rectangle's left edge at the given x coordinate.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr void moveTop(int pos) noexcept
Moves the rectangle vertically, leaving the rectangle's top edge at the given y coordinate.
The QResizeEvent class contains event parameters for resize events.
QRect virtualGeometry
the pixel geometry of the virtual desktop to which this screen belongs
QSize virtualSize
the pixel size of the virtual desktop to which this screen belongs
The QShowEvent class provides an event that is sent when a widget is shown.
Exception-safe wrapper around QObject::blockSignals().
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
constexpr QSize boundedTo(const QSize &) const noexcept
Returns a size holding the minimum width and height of this size and the given otherSize.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
\macro QT_RESTRICTED_CAST_FROM_ASCII
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget.
virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w=nullptr) const =0
Returns the size of the element described by the specified option and type, based on the provided con...
@ SH_TabWidget_DefaultTabPosition
virtual QRect subElementRect(SubElement subElement, const QStyleOption *option, const QWidget *widget=nullptr) const =0
Returns the sub-area for the given element as described in the provided style option.
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
Returns the value of the given pixel metric.
@ SE_TabWidgetRightCorner
@ SE_TabWidgetTabContents
static void initStyleBaseOption(QStyleOptionTabBarBase *optTabBase, QTabBar *tabbar, QSize size)
The QTabBar class provides a tab bar, e.g.
void setTabsClosable(bool closable)
int count
the number of tabs in the tab bar
void setShape(Shape shape)
void removeTab(int index)
Removes the tab at position index.
void setDrawBase(bool drawTheBase)
QRect tabRect(int index) const
Returns the visual rectangle of the tab at position index, or a null rectangle if index is hidden,...
bool autoHide
If true, the tab bar is automatically hidden when it contains less than 2 tabs.
void setMovable(bool movable)
Shape
This enum type lists the built-in shapes supported by QTabBar.
void setExpanding(bool enabled)
bool tabsClosable
Whether or not a tab bar should place close buttons on each tab.
Combined button and popup list for selecting options.
constexpr const T & qMax(const T &a, const T &b)
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLuint GLsizei const GLchar * label
[43]
GLdouble GLdouble GLdouble GLdouble q
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
myObject disconnect()
[26]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent