Commit dbde1ac4 authored by VESIN Marc's avatar VESIN Marc
Browse files

Merge branch 'release/2.25.0'

parents 99637d86 69e470f2
Pipeline #210487 failed with stage
in 0 seconds
# ChangeLog
## version 2.25.0 - 2021-02-01
- add dtkWidgetsReferences example
- fix parameter/parameterWidget accessors for dtkWidgetsMenuBar
- cmake fixes : OS X flags, dependencies
- udate conda dependencies : dtk-log >= 2.3.0, alsa-lib
## version 2.24.1 - 2020-11-13
- Fix regression introduced in 2.24.0 for dtkWidgetsParameterDirBrowse
## version 2.24.0 - 2020-10-01
......
......@@ -14,6 +14,7 @@
cmake_minimum_required(VERSION 3.6.0)
######################################################################
project(dtkWidgets)
......@@ -23,8 +24,8 @@ project(dtkWidgets)
## ###################################################################
set(${PROJECT_NAME}_VERSION_MAJOR 2)
set(${PROJECT_NAME}_VERSION_MINOR 24)
set(${PROJECT_NAME}_VERSION_PATCH 1)
set(${PROJECT_NAME}_VERSION_MINOR 25)
set(${PROJECT_NAME}_VERSION_PATCH 0)
set(${PROJECT_NAME}_VERSION
${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
......@@ -71,6 +72,9 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS "ON")
## Build setup
## #################################################################
# needed on macos, ignored by others
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.12" CACHE STRING "minimum OSX version" FORCE)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
......@@ -102,7 +106,7 @@ include(GenerateExportHeader)
## Dependencies - external
## #################################################################
find_package(Qt5 REQUIRED COMPONENTS Core Gui Quick QuickWidgets Widgets Xml Test)
find_package(Qt5 REQUIRED COMPONENTS Core Gui Quick QuickWidgets Widgets Xml Test WebEngine WebEngineWidgets)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
......
......@@ -14,5 +14,7 @@
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.12" CACHE STRING "minimum OSX version" FORCE)
######################################################################
### dtkWidgetsConfig.cmake.in ends here
......@@ -19,6 +19,7 @@ add_subdirectory(dtkWidgetsMenu)
add_subdirectory(dtkWidgetsOverlayPaneItems)
add_subdirectory(dtkWidgetsParameter)
#add_subdirectory(dtkWidgetsPassThrough)
add_subdirectory(dtkWidgetsReferences)
add_subdirectory(dtkWidgetsScroller)
add_subdirectory(dtkWidgetsWorkspace)
......
......@@ -20,6 +20,7 @@
#include <dtkThemes>
#include <dtkWidgets>
// /////////////////////////////////////////////////////////////////////////////
//
// /////////////////////////////////////////////////////////////////////////////
......@@ -159,12 +160,20 @@ void setup(dtkApplication *application)
params["checkbox_ro_toggle"]->connect( [=] (QVariant v) {
bool visible = v.value<dtk::d_bool>();
dtkWidgetsParameter *widget_slider = application->window()->menubar()->parameterWidget(":Read-only parameters:slider_double_ro_and_rw:");
dtkWidgetsParameter *widget_filebrowser = application->window()->menubar()->parameterWidget(":Read-only parameters:file_browse_ro:");
if(visible) {
//params["slider_double_ro_and_rw"]->setReadOnly(false);
widget_slider->setReadOnly(false);
widget_filebrowser->setReadOnly(false);
params["slider_double_ro_and_rw"]->setLabel("Slider READWRITE");
params["checkbox_ro_toggle"]->setDocumentation("Next widget is READWRITE");
} else {
//params["slider_double_ro_and_rw"]->setReadOnly(true);
widget_slider->setReadOnly(true);
widget_filebrowser->setReadOnly(true);
params["slider_double_ro_and_rw"]->setLabel("Slider READONLY");
params["checkbox_ro_toggle"]->setDocumentation("Next widget is READONLY");
}
......
......@@ -145,7 +145,7 @@
"type": "dtk::d_bool"
},
"file_browse_ro": {
"label": "Open a file (Read Only)",
"label": "Open a file (toggle RO/RW)",
"doc": "Open a VTK file.",
"path": ".",
"filters": [
......@@ -186,7 +186,7 @@
"decimals": 2
},
"checkbox_ro_toggle":{
"label": "toggle RO/RW of next parameter",
"label": "toggle RO/RW of Slider and Open a file",
"doc": "It's a checkbox",
"value": true,
"type": "dtk::d_bool"
......@@ -194,7 +194,7 @@
"slider_double_ro_and_rw": {
"type": "dtk::d_real",
"doc": "It's a slider of double, which is READONLY or not",
"label": "Slider double (Read Write)",
"label": "Slider double (toggle RO/RW)",
"min": -10.0,
"value": 3.0,
"max": 10.0,
......
## Version: $Id$
##
######################################################################
##
### Commentary:
##
######################################################################
##
### Change Log:
##
######################################################################
##
### Code:
project(dtkWidgetsReferences)
## #################################################################
## Sources
## #################################################################
set(${PROJECT_NAME}_HEADERS)
set(${PROJECT_NAME}_SOURCES
main.cpp)
set(${PROJECT_NAME}_SOURCES_QRC)
## #################################################################
## Build rules
## #################################################################
# qt5_add_resources(${PROJECT_NAME}_SOURCES_RCC ${${PROJECT_NAME}_SOURCES_QRC})
add_executable(${PROJECT_NAME} MACOSX_BUNDLE
${${PROJECT_NAME}_SOURCES})
# ${${PROJECT_NAME}_SOURCES_RCC})
target_link_libraries(${PROJECT_NAME} Qt5::Core)
target_link_libraries(${PROJECT_NAME} Qt5::Network)
target_link_libraries(${PROJECT_NAME} Qt5::Widgets)
target_link_libraries(${PROJECT_NAME} Qt5::WebEngine)
target_link_libraries(${PROJECT_NAME} Qt5::WebEngineWidgets)
target_link_libraries(${PROJECT_NAME} dtkThemes)
target_link_libraries(${PROJECT_NAME} dtkWidgets)
######################################################################
### CMakeLists.txt ends here
This diff is collapsed.
......@@ -35,6 +35,7 @@ requirements:
- {{ cdt('libxfixes') }} # [linux]
- {{ cdt('libxfixes-devel') }} # [linux]
- {{ cdt('libxxf86vm') }} # [linux]
- {{ cdt('alsa-lib') }} # [linux]
host:
- qt >=5.9.0
- dtk-core >=2.9.0
......
......@@ -17,6 +17,7 @@
#include "dtkWidgetsMenuItem.h"
#include "dtkLog"
#include "dtkCoreParameter"
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsMenuPrivate
......@@ -26,6 +27,7 @@ class dtkWidgetsMenuPrivate
{
public:
QHash<QString, QObject *> object_hash;
QHash<QString, QObject *> object_hash_uid;
QVector<QObject *> object_list;
QVector<dtkWidgetsMenu *> menu_list;
......@@ -61,6 +63,7 @@ dtkWidgetsMenu *dtkWidgetsMenu::addMenu(dtkWidgetsMenu *menu)
}
if ( !d->object_hash.contains(menu->title()) ) {
d->object_hash.insert(menu->title(), menu);
d->object_hash_uid.insert(menu->title(), menu);
d->object_list << menu;
d->menu_list << menu;
return menu;
......@@ -109,6 +112,7 @@ dtkWidgetsMenu *dtkWidgetsMenu::insertMenu(int pos, dtkWidgetsMenu *menu)
menu->setParent(this);
d->object_hash.insert(menu->title(), menu);
d->object_hash_uid.insert(menu->title(), menu);
d->menu_list.insert(menu_pos, menu);
d->object_list.insert(pos, menu);
return menu;
......@@ -130,6 +134,7 @@ dtkWidgetsMenu *dtkWidgetsMenu::insertMenu(int pos, int icon_id, const QString &
void dtkWidgetsMenu::clear(void)
{
d->object_hash.clear();
d->object_hash_uid.clear();
d->object_list.clear();
d->menu_list.clear();
}
......@@ -142,6 +147,12 @@ dtkWidgetsMenuItem *dtkWidgetsMenu::addItem(dtkWidgetsMenuItem *item)
}
if (!d->object_hash.contains(item->title())) {
d->object_hash.insert(item->title(), item);
if (item->isParameter()) {
dtkWidgetsMenuItemParameter *item_param = static_cast<dtkWidgetsMenuItemParameter *>(item);
d->object_hash_uid.insert(item_param->parameter()->uid(), item);
} else {
d->object_hash_uid.insert(item->title(), item);
}
d->object_list << item;
return item;
}
......@@ -171,6 +182,12 @@ dtkWidgetsMenuItem *dtkWidgetsMenu::insertItem(int pos, dtkWidgetsMenuItem *item
}
if ( !d->object_hash.contains(item->title()) ) {
d->object_hash.insert(item->title(), item);
if (item->isParameter()) {
dtkWidgetsMenuItemParameter *item_param = static_cast<dtkWidgetsMenuItemParameter *>(item);
d->object_hash_uid.insert(item_param->parameter()->uid(), item);
} else {
d->object_hash_uid.insert(item->title(), item);
}
d->object_list.insert(pos, item);
return item;
}
......@@ -202,6 +219,7 @@ dtkWidgetsMenuItem *dtkWidgetsMenu::addSeparator(void)
separator->setSeparator(true);
d->object_hash.insert(title, separator);
d->object_hash_uid.insert(title, separator);
d->object_list << separator;
return separator;
......@@ -229,15 +247,24 @@ void dtkWidgetsMenu::removeItem(dtkWidgetsMenuItem *item)
{
if (!(item && d->object_hash.contains(item->title())))
return;
d->object_hash.remove(item->title());
QString title;
if (item->isParameter())
title = (static_cast<dtkWidgetsMenuItemParameter *>(item))->parameter()->uid();
else
title = item->title();
if(d->object_hash_uid.contains(title))
d->object_hash_uid.remove(title);
d->object_list.removeAll(item);
}
void dtkWidgetsMenu::removeMenu(dtkWidgetsMenu *menu)
{
if (menu && d->object_hash.contains(menu->title())) {
if (menu && d->object_hash.contains(menu->title()) && d->object_hash_uid.contains(menu->title())) {
d->object_hash.remove(menu->title());
d->object_hash_uid.remove(menu->title());
d->object_list.removeAll(menu);
d->menu_list.removeAll(menu);
}
......@@ -245,10 +272,12 @@ void dtkWidgetsMenu::removeMenu(dtkWidgetsMenu *menu)
void dtkWidgetsMenu::renameMenu(dtkWidgetsMenu *menu, const QString& title)
{
if (menu && d->object_hash.contains(menu->title())) {
if (menu && d->object_hash.contains(menu->title()) && d->object_hash_uid.contains(menu->title())) {
d->object_hash.remove(menu->title());
d->object_hash_uid.remove(menu->title());
menu->d->title = title;
d->object_hash.insert(menu->title(), menu);
d->object_hash_uid.insert(menu->title(), menu);
}
}
......@@ -278,6 +307,14 @@ QObject *dtkWidgetsMenu::object(const QString& id)
return d->object_hash[id];
}
QObject *dtkWidgetsMenu::objectFromUid(const QString& id)
{
if(!d->object_hash_uid.contains(id))
return nullptr;
return d->object_hash_uid[id];
}
QVector<QObject *> dtkWidgetsMenu::objects(void) const
{
return d->object_list;
......
......@@ -84,6 +84,8 @@ public:
QObject *object(const QString&);
QObject *objectFromUid(const QString&);
QVector<QObject *> objects(void) const;
public:
......
......@@ -25,6 +25,8 @@
#include <dtkThemes/dtkThemesEngine>
#include <dtkCoreParameter>
// ///////////////////////////////////////////////////////////////////
namespace dtkWidgetsMenuBarHelper {
......@@ -947,12 +949,15 @@ dtkCoreParameter *dtkWidgetsMenuBar::parameter(const QString& id)
if(path.isEmpty())
return;
QObject *object = menu->object(path.takeFirst());
const QString &pathfirst = path.takeFirst();
QObject *object = menu->object(pathfirst);
if (dtkWidgetsMenu *m = qobject_cast<dtkWidgetsMenu *>(object))
sniff(m);
else
else {
object = menu->objectFromUid(pathfirst);
parameter = qobject_cast<dtkWidgetsMenuItemParameter *>(object);
}
};
if(root)
......@@ -979,12 +984,15 @@ dtkWidgetsParameter *dtkWidgetsMenuBar::parameterWidget(const QString& id)
if(path.isEmpty())
return;
QObject *object = menu->object(path.takeFirst());
const QString &pathfirst = path.takeFirst();
QObject *object = menu->object(pathfirst);
if (dtkWidgetsMenu *m = qobject_cast<dtkWidgetsMenu *>(object))
sniff(m);
else
else {
object = menu->objectFromUid(pathfirst);
parameter = qobject_cast<dtkWidgetsMenuItemParameter *>(object);
}
};
if(root)
......
......@@ -140,5 +140,6 @@ private:
QDebug operator<<(QDebug debug, const dtkWidgetsMenuBar &c);
QDebug operator<<(QDebug debug, dtkWidgetsMenuBar *c);
//
// dtkWidgetsMenuBar.h ends here
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