Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • geocode() form QGeoCodingManager class not returning anything after passing an address.

    Unsolved
    8
    0 Votes
    8 Posts
    813 Views
    C
    @jsulm Sorry about that, will make sure to change that next time. I know it never enters either one of handleError() or handleFinish() because in my QML i have, Component.onCompleted: { MapFunctions.getmyaddress(); console.log("Coordinate:", MapFunctions.getlatitude()); console.log("Coordinate:", MapFunctions.getlongitude()); } for the application window. If I set values in those handle() functions they do not get reflected in the console log. For example I set longitude= 14 in handleFinish() and I comment out the other code and this has no effect on the output. For handleError() the values do not get set to -1 so it doesn't get called.
  • qInstallMessageHandler() add object method. How?

    Solved
    4
    0 Votes
    4 Posts
    935 Views
    JonBJ
    @bogong Having glanced through that, I see it goes qInstallMessageHandler(ALogger::mWriteToLog); Which is a static function, exactly what you said you did not want! Note that it does not go qInstallMessageHandler(oLogger->mWriteToLog);
  • Insert Column into Excel Spreadsheet

    Unsolved
    7
    0 Votes
    7 Posts
    990 Views
    VRoninV
    QXlsx doesn't even know about formulae. It does, it just doesn't calculate them The problem is not the insertion itself but it's updating the formulas after an insertion. You'd probably need to insert an engine that can at least read the formulas before even attempting at updating them. This was the stopper in implementing the functionality in the library
  • The program has unexpectedly finished.

    Solved
    8
    0 Votes
    8 Posts
    849 Views
    JonBJ
    @J-Hilk Ooohhh :) That's interesting, didn't know. I compile with -Wall but it doesn't seem to get included in that. https://stackoverflow.com/a/57079021/489865 is interesting in explaining various "shadow levels". Of course, as soon as I actually used it I'd probably moan about the perfectly intentional places I find convenient to have a same-named variable and don't want to be warned... :)
  • 0 Votes
    22 Posts
    14k Views
    8Observer88
    @8Observer8 said in QOpenGLFunctions glGetString(GL_EXTENSIONS) is null: I have a same question. I try to show OpenGL version but I get empty string: I solved the problem. I activated a second video card on my laptop from code in main.cpp: #ifdef _WIN32 #include <windows.h> extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; extern "C" __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001; #endif #include "Widget.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); Widget w; w.show(); return a.exec(); } It works too (without QString::fromLatin1): qDebug() << (const char*)glGetString(GL_VERSION);
  • How to declare global variable in QT?

    Solved
    13
    0 Votes
    13 Posts
    3k Views
    T
    @jsulm Yes, but here I see that cout is object of std::sotream class.
  • Custom QEvent question

    Unsolved
    7
    0 Votes
    7 Posts
    588 Views
    Christian EhrlicherC
    @krm26 said in Custom QEvent question: Guess I'll source-dive the answer, thanks. Not needed and I don't think you're right except somehwere else the event is already accepted: https://code.woboq.org/qt5/qtbase/src/corelib/kernel/qobject.cpp.html#1298 I would guess you simply forget to call the base class event() function when you've overwritten it.
  • Menu bar shows "QtWebEngineCore" instead of program name in MacOS menu bar

    Unsolved
    1
    0 Votes
    1 Posts
    93 Views
    No one has replied
  • QGraphicsPixmapItem is not correctly updated when the pixmap is big.

    Unsolved
    1
    0 Votes
    1 Posts
    140 Views
    No one has replied
  • Copy all screen

    Unsolved
    2
    0 Votes
    2 Posts
    165 Views
    Pl45m4P
    @leandrogmuller Access all your labels and simply get their text?! You want to use your label variables not get, what is written on your screen programmatically. To do that, you could iterate through your layout (if it only contains your labels) and get all the text.
  • 0 Votes
    7 Posts
    410 Views
    Christian EhrlicherC
    @devjb said in Help fixing threading issues when running an application in (debug|release) mode in combination with shared libraries built vice versa: However, you say it was not allowed to ship libs that are build with MSVC in debug mode. Then, just for my understanding, why can Qt do so with the framework? In the MSVC directory there are all the Qt5 libraries both as release and debug versions. This is wrong - maybe we were not clear. You are not allowed (by MS) to distributed to debug MSVC runtime dlls (msvcrtdXXX.dll and others) :)
  • Logging messages: qlogging.h

    Unsolved
    11
    0 Votes
    11 Posts
    997 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
    18k 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
    6k 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
    315 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
    793 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
    662 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 :)