Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • Logging messages: qlogging.h

    Unsolved
    11
    0 Votes
    11 Posts
    1k Views
    Christian EhrlicherC
    No, as long as you add a proper mutex.
  • QtConcurrent vs QThreadPool vs QThread. Which to use?

    Unsolved
    7
    0 Votes
    7 Posts
    6k Views
    S
    I believe that all three possibilities have different use cases. QtConcurrent and QThreadPool are more task-based whereas QThread is, well, a thread. QtConcurrent provides easy access to put single functions into a multithreaded environment. I think it even uses a thread pool in the background. QtConcurrent is especially helpful in the context of the map and reduce operations. With QtConcurrent::run() the idea is just asynchronous execution. If you have short tasks you can use QtConcurrent. The QThreadPool has two advantages over plain old threads: First, you don't have the thread creation cost if you spawn many short lived threads. And second, it helps avoiding oversubscription of CPU cores. In that sense its use is similar to QtConcurrent::run(): it is best utilized for short lived tasks. If you want to a have a thread permanently running, QThread is your only reasonable choice. My preference is to use the default implementation of a thread and have it run the event queue. Then, I can use QMetaObject::invokeMethod with the thread as its first parameter to queue some work into that thread. That all said: You should think twice if you really want to go down this route. First of all, it is a hassle to manage the GUI correctly from a separate thread as all GUI calls need to be inside the GUI thread. If you don't have a performance problem with your software, don't use additional threads. It has a non-negligible performance overhead. This is fact might introduce performance problems on its own. Furthermore, multithreading is prone to additional errors and bugs. This last argument is why you should avoid threads if they are not necessary for your performance.
  • QTcpSocket state always connected

    Unsolved qtcpsocket client
    23
    0 Votes
    23 Posts
    19k Views
    PangolinP
    @puzzled_giraffe QTcpsocket have not got "connectState" setup? I think qt use long tcp connection by default.
  • Problem in Moving Folder in Qt

    Unsolved
    10
    0 Votes
    10 Posts
    2k Views
    Christian EhrlicherC
    @saeid0034 So did you actually tried something out?
  • Weird behavior of QProcess and multiple qoutes

    Moved Solved
    36
    0 Votes
    36 Posts
    7k Views
    G
    @Christian-Ehrlicher thank you very much , arguments << "-i" << "wlan0" << "set_network" << "0"<< "ssid" << """ + strSSID + """; works. sorry for my poor understanding.
  • send message with Peak can bus

    Unsolved can bus
    11
    0 Votes
    11 Posts
    2k Views
    R
    Thanks Pablo, with "CAN Bus example" it works. Now I have to understand why my code doesn't work
  • QSQLDriver and Microsoft Access: Crash on insert statement?

    Unsolved
    4
    0 Votes
    4 Posts
    335 Views
    JonBJ
    @MGirgis Show code --- we still don't know for example where you declared query, m_db looks like a member variable, yet DBAccess::m_db looks static. Better still, run this code under debugger. Look at the stack trace at the exception. I don't know which "that line" is among the lines you have. Having said that, I know nothing about QSQLDriver and Microsoft Access.
  • 0 Votes
    4 Posts
    831 Views
    CyJoeC
    Hey @SGaist, Thanks for responding. I searched for a bit in the bug report system. I didn't find anything with the GLDEBUGPROC in it and searched for "OpenGL" and started going back through time looking at individual issues and didn't see anything into 2018. It is very possible Apple removed something, but this didn't occur to me because of an update from Apple, but an update in a dependency. For me, this is related to a dependency that uses OpenGL. I am linking my application against this dependency that is built as a framework. If I build the dependency using OpenGL 1, the application builds, links, and runs fine. If I update that dependency to use OpenGL 3, this error gets thrown. If I swap it back out for the old version and hit build, it works again. In trying to look through the source code. It looks like this might get triggered in "qopenglversionfunctions.cpp" when it checks #if !defined(QT_OPENGL_ES_2) and it looks like it starts defining those functions at that point. I'm not entirely sure. I'm assuming there is something in my dependency's header files getting defined that Qt is picking up and using. Need to try tracking that down.
  • how to represent contents of Qvector

    Unsolved
    8
    0 Votes
    8 Posts
    761 Views
    J
    Thanks everyone. I will read up on the examples that you have listed and see what I can come up with. No doubt I will be back when I get stuck :)
  • Error while building/deploying project in step "Make"

    Solved
    6
    0 Votes
    6 Posts
    1k Views
    Pablo J. RoginaP
    @Robbie9499 said in Error while building/deploying project in step "Make": tesseract you may want to check this question about Tesseract, Qt & MinGW
  • Using QSettings with data stored in a QByteArray, or QIODevice

    Unsolved
    9
    0 Votes
    9 Posts
    1k Views
    Guy GizmoG
    Just a quick follow-up: I ended up using QAbstractFileEngine to solve this anyway, even though it's private in Qt 5.15. If it ever is removed or otherwise stops becoming a viable method, I'll update my code accordingly. That said, if anyone can suggest another viable method that doesn't rely on writing the data out to a temporary file, I'd love to hear it!
  • Checking if application is still live?

    Solved
    6
    0 Votes
    6 Posts
    474 Views
    JonBJ
    @SPlatten said in Checking if application is still live?: When the main application is terminated I want the child modules to terminate themselves For the record, that's exactly what QProcess::start() will cause. In a robust fashion, if they don't acknowledge. If that's all you want the heartbeat for.
  • "Undefined reference" if MinGW/Linux, MSVS works. Subdirs project.

    Solved
    7
    0 Votes
    7 Posts
    603 Views
    S
    @KroMignon oh, so that's probably it, I didn't know that.
  • Adding data throught QIdentityModel to QSqlTableModel fails

    Solved
    10
    0 Votes
    10 Posts
    833 Views
    S
    @JonB Yes following your explanation with the EditStrategy on inserting new rows the only way to get it to work I guess is to manually call submit on insert. Like I already do now. Good thing is if is not a SQLTableModel the submit will not be called since the qobject_cast fails.
  • 0 Votes
    8 Posts
    3k Views
    S
    @Christian-Ehrlicher You were correct. I could have sworn I set the project up to compile with MinGW but I must have misclicked or some checkmark must have been autofilled on a different compiler. I checked the compiler output today and it clearly states msvc2019_64. Deploying with windeployqt.exe from the \Qt\5.15.1\msvc2019_64\bin folder worked perfectly. This was a good learning exercise. Thank you @JKSH and @Christian-Ehrlicher for the help!
  • QTableWidget fails to display column/row content correctly after MainWindow resize

    Solved
    4
    0 Votes
    4 Posts
    203 Views
    Christian EhrlicherC
    @Simula Then please mark the topic as solved :)
  • MFC CWnd as child window of QWidget

    Unsolved
    3
    0 Votes
    3 Posts
    442 Views
    PerdrixP
    I mean having MFC windows inside a widget. So I might have a layout (e.g. a grid) that has both Widgets and MFC windows in it. D.
  • Button not aligned to the top in QHboxLayout

    Unsolved
    3
    0 Votes
    3 Posts
    2k Views
    T
    @JonB It was a mistake from my side, I was using m_pLayout->addWidget( m_customWidget, Qt::AlignTop) instead of m_pLayout->setAlignment(m_customWidget,Qt::AlignTop) ( event though in question I mentioned it ) it worked when I used setAlignment call. But what is the difference from both the calls? Both have the options to set Alignemnt, but why first one didn't work for me.
  • Seg fault when deleting Q3DScatter object

    Unsolved q3dscatter segmentation segfault
    15
    0 Votes
    15 Posts
    3k Views
    JohanSoloJ
    @vedranMv said in Seg fault when deleting Q3DScatter object: Regarding your edit, what you're writing makes perfect sense, but as you can see in the code, it's the other way around. If I don't call delete manually, I get a segfault. Then it seems to me there must be something else wrong in your code.
  • color part of a mesh loaded

    Unsolved
    1
    0 Votes
    1 Posts
    143 Views
    No one has replied