qtableview

How do I tell Qt to always show an editor in a QTableView?

I've got a QTableView for which I want to display the last column always in edit mode. (It's a QComboBox where the user should be able to always change the value.) I think I've seen the solution in the Qt documentation, but I can't find it anymore. Is there a simple way of doing it? I think I could archive this effect by using openPers...

QTableView selected element in PyQt4

Is there some way to read which row of Qt's QTableView widget is selected by user? Does it have something to do with QModelIndex class? ...

What is the best way to make a QTableView's cells have up and down button pushed states in Qt?

I'm trying to make the cells of a QTableView look like 3D clickable buttons. So that when you click on a cell, the button looks pushed. Everyone seems to think I merely want to change the colour, I need to show images of a normal button, and a pushed button, that look 3-dimensional. I have done this already with calling QTableView::setI...

Qt QTableView and horizontalHeader()->restoreState()

I can't narrow down this bug, however I seem to have the following problem: - saveState() of a horizontalHeader() - restart app - Modify model so that it has one less column - restoreState() - Now, for some reason, the state of the headerview is totally messed up. I cannot show or hide any new columns, nor can I ever get a reasonabl...

selected Rows/Line in QTableView copy to QClipboard

Hi. First of all, sorry for bad English. It's about C++ and Qt. I have a SQLite-Database and I did it into a QSqlTableModel. To show the Database, I put that Model into a QTableView. Now I want to create a Method where the selected Rows (or the whole Line) will be copied into the QClipboard. After that I want to insert it into my OpenO...

QTableView - not allow user to edit cell

I created a QTableView with a QSqlTableModel. By standard, double-clicking on the cells will mark them and the user can edit them. I want, that the user isn't allowed to do that. He is allowed to mark the whole row by clicking on a single cell, but not to edit the cell. How can I do that? ...

how do i get a checkbox item from a QTableView and QStandardItemModel alone?

Seems using model.setData(index, Qt::Checked,Qt::CheckStateRole) is not enough to get the checkbox working right. Any suggestions? ...

Show other data in QTableView with QItemDelegate

I have a QTableView connected with an QSqlTableModel. In the first column, there are only dates at this format: 2010-01-02 I want this column to show the date at this format (but without changing the real data): 02.01.2010 I know that I have to create an QItemDelegate for this column, but I don't know how I can read the existing data and...

QTableView - what signal is send when user selects a row by clicking to it?

Is there a signal which is emmited when user selects a row in QTableView by mouse (sigle selection model)? ...

How to open an URL in a QTableView

What is the best way to present a clickable URL in a QTableView (or QTreeView, QListView, etc...) Given a QStandardItemModel where some of the columns contain text with URLs I'd like them to become clickable and then handle the click by using QDesktopServices::openURL() I was hoping there would be some easy way to leverage QLabel's tex...

QTableView has unwanted checkboxes in every cell

I'm just getting started with Qt programming, and I'm trying to make a simple tabular data layout using a QTableView control with a model class of my own creation inheriting from QAbstractTableModel. For some reason, my table view ends up looking like this: What in the heck are those things that look like checkboxes (but don't do anyt...

RubyQt Crashing on QTableWidget

I'm getting some weirdness with QtRuby when using a TableWidget. The table widget loads, but when you click on the elements in the row, the app segfaults and crashes. require 'Qt4' class SimpleModel < Qt::AbstractTableModel def rowCount(parent) return 1 end def columnCount(parent) return 1 end ...

qtableview (libqt) how do I correctly create a QModelIndex

I'm trying to enter edit mode on a specific cell like this void MainWindow::on_addButton_released(void) { tm->addRow(); tableView->scrollToBottom(); int ec=tm->firstWritableColumn(); int r=tm->rowCount(QModelIndex()); QModelIndex id = tm->index(r, ec, QModelIndex()); tableView->setCurrentIndex(id); tableView-...

How to implement frozen rows in a QTableView

I'm looking for an example on how to freeze the last row in a QTableView? ...

How can I set the line style of a specific cell in a QTableView?

I am working with a QT GUI. I am implementing a simple hex edit control using a QTableView. My initial idea is to use a table with seventeen columns. Each row of the table will have 16 hex bytes and then an ASCII representation of that data in the seventeenth column. Ideally, I would like to edit/set the style of the seventeenth column t...

How to create widget with clickable text in QT/PyQt?

Hi everyone, i'm trying to realize non-editable QTableView with widgets in cells that should contain clickable listed text. With following code i'm setting widget in definite cell: view = QTableView() label = QLabel( <some html text> ) ... view.setIndexWidget(index, label) I used html to make label's text clickable, but links became ...

How to interact with checkbox actions ? (QTableView with QStandardItemModel)

I'm using QTableView and QStandardItemModel to show some data. For each row, there is a column which has a check Box, this check box is inserted by setItem, the code is as follows: int rowNum; QStandardItemModel *tableModel; QStandardItem* __tmpItem = new QStandardItem(); __tmpItem->setCheckable(true); __tmpItem->setCheckState(Qt::U...

Set initial text when editing a QTableView cell

I've subclassed QAbstractTableModel and overrode the flags() method so that some of the table cells are editable. The problem is that when I start editing, the existing cell value is erased. I would like to initially have the existing cell value selected. How can I do this? ...

QTableView sorting signal?

I use QTableView + QStandardItemModel to show some data (data stored in some other data structure), and this table view is sortable. Since it is sortable, when sorting this model, I also need to sort the order of stored data. I try to implement a slot for the sorting signal, but I don't know what signal is emitted when clicking the head...

Qt getting reference of custom data type of QStandardItemModel to change it!

It's getting a little weird I can't see a method to actually change the "data" of a QStandardItemModel. For example: struct TestStruct { std::vector<int> testVector; void addNumber(int i){ //this method will modify the member vector } }; Q_DECLARE_METATYPE(TestStruct) QStandardItemModel* model = QStandardItemModel...