Table and List view with single Model in Qt - qt

I have a 2D model where each row represents a frame in a video, and each column represents an object. The object can have different states on each frame, and this is stored in the model. Then I have a QTableView that shows this data. The model has header data, so each row has a header like "frame k" and each column has a header like "object n". This table is editable. But I want the user to edit it another way. The other way is a graphics view that shows a single frame. Below the graphics view is a list (oriented horizontally) that represents each frame. This way the user can click on a frame in the list and the graphics view now displays that frame.
The problem is that the list displays the first column of each row in the model. What I want it to do is show the header of each row instead (so the list says "frame 1, frame 2, etc"). Is there a way to do this?

Two possible solutions:
Try to use a proxy model (a subclass of QAbstractProxyModel) which accesses row headers as columns in a single row. Not trivial because the proxy model displays as data what the original model considers to be header.
Display a second 2D view of your model, but hide everything except for the column headers. Since your frames are rows, you'll need a proxy model to transpose between rows and columns.
DISCLAIMER: I did not actually implement any of the solutions.

Related

If I want 5 values that are in columns to the right of each key, what is the ideal way to train the Form Recognizer?

I have a column of numbers to the far left as my keys, of which, each entry has 5 design values I'm trying to pair to it. To train the model, I've used 15 completed pdf files, most of which were not scans. I also edited 3 of those, deleting the values but leaving the keys, and saved them with the same file name as the original, suffixed with "Empty".
The results returned from the model have no problem finding any of the numbers or their locations, but they are not in key-value pairs of any kind. I get that key-value "pair" excludes any possibility of grabbing the column header and the row, but just the row and position relative to the others would be make things easy enough. Just hoping for some insight on how to train it to reuse the same key as it looks across the row.
I'm exporting the data to Word format and tabulating the values with a light border. I have no experience with machine learning. For the empty form, would there be any benefit to adding DocVariable fields to each of the 5 value columns, with the variable name being a combination of the row and column key names?
Actually, it's necessary to delete these keys from your sample data to train the model of Form Recognizer, even incorrect to do that. Form Recognizer need to learn what key is in your sample data.
So you just need to follow the offical tutorial Build a training data set for a custom model to train the model with more samples of the similar form layout with different keys and different value. Then, you can follow my answer for the SO thread How to improve the accuracy of Form Recognizer? to draw the keys and values and extract the values what you want from the json result by their boundingBox values.
Yes, what I said means you need to design an algorithm to classify these keys and values by classifing their geometry values of boundingBox.
For example, you can try to draw several horizontal or vertical lines to link these left-up point of keys and values and to find out the geometry point pattern for classification these form cells.

How to import reactive datasets in Rshiny?

i m creating a risk dashboard , the problem is that i need the data set to be reactive , i have a simple dataset composed of countries (8) , sectors and values , what i want is that my app will be able to deal with different data sets for example if we change the colnames (country becomes pays) and we change the position of the col ,the app will recognize the column as country (in reality the data set is composed of an undefined number of variables with unkown names)
for example for the country column , i thought of creating a list that contains all country names and and when the first row of a column matches with a country from that list ,the column become names country
like that the problem is solved for one variable and what about the other ones
I think that's unnecesary complexity.
I suggest you to build an script to clean your data first with those specifications and then use it as a source.
You can use pattern recognition to match columns but be sure there aren't similar columns, for example, if you have two numerical variables there's a big problem.
Via Shiny I suggest you:
fileInput to import your database
Visualizate your database using DT
Create as many textInput boxes as columns you have
Manually change colnames using dplyr::rename and the boxes
Use the transformed database in your dashboard
Other options can be made using base::grep and dplyr.

Dynamic aggregation column input reference in Spotfire TERR data function

How can I make a dropdown menu that allows me to reference different columns and change the column reference of a data function in Spotfire's TERR/R?
I am creating 2D cross plots of data, using TERR data function to overlay the average profile line of the data on top of the individual profile lines. I am trying to add the ability to toggle between different normalizations. I want to be able to see data and the average of data over time normalization, pressure normalization, etc, etc. Without having to go into the data function and change the column name reference every time I want to change.
I know how to make the dropdown in the text area and reference each visualization, so those change automatically, but I still can't figure out how to make the TERR data input column to change dynamically with the dropdown menu selection so that the average line also changes.
There must be some way to simply say I want whatever is in the document property to be the "group by" column in the TERR data function to perform aggregations against. (I'm using the R package dplyr to do various simple statistical aggregations on data)
Thanks for the help!

How can I dynamically refer to an attribute in an R data frame?

I have a SpatialLinesDataFrame named df with a number of attributes. These attributes represent the permutations of three dimensions:
dim1
dim2
dim3
The attributes thus are:
df$dim1a.dim2a.dim3a
df$dim1a.dim2a.dim3b
df$dim1a.dim2b.dim3a
...
df$dim1b.dim2a.dim3a
df$dim1b.dim2a.dim3b
...
df$dim1n.dim2n.dim3n
I am now trying to make my data accessible in Shiny, where I offer a widget item for each dimensions that allows the user select one value for that dimension. If the user selects
dim1a
dim2c
dim3b
I want to display data for df$dim1a.dim2c.dim3b.
How can I dynamically access the part of the data frame that the user is asking to have displayed?
I can construct the name of the attribute by constructing it via
display_data <- paste0(input$radioButton_dim1,'.',input$radioButton_dim2,'.',input$radioButton_dim3)
But how can I refer to it when trying to select it from the df or subset the data frame to select the data?
+++ Update:
When I try subsetting the data frame by using df[,display_data], the objects of class "Lines" are being returned. If I just use df$dim1a.dim2c.dim3b, I get a list of the actual attribute values for those objects, which is what I am looking for.
+++
If this is not easily feasible or not recommended for some reason, can something like melting/casting also be performed on a SpatialLinesDataFrame?

BIRT report: dynamically adding columns to a table based on dataset data

In my report, a table is displaying results from a dataset and it has 6 columns.
But sometimes the dataset returns more than 6 columns depending on the report parameters.
So I need a way to dynamically add columns to my table
Thanks
I'd do it the other way round.
The number of the columns in the query is fixed anyway (for example: FIXED_A, FIXED_B, DYNCOL01, ..., DYNCOL20).
In the layout, your table should have columns for all columns (FIXED_A to DYN_COL20).
Clear the table's width. Set a fixed width for the fixed columns (with enough room left for the dynamic columns). Clear the width of all dynamic columns.
From now on, do not resize and column with the mouse, because this would set individual widths for each column again.
In your table properties, add aggregate bindings for each DYN_COLnn using the MAXIMUM function (let's call these MAX_COL01, ..., MAX_COL20).
For each columns, use a visibility expression like this (the number matching the layout column to the query column accordingly), e.g. for the first dynamic column:
!!row["MAX_COL01"]]
The !! means basically: interprete this as boolean, so the result is: show this column only if MAX_COL01 is not null - or in other words: if DYN_COL1 is not empty in any of the rows.

Resources