qtableview

Qt QTableView how to have a checkbox only column

We are using a QTableView with Qt 4.6.3, and need a column that only has a checkbox in each cell. We're using a custom subclass of QAbstractTableModel as the model for the QTableView. Right now, we have a checkbox by setting the Qt::ItemIsUserCheckable flag. But we can't figure out how to get rid of the blank textbox next to the check...

Determine if QTableView has an open editor

Is there any way to determine if a QTableView has an open editor in the current cell? I need to handle the following situation: A user double-clicks a cell and edits the data, but leaves the cell in the "edit" state. On another part of the UI, an action is taken that changes the selected row of the underlying model. Back on my view, I ...

How to make sure columns in QTableView are resized to the maximum

I'm not sure how to ask this, so, feel free to ask for more information. It seems that tableView->resizeColumnsToContents() will only resize all the columns based on data in current view. Which means that if I have more data below (which is longer in terms of counts of words), those words will be wrapped down (if the wordWrap property i...

Qt thick database client architecture

My goal is to create a thick client to the database. Basically it is all about managing three lists of data. I would like to slice my application into decoupled layers so using Qt's Model/View framework seems natural to me. When should I create QSql*Model instances? I need to be able to connect/disconnect to/from the database severa...

One QStandardItemModel for different QTableView, Generic vs Specific Views

I really don't know if this makes sense but this is what I trying to do: I'm doing my game's editor in QT. Currently I'm using a QStandardItemModel to store all my scene items. These items have names, position, Textures(vector of Texture which is a custom class), Animations (vector of Animation), etc. I find it useful to have one item...

Qt4 Model/View - Transforming data in View?

Here's my use case (very simplified). I have some data from DB in QSQLTableModel and I need to transform it: merge few fields into one (and display as such) or split one field into few. How and where this should be done in Model/View? Notes: I tried using AbstractProxyModel to do this, but I guess, it's suitable only for filtering or...

HowTo make restoreState() and saveState() work correctlly to QTableView class?

Hello, there. First of all, I wanted to say, that my problem was already discuss here, on SO, and here it is. But the answers are not the good ones... So, here is the problem: I have a QTableView class, with a simple model, connected with tableView->setModel(model); method. For example, I have 4-5 columns. I started up my project appli...

How to trigger the edit mode of an item in a QTableView?

I'm using QTableView and QStandardItemModel now. In the QTableView, if you double-click a cell, this cell will get into edit mode and you can edit its content. Now I have a problem, I want to trigger the edit mode of an item by code (by command), what should I do? I cannot find proper function or slot in QTableView or QStandardItemMode...

How to get right row height in Qt for QTableView object?

From this screenshot you can see a lot of space inside the rows: I've used these functions to get resizing: resizeRowsToContents(); resizeColumnsToContents(); How can I get a better fit for cells/rows sizes? ...

PyQt QTableView not displaying icons after update to PyQt 4.5.1

I'll try to be as clear as possible, though this is all a bit muddled in my head. I have a PyQt application that has been working for about a year now. After updating to PyQt 4.5.1 (from 4.3.3) none of my icons appear in the QTableView anymore (this update was concurrent with an update to python 2.6.5 from 2.5.1). Reverting to the old...

Formatting data in a QTableView

Hello everyone, I'm using a custom delegate to display QDoubleSpinBoxes in a QTableView. Those spinboxes display their contents with two decimals. My problem is that I would like the QTableView to also display those numbers with two decimals while they are not being edited (at which point they are not in a QDoubleSpinBox). Or, rather,...

Qt's QTableView and large numbers

How to make it show large numbers in QTableView like 10030232145 and not as 1.02342e+10? ...

QTableView and empty header and column

I have one QTableView object and when I am switching from showIndicators to showIndiValues I am getting this ugly empty header line. Where is the problem? void DBTableView::showIndicators() { enum { indicators_Id = 0, indicators_Name = 1, indicators_CondName = 2, indicators_MeasureName = 3, ...

Call QFileDialog when trying to edit cell in QTableView

Is there a way of doing this without using a QItemDelegate? I've been having a lot of trouble with it. For example, if I use a Delegate: 1) Won't have a native dialog. 2) I'll have to implement my own image preview, 2) For some reason I can't resize the window cause setGeometry doesn't work, etc etc. QWidget *createEditor( QWi...

Qt Qtableview not getting signal for header item clicking.

Hi , Am using Qtableview with QsqlTableModel for populating a table data. I want to sort the column based on user selection on column header. i tried the way mentioned in http://stackoverflow.com/questions/3081340/qtableview-sorting-signal for getting the signal. (get the horizontal header from QtableView and connect signal sectioncli...

QTableView - Selection background color

Hi, I am using the following code for set the style for the table in simulator(S60)(Nokia Qt SDK). searchTable->setStyleSheet("background: rgb(255,255,255);color:rgb(0,0,0); font-family:Arial Narrow;font-size:20px; border: 4px outset rgb(255,255,255);gridline-color: #669933;" "selection-background-color: qline...

how to update QtableView when model change in pyqt Or in qt?

hello i have a QtableView that has a QsqlTableModel. i want my model to check for the changes when a user hit (refresh button) but i can't find a way to update data. i tried model.reset() and model.update() but they didn't work for me . i've been trying to find a solution for a couple of days is it possible in anyway to re-read from d...

QTableView is extremely slow (even for only 3000 rows)

Hi all, I have a table with 3000 rows and 8 columns. I use the QTableView. To insert items I do: QStandardItem* vSItem = new QStandardItem(); vSItem->setText("Blabla"); mModel->setItem(row, column, vSItem); where mModel is QStandardItemModel. Everything is fine if I have not to many rows, but when I am trying to visualize big data (...