Navigation

    Qt Forum

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

    • UNSOLVED Signal and Slot with two different UI class in QT
      General and Desktop • signal & slot qtablewidget qt c++ • • Rhutu  

      2
      0
      Votes
      2
      Posts
      42
      Views

      @Rhutu Nothing should "vanish". If you overwrite what is in QTableWidget with something not as you intended then obviously it will cease to show whatever it showed before. If you need to pass additional data from your main window to the slot, you can either do it via a C++ lambda for the slot, or put a slot which is in the main window instead of Obj,SLOT(WriteToFile()), and have that call Obj->WriteToFile(extra). Stop using old-style SIGNAL/SLOT() macros for signals/slots, use https://wiki.qt.io/New_Signal_Slot_Syntax, it's better and it will help you connect correct things.
    • SOLVED Updating QTablWidget correctly
      General and Desktop • qwidget qtablewidget • • TUStudi  

      9
      0
      Votes
      9
      Posts
      50
      Views

      @TUStudi Well, it's not necessarily that: you can create an item via void QTableWidget::setItem(int row, int column, QTableWidgetItem *item) instead.
    • SOLVED scrollbar not reappearing when a tableWidget is stretched then shrinked
      General and Desktop • qtablewidget resize scrollbar • • torea  

      4
      0
      Votes
      4
      Posts
      65
      Views

      Calling the base class implementation did the trick. Thank you again! I didn't try the resizeToContents as some cells shouldn't be sized to their content in some context.
    • UNSOLVED Custom QCheckbox in QT widgets
      General and Desktop • stylesheet qtablewidget qtwidgets qcheckbox • • EagleSparrow  

      3
      0
      Votes
      3
      Posts
      45
      Views

      Here is the code. QList<SomeClass> ModeTableEntries ; for (int row = 0; row < ModeTableEntries .length(); row++) { ui->EntriesTableWidget->insertRow(row); ui->EntriesTableWidget->setRowHeight(row, 45); ModeValues value = ModeTableEntries [row]; QTableWidgetItem* currentItem = new QTableWidgetItem(value .ModeText); if(TestModeEnabled == true) currentItem->setCheckState(Qt::Checked); else currentItem->setCheckState(Qt::Unchecked); ui->EntriesTableWidget->setItem( row, 0, currentItem); currentItem->setFlags(currentItem->flags()^(Qt::ItemIsEditable )); } The problem is that I cannot style the default implementation of the QTableWidgetItem(QCheckbox) that is part of the QTableWidgetItem.
    • SOLVED What's the best way to use QTableWidgetItem(to don't waste space)
      General and Desktop • c++ qtablewidget for loop saving space • • Muhammad Mirab Br.  

      4
      0
      Votes
      4
      Posts
      37
      Views

      @Christian-Ehrlicher Alright, thanks!
    • SOLVED QTableWidget filling out whole QGroupBox
      General and Desktop • qwidget qtablewidget • • TUStudi  

      5
      0
      Votes
      5
      Posts
      52
      Views

      @mrjj That's it, thanks :)
    • UNSOLVED How to layout CChartViews in a table
      General and Desktop • qtablewidget qchart qchartview • • clayton_tx  

      2
      0
      Votes
      2
      Posts
      33
      Views

      Hi Well it could work but you will have the issue that a row can only be one height so if one big and the rest small, it will look odd. But if all chart will be ca same size yes it should work ok. Alternatively, you could tweak this https://doc.qt.io/qt-5/qtwidgets-layouts-flowlayout-example.html and put it into a QScrollArea. Add this to it https://wiki.qt.io/Widget-moveable-and-resizeable Tweak it a bit and it should allow for a group of chars in various sizes and scrollable.
    • UNSOLVED Deselection event for QTableWidgetItem
      General and Desktop • qtablewidget qtoolbar qtablewidgetit • • ArthurLodbrock  

      2
      0
      Votes
      2
      Posts
      31
      Views

      As I already wrote on SO use selectionChanged() / itemSelectionChanged() signals ... when nothing is selected, you can't deselect items so how do you want to achieve a deselect here?
    • SOLVED Hiding individual cells of QTableWidget
      General and Desktop • qtablewidget hide • • Muster Maxmann  

      6
      0
      Votes
      6
      Posts
      141
      Views

      Okay proxy and listView is what solved the problem for me, thanks @SGaist and @Christian-Ehrlicher. I made a QListView and filtered it with the input of a QLineEdit and a sortFilterProxy, then I toke the data of the sortFilter and inserted it into a QTableView and cleaned the presentation with a delegate up. It works fast and snappy with my 20 exmaple data, I just hope that it keeps working as good with my ~300 data, but to get to this tests I have to finish other parts of my project first. I call this solved for now :-)
    • SOLVED QTableWidget does not show values that come from a QMap
      General and Desktop • qtablewidget qmap • • SpaceToon  

      3
      0
      Votes
      3
      Posts
      58
      Views

      @SGaist Thank oyu, that worked!
    • UNSOLVED when i am trying to move table widget item its shaking all item??
      General and Desktop • qtablewidget drag and drop • • Himanshu charde  

      2
      0
      Votes
      2
      Posts
      37
      Views

      Hi, Can you explain what exactly you are trying to achieve ?
    • SOLVED QTableWidget's width behaves strangely when applying any CSS
      General and Desktop • qtablewidget css width • • SnuggleKat  

      6
      0
      Votes
      6
      Posts
      185
      Views

      @A-A-SEZEN said in QTableWidget's width behaves strangely when applying any CSS: Check QTableWidget font, before css and after. Just changed the font to Consolas. Anyways, adding ui->tableWidget_memory->horizontalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents); to my code solved this problem.
    • UNSOLVED QTableWidget See difference between 0 and NULL
      General and Desktop • qtablewidget • • hobbyProgrammer  

      7
      0
      Votes
      7
      Posts
      65
      Views

      @hobbyProgrammer After fetching data from database, https://doc.qt.io/qt-5/qvariant.html#isNull or (if you are SQL) https://doc.qt.io/qt-5/qsqlfield.html#isNull is the thing to test.
    • SOLVED Detecting sort completed on QTableWidget
      General and Desktop • qtablewidget qt 5 sort • • james b-s  

      7
      0
      Votes
      7
      Posts
      118
      Views

      Thanks that worked
    • UNSOLVED How to check circular references in qtablewidget cells?
      General and Desktop • qtablewidget • • y_belikov  

      2
      0
      Votes
      2
      Posts
      48
      Views

      @y_belikov Well, follow the references until you reach the first cell (then you have circular references) or last cell without references. For the first case you actually should see whether you visit one cell more than once.
    • UNSOLVED QTableWidget/QTableView "word wrap" behavior, but without words (no spaces)?
      General and Desktop • qtableview qtablewidget stretch wordwrap new line • • oblivioncth  

      1
      0
      Votes
      1
      Posts
      737
      Views

      No one has replied

    • UNSOLVED QTableWidget setCellWidget(QWidget*) Inconsistant Behavior with Cell Selection and Focus
      General and Desktop • qwidget qtablewidget qpushbutton • • Blanky  

      1
      0
      Votes
      1
      Posts
      549
      Views

      No one has replied

    • SOLVED Add Qlabel as item in QTableview
      General and Desktop • qtableview qtablewidget qlabel qstandarditem • • sayan275  

      3
      0
      Votes
      3
      Posts
      1162
      Views

      @SGaist said in Add Qlabel as item in QTableview: QStyledItemDelegate Ok..I'll try with that. from google search maybe this kind of output it will give, which maybe as our requirement. Else, I have some lengthy approach..implement custom label with mousepressevent handled which emits the object name and add these custom labels, 20 in HLayout and add hlayouts in a vlayout... Thanks!
    • UNSOLVED QTableWidget draw/Paint over widget in a cell ?
      General and Desktop • qwidget qtablewidget qpainter • • Dariusz  

      7
      0
      Votes
      7
      Posts
      1218
      Views

      You won't get a paint event at all during drag'n'drop I would guess since the cursor is not directly painted by Qt when I'm correct.
    • SOLVED QTableWidget - get column/row from under mouse ?
      General and Desktop • qtablewidget • • Dariusz  

      9
      0
      Votes
      9
      Posts
      1618
      Views

      Ok solved, Im gigantic NUB. I used itemAt instead of indexAt and took me a while to notice it... everything works! thanks!!!
    • UNSOLVED QTableWidgetItem set background color on click (over stylesheet )
      General and Desktop • stylesheet qtablewidget • • nevdokimof  

      15
      0
      Votes
      15
      Posts
      4682
      Views

      Delegate widget has to be used.
    • SOLVED Set QTableWidgetItem maximum displayed text length (truncate and add ellipsis if longer)
      General and Desktop • qtablewidget • • fugreh  

      3
      0
      Votes
      3
      Posts
      1308
      Views

      Thanks I ended up doing the simplest thing: QString descriptionText = QFontMetrics(table->font()).elidedText(m_description, Qt::ElideRight, uiSettings::descriptionTextWidth, 0); QTableWidgetItem *descriptionItem = new QTableWidgetItem(descriptionText); descriptionItem->setToolTip(m_description); table->setItem(r, 0, descriptionItem);
    • SOLVED QTableWidget: horizontal scroll bar not displayed
      General and Desktop • qtablewidget qt5.6.3 • • Alain38 0  

      2
      0
      Votes
      2
      Posts
      1440
      Views

      Forget my question. I have found the problem. It is not realted to QTableWidget. It just a problem with my QSS. In fact the scroll bar is present. But in "white on white"!
    • SOLVED Problem with delegates: repeated editing of same cell in QTableWidget has delay of ca 1 second
      General and Desktop • qtablewidget delegate slow delay editing • • linuxbastler  

      14
      0
      Votes
      14
      Posts
      2822
      Views

      ok, the template solution is also working here. Thanks a lot for your help!
    • SOLVED send Qtable widget selected items to list widget upon button click
      General and Desktop • qtcreator qtablewidget push button listwidget • • Kushan  

      8
      0
      Votes
      8
      Posts
      2788
      Views

      For future reference, this approach only works if you know in advance all the roles you will use. You can use KSelectionProxyModel instead if you need a proper general implementation
    • UNSOLVED Getting changed values of a QTablewidget into a QStringList
      General and Desktop • qtcreator qtablewidget item change • • Kushan  

      8
      0
      Votes
      8
      Posts
      3041
      Views

      This is strange. could you try if this snippet works for you? #include <QApplication> #include <QWidget> #include <QVBoxLayout> #include <QPushButton> #include <QTableWidget> #include <QLabel> int main(int argc, char *argv[]) { QApplication a(argc, argv); QWidget mainWid; QStringList changedValues; QVBoxLayout* mainLay=new QVBoxLayout(&mainWid); QTableWidget* tableWidget = new QTableWidget(&mainWid); QPushButton* button = new QPushButton(QStringLiteral("Display list"),&mainWid); QLabel* resultLabel = new QLabel(&mainWid); mainLay->addWidget(tableWidget); mainLay->addWidget(button ); mainLay->addWidget(resultLabel ); tableWidget->setColumnCount(1); tableWidget->setRowCount(5); for(int i=0;i<5;i++){ QTableWidgetItem* const newItem= new QTableWidgetItem; newItem->setData(Qt::EditRole,i); tableWidget->setItem(i,0,newItem); } QObject::connect(tableWidget,&QTableWidget::cellChanged,[&changedValues,tableWidget](int row, int column)->void{changedValues<<tableWidget->item(row,column)->text();}); QObject::connect(button ,&QPushButton::clicked,[&changedValues,resultLabel ]()->void{resultLabel->setText(changedValues.join(','));}); mainWid.show(); return a.exec(); }
    • UNSOLVED Changing a QTableWidget rows based on the changes made to another QTableWidget rows
      General and Desktop • qtcreator qtablewidget index change • • Kushan  

      5
      0
      Votes
      5
      Posts
      1279
      Views

      Then even easier to use 1 QSqlQueryModel or QSqlTableModel
    • UNSOLVED Reindexing items in Tablewidgets
      General and Desktop • qtcreator qtablewidget edit reindex • • Kushan  

      4
      0
      Votes
      4
      Posts
      900
      Views

      Sure you can, loop through the content of the left QTableWidget and update the content of the right table to match. But again, you seem to overcomplicate things.
    • SOLVED How to delete whole table in qtablewidget?
      General and Desktop • qtablewidget • • vasu_gupta  

      8
      0
      Votes
      8
      Posts
      8192
      Views

      @VRonin I love this. It helped a lot. Thanks.
    • UNSOLVED How to auto update table element with a structures element value??
      General and Desktop • qtablewidget • • vasu_gupta  

      2
      0
      Votes
      2
      Posts
      612
      Views

      Hi, How did you made your table ?
    • SOLVED "The program has unexpectedly finished unexpectedly" in qt c++
      General and Desktop • error qtablewidget item search • • Lasith  

      3
      0
      Votes
      3
      Posts
      1849
      Views

      @Lasith Instead of 100 use ui->tableWidget->rowCount().
    • SOLVED Receiving signal when pressing on QTableWidget header?
      General and Desktop • qtablewidget header signal • • koahnig  

      3
      0
      Votes
      3
      Posts
      1646
      Views

      @mrjj Thanks for your response. I have to admit that I figured that part already, but it looked a bit out of style for Qt. Therefore, I was not sure, if I simply overlooked a more obvious way. Sometimes one dos not recognize the forest, because of the wood the around ;) Finally the implementation looked less complicated than I thought initially. And it works.
    • UNSOLVED QAbstractTableModel hard to set up
      General and Desktop • qtableview qtablewidget model-view qabstracttablem qtablewidgetite • • moffa13  

      3
      0
      Votes
      3
      Posts
      1039
      Views

      In 90% of the cases you can use QStandardItemModel instead of going through the minefield that is subclassing an abstract model. My advice is just to use that "universal model" instead of a custom one. If you really, really want to customise it as performance of QStandardItemModel is a problem then make sure you run your model through the Model Test (needs just a couple of trivial fixes to work on Qt5) that will tell you if you did everything as you were supposed to or you fell in the countless pitfalls of model subclassing
    • UNSOLVED QTableWidget has the line -1?
      General and Desktop • qtablewidget index gettingcrazy • • LowEel  

      2
      0
      Votes
      2
      Posts
      618
      Views

      Hi and welcome to devnet, You're on the wrong column, it should be 0.
    • SOLVED Populate a QTableWidget with QTreeViews
      General and Desktop • qtablewidget qtreeview qvector setcellwidget • • Patou355  

      13
      0
      Votes
      13
      Posts
      2713
      Views

      Hello guys. Thanks for your answerS. The "error" was simple, stupid. In fact the _manageOrderedTable is an instance of a class called ManageOrderedTable which inherits from QTableWidget. In this class, there's a method called fillAll and I called setColumnCount() from there. Bad idea. When I call this method from upon the for loop, everything is fine. I don't understand why. I could understand if setColumnCount() were called too late, but in this case I should have a segfault, trying to call a cell that doesn't exist. Well, I don't really understand why but now it works... Tank you for your help, Patrick.
    • SOLVED How to increase QTableWidgetItem SIZE
      General and Desktop • qtablewidget qt 5.7 qtablewidgetite • • Swapnil_Shelke  

      5
      0
      Votes
      5
      Posts
      2442
      Views

      @Swapnil_Shelke Happy to see that it helped you, You are welcome =)
    • UNSOLVED Reading QTableView row contents with the same order as are seen NOT stored
      General and Desktop • qtableview qtablewidget drag&drop • • alizadeh91  

      9
      0
      Votes
      9
      Posts
      3465
      Views

      this should return the list of the row indexes as sorted in the view. Hidden rows will be placed at the beginning QList<int> viewIndexes(const QHeaderView* const view){ if(!view) return QList<int>(); const int numSections= view->count(); QMap<int,int> sorter; for(int i=0;i<numSections;++i) sorter.insert(view->sectionPosition(i),i); return sorter.values(); } or alternatively: QVector<int> viewIndexes(const QHeaderView* const view){ if(!view) return QVector<int>(); const int numSections=view->count(); QVector<int> result(numSections); for(int i=0;i<numSections;++i) result[i]=i; // Use stable_sort if you want the hidden sections still placed at the beginning but in the same order as the original model std::sort(result.begin(),result.end(),[view](int a,int b)->bool{return view->sectionPosition(a)<view->sectionPosition(b);}); return result; } You'll have to benchmark them to tell which is more efficient
    • UNSOLVED QTableWidget: Set specific row's color
      General and Desktop • qtableview qtablewidget delegate • • sunil.nair  

      10
      0
      Votes
      10
      Posts
      17779
      Views

      @VRonin hey it works. I created a separate qt project and it's working there. I will see if I am doing something wrong in my project. Actually the row to which I am trying to set a background color also has some color set to it in table widget stylesheet. Also tablewidget items also have a background color. I will check there. Thanks again.
    • SOLVED Signals for positions of widgets changed in QTableWidget
      General and Desktop • qtablewidget change in widge • • koahnig  

      8
      0
      Votes
      8
      Posts
      3023
      Views

      Thanks guys for your suggestions. Probably I am following the QHash implementation as next step. The proximity to maps make it easy.