QGridLayout insert qwidget - qt

I would insert QWidget in QGridLayout. Currently, when I put a QWidget in my grid, the number of columns and rows fits it. For example, when I insert a QWidget in row 15 and column 15 then my grid will be 15x15 whereas I would like it to be 20x20.
Is it possible to give a number of rows and columns?
Thanks.

Related

CSS Grid - Span Cols and Rows?

I am trying to acheive the following layout using a CSS Grid.
Is it a Grid with 8 columns and 3 rows where the first larger content (an image) spans three columns and 3 rows or do I size the first column to be a higher Fractional Unit (FR) that the second and third columns?
Does the same solution work for the final "column" of text and basket UX?

Starting grid column from half of the column

I am trying to start grid column from half of the very first column.
I tried grid-start-column with different values but it's not working. Basically, it should be like following:
grid-column: 0.5/7
I know this is not the valid code, but just for explanation I write that.
Is it possible to start a column from the half of the column?
Is it possible to start a column from the half of the column?
No. It is not.
Let's say you have a grid container with five columns and want to start spanning from halfway inside the first column (grid-column: 1.5 / 5 ). This won't work because you're not starting at a column line. More technically, the grid-row-* and grid-column-* properties accept only integers as values.
However, there is a simple workaround:
Instead of five columns use 10 columns.
Then start spanning at the third column (grid-column: 3 / 10).
This creates an equivalent layout, which looks the same visually, but with more precise control of the columns.
More details here: Changing div heights using CSS grid

How to get the specific cell with (column x and row y) in TableView? javafx

given a tableview object
I have got the tableposition for the cell I wanted to get.
I also got the row and column number of the cell I wanted to get.
Let's say it is row 3, column 2, how do I get the cell in row 3 column 2?
I want the cell obj itself, not the value of the cell.
If you are using JavaFX 8u40 or above you can get it by using the AccessibleAttribute.
TableCell cell = (TableCell) tableView.queryAccessibleAttribute(AccessibleAttribute.CELL_AT_ROW_COLUMN,rowIndex,columnIndex);
Remember you may get null value if the cell is not visible in the tableView viewport.

How to set maxLength of QTableWidget item

Is there a way to set the max length of a QTableWidget item (table cell)? I have a table that is editable and I would like the max length to be 3 when a user is editing a cell.
Create a subclass of QStyledItemDelegate and grab the QLineEdit that is created for the cells. You can use QLineEdit::setMaxLength(int) to set the maximum length that you want.
See the documentation of QStyledItemDelegate
tableWidget->setColumnWidth(column_number, length)
but 3 is small value for length, try with 30.

Reason for having separate tables for slots and days

In the agenda day+week view there are two separate tables for days and slots.
The days table essentially has a blank left column, x number of full height columns for each of the days with the date at the top (in a <thead> tag), and finally a right gutter with the scrollbar.
The slots table has y rows for each time slot (obviously a dynamically calculated number of rows). They have two cells per row. One for the time (12am) and one full-width cell that is only used afaik to display alternating dotted/solid horizontal borders.
My question (to the devs hopefully) is why did you make this choice, when compared to one table that contains x columns and y rows? Do you have plans to consolidate it into one table?
The reason I'm asking is because I am forking the code now to make it so that individual days+time slots are addressable (i.e. set the bgcolor on 8-10am on nov 12th to be red ... or disallow events to be dropped there).

Resources