Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. tableview
    Log in to post

    • UNSOLVED Qtableview mouse move
      General and Desktop • tableview qstyleditemdele • • charry  

      7
      -1
      Votes
      7
      Posts
      60
      Views

      Please take a look at your post above - do you really think we can read something meaningful out of it. Please use the <code> - tags to make it more readable and reduce your code as much as possible so only the problem and nothing else is in there.
    • UNSOLVED Export QML TableView as excel file
      QML and Qt Quick • qml tableview excel • • Babs  

      2
      0
      Votes
      2
      Posts
      89
      Views

      @Babs Take a look at https://wiki.qt.io/Handling_Microsoft_Excel_file_format
    • UNSOLVED MouseArea works incorrectly inside TableView's delegate
      QML and Qt Quick • tableview • • Dmitriano  

      20
      0
      Votes
      20
      Posts
      226
      Views

      @jeremy_k Unfortunately, my MouseArea that covers the entire view and finds the delegate does not detect row insertion. For example on the picture below two rows surrounded with green were inserted (with beginInsertRows/endInsertRows) and MouseArea stopped responding to the clicks on the last two rows surrounded with red: Below I provided the source code of the entire TableView as it is now in my project: TableView { id: table anchors.fill: parent columnSpacing: 5 rowSpacing: 3 clip: true property var columnWidths: [100, 80, 80, 20, 20, 20, 90, 90]; columnWidthProvider: function (column) { return columnWidths[column]; } property var rowHeight: 40 rowHeightProvider: function (column) { return rowHeight; } ScrollBar.horizontal: ScrollBar{} ScrollBar.vertical: ScrollBar{} ScrollIndicator.horizontal: ScrollIndicator { } ScrollIndicator.vertical: ScrollIndicator { } MouseArea { //id: ma anchors.fill: parent //hoverEnabled: true onClicked: { var index = Math.floor((mouse.y - table.originY) / (table.rowHeight + table.rowSpacing)); console.log("index:", index, " mouse: (", mouse.x, "," , mouse.y, ") table.origin: (", table.originX, ",", table.originY + ") table.content: (", table.contentX, ",", table.contentY + ")") var item = table.model.rowKey(index) if (item) window.openMarket(item) } } QtObject { id: enumSymbols property string spotAllowed: "S" property string marginAllowed: "M" property string isolatedMarginAllowed: "I" } delegate: DelegateChooser { role: "type" DelegateChoice { roleValue: "symbol" delegate: SymbolCell { item: model.item } } DelegateChoice { roleValue: "price" delegate: Text { horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter text: { var val = model.item[model.name]; return val ? val.toFixed(model.item.pricePrecision) : ""; } } } DelegateChoice { roleValue: "signal" delegate: Text { horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter text: TimeFormat.ago(model.item.signalTime, timeMachine.now) color: model.item.signalTime ? "black" : "gray" } } DelegateChoice { roleValue: "enum" delegate: Text { horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter text: model.display ? enumSymbols[model.name] : "" color: "#1e73cd" } } DelegateChoice { roleValue: "zparams" delegate: Text { property var zparams: model.item[model.name] horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter text: zparams ? "(%1, %2, %3)".arg(zparams.lag).arg(zparams.threshold.toFixed(2)).arg(zparams.influence.toFixed(2)) : qsTr("No") color: zparams ? "black" : "gray" } } DelegateChoice { roleValue: "check" delegate: CheckBox { checked: model.item[model.name]; onClicked: { table.model.beginUpdateItem(model.item) model.item[model.name] = checked table.model.endUpdateItem(model.item) } } } DelegateChoice { delegate: Text { verticalAlignment: Text.AlignVCenter text: model.item[model.name] } } } } If I refresh my TableView with beginResetModel/endResetModel MouseArea starts to work correctly.
    • SOLVED HorizontalHeaderView not calling headerData() of QAbstractTableModel's child
      QML and Qt Quick • qml tableview horizontalheade • • noone  

      2
      0
      Votes
      2
      Posts
      77
      Views

      my bad. I got answer in stack overflow The problem is caused by a naming conflict between the Button's display property and the role. The solution is to access the role through the model explicitly: delegate: Button { text: model.display }
    • SOLVED TableView with exapanding columns
      QML and Qt Quick • qml tableview layout • • noone  

      5
      0
      Votes
      5
      Posts
      66
      Views

      adding onWidthChanged: forceLayout() with columnWidthProvider to TableView works
    • SOLVED How to add a component onto the whole row of a multi-column TableView?
      QML and Qt Quick • tableview row anchoring multi-column • • jeanmilost  

      5
      0
      Votes
      5
      Posts
      67
      Views

      @jeanmilost Because of z ordering issues between delegates you will most likely need a popup.
    • SOLVED MouseArea prevents the parent scrolling to work properly
      QML and Qt Quick • tableview mouse mousearea scroll mouseevents • • jeanmilost  

      2
      0
      Votes
      2
      Posts
      87
      Views

      Finally I searched a while by myself, and I think I may answer my own question. Although I couldn't completely resolve my issue, I noticed that the answer is hidden in the other MouseArea events. For example, by handling the onPressed event and adding the mouse.accepted in several key locations, I could let the component take care of the scrolling when the left mouse button is pressed, whereas the right click opens a popup menu. My conclusion is that there is no ready-to-use way, i.e there is no parameter to activate in the MouseArea itself which may resolve this kind of issue, and the solution is a good balance between activating different parameters in the different functions.
    • SOLVED How to add rows automatically with sleep?
      General and Desktop • qthread tableview sleep • • SoleyRan  

      3
      0
      Votes
      3
      Posts
      157
      Views

      @Christian-Ehrlicher Thank you very much! It solved my problem perfectly :)
    • UNSOLVED Emulating ListView as TableView
      QML and Qt Quick • qml listview tableview view • • Ahti  

      6
      0
      Votes
      6
      Posts
      101
      Views

      @fcarney I am new to Qt so don't anything about Loader and Can you please take a look at this question too: https://forum.qt.io/topic/111852/inconsistency-between-model-and-view-while-updating-qsqltablemodel-cell
    • SOLVED DelegateChooser creates delegates in other context
      QML and Qt Quick • tableview qt 5.12 delegatechooser • • SebastianM  

      7
      0
      Votes
      7
      Posts
      195
      Views

      @SebastianM great that you managed to figure it out. It's a bit difficult to read all this on a mobile screen so excuse my previous posts 🙈 Never the less, thanks for charing the answer
    • SOLVED Different delegates in TableViewColumn depending on data
      QML and Qt Quick • tableview delegate qt 5.12 • • SebastianM  

      5
      0
      Votes
      5
      Posts
      239
      Views

      Cool, that's what I was looking for.
    • SOLVED DelegateChooser does not work
      QML and Qt Quick • tableview delegatechooser • • Dmitriano  

      2
      0
      Votes
      2
      Posts
      269
      Views

      hi @dmitriano Window { visible: true width: 640 height: 480 title: qsTr("Hello World") TableView { anchors.fill: parent columnSpacing: 1 rowSpacing: 1 clip: true model: TableModel {} delegate: DelegateChooser { role: "type" DelegateChoice { roleValue: "lab2" delegate: Rectangle { Text { id: label2 text: "type delegate" } } } DelegateChoice { // roleValue: "String" // default delegate delegate: Rectangle { color: ms.containsMouse ? "#d2cc01" : "lightgrey" MouseArea{ anchors.fill: parent hoverEnabled: true id:ms } implicitWidth: defaultLabel.implicitWidth + 8 implicitHeight: defaultLabel.implicitHeight + 4 Text { id: defaultLabel text: tabledata } } } } } }
    • SOLVED QAbstractTableModel::removeRows() implementation
      QML and Qt Quick • qml tableview • • Babs  

      4
      0
      Votes
      4
      Posts
      402
      Views

      Well, your model is a "wrapper" around your data structure. Take a look at the Creating New Models in the Model View chapter of QT's documentation.
    • UNSOLVED Is it possible through qml javascript change the value of an delegate of a TableViewColumn?
      QML and Qt Quick • qml tableview model tableviewcolumn • • Nmaster88  

      1
      0
      Votes
      1
      Posts
      117
      Views

      No one has replied

    • UNSOLVED Is there a way to have subheader on a TableView?
      QML and Qt Quick • tableview tableviewcolumn • • Nmaster88  

      1
      0
      Votes
      1
      Posts
      128
      Views

      No one has replied

    • SOLVED How to change models using TableView column click event
      QML and Qt Quick • qml tableview listmodel onclick • • Flesh  

      2
      0
      Votes
      2
      Posts
      531
      Views

      @Flesh Romha Korev on stackoverflow.com gave me this answer: onSortIndicatorColumnChanged: tableView.model = (sortIndicatorColumn == 0) ? myListModel1 : myListModel2 onSortIndicatorOrderChanged: tableView.model = (sortIndicatorColumn == 0) ? myListModel1 : myListModel2
    • UNSOLVED DelegateChooser not working with TableView and QAbstractTableModel
      QML and Qt Quick • tableview delegatechooser • • notsak  

      1
      0
      Votes
      1
      Posts
      184
      Views

      No one has replied

    • UNSOLVED How to filter out columns in the new Quick Controls 2.12 TableView?
      QML and Qt Quick • tableview qsqltablemodel quick controls models qml components • • ivarec  

      1
      0
      Votes
      1
      Posts
      158
      Views

      No one has replied

    • UNSOLVED TableView rowDelegate how to take row index?
      QML and Qt Quick • qml tableview rowdelegate • • Galbarad  

      3
      0
      Votes
      3
      Posts
      717
      Views

      but in MouseArea in row delegate styleData.row - available following code show right click menu for row in place where mouse clicked rowDelegate: Rectangle { id: rdRow height: 30 MouseArea { id: maRow anchors.fill: parent acceptedButtons: Qt.RightButton onClicked: { console.log("right click on row", styleData.row, mouseX, mouseY, tvMain.flickableItem.contentY) if ((styleData.row || (styleData.row === 0)) && (mouse.button === Qt.RightButton)) { currentRowIdxForMenu = styleData.row cmRow.x = mouseX cmRow.y = mouseY + styleData.row * rdRow.height - tvMain.flickableItem.contentY cmRow.open() } } } }
    • SOLVED what's the meaning of row in tableView::rowMoved(int row, int oldIndex, int newIndex)?
      General and Desktop • tableview rowmoved • • brozo77  

      2
      0
      Votes
      2
      Posts
      240
      Views

      I have download the source code. And find no use of the param row. So it's redundant. Close the question, thanks!
    • SOLVED How to show QSqlQuryModel in QML?
      QML and Qt Quick • qml sql tableview qsqlquerymodel • • noone  

      3
      0
      Votes
      3
      Posts
      407
      Views

      Hi, Add a setter to your model that is Q_INVOKABLE and pass your query through it. Don't forget to add proper error checking to give feedback to your user if something goes wrong.
    • SOLVED Loading data from sqlite database
      General and Desktop • qtcreator tableview sqlite button • • Kushan  

      10
      0
      Votes
      10
      Posts
      3692
      Views

      What was the problem ?
    • UNSOLVED qml TableView and group of columns
      QML and Qt Quick • tableview tableviewcolumn • • BePie  

      1
      0
      Votes
      1
      Posts
      348
      Views

      No one has replied

    • SOLVED Searching word found after several clicks!
      General and Desktop • qtcreator tableview button search • • Lasith  

      4
      0
      Votes
      4
      Posts
      1116
      Views

      Hi, More likely that not all your database data are loaded in memory. You would have to call fetchMore however beware that if you have big tables it's going to cost you more in RAM.
    • UNSOLVED TableView and Columns
      QML and Qt Quick • tableview tableviewcolumn • • RostV  

      1
      0
      Votes
      1
      Posts
      351
      Views

      No one has replied

    • UNSOLVED Enter manually in TableView
      QML and Qt Quick • qml tableview • • alemio  

      1
      0
      Votes
      1
      Posts
      416
      Views

      No one has replied

    • TableView with Controls 2
      Announcements • qml qtquick tableview grid • • Eluvatar  

      2
      2
      Votes
      2
      Posts
      1199
      Views

      Thank you for sharing!
    • QCompleter in QTableView: show always, even before user input
      General and Desktop • c++ tableview view completer completion • • azrdev  

      6
      0
      Votes
      6
      Posts
      4002
      Views

      @raven-worx said in QCompleter in QTableView: show always, even before user input: declare the m_Editor variable as mutable. This makes it compile (even though I'm not sure about the implications), but it doesn't help me: there is no Show event handled in editorEvent ever (tested with printf-debugging - yes, before the test for QLineEdit), I'm only getting Mouse events. @SGaist said in QCompleter in QTableView: show always, even before user input: Something like completer->popup()->show(); should do what you want. Nope, does not help. I figured (using qDebug, again), the place where I should put my popup-opening call is setEditorData. In there, I receive the QLineEdit and it's QCompleter: But I cannot make it show the popup. I tried now: completer->setCompletionPrefix(index.data(Qt::EditRole).toString()); completer->complete(); completer->popup()->show(); Note: Sometimes the popup is shown for a very short time, but immediately hides. When repeatedly entering & leaving edit mode this only works the first time.
    • UNSOLVED Text wrap in TableView
      QML and Qt Quick • qml tableview wordwrap • • DanielJG  

      1
      0
      Votes
      1
      Posts
      959
      Views

      No one has replied

    • SOLVED Reordering TableView with drag and drop
      General and Desktop • tableview setpixmap drag and drop t moveaction • • PeterPan32  

      3
      0
      Votes
      3
      Posts
      1478
      Views

      Sounds great, but I get some runtime error: QPainter::begin: Paint device returned engine == 0, type: 2 QWidget::render: Cannot render with an inactive painter Edit: There is some modification on your suggested code neccessary: const QModelIndex& index = currentIndex(); // Render the pixmap QPixmap pixmap(visualRect(index).size()); //pixmap. render(&pixmap, QPoint(), visualRect(index)); // Create the drag QDrag* drag = new QDrag(this); drag->setPixmap(pixmap); ... But anyhow it renders the cell of one index above the selected one. Maybe that has something to do with the offset parameter (second one in render). Edit2: The proper QRect can be calculated with the height of the horizontal header: render(&pixmap, QPoint(0,0), visualRect(index).translated(0, horizontalHeader()->height() ));
    • SOLVED Double-click causes opening new window in Table View
      General and Desktop • sql tableview window • • drock  

      4
      0
      Votes
      4
      Posts
      1536
      Views

      Thanks everyone
    • UNSOLVED we have use qt TableView like sample source. but the memory was leaked.
      QML and Qt Quick • tableview memory resolution leak with • • liuyang  

      6
      0
      Votes
      6
      Posts
      1543
      Views

      @cheezus JavaScipt source doesn't leak now.but QML side still leaks.please .
    • UNSOLVED Synchronize tableview scrollbars
      QML and Qt Quick • qml tableview scrollbar • • PhTe  

      2
      0
      Votes
      2
      Posts
      1251
      Views

      @PhTe flickableItem is your friend here. It could be done as follows: //Inside some TableView flickableItem.onContentYChanged: { mirror.flickableItem.contentY = flickableItem.contentY //mirror = id of other table }
    • UNSOLVED can't make widgets placed outside of viewport scrollable....
      General and Desktop • tableview • • yxlee  

      2
      0
      Votes
      2
      Posts
      674
      Views

      @yxlee Hi! Did I get this right: You've got a window. To that window you've added a QScrollArea with some content. You also added some other widgets to that window. Now you want these other widgets to move when you scroll inside the scroll area?
    • UNSOLVED QRadioButton on tableview vertical header..
      General and Desktop • tableview • • yxlee  

      3
      0
      Votes
      3
      Posts
      728
      Views

      Thanx Ratzz.
    • UNSOLVED Instant initialization of qml object in TabView at app start
      QML and Qt Quick • qml tableview • • Bioniwulf  

      2
      0
      Votes
      2
      Posts
      834
      Views

      Hi @Bioniwulf, Did you try creating them dynamically using addTab. Do it as soon you as you receive UDP data.
    • UNSOLVED QSqlQueryModel downcasting problem !
      General and Desktop • tableview qsqlquerymodel downcasting • • _compiler  

      4
      0
      Votes
      4
      Posts
      970
      Views

      @_compiler Model *derived = static_cast<QSqlQueryModel*>(model); This isn't a valid cast because you can't implicitly cast to a derived type (see @mrjj's comment). Model *derived = static_cast<Model *>(model); Is valid but unsafe, as @SGaist pointed out. Ultimately, what is not working?