Navigation

    Qt Forum

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

    • UNSOLVED Properly changing the displayed chart in a QChartView
      General and Desktop • qchart qchartview pointers • • BradDev20  

      4
      0
      Votes
      4
      Posts
      56
      Views

      Hi, Why not use QChartView::setChart ? What you currently do is just replacing the object pointed by ui->diceView by a different one, but that is all.
    • UNSOLVED What is the good way to work with pointers in Javascript/Qml?
      QML and Qt Quick • component pointers javascript qml object instance • • jeanmilost  

      2
      0
      Votes
      2
      Posts
      73
      Views

      Javascript abstracts the concept of pointers. Data is only ever passed around by reference. It is usually safer, since memory management is handled automatically and you can be sure an object equals another object if they are compared. If you need to compare objects to see if they are identical, you may have better luck creating a "compare" method that directly compares primitive attributes (strings can be compared directly, for instance). Hope this helps, sorry I can't provide a more specific implementation suggestion. Too many details to focus on at once.
    • UNSOLVED How to dynamically store address of a QVector in another QVector?
      General and Desktop • qvector pointers • • CJha  

      9
      0
      Votes
      9
      Posts
      200
      Views

      @Christian-Ehrlicher Thanks! That saves a lot of trouble for me :)
    • UNSOLVED Few questions about QThread worker-object model
      General and Desktop • qthread signal & slot pointers cleanup • • oblivioncth  

      1
      0
      Votes
      1
      Posts
      246
      Views

      No one has replied

    • SOLVED Store objects to file
      General and Desktop • qdatastream pointers store • • jsavin  

      12
      0
      Votes
      12
      Posts
      3210
      Views

      @raven-worx @mrjj @Wieland @Pablo-J-Rogina Thank you guys ! It worked perfectly. I'm now able to read and write a XML file and load items to my drawing. Thank you again Happy coding !
    • UNSOLVED Should I delete dynamic element or not in this code?
      General and Desktop • mainwindow pointers dynamic allocat dynamic delegat • • testerius  

      7
      0
      Votes
      7
      Posts
      1892
      Views

      Thanks guys for replies, generally my app isn't well designed because it's for education purpose. Anyway thank you very much.
    • SOLVED How to get a class pointer without messing up data.
      General and Desktop • class pointer inheritance pointers • • Basti46  

      4
      0
      Votes
      4
      Posts
      1125
      Views

      Hi Just a note first Having class SerialPort : public QObject and then QSerialPort *serialPort; Where only diffence is capital S to the main class is just confusing. anyway, why is the issue with settings(new SettingsDialog()), did you declare it as void settings(SettingsDialog *mydialog) Im not sure what you dont understand. To use a pointer to a class in another class, you simply give the pointer to the other class and it can use it class B {}; class A { B* mykeptBpointer; setB(B* myb) { mykeptBpointer = myb; } void DoB { mykeptBpointer->xxxx(); }; A mya; B* myb = new B; mya.setB(b); oh, is settings(new SettingsDialog()) rather settings = new SettingsDialog();
    • SOLVED C++11 standard and Qt5 default GUI
      General and Desktop • gui c++11 pointers smart pointers raw pointers • • alogim  

      11
      1
      Votes
      11
      Posts
      5320
      Views

      @alex_malyu The original post is some 2 months old. So I wrote a whole lot of a post in reply to the original question ... well didn't my ears burn, when I noticed the post time ... I felt like a complete idiot. :)
    • SOLVED Creating/deleting *QThread on the stack
      General and Desktop • qthread pointers stack • • reezeus  

      6
      0
      Votes
      6
      Posts
      1849
      Views

      @reezeus said: Is it a good practice to use QThreadPool even if I have only one thread? I've never used QThreadPool but I can imagine that it eases scaling if you do so... The day you want to increase the number of threads, simply have a bigger pool. On the other hand if you know that one thread is what you need and will continue to need, QThread seems more reasonable IMHO.
    • SOLVED double free or corruption (out):
      The Lounge • qt5.5 pointers • • ChajusSaib  

      5
      0
      Votes
      5
      Posts
      7237
      Views

      @SGaist Thank you mate, that clears it up a lot! EDIT: Is there a way for me to know when I should free something? Or will it just come by practice?
    • Need Help with QList !
      Qt in Education • qlist pointers objects eraseqlist • • Afterwork  

      7
      0
      Votes
      7
      Posts
      2781
      Views

      @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.
    • Pointers With Signals and Slots
      General and Desktop • layout signal slot pointers • • Bolt2strike  

      6
      0
      Votes
      6
      Posts
      1410
      Views

      Yes that was it. You slot looks good. For that second task you can use QSignalMapper)