Project

General

Profile

Actions

Feature #13787

open

WTableView: Add getters for size of viewport

Added by Michael Seibt 10 months ago. Updated 28 days ago.

Status:
New
Priority:
High
Target version:
Start date:
06/19/2025
Due date:
% Done:

0%

Estimated time:

Description

We are porting a desktop application having wide tables. Single cell selection must work using arrow keys.
We have implemented this by handling signals keyWentDown and selectionChanged calling scrollTo.
In order to enable implementing page-wise movement on press of Key::PageUp / Key::PageDown, we need getters like

int countOfVisibleRows() const;
int countOfVisibleColumns() const;

(meaning entirely visible rows).
The necessary information "which cells are visible in the browser" is available in WTableView, but inaccessible because all private.
I.e. WTableView itself needs to be modified.

Actions #1

Updated by Michael Seibt about 1 month ago

Implementation of the most important part WTableView::visibleRowCount(): https://github.com/emweb/wt/pull/239

Actions #2

Updated by Romain Mardulyn 29 days ago

  • Assignee set to Romain Mardulyn
Actions #3

Updated by Romain Mardulyn 29 days ago

  • Status changed from New to InProgress
Actions #4

Updated by Romain Mardulyn 29 days ago

  • Status changed from InProgress to New

Hi Michael,

If I understand correctly, what you want to do is to have a WTableView that does scroll the page when the selected cell is outside the browser window due to the WTableView not being completely visible in the browser window.

If that is the case, the viewportHeight_ and viewportWidth_ are probably not the values you are looking for as these are just the height and width of the contentContainer_.

Actions #5

Updated by Michael Seibt 29 days ago

Hi Romain,

I want that PgUp/PgDn select the cell visibleRowCount() rows below/above the currently selected cell.
The selected cells is made visible by means of scrollTo called from selectionChanged handler.
I do not want to control the scrollbars directly. They shall reflect the visible part of the TableView, and shall always be visible if there are more cells than fit into the widget's viewport.

For ajaxMode, it works for me with the implementation in https://github.com/emweb/wt/pull/239.
The implementation for plain mode was just a quick guess.

Actions #6

Updated by Michael Seibt 29 days ago

Anyway, I was surprised / disappointed that the selection (cell or row) cannot be moved by means of the usual movement keys out of the box. This might be a feature request.

Actions #7

Updated by Romain Mardulyn 28 days ago

  • Target version set to 4.14.0
Actions

Also available in: Atom PDF