-
-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto Sort labels bug and other label handling issues #5630
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,12 +44,17 @@ class Column : public DataSetBaseNode | |
typedef std::map<std::pair<std::string, std::string>, Label*> LabelByStrStr; | ||
|
||
Column(DataSet * data, int id = -1); | ||
private: | ||
Column(DataSet * data, int id, columnType colType, computedColumnType computedType, bool autoSort); | ||
|
||
public: | ||
static Column * addColumn(DataSet* data, int index = -1, const std::string & name = "", columnType colType = columnType::scale, computedColumnType computedType = computedColumnType::notComputed, bool alterDataSetTable = true); | ||
static Column * loadColumn(DataSet* data, int index); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function obviously should be on |
||
~Column(); | ||
|
||
DatabaseInterface & db(); | ||
const DatabaseInterface & db() const; | ||
|
||
void dbCreate( int index); | ||
void dbLoad( int id=-1, bool getValues = true); ///< Loads *and* reloads from DB! | ||
void dbLoadIndex(int index, bool getValues = true); | ||
void dbUpdateComputedColumnStuff(); | ||
|
@@ -72,7 +77,7 @@ class Column : public DataSetBaseNode | |
void setIndex( int index ); | ||
void setInvalidated( bool invalidated ); | ||
void setCompColStuff( bool invalidated, bool forceSourceColType, computedColumnType codeType, const std::string & rCode, const std::string & error, const Json::Value & constructorJson); | ||
void setDefaultValues( enum columnType columnType = columnType::unknown); | ||
void setDefaultValues(); | ||
|
||
bool setAsNominalOrOrdinal( const intvec & values, bool is_ordinal = false); | ||
bool setAsNominalOrOrdinal( const intvec & values, intstrmap uniqueValues, bool is_ordinal = false); | ||
|
@@ -242,7 +247,8 @@ class Column : public DataSetBaseNode | |
columnTypeChangeResult _changeColumnToScale(); | ||
void _convertVectorIntToDouble(intvec & intValues, doublevec & doubleValues); | ||
void _resetLabelValueMap(); | ||
doublevec valuesNumericOrdered(); | ||
doublevec valuesNumericOrdered(); | ||
stringvec valuesAlphabeticOrdered(); | ||
|
||
private: | ||
DataSet * const _data; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,15 +57,15 @@ FocusScope | |
target: columnModel | ||
function onChosenColumnChanged() | ||
{ | ||
levelsTableView.lastRow = -1; | ||
levelsTableView.selectedRow = -1; | ||
} | ||
} | ||
|
||
property real filterColWidth: 60 * jaspTheme.uiScale | ||
property real remainingWidth: width - filterColWidth | ||
property real valueColWidth: Math.min(columnModel.valueMaxWidth + 10, remainingWidth * 0.5) * jaspTheme.uiScale | ||
property real labelColWidth: Math.min(columnModel.labelMaxWidth + 10, remainingWidth * 0.5) * jaspTheme.uiScale | ||
property int lastRow: -1 | ||
property int selectedRow: -1 | ||
|
||
|
||
columnHeaderDelegate: Item | ||
|
@@ -129,7 +129,7 @@ FocusScope | |
{ | ||
id: backgroundItem | ||
|
||
onActiveFocusChanged: if(activeFocus) levelsTableView.lastRow = rowIndex | ||
onActiveFocusChanged: if(activeFocus) levelsTableView.selectedRow = rowIndex | ||
|
||
MouseArea | ||
{ | ||
|
@@ -440,7 +440,7 @@ FocusScope | |
iconSource: jaspTheme.iconPath + "menu-column-order-by-values.svg" | ||
onClicked: { forceActiveFocus(); columnModel.toggleAutoSortByValues(); } | ||
|
||
toolTip: qsTr("Automatically order labels by their numeric value") | ||
toolTip: qsTr("Automatically order labels by their value") | ||
|
||
height: buttonColumnVariablesWindow.buttonHeight | ||
implicitHeight: buttonColumnVariablesWindow.buttonHeight | ||
|
@@ -458,49 +458,49 @@ FocusScope | |
height: buttonColumnVariablesWindow.buttonHeight | ||
implicitHeight: buttonColumnVariablesWindow.buttonHeight | ||
width: height | ||
visible: !columnModel.autoSort || columnModel.firstNonNumericRow > 1 //if there are at least 2 numerics we have something to reverse | ||
visible: columnModel.hasSeveralNumericValues //if there are at least 2 numerics we have something to reverse | ||
} | ||
|
||
RoundedButton | ||
{ | ||
iconSource: jaspTheme.iconPath + "arrow-reverse.png" | ||
onClicked: { forceActiveFocus(); columnModel.reverse(); } | ||
|
||
toolTip: columnModel.autoSort ? qsTr("Reverse order of the labels with non-numeric values") : qsTr("Reverse order of all labels") | ||
toolTip: qsTr("Reverse order of all labels") | ||
|
||
height: buttonColumnVariablesWindow.buttonHeight | ||
implicitHeight: buttonColumnVariablesWindow.buttonHeight | ||
width: height | ||
visible: !columnModel.autoSort || columnModel.rowsTotal - columnModel.firstNonNumericRow > 1 //If there are at least 2 non numerics there is something to reverse | ||
|
||
visible: !columnModel.autoSort | ||
enabled: columnModel.rowCount() > 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dont use rowCount() in a binding because it wont update on changes... |
||
} | ||
|
||
RoundedButton | ||
{ | ||
iconSource: jaspTheme.iconPath + "arrow-up.png" | ||
|
||
onClicked: { forceActiveFocus(); columnModel.moveSelectionUp(); levelsTableView.lastRow--; } | ||
toolTip: columnModel.autoSort ? qsTr("Move selected non-numeric labels up") : qsTr("Move selected labels up") | ||
onClicked: { forceActiveFocus(); columnModel.moveSelectionUp(); levelsTableView.selectedRow--; } | ||
toolTip: qsTr("Move selected labels up") | ||
|
||
height: buttonColumnVariablesWindow.buttonHeight | ||
implicitHeight: buttonColumnVariablesWindow.buttonHeight | ||
width: height | ||
enabled: levelsTableView.lastRow == -1 ? false : columnModel.firstNonNumericRow < levelsTableView.lastRow | ||
visible: !columnModel.autoSort || columnModel.rowsTotal - columnModel.firstNonNumericRow > 1 //If there are at least 2 non numerics there is something to move up | ||
enabled: levelsTableView.selectedRow > 0 | ||
visible: !columnModel.autoSort | ||
} | ||
|
||
RoundedButton | ||
{ | ||
iconSource: jaspTheme.iconPath + "arrow-down.png" | ||
|
||
onClicked: { forceActiveFocus(); columnModel.moveSelectionDown(); levelsTableView.lastRow++; } | ||
toolTip: columnModel.autoSort ? qsTr("Move selected non-numeric labels down") : qsTr("Move selected labels down") | ||
onClicked: { forceActiveFocus(); columnModel.moveSelectionDown(); levelsTableView.selectedRow++; } | ||
toolTip: qsTr("Move selected labels down") | ||
|
||
height: buttonColumnVariablesWindow.buttonHeight | ||
implicitHeight: buttonColumnVariablesWindow.buttonHeight | ||
width: height | ||
enabled: levelsTableView.lastRow == -1 ? false : ((columnModel.firstNonNumericRow <= levelsTableView.lastRow) && ( levelsTableView.lastRow < columnModel.rowsTotal - 1 )) | ||
visible: !columnModel.autoSort || columnModel.rowsTotal - columnModel.firstNonNumericRow > 1 //If there are at least 2 non numerics there is something to move down | ||
enabled: levelsTableView.selectedRow >= 0 && levelsTableView.selectedRow < columnModel.rowCount() - 1 | ||
visible: !columnModel.autoSort | ||
} | ||
|
||
RoundedButton | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So with this change it either orders the numeric ones or the non-numerics if there are no numerics?
Why not order both?