Search Results

Search found 6 results on 1 pages for 'qabstracttablemodel'.

Page 1/1 | 1 

  • Custom editor in QAbstractTableModel

    - by Martin Beckett
    Does anyone have an example of using a QWidget as an editor in a QAbstractTableModel? I have a column which when edited should create a QCombobox with the list of choices. The docs seem to suggest I need to write a QAbstractItemDelegate and a custom paint function but that seems overkill to simply pop-up a standard QCombobox in Qt::EditRole. Note - the combo box contents are the same for every row and it only needs to be shown when somebody clicks in the cell. I know this should be simple but I can't get it to work. It's easy for a QTableWidget based table - but I need it for a very large data table.

    Read the article

  • QAbstractTableModel as a model for one QTableView and few QListViews

    - by ??????
    community. Briefly. I wrote usual model over QAbstractTableModel and using it in usual way for QTableView. But I think I need to use some columns of this model for the few QListViews in QWizard to fill main table in the right way (for user). For example: use the column2 as the QListView's model on the page1 of the wizard; column3 for page2 for its QListView etc. Please, help me to understand just two things: Am I on the right way? If yes then how can I make it simply and explicitly?

    Read the article

  • How to overload operator<< for qDebug

    - by iyo
    Hi, I'm trying to create more useful debug messages for my class where store data. My code is looking something like this #include <QAbstractTableModel> #include <QDebug> /** * Model for storing data. */ class DataModel : public QAbstractTableModel { // for debugging purposes friend QDebug & operator<< (const QDebug &d, DataModel model); //other stuff }; /** * Overloading operator for debugging purposes */ QDebug & operator<< (QDebug &d, DataModel model) { d << "Hello world!"; return d; } I expect qDebug() << model will print "Hello world!". However, there is alway something like "QAbstractTableModel(0x1c7e520)" on the output. Do you have any idea what's wrong?

    Read the article

  • how to change headers data

    - by Moayyad Yaghi
    hello i have the following class class AssetTableModel(QtCore.QAbstractTableModel): def init(self,filename=''): super(AssetTableModel,self).init() self.fileName=filename self.dirty = False self.assets = [] self.setHeaderData(0,QtCore.Qt.Horizontal,QtCore.QVariant('moayyad'),QtCore.Qt.EditRole) and i need to change the headers of the columns or the rows ,i used ( self.setHeaderdata()) but its not working ,i have a table that consistes of 2 columns and 2 rows only. is there any other function that changes headers ??. please help thanx in adnvance

    Read the article

  • Segmentation fault while switching QCompleter for QLineEdit [on hold]

    - by san
    I have a QLineEdit that uses autocompletion one which on focusIn event in which it shows paths from XML List(here I have used hardcoded list) but if user doesn't find the path from that list popped by QCompleter than I want user to be able to browse to path typing '/' in QLineEdit , I am not able to select the paths say /Users etc and on trying to type Segmentation fault occurs. from PyQt4.Qt import Qt, QObject,QLineEdit from PyQt4.QtCore import pyqtSlot,SIGNAL,SLOT from PyQt4 import QtGui, QtCore import sys class DirLineEdit(QLineEdit, QtCore.QObject): """docstring for DirLineEdit""" def __init__(self): super(DirLineEdit, self).__init__() self.defaultList = ['~/Development/python/searchMethod', '~/Development/Nuke_python', '~/Development/python/openexr', '~/Development/python/cpp2python'] self.textChanged.connect(self.__dirCompleter) def focusInEvent(self, event): if len(self.text()) == 0: self._pathsList() QtGui.QLineEdit.focusInEvent(self, event) self.completer().complete() def __dirCompleter(self): if len(self.text()) == 0: model = MyListModel(self.defaultList, self) completer = QtGui.QCompleter(model, self) completer.setModel(model) else: dirModel = QtGui.QFileSystemModel() dirModel.setRootPath(QtCore.QDir.currentPath()) dirModel.setFilter(QtCore.QDir.AllDirs | QtCore.QDir.NoDotAndDotDot | QtCore.QDir.Files) dirModel.setNameFilterDisables(0) completer = QtGui.QCompleter(dirModel, self) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) completer.setModel(dirModel) self.setCompleter(completer) def _pathsList(self): completerList = QtCore.QStringList() for i in self.defaultList: completerList.append(QtCore.QString(i)) lineEditCompleter = QtGui.QCompleter(completerList) lineEditCompleter.setCompletionMode(QtGui.QCompleter.UnfilteredPopupCompletion) self.setCompleter(lineEditCompleter) class MyListModel(QtCore.QAbstractListModel): def __init__(self, datain, parent=None, *args): """ datain: a list where each item is a row """ QtCore.QAbstractTableModel.__init__(self, parent, *args) self.listdata = datain def rowCount(self, parent=QtCore.QModelIndex()): return len(self.listdata) def data(self, index, role): if index.isValid() and role == QtCore.Qt.DisplayRole: return QtCore.QVariant(self.listdata[index.row()]) else: return QtCore.QVariant() app = QtGui.QApplication(sys.argv) smObj = DirLineEdit() smObj.show() app.exec_() Please help fix this or suggest better way of implementation?

    Read the article

1