Allow tabs to have a close button

Can be tested with kddockwidgets_example -c

Disabled by default, as I'm not 100% happy with it:
A dock widget with the "non closable" attribute will still show
the x button on the tab bar. Clicking on it won't do anything but
doesn't look so nice. Qt doesn't allow to have the close buttons only
in some tabs.

Fixes #26
This commit is contained in:
Sergio Martins
2020-02-17 20:39:28 +00:00
parent 723491d9b6
commit 10621f3b4a
4 changed files with 10 additions and 1 deletions

View File

@@ -64,6 +64,9 @@ int main(int argc, char **argv)
QCommandLineOption incompatibleMainWindows("i", QCoreApplication::translate("main", "Only usable with -m. Make the two main windows incompatible with each other. (Illustrates (MainWindowBase::setAffinityName))"));
parser.addOption(incompatibleMainWindows);
QCommandLineOption tabsHaveCloseButton("c", QCoreApplication::translate("main", "Tabs have a close button"));
parser.addOption(tabsHaveCloseButton);
#if defined(DOCKS_DEVELOPER_MODE)
QCommandLineOption noCentralFrame("c", QCoreApplication::translate("main", "No central frame"));
parser.addOption(noCentralFrame);
@@ -94,6 +97,9 @@ int main(int argc, char **argv)
if (parser.isSet(lazyResizeOption))
flags |= KDDockWidgets::Config::Flag_LazyResize;
if (parser.isSet(tabsHaveCloseButton))
flags |= KDDockWidgets::Config::Flag_TabsHaveCloseButton;
if (parser.isSet(incompatibleMainWindows) && !parser.isSet(multipleMainWindows)) {
qWarning() << "Error: Argument -i requires -m";
return 1;