Commit 58161fb2 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Remove the tabbed option for the tool options docker

This was never used in Krita, only in Words.
parent 280a76ea
......@@ -160,7 +160,6 @@ public:
QDockWidget* createDockWidget() override {
KoToolDocker* dockWidget = new KoToolDocker();
dockWidget->setTabEnabled(false);
return dockWidget;
}
......
......@@ -38,7 +38,6 @@
#include <QAction>
#include <QStyleOptionFrame>
#include <QToolButton>
#include <QTabWidget>
#include <WidgetsDebug.h>
#include <kis_debug.h>
......@@ -48,9 +47,6 @@ class Q_DECL_HIDDEN KoToolDocker::Private
public:
Private(KoToolDocker *dock)
: q(dock)
, tabbed(false)
, tabIcon(koIcon("tab-new"))
, unTabIcon(koIcon("tab-close"))
{
}
......@@ -62,11 +58,6 @@ public:
QGridLayout *housekeeperLayout;
KoToolDocker *q;
Qt::DockWidgetArea dockingArea;
bool tabbed;
QIcon tabIcon;
QIcon unTabIcon;
QToolButton *tabButton;
void resetWidgets()
{
......@@ -90,18 +81,6 @@ public:
// need to unstretch row that have previously been stretched
housekeeperLayout->setRowStretch(housekeeperLayout->rowCount()-1, 0);
if (tabbed && currentWidgetList.size() > 1) {
QTabWidget *t;
housekeeperLayout->addWidget(t = new QTabWidget(), 0, 0);
t->setDocumentMode(true);
currentAuxWidgets.insert(t);
Q_FOREACH (QPointer<QWidget> widget, currentWidgetList) {
if (widget.isNull() || widget->objectName().isEmpty()) {
continue;
}
t->addTab(widget, widget->windowTitle());
}
} else {
int cnt = 0;
QFrame *s;
QLabel *l;
......@@ -166,7 +145,7 @@ public:
default:
break;
}
}
housekeeperLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
housekeeperLayout->invalidate();
}
......@@ -177,26 +156,12 @@ public:
recreateLayout(currentWidgetList);
}
void toggleTab()
{
if (!tabbed) {
tabbed = true;
tabButton->setIcon(unTabIcon);
} else {
tabbed = false;
tabButton->setIcon(tabIcon);
}
recreateLayout(currentWidgetList);
}
};
KoToolDocker::KoToolDocker(QWidget *parent)
: QDockWidget(i18n("Tool Options"), parent),
d(new Private(this))
{
KConfigGroup cfg = KSharedConfig::openConfig()->group("DockWidget sharedtooldocker");
d->tabbed = cfg.readEntry("TabbedMode", false);
setFeatures(DockWidgetMovable|DockWidgetFloatable);
connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea )), this, SLOT(locationChanged(Qt::DockWidgetArea)));
......@@ -218,21 +183,10 @@ KoToolDocker::KoToolDocker(QWidget *parent)
d->scrollArea->setFocusPolicy(Qt::NoFocus);
setWidget(d->scrollArea);
d->tabButton = new QToolButton(this); // parent hack in toggleLock to keep it clickable
d->tabButton->setIcon(d->tabIcon);
d->tabButton->setToolTip(i18n("Toggles organizing the options in tabs or not"));
d->tabButton->setAutoRaise(true);
connect(d->tabButton, SIGNAL(clicked()), SLOT(toggleTab()));
d->tabButton->resize(d->tabButton->sizeHint());
}
KoToolDocker::~KoToolDocker()
{
KConfigGroup cfg = KSharedConfig::openConfig()->group("DockWidget sharedtooldocker");
cfg.writeEntry("TabbedMode", d->tabbed);
cfg.sync();
delete d;
}
......@@ -241,22 +195,11 @@ bool KoToolDocker::hasOptionWidget()
return !d->currentWidgetList.isEmpty();
}
void KoToolDocker::setTabEnabled(bool enabled)
{
d->tabButton->setVisible(enabled);
}
void KoToolDocker::setOptionWidgets(const QList<QPointer<QWidget> > &optionWidgetList)
{
d->recreateLayout(optionWidgetList);
}
void KoToolDocker::resizeEvent(QResizeEvent*)
{
int fw = isFloating() ? style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, this) : 0;
d->tabButton->move(width() - d->tabButton->width() - d->scrollArea->verticalScrollBar()->sizeHint().width(), fw);
}
void KoToolDocker::resetWidgets()
{
d->resetWidgets();
......
......@@ -45,9 +45,6 @@ public:
void setCanvas(KoCanvasBase *canvas) override;
void unsetCanvas() override;
protected:
void resizeEvent(QResizeEvent* event) override; ///< reimplemented from QWidget
public Q_SLOTS:
/**
* Update the option widgets to the argument one, removing the currently set widget.
......@@ -59,13 +56,7 @@ public Q_SLOTS:
*/
bool hasOptionWidget();
/**
* set the tab option
*/
void setTabEnabled(bool enabled);
private:
Q_PRIVATE_SLOT(d, void toggleTab())
Q_PRIVATE_SLOT(d, void locationChanged(Qt::DockWidgetArea area))
class Private;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment