Skip to content
  • 0 Votes
    15 Posts
    4k Views
    JonBJ

    @n-2204
    Please try to format your posts readably. For lines of code use the Code tag when posting, or but lines of 3-backticks above & below.

    You are also now asking this same question in a new thread you have created (https://forum.qt.io/topic/125774/qtableview-how-to-make-noneditable-column). You should stick to one thread, not create multiple ones.

    where i should give like it will be applicable for table1 or table2

    I don't know what you mean. To use the flags() approach you must sub-class QStandardItemModel, which I assume is what your GAS_tool is, else this will have no effect.

    If you want to use the setFlags() approach, you do not need to sub-class, but must set the flags explicitly on each item which is to be non-editable.

    I also wrote this in your other thread.

  • 0 Votes
    5 Posts
    1k Views
    A

    @SGaist
    thank you SGaist for your kind replay
    honestly all the tense & anxiety & obsecurity is gone thanks to matthew & you
    i know now what to focus on & what's the matter with Qt
    Qt is uses RAW C++ codes & don't hide any mechanism from the user
    hence they required you to communicate with it in RAW format codes
    it's really helpful to talk with experts ^_^

  • 0 Votes
    25 Posts
    7k Views
    McLionM

    Got it solved :-)

    QWebFrame * webGUIframe = qobject_cast<QWebFrame >(sender());
    QWebView * webGUI = (QWebView)(webGUIframe->parent())->parent();
    webGUI->page()->mainFrame()->addToJavaScriptWindowObject("NativeBridge", this);

  • 0 Votes
    1 Posts
    793 Views
    No one has replied
  • 0 Votes
    3 Posts
    2k Views
    oblivioncthO

    @JohanSolo

    Ah ok, so it is due to the organization of C++ not Qt, and like you said, the difference of a class instances and pointers.

    It has been long time since I've had to use C++ and I never did anything too advance with it other than a text-based adventure game. I generally am more focused on hardware oriented programing such as with C and Verilog, and MATLAB is the only more software (excluding Arduino interaction) oriented language I have decent experience with.

    Thank you for pointing out why there needs to be a difference. I wasn't familar with pointer usage in C++.

  • 0 Votes
    8 Posts
    4k Views
    C

    @SGaist
    Thanks,

    I looked into QSignalMapper, but it seems to have limitations, for example you can only pass one parameter and you can really just map one slot/signal.

    I could probably make it work by passing a structure (and register that with the meta compiler), and then use multiple QSignalMappers... but, at least for my case, I find that creating my own object to be much simpler both to implement and to read.

  • 0 Votes
    16 Posts
    12k Views
    T

    My apologies, I will create a new thread. Thanks for all your help! (and putting up with my stuff :) )

  • 0 Votes
    3 Posts
    2k Views
    J

    @juanki Gracias por tu respuesta, voy a estudiar la propuesta. Hace mil que no uso las clases abstractas y aun más el polimorfismo, me va a tocar quitarle el polvo a los apuntes de la universidad...

    ¿Tenéis más propuestas?

  • 0 Votes
    7 Posts
    3k Views
    Chris KawaC

    @Afterwork said:

    I recreate them every time. Are there better way ?

    If they change then there's no way around it but if they're the same every frame then it's a waste of time. Generate the list once, store it as a class member and just expose them by reference e.g.

    //split that to .h and .cpp of course class GameWidget : public QWidget { Q_OBJECT public: GameWidget(QWidget* parent = nullptr) : QWidget(parent) { generateMyListOfObjects(); } const QVector<Object>& objects() const { return objects_; } private: void generateMyListOfObjects() { //fill the objects vector here } QVector<Object> objects_; };

    And how i can connect the slot of differents objects to built-in timer of QWidget ?

    You don't. As I said - reimplement the timerEvent method. It will be called every time the timer times out. You can call some methods directly in it or emit a custom signal if you'd like.