Commit 9d758f85 authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas
Browse files

Merge branch 'release/2.26.1'

parents 396493ee 39fa4c8f
Pipeline #260603 running with stage
{
"files.associations": {
"*.moc": "cpp",
"chrono": "cpp",
"algorithm": "cpp",
"variant": "cpp"
}
}
\ No newline at end of file
# ChangeLog
## version 2.26.1 - 2021-06-16
- highlight selected menu
- allow to reload the current path with shift+click in dtkWidgetsParameterBrowse
## version 2.26.0 - 2021-06-04
- add methods to import/export in menu
- add reset method in dtkWidgetsParameter
......
......@@ -25,7 +25,7 @@ project(dtkWidgets)
set(${PROJECT_NAME}_VERSION_MAJOR 2)
set(${PROJECT_NAME}_VERSION_MINOR 26)
set(${PROJECT_NAME}_VERSION_PATCH 0)
set(${PROJECT_NAME}_VERSION_PATCH 1)
set(${PROJECT_NAME}_VERSION
${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
......
......@@ -280,7 +280,7 @@ dtkWidgetsMenuItemCustomFacade::~dtkWidgetsMenuItemCustomFacade(void)
dtkWidgetsMenuFacade::dtkWidgetsMenuFacade(dtkWidgetsMenu *m, QWidget *parent) : QWidget(parent), menu(m)
{
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->setContentsMargins(0, 10, 0, 10);
layout->setSpacing(1);
layout->setAlignment(Qt::AlignTop);
......
......@@ -173,6 +173,7 @@ public:
void enableSpying(bool);
public:
QWidget *widgetHeader(int index);
QWidget *widget(int index);
protected:
......@@ -255,7 +256,7 @@ QWidget *dtkWidgetsOverlayPaneSliderArea::widget(int index)
if (dtkWidgetsOverlayPaneSliderViewPort *viewport = dynamic_cast<dtkWidgetsOverlayPaneSliderViewPort *>(QScrollArea::widget())) {
for (int i = 0; i < viewport->layout->count(); ++i) {
for (int i = 0; i < viewport->layout->count(); ++i) { // \TODO Is it possible to have more than one item in viewport->layout?
if (dtkWidgetsMenuBarContainerSlide *slide = dynamic_cast<dtkWidgetsMenuBarContainerSlide *>(viewport->layout->itemAt(i)->widget())) {
......@@ -286,6 +287,31 @@ QWidget *dtkWidgetsOverlayPaneSliderArea::widget(int index)
return nullptr;
}
QWidget *dtkWidgetsOverlayPaneSliderArea::widgetHeader(int index)
{
if(this->size().width() < 100)
return nullptr;
if (dtkWidgetsOverlayPaneSliderViewPort *viewport = dynamic_cast<dtkWidgetsOverlayPaneSliderViewPort *>(QScrollArea::widget())) {
for (int i = 0; i < viewport->layout->count(); ++i) { // \TODO Is it possible to have more than one item in viewport->layout?
if (dtkWidgetsMenuBarContainerSlide *slide = dynamic_cast<dtkWidgetsMenuBarContainerSlide *>(viewport->layout->itemAt(i)->widget())) {
int k = 0;
for (int j = 0; j < slide->layout()->count(); ++j) {
if (dtkWidgetsMenuHeaderFacade *facade = dynamic_cast<dtkWidgetsMenuHeaderFacade *>(slide->layout()->itemAt(j)->widget())) {
if(k == index) {
return facade;
}
++k;
}
}
}
}
}
return nullptr;
}
void dtkWidgetsOverlayPaneSliderArea::scrollContentsBy(int dx, int dy)
{
QScrollArea::scrollContentsBy(dx, dy);
......@@ -560,6 +586,33 @@ void dtkWidgetsOverlayPaneSliderPrivate::setCurrentIndex(int index, std::functio
if (this->area->to)
return;
// highlight the destination widget
dtkWidgetsOverlayPaneSliderViewPort *viewport = dynamic_cast<dtkWidgetsOverlayPaneSliderViewPort *>(((QScrollArea*)this->area)->widget());
dtkWidgetsMenuBarContainerSlide *slide = dynamic_cast<dtkWidgetsMenuBarContainerSlide *>(viewport->layout->itemAt( 0 )->widget());
for (int n_widget = 0; n_widget < slide->layout()->count(); n_widget++)
{
QWidget *widget_header = this->area->widgetHeader( n_widget );
if (widget_header) {
QPalette pal = palette();
if (n_widget == index) {
pal.setColor(QPalette::Background, pal.color( QPalette::Highlight ) );
}
widget_header->setAutoFillBackground(true);
widget_header->setPalette(pal);
}
QWidget *widget = this->area->widget( n_widget );
if (widget) {
QPalette pal = palette();
if (n_widget == index) {
pal.setColor(QPalette::Background, pal.color( QPalette::Highlight ) );
}
widget->setAutoFillBackground(true);
widget->setPalette(pal);
}
}
QWidget *destination = this->area->widget(index);
const QRect microFocus = destination ->inputMethodQuery(Qt::ImMicroFocus).toRect();
......
......@@ -109,7 +109,15 @@ bool dtkWidgetsParameterBrowse::connect(dtkCoreParameter *p)
QObject::connect(d->push_button, &QPushButton::clicked, [=] ()
{
QString v = this->browse();
QString v;
Qt::KeyboardModifiers modifiers = QApplication::queryKeyboardModifiers();
if (modifiers & Qt::ShiftModifier) {
dtkInfo() << "reloading path " << m_parameter->path();
v = m_parameter->path();
} else {
v = this->browse();
}
m_parameter->shareValue(QVariant::fromValue(v));
});
......
......@@ -31,9 +31,9 @@ void dtkWidgetsWorkspaceStackBarOverview::paintEvent(QPaintEvent *event)
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.setPen(Qt::NoPen);
painter.setBrush(QColor(0, 0, 0, 128));
painter.setBrush(QColor(255, 0, 0, 128));
painter.drawRect(0, this->size().height() - offset - margin, this->size().width(), margin * 7/4);
painter.setPen(Qt::white);
painter.setPen(Qt::green);
painter.drawText(this->size().width()/2 - metrics.width(text)/2, this->size().height() - offset, text);
}
......@@ -64,13 +64,14 @@ public:
}
public:
QWidget* source( void );
void setSource(QWidget *);
protected:
void mousePressEvent(QMouseEvent *);
private:
QWidget *source = nullptr;
QWidget *_source = nullptr;
private:
dtkWidgetsWorkspaceStackBarOverview *overview;
......@@ -102,11 +103,16 @@ dtkWidgetsWorkspaceStackBarItem::~dtkWidgetsWorkspaceStackBarItem(void)
}
QWidget* dtkWidgetsWorkspaceStackBarItem::source( void )
{
return this->_source;
}
void dtkWidgetsWorkspaceStackBarItem::setSource(QWidget *source)
{
this->source = source;
this->_source = source;
this->overview->setObjectName(this->source->objectName());
this->overview->setObjectName(this->_source->objectName());
QTimer *timer = new QTimer(this);
timer->setInterval(1000);
......@@ -115,8 +121,8 @@ void dtkWidgetsWorkspaceStackBarItem::setSource(QWidget *source)
connect(timer, &QTimer::timeout, [=] (void) {
if (this->visibleRegion().isNull())
return;
QPixmap pixmap(this->source->size());
this->source->render(&pixmap);
QPixmap pixmap(this->_source->size());
this->_source->render(&pixmap);
this->overview->setPixmap(pixmap.scaledToWidth(280));
});
......@@ -195,6 +201,12 @@ void dtkWidgetsWorkspaceStackBar::setStack(QStackedWidget *stack)
for(dtkWidgetsWorkspaceStackBarItem *it : d->items) {
this->style()->unpolish(it);
it->setActive(it == item);
QPalette pal = palette();
pal.setColor(QPalette::Background, Qt::black);
it->source()->setAutoFillBackground(true);
it->source()->setPalette(pal);
this->style()->polish(it);
}
});
......
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