Menu
  • HOME
  • TAGS

QTreeView or QTreeWidget

qt,design-patterns,treeview,qtreewidget,model-view

If your data is stored in a database model or if you want to have a single data model and show it in some views in different ways, then you are definitely better to go with QTreeView. But QTreeWidget has it's internal model in some way along with the methods...

how to store and retrieve custom data (using QtCore.Qt.UserRole?) with Qtableview /QAbstractTableModel in pyqt?

qt,pyqt,model-view,custom-data-type

Your data method signature appears incorrect. It should be data(self, index, role = QtCore.Qt.DisplayRole) Based on the code provided, you should be able to call myModel.data(index, QtCore.Qt.UserRole) to get what you want. As you have pointed out, QtCore.Qt.UserRole is just an integer. If you pass the integer to the role...

Python-PySide TreeView Model 'for' statements LOGIC help needs a function maybe

python,for-loop,sqlite3,treeview,model-view

rootNode = Node("Categories") self.dbCursor.execute("SELECT * FROM Category WHERE company_ID=1") allCatRows = self.dbCursor.fetchall() self.dbCursor.execute("SELECT cat_ID FROM Category WHERE company_ID=1") cat_ids = self.dbCursor.fetchall() self.dbCursor.execute("SELECT subCat_ID FROM Sub_Category") subCat_ids = self.dbCursor.fetchall() self.dbCursor.execute("SELECT item_ID FROM Item") item_ids = self.dbCursor.fetchall() for ids in cat_ids: self.dbCursor.execute("SELECT * FROM Sub_Category WHERE cat_ID=(?)", (ids)) allSubRows =...

Use viewmodel to bind data with html.dropdownlistFor in asp.net-MVC

c#,asp.net-mvc,repository-pattern,html.dropdownlistfor,model-view

@Html.DropDownList("Group", new SelectList(Model.Groups.Select(g => g.GroupName ))) ...

Qt Model-View: What's the correct way to update the model and then the view when the data is stored and changed outside the model in a std::vector

c++,qt,model-view

The call to beginInsertRows seems to be incorrect: beginInsertRows(QModelIndex(), lastdisplayedrow, 1); This means you will insert rows in the span [lastdisplayedrow, 1]. The parameters in this function specify the start- and end-index of the to be inserted rows (see QAbstractItemModel::beginInsertRows). Your call should look like this: beginInsertRows(QModelIndex(), lastdisplayedrow, lastdisplayedrow +...

openGL/glut & glm ModelView Matrix

opengl,matrix,glm,model-view

Your Get Matrix function is wrong. When you iterate through the loop, you're not skipping over the right amount of elements in arr, the first iteration is arr[0] = modelview[0][0]; arr[1] = modelview[0][1]; arr[2] = modelview[0][2]; arr[3] = modelview[0][3]; and the second goes arr[1] = modelview[1][0]; arr[2] = modelview[1][1]; arr[3]...

Changing data in a QTableView depending on the selection of a QComboBox

c++,qt,qt5,model-view,qt5.4

There are at least 2 approaches. Use natural for Qt's model itemChanged signal. emit signal from your delegate and catch it inside your main window. If your delegate is standard which means that inside setModelData() method you have something like: QComboBox *line = static_cast<QComboBox*>(editor); QString data = line->currentText(); //... model->setData(index,...

Getting ModelView and Projection matrices in Opengl 2.x [C++]

c++,model-view,projection-matrix,opengl-2.0

The problem is that gluProject expects an array of type double while you're passing it a float. When it goes to iterate, it'll iterate using the size of a double, which is twice the size of a float! Therefore, it'll skip over some elements and give you garbage for others....

Is it correct to create a shader program for camera?

opengl,opengl-es,3d,webgl,model-view

Is it correct to create a particular shader program for the camera object No, because there is no camera in OpenGL. In fact there is not even a scene in OpenGL. OpenGL is a very simplicistic drawing API. All that OpenGL does is drawing points, lines or triangles to...

QDataWidgetMapper: wrong mapping

qt,pyqt,pyqt4,model-view

Everything is perfectly OK. It's because QDataWidgetMapper sets data for all connected widgets, thus using toNext you set data from second row for all mapped widgets.