Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • How to include files from the subproject dll library in a unit testing subproject

    Unsolved
    3
    0 Votes
    3 Posts
    74 Views
    Pl45m4P
    @Stanislav228 Hi and welcome to the forum, I don't quite understand your issue. You don't need to add the EXPORT to all functions/classes of your library. You can still hide some classes or functions that you don't want in your target that imports the lib. Everything works until I add the q_decl_export directive to the classes in the dll. What should I do? What does not work then?! How do you add the import/export directives to your project? Are you using the "Qt-Global" style?!
  • 0 Votes
    15 Posts
    242 Views
    S
    To add on to this, I discovered why it was trying to insert NULL for relation fields. I did the select before setting my relations. And it wasn't enough to have a separate model load the related table. It has to be loaded in the QSqlRelationTableModel for it to work. So the very original comment here (sorry if this pings you) turned out to be 100% correct. I'm just also posting this here for future reference @JonB said in QSqlRecord forces null in composite primary key on QSqlTableModel::insertRecord: Isn't that actually a consequence of you using a QSqlRelationalTableModel? Isn't it that the Qt side expects to see in the related FoodData table/model an entry for the value of your food column in FoodDay table/model equal to it? You have "broken the contract" you establish with QSqlRelationalTableModel that Qt will see in-memory models maintaining the relationship? It is not good enough if you say the row does exist at the backend database side, if you want to use QSqlRelationalTableModel (you don't have to, it's only for value lookup) you must have the FK model/table up-to-date in memory.
  • How to exclude a specific widget from the global stylesheet?

    Unsolved
    5
    0 Votes
    5 Posts
    115 Views
    S
    You can see if any of the selectors (https://doc.qt.io/qt-6/stylesheet-syntax.html) work for you. You could create your own subclass of QPushButton. As long as all the other buttons are actual QPushButtons the class selector .QPushButton would only style these, but not your subclass. Or you could try to use a Property Selector with your own property. But I'm not sure if that works for buttons that don't have that property. (You see, it is a lot easier to just specify something for a specific button, but a lot harder to specify something for all other buttons.)
  • QSqlTableModel Network Performance

    Unsolved
    16
    0 Votes
    16 Posts
    342 Views
    Kent-DorfmanK
    Full tableview models over an internet are bad ju-ju. You should switch to a client/server transaction model. It's ok to load managable chunks into a local table presentation, but you MUST limit the number of returned rows and use indexes properly. Never blindly load a table. Doing that means you are not using the relational database properly. Only time you should ever need full table access is during maintenance as a DBA, but even then it's not strictly necessary. trying to predict and manage latency won't solve your problems. When you switch to a networked database model your access mechanisms have to allow for unpredictable latency. Some hints make sure your SQL is being executed as stored procedures on the database server where the data is hosted, not the local machine..."cloud" should make you nervous if the table data isn't stored on the same machine as the DB server. switch to a rigid transaction model rather than a table view model make effective use of proper indexing and limiting of SQL result sets Sorry to be the voice of gloom, but local DB and network are two different worlds.
  • How to force a style sheet recalculation

    24
    0 Votes
    24 Posts
    29k Views
    Pl45m4P
    @JonB Maybe even https://doc.qt.io/qt-6/qwidget.html#ensurePolished https://doc.qt.io/qt-6/qstyle.html#polish That might force the style(sheet) to update too. But usually the widget should do this when a new style(sheet) is applied.
  • Cannot install

    Unsolved
    17
    0 Votes
    17 Posts
    13k Views
    M
    Hey! If you're on windows, ensure that your date/time is up to date.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    13 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • QRemoteObjectReplica.Suspect when busy in while loop

    Unsolved
    3
    0 Votes
    3 Posts
    66 Views
    M
    @jsulm The loop has something to do with a special libusb device waiting to be established etc. I don't want to change the logic of this code (not from me). Just want to wrap the QRemoteObjectReplica class around it, call it from the connection and wait until its finished with QRemoteObjectPendingReply But i guess it works only if the function returns "immediately".
  • Qt class for Contour plots

    Unsolved
    3
    0 Votes
    3 Posts
    79 Views
    PerdrixP
    No, but I will now :). Thank you
  • I Can't load the QMySQL with Qt 6 C++

    Unsolved
    4
    0 Votes
    4 Posts
    109 Views
    B
    @Tuanhoc8 This is not what you should be looking for. These are information that tells you these plugins exist. But we already know that from your "available drivers" output. Find something like "loaded" or "cannot load" / “failed”. By the way, where is your libmysql.dll coming from? (You don't need to have libmysqld.dll though) If you get it from MySQL Server, I remember it depends on libopenssl so it needs libcrypto-3-x64.dll and libssl-3-x64.dll to load. You may use Dependencies tool to check that. (I highly recommend to build the plugin using the library from MariaDB instead of MySQL Server because it depends the least.)
  • 0 Votes
    66 Posts
    14k Views
    FeRDNYCF
    Necromancy, sorry, but there was a point made a while back that kind of zipped by without comment, and I wanted to circle back to it: @Christian-Ehrlicher said in Rust file parsing significantly faster than Qt/C++ file parsing. Solutions for Qt implementation wanted. File size: 68.5 MB: The problem with QDateTime is that for every call the internal format parser (QDateTimeParser, private class) is re-created and needs to re-evaluate the string. This takes a lot of time. Given how expensive it is to re-create that parser for every call, I wonder if Qt would consider making the parser public. instantiable, and reusable, so that when parsing a lot of same-formatted date strings, it could be created just once and applied to all of them? Kind of like Python's re.compile() for regular expressions. e.g. something like: QDateTimeStringParser* dateParser = new QDateTimeStringParser( "yyyyMMdd HHmmss zzz0000" ); QElapsedTimer* parseTimer1 = new QElapsedTimer(); parseTimer1->start(); for (int ii = 0; ii < allData.size() - 1; ii++) { QByteArrayList data = allData.at(ii).split(';'); t.dt = dateParser->parse(data.at(0)); t.last = data.at(1).toDouble(); t.bid = data.at(2).toDouble(); t.ask = data.at(3).toDouble(); t.volume = data.at(4).toInt(); instr.tickList.append(t); } qDebug().noquote() << QString("Qt parse time: %1ms") .arg(parseTimer1->elapsed()); dateParser->deleteLater(); I wonder if that could make it significantly faster? parse() would have to be reentrant and stateless, of course (beyond the stored, immutable format string), which could still be tricky for a complex parser.
  • SDL3 Lib in Qt6

    Solved sdl joysticks button gamepad general problem
    3
    0 Votes
    3 Posts
    217 Views
    J
    Thank you so much, I will check over
  • QFileDiaolg question about extensions

    Unsolved
    5
    0 Votes
    5 Posts
    190 Views
    J
    Some platforms or Qt versions may treat .gz as the primary extension, so the dialog might not match files as expected unless each full extension is written out.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • Using setCamera[XY]Rotation in Q3DScatterWidgetItem to move camera above a point

    Unsolved
    2
    0 Votes
    2 Posts
    117 Views
    G
    After much digging to understand how qtgraphs handles vectors, I did finally crack this. Camera direction is -z, coordinates are y-up. So X rotation angle is from yaw. QVector3D v = QVector3D(x,y,z); v.normalize(); // camera vector QVector3D camera = QVector3D(0,0,-1); // camera along z axis // compute rotation QQuaternion rotation = QQuaternion::rotationTo(camera,v); rotation.getEulerAngles(&pitch,&yaw,&roll); // set camera rotation graph->setCameraXRotation(yaw); graph->setCameraYRotation(pitch);
  • Video Output Not Displaying in QVideoWidget with Playbin Element

    Solved
    5
    0 Votes
    5 Posts
    302 Views
    B
    @ccls Yes, not using playbin is a better way I think. I was also curious why you need to use playbin in pipeline since Qt already uses playbin to play normal urls, now this makes sense :)
  • Cryptic malloc crash

    Solved
    7
    0 Votes
    7 Posts
    248 Views
    J
    Okay; so I have to find a way to make sure that QByteArray persists through the entirety of the call to write in the socket it eventually gets passed to. Thanks all!
  • qthread conflict with _I in VS2022, BUT ok in qt5

    Unsolved
    2
    0 Votes
    2 Posts
    128 Views
    Christian EhrlicherC
    include the Qt headers first
  • This topic is deleted!

    2
    0 Votes
    2 Posts
    20 Views