qtquick: Add support for "Always show tabs" option
Shows the tab even if the group only has 1 dock widget
This commit is contained in:
@@ -41,6 +41,9 @@ int main(int argc, char *argv[])
|
||||
QCommandLineOption noTitleBars("t", QCoreApplication::translate("main", "Hide titlebars when tabs are visible"));
|
||||
parser.addOption(noTitleBars);
|
||||
|
||||
QCommandLineOption alwaysTabs("z", QCoreApplication::translate("main", "Show tabs even if there's only one"));
|
||||
parser.addOption(alwaysTabs);
|
||||
|
||||
#if defined(DOCKS_DEVELOPER_MODE)
|
||||
QCommandLineOption noQtTool("no-qttool", QCoreApplication::translate("main", "(internal) Don't use Qt::Tool"));
|
||||
QCommandLineOption noParentForFloating("no-parent-for-floating", QCoreApplication::translate("main", "(internal) FloatingWindows won't have a parent"));
|
||||
@@ -87,6 +90,9 @@ int main(int argc, char *argv[])
|
||||
if (parser.isSet(noTitleBars))
|
||||
flags |= KDDockWidgets::Config::Flag_HideTitleBarWhenTabsVisible;
|
||||
|
||||
if (parser.isSet(alwaysTabs))
|
||||
flags |= KDDockWidgets::Config::Flag_AlwaysShowTabs;
|
||||
|
||||
// Set any required flags. The defaults are usually fine.
|
||||
KDDockWidgets::Config::self().setFlags(flags);
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ Group::Group(View *parent, FrameOptions options, int userType)
|
||||
this, &Group::onCurrentTabChanged);
|
||||
|
||||
setLayout(parent ? parent->asLayout() : nullptr);
|
||||
m_stack->setTabBarAutoHide(!alwaysShowsTabs());
|
||||
view()->init();
|
||||
view()->d->closeRequested.connect([this](QCloseEvent *ev) {
|
||||
onCloseEvent(ev);
|
||||
|
||||
@@ -207,7 +207,7 @@ Rectangle {
|
||||
readonly property QtObject tabBarCpp: root.groupCpp ? root.groupCpp.tabWidget.tabBar
|
||||
: null
|
||||
|
||||
visible: count > 1
|
||||
visible: tabBarCpp ? (tabBarCpp.tabBarAutoHide ? count > 1 : true) : count > 1
|
||||
height: visible ? implicitHeight : 0
|
||||
|
||||
anchors {
|
||||
|
||||
@@ -65,10 +65,8 @@ void Group_qtwidgets::init()
|
||||
vlayout->setContentsMargins(0, 0, 0, 0);
|
||||
vlayout->setSpacing(0);
|
||||
vlayout->addWidget(asQWidget(m_group->titleBar()));
|
||||
auto tabWidget = m_group->stack();
|
||||
vlayout->addWidget(asQWidget(m_group->stack()));
|
||||
|
||||
tabWidget->setTabBarAutoHide(!m_group->alwaysShowsTabs());
|
||||
vlayout->addWidget(asQWidget(m_group->stack()));
|
||||
|
||||
if (m_group->isOverlayed())
|
||||
setAutoFillBackground(true);
|
||||
|
||||
Reference in New Issue
Block a user