Results 1 to 20 of 20

Thread: Has anyone done dynamic column spanning with a QTableWidget?

  1. #1
    Join Date
    Nov 2008
    Posts
    183
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Has anyone done dynamic column spanning with a QTableWidget?

    I need to use QTableWidget to create what us old timers call a control break report. Yes, it has to be a table, not just a text thing or a list. There are other things we wish to be able to do and columns are a nice way of getting alignment across languages and fonts. The database has millions of rows and we will only display 30 or so at a time for obvious reasons. Since many of you reading this may be kids who never had a report writing or logic course I will try to draw it a bit here.


    some-long-multi-cell-here-which-repeats-occasionally
    xxxx xxxx xxxx xxxx xxxx xxxx xxxx
    xxxx xxxx xxxx xxxx
    xxxx xxxx xxxx xxxx
    xxxx xxxx xxxx xxxx xxxx xxxx
    xxxx xxxx xxxx xxxx
    xxxx xxxx xxxx xxxx xxxx xxxx xxxx

    I don't believe the empty cells will be a problem given a custom model. I'm trying to avoid having to do a custom item delegate just to get that dynamic cell spanning though. Any ideas?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Has anyone done dynamic column spanning with a QTableWidget?

    If you're using a custom model, then you want QTableView, not QTableWidget, no?

    Could you not reimplement QAbstractItemModel::span() to do this? (Duh, I should RTFM - "Note: Currently, span is not used." That's exactly what you need).

    What you're asking for sort of breaks the model / view separation. I think you might be able to accomplish what you want by implementing a signal in a custom model that is emitted whenever the Qt::DisplayRole is requested for one of these header row indexes in the QAbstractTableModel::data() method. The widget that contains your QTableView could listen for this signal and set the column span appropriately.

    Something like:

    Qt Code:
    1. QVariant MyCustomModel::data( const QModelIndex & index, int role )
    2. {
    3. if ( Qt::DisplayRole == role )
    4. {
    5. v = "whatever";
    6. if ( indexIsAHeaderRow( index ) )
    7. emit setColumnSpanForHeaderRow( index.row(), index.column() );
    8. }
    9. return v;
    10. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Nov 2008
    Posts
    183
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Has anyone done dynamic column spanning with a QTableWidget?

    Quote Originally Posted by d_stranz View Post
    If you're using a custom model, then you want QTableView, not QTableWidget, no?

    Could you not reimplement QAbstractItemModel::span() to do this? (Duh, I should RTFM - "Note: Currently, span is not used." That's exactly what you need).

    What you're asking for sort of breaks the model / view separation. I think you might be able to accomplish what you want by implementing a signal in a custom model that is emitted whenever the Qt::DisplayRole is requested for one of these header row indexes in the QAbstractTableModel::data() method. The widget that contains your QTableView could listen for this signal and set the column span appropriately.

    Something like:

    Qt Code:
    1. QVariant MyCustomModel::data( const QModelIndex & index, int role )
    2. {
    3. if ( Qt::DisplayRole == role )
    4. {
    5. v = "whatever";
    6. if ( indexIsAHeaderRow( index ) )
    7. emit setColumnSpanForHeaderRow( index.row(), index.column() );
    8. }
    9. return v;
    10. }
    To copy to clipboard, switch view to plain text mode 

    Thanks. I will give it a whirl. Yes, I meant View. Shouldn't type posts first thing Sunday morning I guess.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Has anyone done dynamic column spanning with a QTableWidget?

    In my opinion the proper way to solve the problem is to implement a custom view based on QTableView. Could be that it is enough to just reimplement visualRect() so that it takes into consideration "dynamic spanning" needs of the model.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Has anyone done dynamic column spanning with a QTableWidget?

    Hmm, might work. I suppose it depends on whether the table draws the grid lines before or after the cell contents, and if the grid is drawn first, on whether the painting clears the visual rect before painting it with its contents. This would be a good excuse to implement the span() method in the model.

    Documentation of QTableView::visualRect() seems to be missing from the Qt 5.2 docs, even though as a pure virtual method in QAbstractItemView it has to be implemented in QTableView.
    Last edited by d_stranz; 20th October 2014 at 21:50.

  6. #6
    Join Date
    Sep 2014
    Posts
    27
    Thanks
    2
    Thanked 2 Times in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Has anyone done dynamic column spanning with a QTableWidget?

    I was able to accomplish this in 2 parts.
    First, I implemented span() for my model, which would look something like this:
    Qt Code:
    1. QSize MyModel::span(QModelIndex index) {
    2. if(isSpanningColumn(index)) {
    3. return QSize(spanAmount, 1);
    4. }
    5. return QSize(1, 1);
    6. }
    To copy to clipboard, switch view to plain text mode 

    Then I reimplemented the setModel() method in my view:
    Qt Code:
    1. void MyTableView::setModel(QAbstractItemModel* model){
    2. QTableView::setModel(model);
    3. for(int col = 0; col < model->columnCount(); col++){
    4. for (int row = 0; row < model->rowCount(); row++){
    5. QSize span = model->span(model->index(row, col));
    6. if(span != QSize(1,1)) //Preform this check so you don't get a bunch of warnings about setting a span of 1 being ignored
    7. setSpan(row, col, span.height(), span.width());
    8. }
    9. }
    10. }
    To copy to clipboard, switch view to plain text mode 

    I hope that helps

  7. #7
    Join Date
    Nov 2008
    Posts
    183
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default SOLVED: Has anyone done dynamic column spanning with a QTableWidget?

    Thanks to all who replied. I ended up using the solution provided by d_stranz today. Here is a side note though. I found this out completely by accident since I put a debug print in the slot.

    The view/model in Qt 4.8.x (and probably 5.x as well) is a vicious CPU squanderer. When I was poking through the doc I wondered why there were no signals going from the model which could be caught by the view indicating cell(x,y) had changed. In part I guess this was due to my confusion about the infintesimally small lifespan of QModelIndex. After stumbling on this with my slot I put a debug print in ::data() of the model to verify.

    The reason we have no signals for data changes is because the view goes into an infinite loop of fetching data from the model for all visible cells. This seems to be SO not Qt. The model should have signal(s) which get emitted when data has changed and the view using the model should catch those. If you pull up something static, such as an XML or spreadsheet file, or a periscope over a section of database tables, the displayed data will not change, but the view will sit there sucking the battery life out of every device.

    Now I need to figure out how to mark this as solved.

    Thanks again.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: SOLVED: Has anyone done dynamic column spanning with a QTableWidget?

    Quote Originally Posted by RolandHughes View Post
    The reason we have no signals for data changes (...)
    We don't? What is QAbstractItemModel::dataChanged() then?

    (...) because the view goes into an infinite loop of fetching data from the model for all visible cells.
    Infinite loop? Have you verified properly that what you say was true? I'm sure it is not for a regular table with a regular delegate and a regular model. If you get such behavior then you probably introduced the loop yourself.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Nov 2008
    Posts
    183
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Has anyone done dynamic column spanning with a QTableWidget?

    I emailed several others and they conducted their own tests with their own code and got the same results. We didn't share any code. Just be sure to use the tableview with the abstract table model when you conduct your test.

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Has anyone done dynamic column spanning with a QTableWidget?

    Quote Originally Posted by RolandHughes View Post
    I emailed several others and they conducted their own tests with their own code and got the same results. We didn't share any code.
    Well, apparently you all got wrong results.

    Qt Code:
    1. #include <QtGui>
    2.  
    3. class Model : public QAbstractTableModel {
    4. public:
    5. Model() {}
    6. int rowCount(const QModelIndex &parent = QModelIndex()) const {
    7. if(parent.isValid()) return 0;
    8. return 1;
    9. }
    10. int columnCount(const QModelIndex &parent = QModelIndex()) const { return 1; }
    11.  
    12. QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const {
    13. Q_UNUSED(index);
    14. if(role != Qt::DisplayRole) return QVariant();
    15. qDebug() << Q_FUNC_INFO;
    16. return "A";
    17. }
    18. };
    19.  
    20. int main(int argc, char **argv) {
    21. QApplication app(argc, argv);
    22. Model model;
    23. QTableView view;
    24. view.setModel(&model);
    25. view.show();
    26. return app.exec();
    27. }
    To copy to clipboard, switch view to plain text mode 

    This test application clearly indicates there is no loop. If you want you can even disrupt the dataChanged() signal connection, modify the model and see that the view doesn't update until something else forces the view to ask explicitly for the item data.

    I do agree though that the default table view and the default delegate read the model data more than one time. This is probably related to auto-sizing columns and rows but this is only my guess.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    Nov 2008
    Posts
    183
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Has anyone done dynamic column spanning with a QTableWidget?

    I don't have time to set up the test right now, perhaps this weekend, if I don't have to work this weekend. The test you used is invalid or, as they like to call it at one of my client sites "happy path". Our tests did use UI files to control the visible number of rows. (My "test" is embedded in NDA covered code for client, so I have to create one from scratch for here.)

    Our models had 50-80 rows which contained 16 to 20 columns each (some hidden) which had things like timestamps, names, etc. Doesn't matter quite so much what it is as long as the text for a good number of cells in any given column is not even close to width of others. Think of things like "Jim" follwed some rows down by "Christopher", etc.

    Once the model was loaded the last step was:

    resizeColumnsToContents();
    resizeRowsToContents();

    As you eluded to in your response, it appears to be where the gopher went down the mountain.

    I do not know for certain the loop was "infinite". I killed it after 1 minute. It is not a lock-the-machine-max-the-processor loop either. I was able to navigate around and do things with the application while my application output window spewed at high volume. It sounds like there is a deadly embrace if you call both resize methods. I'm guessing it has to do with word wrap. Column resize forcing a wrap and row resize forcing a column width change to get rid of the wrap, neither happy with the results of the other and both insisting they are correct.


    Added after 4 minutes:


    Oh, one last thing which may or may not have contributed. "Some" of the data rows had column spanning dynamically turned on.

    At any rate, the initial question about dynamic column spanning was answered. When I have time to dig into the infinite loop issue I will put together something which triggers it. I know what all of the conditions were at the time, I just don't know what the guilty condition(s) is(were)
    Last edited by RolandHughes; 27th October 2014 at 23:14.

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Has anyone done dynamic column spanning with a QTableWidget?

    There is no loop, be in finite or infinite. You claim the table loops over the model and reads the data constantly which is clearly not what is happening which is what my simple example shows regardless if someone calls it a happy or a sad path. This is simply not how the model view architecture in Qt works. And it will not magically start working this way even if you enable column spanning. The view/delegate will be reading data from the model while you keep moving the mouse over table contents which is what you maybe interpreted as "infinite loop". This is however caused by your action of moving the mouse and not by the view itself. Your investigation regarding column and row auto-sizing is a dead-end again, calling those methods will cause the view to iterate over all the data in the model (twice) but it will not cause a loop and these two calls will not interfere each other, both are single-shot operations.

    If you want to know how the architecture works, take a look at signals exposed by QAbstractItemModel. The view connects to them to do its job. I think it will be a better use of your time than chasing infinite loops
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  13. #13
    Join Date
    Nov 2008
    Posts
    183
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Has anyone done dynamic column spanning with a QTableWidget?

    Quote Originally Posted by wysota View Post
    There is no loop, be in finite or infinite. You claim the table loops over the model and reads the data constantly which is clearly not what is happening which is what my simple example shows regardless if someone calls it a happy or a sad path. This is simply not how the model view architecture in Qt works. And it will not magically start working this way even if you enable column spanning. The view/delegate will be reading data from the model while you keep moving the mouse over table contents which is what you maybe interpreted as "infinite loop". This is however caused by your action of moving the mouse and not by the view itself. Your investigation regarding column and row auto-sizing is a dead-end again, calling those methods will cause the view to iterate over all the data in the model (twice) but it will not cause a loop and these two calls will not interfere each other, both are single-shot operations.

    If you want to know how the architecture works, take a look at signals exposed by QAbstractItemModel. The view connects to them to do its job. I think it will be a better use of your time than chasing infinite loops
    Well, rather than rely on a happy path, the documentation, or people's thinking, I burned my one day off this month to hack out a stand alone example.


    I attached a zip file to this. Hopefully it will survive. I don't want to paste all of that stuff into a message.

    In the source file mainwindow.cpp comment out the connect() statement at line 13 to make the problem go away and uncomment to make problem appear.

    I'm on Mint 14 32-bit with qt-everywhere 4.8.x built from source just in case this problem is platform specific.

    Turning column spanning on in just one row which is physically displayed triggers the loop. Scroll the table down so the row with column spanning is not visible and the table behaves as it should.

    I believe this to be a vicious CPU churning battery draining bug. I would appreciate someone using 5.x verifying the problem still exists. If so then I need to file a bug report. Having a single visible row with column spanning should not cause this issue.
    Attached Files Attached Files

  14. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Has anyone done dynamic column spanning with a QTableWidget?

    What exactly are you trying to prove? That emitting a signal which redraws the view every time you read data from the model causes an infinite loop? Your code is obviously bugged so please fix it first before you start accusing others.

    For reference, the related code:
    Qt Code:
    1. QVariant TableDataModel::data(const QModelIndex &index, int role) const
    2. {
    3. // ...
    4. CellData cell = m_rows.value( index.row()).value( index.column());
    5.  
    6. if (m_headerColumns[ index.column()] == ENU_HEADER_COLUMN_BATCH)
    7. {
    8. if (cell.data( Qt::DisplayRole).toString().trimmed() > 0)
    9. {
    10. // had to cast away const to get rid of compiler error
    11. //
    12. emit const_cast<TableDataModel*>(this)->setColumnSpanForHeaderRole( index.row(), index.column());
    13. }
    14. }
    15.  
    16. return cell.data( role);
    17. }
    To copy to clipboard, switch view to plain text mode 

    The signal emitted is connected to setSpan() slot of the view which schedules update() for the part of the view where the span occurs, forming a loop if the span is visible.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  15. #15
    Join Date
    Nov 2008
    Posts
    183
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Has anyone done dynamic column spanning with a QTableWidget?

    Quote Originally Posted by wysota View Post
    What exactly are you trying to prove? That emitting a signal which redraws the view every time you read data from the model causes an infinite loop? Your code is obviously bugged so please fix it first before you start accusing others.

    For reference, the related code:
    Qt Code:
    1. QVariant TableDataModel::data(const QModelIndex &index, int role) const
    2. {
    3. // ...
    4. CellData cell = m_rows.value( index.row()).value( index.column());
    5.  
    6. if (m_headerColumns[ index.column()] == ENU_HEADER_COLUMN_BATCH)
    7. {
    8. if (cell.data( Qt::DisplayRole).toString().trimmed() > 0)
    9. {
    10. // had to cast away const to get rid of compiler error
    11. //
    12. emit const_cast<TableDataModel*>(this)->setColumnSpanForHeaderRole( index.row(), index.column());
    13. }
    14. }
    15.  
    16. return cell.data( role);
    17. }
    To copy to clipboard, switch view to plain text mode 

    The signal emitted is connected to setSpan() slot of the view which schedules update() for the part of the view where the span occurs, forming a loop if the span is visible.

    And setSpan() should never ever cause a loop. Calling setSpan() which already has a matching span set should have no impact. That would be consistent with Qt architecture as it applies to update and paint events. It's a bug, and a quiet bug. One which is difficult to spot if the processor has enough speed. The table/app won't be sluggish but the battery life circles the drain.

  16. #16
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Has anyone done dynamic column spanning with a QTableWidget?

    Quote Originally Posted by RolandHughes View Post
    And setSpan() should never ever cause a loop. Calling setSpan() which already has a matching span set should have no impact. That would be consistent with Qt architecture as it applies to update and paint events. It's a bug, and a quiet bug.
    No comment. There would be no loop if someone didn't try setting a new span from a const method for reading model data.

    One which is difficult to spot if the processor has enough speed.
    I spotted the bug in your code in about 30 seconds without even compiling your example.

    Based on your recent posts I can see that you are trying your best to do everything the wrong way without relying on "happy paths" or the docs (not speaking of people who spend years using the framework almost every day) but it would really be easier for you to first read and understand the architecture if you have to do anything complex with it instead of blindly interpreting some bits and pieces of information you gather here and there. Just acknowledge that whatever you are trying to do here, you are doing it the wrong way. If you want content of one cell to overflow to the next one then the model has nothing to do with it, it is clearly the responsibility of the view and you can probably easily implement it either with a custom delegate and/or with a view subclass that reimplements visualRect().
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  17. #17
    Join Date
    Nov 2008
    Posts
    183
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Has anyone done dynamic column spanning with a QTableWidget?

    Quote Originally Posted by wysota View Post
    No comment. There would be no loop if someone didn't try setting a new span from a const method for reading model data.


    I spotted the bug in your code in about 30 seconds without even compiling your example.

    Based on your recent posts I can see that you are trying your best to do everything the wrong way without relying on "happy paths" or the docs (not speaking of people who spend years using the framework almost every day) but it would really be easier for you to first read and understand the architecture if you have to do anything complex with it instead of blindly interpreting some bits and pieces of information you gather here and there. Just acknowledge that whatever you are trying to do here, you are doing it the wrong way. If you want content of one cell to overflow to the next one then the model has nothing to do with it, it is clearly the responsibility of the view and you can probably easily implement it either with a custom delegate and/or with a view subclass that reimplements visualRect().
    Feel free to call it a bug in my code all you want, it's not, but if it makes you feel better, fine. Calling it that doesn't change the fact setSpan() is blindly performing an update when it has done no work. Saying setSpan() should operate in such a manner is basically the same as saying Qt should execute 100 repaints of an image which has not changed or been hidden simply because there are 100 paint events in the queue. What it is supposed to do is the sum of the work, not the totality of it. setSpan() is not checking the cell to see if there is anything to be done which is exponentially cheaper than forcing an update where none is needed.

    Thank you for your time.

    Oh, BTW, I don't claim to know everything, but I've been at this software stuff quite a while.

    look at the second entry in the list
    http://www.drdobbs.com/tools/develop...2500396?pgno=6

    http://theminimumyouneedtoknow.com/

    http://books.google.com/books?id=cdx...2-39-5&f=false

    http://books.google.com/books?id=4vu...2-41-7&f=false

  18. #18
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Has anyone done dynamic column spanning with a QTableWidget?

    Quote Originally Posted by RolandHughes View Post
    Feel free to call it a bug in my code all you want, it's not,
    I don't really see the point of continuing this discussion. Qt's original code works. Once you add your code to it, your program breaks. Period. You took a wrong approach -- that's fine, we all make mistakes. But then you push forward with your wrong approach and when you are faced with facts that your claims were incorrect, you neglect that and force your broken code to be correct. First you claimed there were no signals in the model notifying about data changes (post #7), so you were shown the dataChanged() signal (post #8). You also said the view had an infinite loop making calls to all visible cells (again post #7) which I proved to be untrue (post #10). Then you were kind enough to say my example was invalid (#11) because it was some "happy path" (is that a term from the industry?) but at the same time you provided no arguments to back your claims. In post #13 you finally showed some code of yours and it took me two key-presses and one mouse-wheel scroll to find the loop in your code which had nothing to do with your earlier conclusions but rather with a pesky idea of tightly coupling the view with the model (which you are also trying to do in your other thread on model-view) though an even more pesky const_cast, claiming this time it was setSpan's fault. Then your ego came in bashing through the door growling that someone dared to doubt your programming skills (while nobody did as we don't know you). You are acting like a regular forum troll so stop doing that, please.

    Even if setSpan() prevented an update in this particular situation, it would not make your code any less incorrect than it currently is.

    Oh, BTW, I don't claim to know everything, but I've been at this software stuff quite a while.
    I don't see where you are going. None of the links refer to Qt's model-view architecture you seem to have trouble grasping. And I'm assuming none of the links suggest that doing const_casts in const methods to make a call which modifies the object are proper solutions to any problem.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  19. #19
    Join Date
    Nov 2008
    Posts
    183
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Has anyone done dynamic column spanning with a QTableWidget?

    Quote Originally Posted by wysota View Post
    I don't really see the point of continuing this discussion.
    And thanks for not continuing it <Grin>

    Quote Originally Posted by wysota View Post
    Qt's original code works.
    It functions in a manner not conducive to a long battery life.

    Quote Originally Posted by wysota View Post
    Once you add your code to it, your program breaks.
    Once we left the happy path the inefficiency was exposed.

    Quote Originally Posted by wysota View Post
    because it was some "happy path" (is that a term from the industry?)
    It has been rather common in the medical device field: No hardware error, no human error, no device stress and no potential for patient harm/adverse outcome. It also seems to be used in other fields. The Software Engineering Institue as documentation on it.

    http://www.sei.cmu.edu/library/assets/happy.pdf

    Quote Originally Posted by wysota View Post
    I don't see where you are going.
    That really says it all. Thank you for your time. This conversation is over.

  20. #20
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Has anyone done dynamic column spanning with a QTableWidget?

    Quote Originally Posted by RolandHughes View Post
    That really says it all. Thank you for your time. This conversation is over.
    Good. Now go fix your code
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QTableWidget : dynamic colomn size
    By ArnaudC in forum Qt Programming
    Replies: 0
    Last Post: 11th September 2013, 15:44
  2. Dynamic sorting using proper column after adding a row.
    By kremuwa in forum Qt Programming
    Replies: 1
    Last Post: 29th September 2010, 00:50
  3. Dynamic Sizing of QTableView Column Widths
    By tntcoda in forum Qt Programming
    Replies: 1
    Last Post: 17th June 2009, 19:30
  4. spanning in QTableWidget acting weird
    By ferrari in forum Qt Programming
    Replies: 0
    Last Post: 15th October 2008, 12:31
  5. Replies: 6
    Last Post: 5th March 2006, 22:05

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.