Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • MainWindow dark mode

    Unsolved
    5
    0 Votes
    5 Posts
    388 Views
    Pl45m4P
    @JacobNovitsky You can still use QPalette and/or a stylesheet for your dark design appearance of your app
  • Asking about qnetworkauth redirect uri

    Unsolved
    2
    0 Votes
    2 Posts
    150 Views
    SGaistS
    Hi and welcome to devnet, Are you looking for something like described in this stack overflow answer ?
  • Native title bar size for proper window placement ?

    Solved
    13
    0 Votes
    13 Posts
    6k Views
    SGaistS
    @Violet-Giraffe That was to retrieve the information and use it in the following calculations.
  • QGraphicsView Performance

    Unsolved
    3
    0 Votes
    3 Posts
    282 Views
    JoeCFDJ
    @BoLin just curious. How do you connect two nodes?
  • Exclusive (write) access to a variable/data structure

    Solved
    25
    0 Votes
    25 Posts
    3k Views
    deisikD
    @SGaist said in Exclusive (write) access to a variable/data structure: @deisik composition is a core part of C++ and is encouraged over inheritance Then why care about C++ at all? You usually inherit when you want to augment the base class with new capabilities. In your case, you are leaking implementation details by doing so Leaking to whom or what, and why is it inherently a bad thing? If you need to lock the access to the whole data structure, then maybe you were putting the original lock in the wrong place Yes, when I need to dramatically change its contents. When I need to change/retrieve from another thread a single element in a list, I now use QReadWriteLock-enabled versions of regular getter/setter functions
  • VTK crash after QtOpengl activated.

    Unsolved
    2
    0 Votes
    2 Posts
    197 Views
    JoeCFDJ
    @shuiliuduan It seems more a VTK problem than a Qt issue. You may post your issue to a VTK forum.
  • App crashes when using jpegs

    Unsolved
    16
    0 Votes
    16 Posts
    863 Views
    JoeCFDJ
    @Creaperdown you may have to wrap the right lib with or statically link it to your app in this case. rpath will lead your app to look for the linked libs first in a specified dir if your know exactly where the libs are located. LD_LIRARY_PATH will not work if your app is launched when os starts. But you can start your app as: env LD_LIRARY_PATH=... your app. ldd your app to make sure your app is linked to the right lib.
  • QHttpServer and QWebSocket same port

    Unsolved
    2
    0 Votes
    2 Posts
    199 Views
    Christian EhrlicherC
    Use different ports - anything else will not work.
  • I cant read qrc file in Qt6

    Unsolved
    3
    0 Votes
    3 Posts
    346 Views
    kkoehneK
    @RahibeMeryem Christian is right that proper formatting + a full compilable example would help . Anyhow, I think I spotted the issue already: if(QFile::copy("qrc:/qtlib/centerface.onnx" , tempFile)){ Use ":/qtlib/centerface.onnx" here, since QFile expects a file path, not a QUrl. (And yes, the difference between :/ and qrc:/ is very annoying, as you need to know the signature of the API to decide which one to use).
  • 0 Votes
    6 Posts
    2k Views
    JonBJ
    @CJha That is great. I might be forgetting, but I don't think ~ or # are actually regular expression special characters. However, the escape() method may replace every punctuation character with \-character (including non-ASCII characters like copyright) because that never does any harm/is allowed on any punctuation character. Or it might be enough to let * go to \* and then revert any \*s to plain *s (actually .* in your case).
  • How can I include multiple classes together?

    Solved
    5
    0 Votes
    5 Posts
    265 Views
    yy_pc_programmerY
    @JonB I understood properly now. Thank you for your valuable answers. Have a nice day
  • QTableWidget in QGraphicsScene

    Solved
    5
    0 Votes
    5 Posts
    466 Views
    L
    @LiuXiaoHhan i figureout try this one in middlebtn pressing event setInteractive(false); and after releasing restore this status in QGraphicsView setInteractive(true);
  • Need to identify when all three channels have waveform peaks at the same time

    Unsolved
    1
    0 Votes
    1 Posts
    120 Views
    No one has replied
  • QScreenCapture with partial screen

    Solved
    7
    0 Votes
    7 Posts
    460 Views
    JoeCFDJ
    @Timmy you may rely more on FFMpeg than on QMultiMedia. QMultiMedia is a very basic tool for now. I do not use it at all.
  • "New Class Form" does not name a type

    Unsolved
    16
    0 Votes
    16 Posts
    595 Views
    JonBJ
    @Andrew23 That's like I said then! It has indeed found the function named UpdateWindow() in winuser.h, a Windows SDK header file. And it tells you that is hiding the class UpdateWindow you want it to pick up. You can wait for some C++ guru to suggest your best move. But one thing would work: completely delete your UpdateWindow class and pick some other name for it! Make sure you rebuild from scratch when you do so. Oh, for this error it tells you what you can do here: class UpdateWindow *updateWindow = nullptr; It even says you can click the message to make it do it for you.... I don't know if there will be other similar issues elsewhere, you will always have to use class UpdateWindow ..., might be simpler to rename your class.
  • rendering text in QOpenGLWidget

    Unsolved
    7
    0 Votes
    7 Posts
    8k Views
    P
    I had this issue when I needed to draw axis and corresponding ticks. In Qt4, I can use the following code: for (int i = _Ymin; i <= _Ymax; i = i + _yGrid) { double yPos = (_Ymax-i)*_yscaleF*_yscalingF; double xPos = -_xmin*_xscaleF-_shiftX; if(yPos < (_Ymax-_Ymin)*_yscaleF-_shiftY+1) { glBegin(GL_LINES); glVertex2f(xPos-2, yPos); glVertex2f(xPos+2, yPos); glEnd(); renderText (xPos - offset,yPos+5 , 0, QString::number(i/10.0)); } } glScalef(_xscalingF,_yscalingF,0); However, when I try to migrate my code to Qt6, there's no renderText anymore. After searching on the web and investigating the source code of renderText, finally I found the solution, one needs to save/load gl status: glBegin(GL_LINES); glVertex2f(xPos-4, yPos); glVertex2f(xPos+4, yPos); glEnd(); qt_save_gl_state(); renderText(xPos - offset,yPos+5 , QString::number(i/10.0)); qt_restore_gl_state(); Here are the def of qt_save_gl_state, renderText, qt_restore_gl_state: static void qt_save_gl_state() { glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS); glPushAttrib(GL_ALL_ATTRIB_BITS); glMatrixMode(GL_TEXTURE); glPushMatrix(); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glPushMatrix(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glShadeModel(GL_FLAT); glDisable(GL_CULL_FACE); glDisable(GL_LIGHTING); glDisable(GL_STENCIL_TEST); glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); } static void qt_restore_gl_state() { glMatrixMode(GL_TEXTURE); glPopMatrix(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glPopAttrib(); glPopClientAttrib(); } void GLWidgetnew::renderText(double x, double y, const QString text) { GLdouble textPosX = x, textPosY = y; // Retrieve last OpenGL color to use as a font color GLdouble glColor[4]; glGetDoublev(GL_CURRENT_COLOR, glColor); QColor fontColor = QColor(glColor[0]*255, glColor[1]*255, glColor[2]*255, glColor[3]*255); // Render text QPainter painter(this); painter.translate(float(_shiftX),float(_shiftY)); //This is for my own mouse event (scaling) painter.setPen(fontColor); QFont f; f.setPixelSize(10); painter.setFont(f); painter.drawText(textPosX, textPosY, text); painter.end(); } Note that one might need to adjust the renderText function for some special purposes (e.g., scaling, translation etc) src code of the project can be found here QtSignalProcessing
  • Qt Build Issue

    Unsolved
    8
    0 Votes
    8 Posts
    990 Views
    S
    I am able to run my app through code. Thank you so much All. Special thanks to @Christian-Ehrlicher. Great help!.
  • Qt (maybe 5) became sluggish recently. Any ideas why?

    Unsolved
    19
    0 Votes
    19 Posts
    1k Views
    S
    @Valso said in Qt (maybe 5) became sluggish recently. Any ideas why?: Now I installed these two and forced them to use the GTK file dialogs, so no more waiting for an eternity for the dialog to load. Then it sounds like a problem of KDE and not Qt. Yes, KDE is closely related to Qt, but it also extends Qt. Most likely it provides its own "native" file dialog for Qt. There is a difference between plain Qt programs and KDE programs. And you were (almost) right initially that KDE would imply Linux as OS, but Qt actually does not (as mentioned before). (Just for completeness sake: the official KDE programs are also available on Windows. I even have Kate installed.)
  • qAsConst() deprecated

    Solved
    4
    0 Votes
    4 Posts
    2k Views
    C
    @Chris-Kawa Thanks so much Chris. You have saved me from making a systematic errror. Much appreciated.
  • windeployqt via docker issue

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