Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.2k Topics 455.3k Posts
  • reading multiline value from database, then using the value in query

    Unsolved
    6
    0 Votes
    6 Posts
    436 Views
    SGaistS
    Hi, To add to @JonB, please give an example of text you are storing in your database and an example of search you are currently doing.
  • how to deal with numbers containing a comma?

    Unsolved
    9
    0 Votes
    9 Posts
    2k Views
    N
    @jsulm thnx for your reply. sorry, i meant the forum thread: link text
  • QSplitter - change grab region size or add a custom knob

    Unsolved
    6
    0 Votes
    6 Posts
    2k Views
    mrjjM
    @Doug-Wood Hi Sorry my bad. I miss the touch part. No hover in that use case. The issues is that the handle is a widget and its not possible to draw outside its area in any good way. However, i was wondering if an event filter could be used to look at mouseMove event and expand the "trigger" zone.
  • Qt 3D: How to draw a cube with 6 different textures on each face ?

    Unsolved
    1
    0 Votes
    1 Posts
    239 Views
    No one has replied
  • Get the MainWindow size

    Solved
    7
    0 Votes
    7 Posts
    4k Views
    SGaistS
    You're welcome ! Since you have it working now please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :-) Note that you can also mark an answer as the "thread correct answer" by using the three vertical dots on the right of each answer.
  • 0 Votes
    4 Posts
    388 Views
    GuerrianG
    @jsulm No, I'm not.
  • generalize a c++ method

    Solved
    34
    0 Votes
    34 Posts
    2k Views
    ODБOïO
    @jsulm finally it is this working thanks to you ! class MachineBackend : public QObject { typedef void (MachineBackend::*MethodPtr) (QOpcUa::NodeAttribute, const QVariant&); Q_OBJECT public: void uaSub2(QScopedPointer<QOpcUaNode>&node, QString nodeId, MethodPtr updateHandlerPtr){ QObject::connect(node.data(),&QOpcUaNode::attributeUpdated,this,updateHandlerPtr); } void nIndexUpdated(QOpcUa::NodeAttribute attr, const QVariant &value){ //return; // i can access member variables / signal / methods here } // use uaSub uaSub2(nIndexNode,"ns=4;s=MAIN.nIndex",&MachineBackend::nIndexUpdated); // }; thank you infinitely everybody who helped me
  • KDAB/KDSoap usage

    Solved
    5
    0 Votes
    5 Posts
    400 Views
    M
    Solved, more info on github in issue description. Best, Marek
  • Connect a gamepad in dirrect input mode

    Solved
    2
    0 Votes
    2 Posts
    247 Views
    B
    I have done it using SFML
  • help on signals and slots

    Solved
    10
    0 Votes
    10 Posts
    529 Views
    J.HilkJ
    @russjohn834 sure, but all information needed should actually be inside the wiki page @jsulm linked you connect(this, &MainOne::textToChange, ui->label_pid, &QLabel::setText);
  • run vs movetothread ? (thread)

    Solved
    9
    0 Votes
    9 Posts
    4k Views
    KroMignonK
    @mduzoylum said in run vs movetothread ? (thread): in jobs that need to run continuously in the background(Is the answer enough?) I apologies if my answer is hurting you, this was not my intention.English is not my first language (I am french), so my answer is perhaps rudder as that I want to say :( If you want to to work in background and continuously then create a worker class and assign it to a thread is, in my eyes, the right way as described in the link I give you in my previous message or those: http://blog.debao.me/2013/08/how-to-use-qthread-in-the-right-way-part-1/ https://www.toptal.com/qt/qt-multithreading-c-plus-plus If you just want to do a specific job in background and be informed when it is done, QtConcurrent::run() is what you need. This avoids you the create/destroy thread, you can simply call you function with specific parameters like this: auto resultFuture = QtConcurrent::run(worker, &WorkerKlass::calculate, listOfItems); Then you can use QFutureWatcher to be aware when calculate is finished and get the return value:
  • This topic is deleted!

    Unsolved
    1
    -1 Votes
    1 Posts
    8 Views
    No one has replied
  • loop over QLabel Attributes?

    Solved loop for attribute center
    6
    0 Votes
    6 Posts
    2k Views
    pauleddP
    Thanks a lot for your suggestions. I ended up doing it with the vectors because it was most elegant for my brain... *.h QVector<QLabel*> labels; *.cpp for(int i=0;i<24;i++){ labels.append(new QLabel(QString::number(23-i))); } for(int i=0;i<labels.size();i++){ labels[i].setAlignment(Qt::AlignCenter); } and then the same for the checkboxes. I guess the vector saved about 100 lines of code. Works like a charm :) [image: 5fabe5b1-7606-4c8c-a27a-26d179311380.png]
  • how to draw QGraphicsPolygonItem

    Solved
    14
    0 Votes
    14 Posts
    2k Views
    mrjjM
    @hobbyProgrammer Ok. Good. :) It was my only guess how on earth the points list could become empty. Sometimes Im a lucky guesser :)
  • connecting context menu won't work

    Unsolved
    11
    0 Votes
    11 Posts
    816 Views
    jsulmJ
    @hobbyProgrammer said in connecting context menu won't work: void alterRoom(QPolygonF room); it has a parameter which you did not mention in your connect() call. But since the triggered() signal does not provide such a parameter it will not works anyway. Do it with a lambda: QPolyF poly; connect(alterPoly, &QAction::triggered, [poly, this]() { alterPoly(poly); });
  • How to refresh data on horizontal header of QTableWidget?

    Solved
    28
    0 Votes
    28 Posts
    4k Views
    tovaxT
    Solved: Derived from QAbstractTableModel + QTableView Create two QTableView, one for cell's data, another for header data. Frozen the first row of the QTableView used for header data, and refresh data in it (100Hz). (Refer to official demo: Frozen Column Example)
  • how to convert QCharRef to hex, int, binary

    Solved
    14
    0 Votes
    14 Posts
    2k Views
    MijazM
    @J-Hilk Thank you very much. it works
  • How to toggle WindowCloseButton Hint off and on

    Unsolved
    7
    0 Votes
    7 Posts
    1k Views
    A
    @jsulm I am not sure whether I have fully understood your question but the toggle for enabling/disabling the dialog close button is handled and called within the dialog class.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • can i set value at model without using SetModelData()

    Unsolved setmodeldata qstyleditemdele
    4
    0 Votes
    4 Posts
    638 Views
    JonBJ
    @rahi444 I don't claim to understand why you want to do this. However, does the example (teh accepted solution to it) in, say, https://stackoverflow.com/questions/36778577/qstyleditemdelegate-how-to-make-checkbox-button-to-change-its-state-on-click give you what you need? It's using https://doc.qt.io/qt-5/qstyleditemdelegate.html#editorEvent to access the widget's state in an event. Seems a bit low-level to me, but maybe that's what you do....? Otherwise, I know the editor arranges to store the widget's value via editor widget's user property, see https://doc.qt.io/qt-5/qstyleditemdelegate.html#setModelData itself. Can you leverage that without actually calling setModelData()? Finally, https://doc.qt.io/qt-5/qstyleditemdelegate.html#createEditor returns the widget created for doing the editing. Can you put your own slots/call functions on that to recognise when it's edited and retrieve its value directly? If all else fails, what about looking at the source of the setModelData() method you do not want to use in page https://code.woboq.org/qt5/qtbase/src/widgets/itemviews/qstyleditemdelegate.cpp.html ? You can see there what it does (looks pretty simple), and decide what you want to do compared to that, since you don't want to call it yourself for whatever reason.