Selected Item losing Highlight in QTableView - qt

I have a problem with the extendedSelection of my QTableView.
The Problem is that i have some whitespace around my columns and rows and when i click this whitespace the highlighting of my selected Fields is lost.
Its not ocurring when i click somewhere else in my application, only in the whitespace.
Also when i set the selection mode to SingleSelection it works just fine.
here is a short gif to illustrate the problem
https://gyazo.com/8e4ae161aaff25a4afa1b588579ddd01
thank you everyone who can help me
sincerely

Because that white region belongs to QTableWidget, so when you click that place it resets the selection and selected cell is gone since none of cell is selected. But when you click outside of the QTableWidget, selection state still exists.So If you do not want to this, you can increase column widths like this:
ui.tableWidget->setColumnWidth(columnNumber,columnWidht);
or you can decrease the width of QTableWidget to fit the columns. So user can not see and click this white region.

Related

How to select two buttons in a screen at the same time in UWP

I used button PointerFocus event to set the button border. Need to set border on two buttons in the same screen. Is There a way to set the border of one button without remove the border from a previously selected button in UWP.
The act of getting focus is unique. In other words, when a control gets focus, the previous control loses focus.
If you need the button to remain selected, you may not need Button, but ToggleButton.
ToggleButton has two states (selected/unselected), while retaining the appearance of Button. You can have multiple ToggleButtons selected at the same time.
Here is the document about the ToggleButton.
Best regards.

QML: GridView/SwipeView with drag and drop

I have a list of lets say 20 buttons (this number can change dynamically) in a listView which I want to display using a grid on a swipeView or gridView. Only 6 buttons should be visible at once. In addition, it should be possible to exchange the position of buttons via drag and drop (see http://doc.qt.io/qt-5/qtquick-draganddrop-example.html). In case gridView is the way to go, is it possible to have it behave like swipeView, so that the buttons can not be moved to an arbitrary position but lock onto their column?
You might want to give snapMode a try.
You have the choice of:
GridView.NoSnap (default) - the view stops anywhere within the visible area.
GridView.SnapToRow - the view settles with a row (or column for GridView.FlowTopToBottom flow) aligned with the start of the view.
GridView.SnapOneRow - the view will settle no more than one row (or column for GridView.FlowTopToBottom flow) away from the first visible row at the time the mouse button is released. This mode is particularly useful for moving one page at a time.
You need to make sure, that the size of the GridView really fits your desired amount of delegates, for it will only make sure, that the first element is aligned, not that there is no element paritally protruding the view.

EXTJS how to focus checkcolumn cell

Been working with the checkcolumn plugin, I've discovered that when I click on any cell in that column, it doesn't highlight. I'm going to assume this means that the cell is not focused.
This has the effect of that when another cell receives focus, the grid scrolls back up to its last/current focused cell whenever I click on any cell in the checkbox column. I could scroll halfway down and click on a checkbox and if a textfield at the start of the grid had focus the grid will scroll back up.
Strangely enough when I navigate using the keyboard the cell is highlighted as expected, so this is a mouse-only issue which I don't understand. Where would I add code to focus on the cell in the checkcolumn?
Looks like processEvent method in the checkcolumn returns false to stop selection on purpose:
http://docs.sencha.com/ext-js/4-0/source/CheckColumn.html#Ext-ux-CheckColumn
I don't know why that is and what would be the ramification if it returned true - but it possible to override it and see I guess :)

adobe flex datagrid selectable columns

I'm trying to make a Flex (Advanced)DataGrid component with some mechanism where the user can toggle the visibility of the columns. I've crudely implemented this by reading in the columns into the right-click menu, and when a column name is selected here, the visibility is toggled. It works, but it's not the most elegant solution.
Specifically, I'm trying to emulate the "datagrid" that Mozilla Thunderbird uses to display emails. Here is an image:
In the upper right, there is an icon over the scroll bar. If there is no scrollbar, the icon remains in the same place. When clicking the icon, it opens up a menu that shows all the possible columns, with the visible ones having a check mark next to them, like this:
Also, the scroll bar always appears under this button, never "pushing" it over into it's own column.
I'd like to re-create this in Flex. I believe the menu part and creating a column with a button headerRenderer is easy enough. But I can't figure out how (if at all possible) to do this with the scrollbar, because the scrollbar always seems to be "its own column". Any ideas or help would be appreciated. Thank you.
Ian
One dirty solution comes to mind. Create a component based on Canvas, then add an AdvancedDataGrid by overriding createChildren. Override updateDisplayList as well and add a button like the one in Thunderbird to the upper right of the Canvas. This will cause the button to appear over the DataGrid. Problemo solved?

How to select Row in QTableView?

I am new to QT, and I'm using QTableView, as shown below:
On the left side of the table, Qt is automatically showing a row number, as I've noted in red. How do I get rid of these numbers?
My other problem is, if I click any cell, only that cell is selected. How can I make it to where, when a user clicks a cell, the entire row is selected, like I noted in pink? For example, if I click the testApp-copy.itr cell then the entire third row should be selected.
Use
table->verticalHeader()->hide();
to get the vertical header and hide it, and
table->setSelectionBehavior(QAbstractItemView::SelectRows);
to make QTableView only select whole rows.
You may also want to specify the selection mode.

Resources