Skip to content
  • 0 Votes
    3 Posts
    520 Views
    jeanmilostJ

    Thank you very much for the tip, this looks good and is effectively the best option I know until now.

  • 0 Votes
    13 Posts
    840 Views
    jsulmJ

    @PMime Sounds like "describe" statement is what you need, see https://www.geeksforgeeks.org/sql-describe-statement/

  • 0 Votes
    2 Posts
    445 Views
    J.HilkJ

    @jeanmilost
    I can't answer all your questions, as I'm not an expert on Qt's Model/View system, what I do know is,

    that all models have a QAbstractItemModel as base model and that is also the ABI for all views.
    For that reason alone, you can assign all models to all views. You will however not get a useful representation of all your data in all views.

    As I understand it, and anyone fell me to correct me here, the other higher level classes of models are only there to make your life easier, as in you do not have to implement all functions/functionalities of the whole AbstractItemModel class

  • 0 Votes
    6 Posts
    719 Views
    AhtiA

    @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

  • 0 Votes
    6 Posts
    5k Views
    P

    After thinking about this problem more and looking at the interface for QAbstractProxyModel, I am beginning to think that a subclass of a proxy model is not the answer. I am wondering if the best course of action would be to create a new model which keeps a pointer to my base model. Every time the various data changed signals are emitted from the base model, my "proxy" model determines if a new sequence has been found. It then keeps track of all the various sequences in its own internal data structure which keeps QPersistenModelIndex indexes into the base model. Then my "proxy's" data() method would use these indexes to get the real data from the underlying model but parsed into the correct format.

    Do this sound like a better approach?

    In this case, I am also wondering how to display my data as a table where each row could have a different number of columns. Perhaps I could keep track of the row with the maximum number of columns and return this in columnCount()? Then my data() method would just return QVariant() for columns that don't exist in a given row.

  • 0 Votes
    9 Posts
    3k Views
    J.HilkJ

    @AloyseTech IIRC hidePop() will reset the Popupwidget, so maybe hijack the add/remove process.
    Call hidePopup before adding are removing item and call showPopup afterwards?

  • 0 Votes
    7 Posts
    2k Views
    VRoninV

    @Arthur-Araruna said in Replicate the contents of the current selected item in QTableView:

    both column and row indices

    All you need to do is replace currentRowChanged with currentIndexChanged

  • 0 Votes
    8 Posts
    3k Views
    mmikeinsantarosaM

    So it's built into the Qt base library then.

    I noticed also that any time the table gets clicked that method must get called again because I get another complete set of qDebug() messages. So paint() makes sense then as to why that happens.

    Thanks

  • 0 Votes
    8 Posts
    5k Views
    VRoninV

    @sm4ll-3gg said in How to resize QListView row to index widget size:

    what I should read to better understand Model / View / Delegate programming?

    Basically everything I know comes from Advanced Qt Prgramming: Creating Great Software with C++ and Qt4

    It is normal to set new delegate for each item if I need to show heterogeneous data in list?

    No. What I would do is create a QStackedWidget with the possible combinations, use that as base and display the correct page based on the data in the index

  • 0 Votes
    2 Posts
    991 Views
    Chris KawaC

    I'm doing something similar in sort of objects property tree. It works pretty well for large number of items. Definitely a massive win over a widget per item approach.
    One difference to your approach is that I don't use grab(), but instead have the editors created by the delegate a static drawing function that uses QStyle::drawControl and friends to draw an image of itself. This is because I don't want to instantiate all the editor widgets upfront to grab them (I have a bunch of them and it takes time). It's sort of a trade-off because it can get out of sync with the actual widget look. Whether this is something you'd be interested in or not is up to you, but the general idea of drawing an image is a valid one.

  • 0 Votes
    3 Posts
    1k Views
    L

    Interestingly, if I make the plugin static, it works fine. Only when the plugin is dynamic does this error happen... Very strange.

  • 0 Votes
    6 Posts
    2k Views
    M

    I have posted suggestion about adding such positioner to QtQuick:
    https://bugreports.qt.io/browse/QTBUG-57549

  • 0 Votes
    16 Posts
    7k Views
    ?

    Hi! Just to be sure I understood this correctly: You have a single DB with a humongous number of identically structured tables? Do you really believe you can store 2^128 bits / rows / tables / whatever in your database / filesystem / datacenter?

    In worst case I will have to keep in RAM about 4e+38 of 16 bytes pointers

    Even that is way more rows than what a SQLite table can hold (see: https://www.sqlite.org/limits.html).

  • 0 Votes
    6 Posts
    6k Views
    A

    @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.

  • 0 Votes
    0 Posts
    612 Views
    No one has replied
  • 0 Votes
    4 Posts
    6k Views
    p3c0P

    @Pheelbert Yes missed the mentioning of data() here.
    You're Welcome :-) Happy Coding.

  • 0 Votes
    2 Posts
    996 Views
    sierdzioS

    I think QAbstractItemModel and friends is a winner here. It contains a lot of optimized functions, that allow you to update single cells instead of invalidating the view, reconnecting the widgets, etc. It also allows you to leverage all the more advanced mechanisms like lazy initialization (canFetchMore() and fetchMore() methods).