Commit 8be4350f authored by WINTZ Julien's avatar WINTZ Julien

Fixing horizontal scrolling issues of the menu framework in a dynamic context.

parent a1efe8d3
......@@ -523,6 +523,10 @@ void dtkWidgetsMenuBarContainer::touch(dtkWidgetsMenuBar *mb)
void dtkWidgetsMenuBarContainer::decr(void)
{
qDebug() << Q_FUNC_INFO;
this->slider->decr();
::stack.takeLast();
}
......
......@@ -135,6 +135,8 @@ dtkWidgetsOverlayPaneSliderViewPort::~dtkWidgetsOverlayPaneSliderViewPort(void)
void dtkWidgetsOverlayPaneSliderViewPort::addWidget(QWidget *widget)
{
qDebug() << Q_FUNC_INFO << widget;
widget->setFixedWidth(this->bound);
this->layout->addWidget(widget);
......@@ -144,9 +146,11 @@ void dtkWidgetsOverlayPaneSliderViewPort::addWidget(QWidget *widget)
this->count++;
}
void dtkWidgetsOverlayPaneSliderViewPort::remWidget(QWidget *w)
void dtkWidgetsOverlayPaneSliderViewPort::remWidget(QWidget *widget)
{
this->layout->removeWidget(w); w->setParent(0);
qDebug() << Q_FUNC_INFO << widget;
this->layout->removeWidget(widget); widget->setParent(0);
this->repaint();
......@@ -404,6 +408,8 @@ dtkWidgetsOverlayPaneSliderPrivate::~dtkWidgetsOverlayPaneSliderPrivate(void)
void dtkWidgetsOverlayPaneSliderPrivate::addWidget(fa::icon icon, QWidget *widget)
{
qDebug() << Q_FUNC_INFO << widget;
// this->bar->addItem(icon);
widget->show();
......@@ -422,6 +428,8 @@ void dtkWidgetsOverlayPaneSliderPrivate::addWidget(fa::icon icon, QWidget *widge
void dtkWidgetsOverlayPaneSliderPrivate::addWidget(fa::icon icon, QWidget *widget, const QString& tooltip)
{
qDebug() << Q_FUNC_INFO << widget;
// this->bar->addItem(icon, tooltip);
widget->show();
......@@ -438,9 +446,11 @@ void dtkWidgetsOverlayPaneSliderPrivate::addWidget(fa::icon icon, QWidget *widge
this->area->repaint();
}
void dtkWidgetsOverlayPaneSliderPrivate::remWidget(QWidget *w)
void dtkWidgetsOverlayPaneSliderPrivate::remWidget(QWidget *widget)
{
this->viewport->remWidget(w);
qDebug() << Q_FUNC_INFO << widget;
this->viewport->remWidget(widget);
this->viewport->updateGeometry();
this->viewport->repaint();
......@@ -453,6 +463,8 @@ void dtkWidgetsOverlayPaneSliderPrivate::remWidget(QWidget *w)
QAbstractAnimation *dtkWidgetsOverlayPaneSliderPrivate::slideToPrivate(int to)
{
qDebug() << Q_FUNC_INFO << to;
if(this->viewport->count <= 1)
return 0;
......@@ -469,6 +481,10 @@ QAbstractAnimation *dtkWidgetsOverlayPaneSliderPrivate::slideToPrivate(int to)
double h_xt = to;
this->h_ss = this->area->horizontalScrollBar()->value();
qDebug() << Q_FUNC_INFO << "h_xf:" << h_xf;
qDebug() << Q_FUNC_INFO << "h_xt:" << h_xt;
qDebug() << Q_FUNC_INFO << "h_ss:" << h_ss;
QVariantAnimation *h_animation = new QVariantAnimation;
h_animation->setEasingCurve(QEasingCurve::OutBounce);
h_animation->setStartValue(h_xf);
......@@ -481,6 +497,8 @@ QAbstractAnimation *dtkWidgetsOverlayPaneSliderPrivate::slideToPrivate(int to)
double sm = this->area->horizontalScrollBar()->maximum();
double sc = this->viewport->count - 1;
qDebug() << Q_FUNC_INFO << ss + (value.toDouble() - h_xf) * sm / sc;
this->area->slideH(ss + (value.toDouble() - h_xf) * sm / sc);
});
......@@ -535,6 +553,10 @@ QAbstractAnimation *dtkWidgetsOverlayPaneSliderPrivate::slideToPrivate(int to, s
double h_xt = to;
this->h_ss = this->area->horizontalScrollBar()->value();
qDebug() << Q_FUNC_INFO << "h_xf:" << h_xf;
qDebug() << Q_FUNC_INFO << "h_xt:" << h_xt;
qDebug() << Q_FUNC_INFO << "h_ss:" << h_ss;
QVariantAnimation *h_animation = new QVariantAnimation;
h_animation->setEasingCurve(QEasingCurve::OutBounce);
h_animation->setStartValue(h_xf);
......@@ -547,6 +569,8 @@ QAbstractAnimation *dtkWidgetsOverlayPaneSliderPrivate::slideToPrivate(int to, s
double sm = this->area->horizontalScrollBar()->maximum();
double sc = this->viewport->count - 1;
qDebug() << Q_FUNC_INFO << ss + (value.toDouble() - h_xf) * sm / sc;
this->area->slideH(ss + (value.toDouble() - h_xf) * sm / sc);
});
......@@ -602,6 +626,8 @@ void dtkWidgetsOverlayPaneSliderPrivate::slideToNext(void)
void dtkWidgetsOverlayPaneSliderPrivate::slideToPrevious(void)
{
qDebug() << Q_FUNC_INFO << this->from;
this->slideTo(this->from - 1);
}
......@@ -763,6 +789,8 @@ void dtkWidgetsOverlayPaneSlider::setBound(int bound)
void dtkWidgetsOverlayPaneSlider::addSlide(fa::icon icon, QWidget *contents)
{
qDebug() << Q_FUNC_INFO << contents;
d->addWidget(icon, contents);
}
......@@ -816,6 +844,13 @@ void dtkWidgetsOverlayPaneSlider::enableSpying(bool enable)
d->area->enableSpying(enable);
}
void dtkWidgetsOverlayPaneSlider::decr(void)
{
this->slideToPrevious();
d->viewport->count--;
}
// ///////////////////////////////////////////////////////////////////
#include "dtkWidgetsOverlayPaneSlider.moc"
......
......@@ -58,6 +58,9 @@ public:
public:
void enableSpying(bool);
public:
void decr(void);
private:
class dtkWidgetsOverlayPaneSliderPrivate *d;
};
......
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