Skip to content

Commit

Permalink
make all filterallows work and tweak sizing of filterwindow and varsw…
Browse files Browse the repository at this point in the history
…indow
  • Loading branch information
JorisGoosen committed Feb 26, 2025
1 parent 2e0dadf commit 686439e
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Desktop/components/JASP/Widgets/DataPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Rectangle
objectName: "filterWindow"
SplitView.minimumHeight: desiredMinimumHeight
SplitView.preferredHeight: desiredHeight
SplitView.maximumHeight: rootDataset.height * 0.8
SplitView.maximumHeight: splitViewData.height

}

Expand All @@ -32,7 +32,7 @@ Rectangle
id: variablesWindow
SplitView.minimumHeight: calculatedMinimumHeight
SplitView.preferredHeight: calculatedPreferredHeight
SplitView.maximumHeight: calculatedMaximumHeight
SplitView.maximumHeight: splitViewData.height
}

DataTableView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Item
property real fontPixelSize: baseFontSize * preferencesModel.uiScale
property real blockDim: baseBlockDim * preferencesModel.uiScale
property var allKeys: ["number", "boolean", "string", "variable"]
readonly property real desiredMinimumHeight: operatorsRow.height + hints.height + applyFilter.height + blockDim * 4
readonly property real desiredHeight: operatorsRow.height + hints.height + applyFilter.height + functieLijst.contentHeight
readonly property real desiredMinimumHeight: operatorsRow.height + applyFilter.height + blockDim * 4
readonly property real desiredHeight: operatorsRow.height + applyFilter.height + blockDim * 12
property real extraSpaceUnderColumns: 0
property bool somethingChanged: false
property bool isColumnConstructor: false
Expand Down
15 changes: 13 additions & 2 deletions Desktop/components/JASP/Widgets/FilterWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,20 @@ FocusScope

Connections
{
target: filterModel
function onFilterErrorMsgChanged() { if (filterModel.filterErrorMsg.length > 0) open(); }
target: filterModel
function onRFilterChanged() { absorbModelRFilter(); }
function onFilterErrorMsgChanged()
{
if (filterModel.filterErrorMsg.length > 0 && !visible)
{
open();

//Now this might be caused by some labelfilter, or something. However, the filterwindow by default does not show the generatedFilter
//Maybe its better to open it on the R display then?
if(filterModel.isJustGeneratedFilter())
filterContainer.showEasyFilter = false
}
}
}

function toggle()
Expand Down
1 change: 0 additions & 1 deletion Desktop/components/JASP/Widgets/LabelEditorWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ FocusScope
onClicked:
{
columnModel.setChecked(rowIndex, !itemFiltered); // Case when all labels are unchecked.
columnModel.setSelected(rowIndex,true);
}

Image
Expand Down
4 changes: 2 additions & 2 deletions Desktop/components/JASP/Widgets/VariablesWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ FocusScope

property real calculatedBaseHeight: (columnInfoTop.height + jaspTheme.generalAnchorMargin * 2)
property real calculatedMinimumHeight: calculatedBaseHeight * 1.5
property real calculatedPreferredHeight: Math.max(parent.height / 2, calculatedBaseHeight * 4)
property real calculatedPreferredHeight: calculatedBaseHeight * 4
property real calculatedMaximumHeight: !tabView.visible ? calculatedBaseHeight : 0.90 * parent.height

Connections
Expand Down Expand Up @@ -66,7 +66,7 @@ FocusScope

property int minWidth: 500 * preferencesModel.uiScale

onHeightChanged: columnModel.setCompactMode(height < variablesContainer.calculatedPreferredHeight)
onHeightChanged: columnModel.setCompactMode(height < calculatedBaseHeight * 3)

anchors
{
Expand Down
2 changes: 2 additions & 0 deletions Desktop/data/columnmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,8 @@ bool ColumnModel::setChecked(int rowIndex, bool checked)

if(_beingRefreshed || checked == data(index(rowIndex,0), int(DataSetPackage::specialRoles::filter)).toBool())
return true; //Its already that value

setSelected(rowIndex, true);

_editing = true;
_undoStack->pushCommand(new FilterLabelCommand(this, rowIndex, checked));
Expand Down
4 changes: 2 additions & 2 deletions Desktop/data/datasetpackage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1038,8 +1038,8 @@ bool DataSetPackage::setLabelAllowFilter(const QModelIndex & index, bool newAllo
bool before = column->hasFilter();
labels[row]->setFilterAllows(newAllowValue);

if(before != column->hasFilter())
notifyColumnFilterStatusChanged(col); //basically resetModel now

notifyColumnFilterStatusChanged(col); //basically resetModel now

emit labelFilterChanged();
QModelIndex columnParentNode = indexForSubNode(column);
Expand Down
5 changes: 5 additions & 0 deletions Desktop/data/filtermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ const char * FilterModel::defaultRFilter()
return defaultFilter.c_str();
}

bool FilterModel::isJustGeneratedFilter() const
{
return rFilter() == defaultRFilter() && constructorJson() == DEFAULT_FILTER_JSON;
}

void FilterModel::reset()
{
_setGeneratedFilter(DEFAULT_FILTER_GEN );
Expand Down
1 change: 1 addition & 0 deletions Desktop/data/filtermodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class FilterModel : public QObject


Q_INVOKABLE void resetRFilter() { applyRFilter(defaultRFilter()); }
Q_INVOKABLE bool isJustGeneratedFilter() const;
void sendGeneratedAndRFilter();

void updateStatusBar();
Expand Down

0 comments on commit 686439e

Please sign in to comment.