22 #include <dtkCoreSupport/dtkGlobal.h>
24 #include <dtkGuiSupport/dtkSpacer.h>
28 class axlInspectorStackPrivate
31 QStackedWidget *widget;
34 QMap<QAction *, QWidget *> actions;
39 d->widget =
new QStackedWidget(
this);
40 d->widget->setFixedWidth(290);
43 d->bar =
new QToolBar(
this);
44 d->bar->setFloatable(
false);
46 QScrollArea *area =
new QScrollArea(
this);
47 area->setAttribute(Qt::WA_MacShowFocusRect,
false);
48 area->setFrameShape(QFrame::NoFrame);
49 area->setContentsMargins(0, 0, 0, 0);
50 area->setWidget(d->widget);
51 area->setWidgetResizable(
true);
53 QVBoxLayout *layout =
new QVBoxLayout(
this);
54 layout->setContentsMargins(0, 0, 0, 0);
55 layout->addWidget(d->bar);
56 layout->addWidget(area);
57 layout->setSpacing(0);
61 this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
75 d->widget->addWidget(widget);
77 QAction *action = d->bar->addAction(title,
this, SLOT(
onActionClicked()));
78 action->setShortcut(QKeySequence(QString(
"Ctrl+%1").arg(QString::number(++count))));
80 this->addAction(action);
82 d->actions.insert(action, widget);
87 return QFrame::width();
92 this->setFixedWidth(width);
97 d->widget->setCurrentWidget(d->actions.value(dynamic_cast<QAction *>(this->sender())));
void addWidget(QString title, QWidget *widget)
void onActionClicked(void)
axlInspectorStack(QWidget *parent=0)