Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • Memory management in the calendarwidget example. Is there are memory leak?

    Solved
    3
    0 Votes
    3 Posts
    329 Views
    D
    @JonB Thank you! It's all clear now :)
  • Defining FD_SETSIZE in .pro file

    Solved
    9
    0 Votes
    9 Posts
    716 Views
    P
    #ifndef FD_SETSIZE #define FD_SETSIZE MaxClients #endif Solved my problem, thanks
  • QFile doesn't detect read-only files

    Solved
    14
    0 Votes
    14 Posts
    2k Views
    JonBJ
    @Sucharek said in QFile doesn't detect read-only files: Copied file at "C:/Users/username/Downloads/Other/Spotify.lnk" does not exist This is a .lnk file. You never mentioned this, even though it behaves differently from all other file types under Windows. Did you not think that relevant? The QFile etc. documentation tells you how it handles .lnk files --- effectively, it always tells you about the file pointed to by the .lnk file, not the .lnk file itself. So, for example, when you say QFile::exists() reports it as not existing, it is telling you about the file the .lnk points to. Did that exist? @JonB QFileInfo returned false You were supposed to look through the various QFileInfo::is...() methods, not just QFileInfo::exists(), to see what the attributes of the file are. For instance, QFileInfo::isShortcut() under Windows would have told you/us what is relevant here.
  • Mac, Static lib, Dynamic lib Lost signals!

    Unsolved static staticlibrary dynamic dynamiclibrary mac
    13
    0 Votes
    13 Posts
    2k Views
    SGaistS
    Libraries that are shared between plugins and executable shall be shared and not static. Otherwise you will end up with multiple definition of the static meta object of your QObject based classes which is not good.
  • Check if audio has ended.

    Unsolved
    2
    0 Votes
    2 Posts
    197 Views
    SGaistS
    Hi, Doesn't QAudioSink::audioStateChanged provide the info you want ?
  • 0 Votes
    1 Posts
    92 Views
    No one has replied
  • Shortcuts and widget keyPressEvent

    Solved
    3
    0 Votes
    3 Posts
    406 Views
    R
    Thanks, that appears to be the solution. I install the event filter in the widget's constructor and trap the shortcut delete key in the event filter method. Then accept the event, do the widget's specific handling, and then return true.
  • QPolygonF error

    Unsolved
    34
    0 Votes
    34 Posts
    7k Views
    kshegunovK
    @Daniil-S said in QPolygonF error: @kshegunov probably, as advised in one of the reports, I will use the clipper library Yes, that's prudent as even if I have the time and will to fix at least some of this, assuming it gets accepted to begin with, it can be a long time.
  • Remove comma separator from lines read in from a .csv file

    Solved
    9
    0 Votes
    9 Posts
    1k Views
    E
    @mchinand This solved my problem. I'm refactoring code that uses data files that were previously generated into Excel Spreadsheets. The user stopped paying for the MSOffice subscription to keep Excel running so now the DAQ equipment is outputting a .csv I did a hex dump on a couple of files and it appears that the DAQ equipment automatically puts a comma at the end of the line. It's not new equipment so perhaps when it was designed there was some requirement for a .csv line to end with a comma.
  • QTabWidget in ScrollArea

    Unsolved
    5
    0 Votes
    5 Posts
    361 Views
    W
    Thanks at @SGaist I will try that out
  • QWidget, setEnable, change not visible immediately

    Solved
    9
    0 Votes
    9 Posts
    2k Views
    SPlattenS
    @J-Hilk , sorry for wasting your time....I've found the problem which as an error in my code.
  • Configure for cross-compile does not check for xcb-glx-integrations

    Solved
    3
    0 Votes
    3 Posts
    2k Views
    I
    Okay I figured this out. By searching the whole Qt source tree for "XCB GLX" I found this rule in qtbase/src/gui/configure.json which seems to be what causes the build check to be skipped. "xcb-glx-plugin": { "label": "GLX Plugin", "emitIf": "features.xcb", "condition": "features.xcb-xlib && features.opengl && !features.opengles2", "output": [ "privateFeature" ] }, In my case xcb-xlib being missing was the failing condition. By adding -xcb-xlib to the configure options, I could force configure to run the checks, and then resume my earlier procedure of looking at config.log to see details about what failed, and then copying the missing headers/libs into the target toolchain (libxcb-xinput.so in this case). The reason libxcb-xinput.so did not exist is because I was copying in libs and headers from Ubuntu 16.04, which simply does not have libxcb-xinput. Fortunately I was able to build that from source easily enough.
  • QSqlQuery is not substituting bound values on exec upon second run

    Solved
    4
    0 Votes
    4 Posts
    313 Views
    JonBJ
    @ChrisW67 It isn't, and I wondered about that, but these days one doesn't dare to ask when OPs state it is "obvious" what it is and/or did not paste their actual code but you should guess what it really is..... @ocgltd qDebug() << rowsAffected; Is this your actual code? rowsAffected is what --- an undeclared local variable, an unset member variable? There is a int QSqlQuery::numRowsAffected() const, but you don't show any call to it?
  • 0 Votes
    6 Posts
    1k Views
    S
    @dev_liya said in I want to generate random number between the 0 to 1. with the interval of 1 second in qt.: but my requirement is to generate in infinite loop ad show in window. If you do an infinite loop then the event loop will not run. That means that setting the random_label or anything like that will not show on the screen as the slots cannot be handled: your infinite loop will block the event loop. The effect is that you have a frozen application. So, trust @JonB. As per your request: to wait for one second and block everything (you have been warned!): use QThread::sleep(1);
  • QObject as Q_PROPERTY best practices

    Unsolved
    11
    0 Votes
    11 Posts
    2k Views
    kshegunovK
    @pjorourke said in QObject as Q_PROPERTY best practices: The data structure I have is 3 levels deep. Something like this Well, since you asked for advice, here it goes. If you have hierarchical data, I'd go with QAbstractItemModel. This whole concept of exposing arrays into QML isn't that great in practice. It's not wrong per se, but doesn't work as well. Otherwise you could of course do what you originally intended - keep things into QObjects, however then keep the object pointers into QPointer as you can loose the reference at any time due to QML garbage collection. QML is quite QObject heavy to begin with, but that isn't really ideal to represent "data" as such. The only thing I dont like is that I cannot create Q_GADGET objects in QML I wish I could do that but maybe that support will come in the future. https://codereview.qt-project.org/c/qt/qtdeclarative/+/389027 and https://codereview.qt-project.org/c/qt/qtdeclarative/+/389016 are relevant.
  • Duplicating the orientation of a graph on to a mesh

    Unsolved scene3d rotation scatter3d
    1
    0 Votes
    1 Posts
    326 Views
    No one has replied
  • Main window positioned near Tray Icon

    Solved
    5
    0 Votes
    5 Posts
    592 Views
    E
    @SGaist THANK YOU!!!!!!!!!!!!!! That was it!
  • Very strange performance of QLabel and QLineEdit

    Unsolved
    4
    0 Votes
    4 Posts
    356 Views
    SGaistS
    Hi, Are you graphics driver up to date ? If so, did you try with an older version ?
  • Does QStackedWidget processes all pages simultaneously?

    Unsolved qstackedwidget pages gui
    2
    0 Votes
    2 Posts
    577 Views
    SGaistS
    Hi and welcome to devnet, QStackedWidget does not care nor handle what do the widgets inside it. What will not happen is UI updates but all the rest will. What you can do is disable these processing when the widgets are not visible if it makes sense.
  • What SIGNAL to monitor for incorrect QProocess ?

    Unsolved
    2
    0 Votes
    2 Posts
    191 Views
    JonBJ
    @AnneRanch You have asked this so many times, and been answered. You cannot execute hcitool -i hci0 scan --flush | tee /tmp/temp as the command in process ->start(command). The answer is always the same: process ->start("/bin/sh", QStringList() << "-c" << command); YES, I can go back to passing data to "bash"... BUT bash script does not accept some standard options likes "|" and "tee". Completely incorrect. It is only either /bin/sh or /bin/bash which does accept and interpret |. tee has nothing to do with the shell, and works fine from either. If I do pass QSTring to QPProcess - what is the corrent systex for passinf "system" function ? There is no system-anything to pass to QProcess. system() is an alternative to using QProcess. You are better using QProcess in Qt programs and not system(). There is nothing system() does that QProcess() cannot do, but there are things you can do with QProcess which cannot be done with system(). You could save yourself time but not trying to use system(), I have shown you the equivalent process ->start() to use instead. Which one of QProcess standard SIGNALs should I monitor for possible error? void errorOccurred(QProcess::ProcessError error) errorOccurred() is the signal for errors launching QProcess. You will doubtless be interested in other things which happen that are not process errors, even if you might think they should be. They may be reported by reading stderr (readyReadStandardError()) and possibly stdout too. For the simplest case just use const char *command = "hcitool -i hci0 scan --flush | tee /tmp/temp"; process ->start("/bin/sh", QStringList() << "-c" << command); process->waitForFinished(); qDebug() << process->readAllStandardError(); qDebug() << process->readAllStandardOutput(); You should also connect on the errorOccurred signal, just in case.