How to know if an item is a leaf level item or not - qtreeview

See the attached image below. I have created a tree view and I have connected the doubleClicked signal to a slot which prints the row number, column number, hasChildren and childCount
When I clicked on "Property 0", I got the first print and when I clicked on "222.1", I got the 2nd print as shown.
The first print is correct because Property 0 has 4 children
I was expecting the 2nd print also to be same. Why did it give me a childCount as 0?
I wanted to know that when I clicked on any item in the 2nd column, whether that is leaf level item or not..
Please explain and help.

Related

How to distinguish selected row from current row in TableView in JavaFX?

If display simple TableView sample, then select first row, then press Ctrl and then Down Arrow button two times, we will see the following picture:
I.e. first row remains selected, while third row get cursor.
How to know this row?
This is the focused row. You can access that row via the focusModel property:
int rowIndex = tableView.getFocusModel().getFocusedIndex();
The TableView.TableViewFocusModel class used for focusModel also supports some additional features like accessing the item for the focused row.

Qt treewidget sorting top-level items

I am having a difficult time overloading QTreeWidgetItem's < operator.
I have a list of QTreeWidgetItems, some top-level items and some children. When the user activates the "date created" column to sort the tree, the sort occurs at the child level.
In other words, imagine a tree like this:
Item A - latest modification 9/24/12
3rd Modified - 9/21/12
2nd Modified - 9/15/12
1st Modified - 9/10/12
Item B - latest modification 9/23/12
2nd Modified - 9/23/12
1st Modified - 9/22/12
When the date column is activated to sort ascending, I would expect the return result to be: Item A, then Item B... but instead, the sort occurs on the 1st modified date of the item. I am returned with Item B then Item A. Even though none of the top-level items are expanded, or active.
If you use a QWidgetTree to dispay your QTreeWidgetItems list :
You can add your 2 firsts level item (item A and B), sort your QwidgetTree and then add your low level items.
so your tree will be sorted by latest modification

Dynamics AX MorphX WMSPickingList Report

I am trying to modify the WMSPickingList_OrderPick Report in Dynamics AX 2009.
I am attempting to move the InventDim group onto the same line as the actual Item Line, as it currently prints underneath.
I have tried manually moving the fields, in this case no data appears.
I have tried switching the parameters so that the item dimensions appear after or a part of the item number, in this case it still appears below.
I have also attemped to simply pick up the values in the Fetch statement and pass them to variables, I can see the values being picked up but on returning them in a display method no data appears?
Many thanks for your help in advance.
Go to Accounts receivables > Setups > Forms > Forms Setup
In the "General" tab > "Print item dimensions" group, Select the "Print item dimensions" as "After item number"
I am assuming it is currently set to "Under item line"
The problem with WMSPickingList_OrderPick report is the width of the design, the design doesnt have enough width to print the Inventory Dimensions, they dont appear when u put them in the same line because the columns overlap.
However, one very clean solution can be to use a Display method as datasource for the Item ID (i.e item number) and in that display method just append the dimension.

UITableViewController indexPathForSelectedRow returns incorrect value

I'm not sure what is going on but I have a list that has 3 items and I am selecting row 1.
I am using a viewcontroller that is a UITableViewController and that has a property tableView where I am accessing the indexPathForSelectedRow during the didSelectRowAtIndexPath.
For some reason this value is incorrect sometimes...
What could cause this?
The UITableView * param on didSelectRowAtIndexPath is also called tableView.
If your table has more than one section that can confuse things (it's caught me before). indexpath.row will return the row number in the section of the table, not the row number of the overall table. If that's not what you're expecting it'll appear wrong.

Change item sortorder in gridview - LINQToSQL

I've got a gridview with a list of categories. In the database (MSSQL2008), the category table has a SortOrder(INT) NULL field.
Currently categories are retrieved using:
Galleries.DataSource = From G In DB.GalleryCategories Order By G.SortOrder, G.Name
Now, what I need to be able to do is add "Move Up" and "Move Down" buttons to each row to allow the user to sort the items in an arbitrary way.
My initial thoughts are along the lines of:
Identify ID of selected item.
Identify ID of item before/after selected item.
Swap of identified items in the DB SortOrders.
I would then have make the sortorder NOT NULL and make sure it's initialised to a unique number
I'd appreciate any alternative suggestions / comments on this approach
Many thanks
I have generally seen it done this way, and have done it myself
SortOrder is an int
Each item increases by 10 (so, 10,20,30,40) or suitable increment
To move an item up, subtract 15
To move an item down, add 15
To insert an item, take the target and add/subtract 1
Apply a NormalizeSort() routine which resets the values to even intervals
10,20,25,30,40 => 10,20,30,40,50
That makes it all pretty simple, since inserting something above something else is just:
list.Add( New Item(..., target.SortOrder +1) )
list.NormalizeSort()
// or
item.SortOrder += 11, etc
If you want to make it a decimal, then you can just make it all sequential and just add .1, etc to the sort order and re-normalize again.
// Andrew
I believe
Galleries.AllowSorting = true;
would be far enough ;)

Resources