Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.5k Topics 457.3k Posts
  • Http file server list files and directories

    Unsolved
    2
    0 Votes
    2 Posts
    262 Views
    JonBJ
    @Sucharek It's much better to make the equivalent calls yourself. If you like curl you can build and link as a library, code at libcurl - the multiprotocol file transfer library, and e.g. https://everything.curl.dev/libcurl/cplusplus, https://dev.to/hi_artem/using-libcurl-in-c-c-application-4668 ?
  • Exception when calling QFileDialog.exec()

    Unsolved
    7
    0 Votes
    7 Posts
    588 Views
    JonBJ
    @Perdrix It looks like OldNewExplorer is this software: https://www.majorgeeks.com/files/details/oldnewexplorer.html. Like I said, I think you have a way forward: ask your user to uninstall it to verify that your Qt code then works OK. And/or install it for yourself to see if you can replicate the bug. Then figure whether it can be made to work in whatever situation, or whether it cannot be used with whatever Qt is doing.
  • Qt shows error

    Unsolved error
    5
    0 Votes
    5 Posts
    820 Views
    A
    Check return value from bcm2835_spi_begin() function; Maybe 0...
  • Qt mini sass

    Solved
    6
    0 Votes
    6 Posts
    414 Views
    JonBJ
    @Kris-Revi Yes, glancing at it this approach looks more readable/intelligible to me :)
  • Dialog box Ui loading Slow in Qt C++

    Unsolved
    2
    0 Votes
    2 Posts
    207 Views
    C
    @prasad15 What and how much data is being loaded onto the text label? What other elements are in your UI? Does this happen if you load an empty dialog?
  • QtKNX - converting messages to human readable numbers

    Unsolved
    6
    0 Votes
    6 Posts
    470 Views
    M
    @J-Hilk Thanks for the response but I am not looking at manually assembling the bytes to get a value and then multiplying it with some coefficient. I was hoping that the QtKNX classes could do that for me. There is a fixed datapoint type class (QKnxFixedSizeDatapointType) and a lot for other int/float classes that inherit from it. I was hoping that by choosing the correct type, I could get the conversion and multiplication done for me. List of classes listed here: https://doc.qt.io/qt-5/qtknx-module.html Looking at the Qt source code, it looks like the value() function does not even do the multiplication with the coefficient in some cases. For QKnx2ByteFloat::value() there is no clear coefficient multiplication but there is a hardcoded multiplication by 0.01 see: https://github.com/qt/qtknx/blob/dev/src/knx/dpt/qknx2bytefloat.cpp float QKnx2ByteFloat::value() const { quint16 temp = QKnxUtils::QUint16::fromBytes(bytes()); quint16 encodedM = (temp & 0x87ff); // Turning on bits reserved for E. // Only needed for reinterpretation of negative values if (encodedM > 2047) encodedM += 0x7800; qint16 M = qint16(encodedM); quint8 E = (temp & 0x7800) >> 11; return float(0.01 * (M) * qPow(2, qreal(E))); } For QKnx2ByteSignedValue:value() there is a coefficient multiplication: double QKnx2ByteSignedValue::value() const { return qint16(QKnxUtils::QUint16::fromBytes(bytes())) * coefficient(); } For QKnx4ByteSignedValue::value() there is no multiplication: qint32 QKnx4ByteSignedValue::value() const { return qint32(QKnxUtils::QUint32::fromBytes(bytes())); } So how does one know when to manually multiply with a coefficient? Are we assuming that no QKnx2ByteFloat, QKnx4ByteSignedValue values will ever need multiplying with a coefficient, or will I have to manually subclass those? Would it not be better to always do the multiplication and just have a default coefficient of 1?
  • File-save doesn't prepend extension?

    Solved
    11
    0 Votes
    11 Posts
    626 Views
    JonBJ
    @clarify said in File-save doesn't prepend extension?: E.g. if my code tells the File Save dialog to save as a ".txt" file, then the user sees the .txt to the right of the cursor where he has to type the file name and he cannot delete the .txt. I really don't see how your accepted solution satisfies your stated requirement. Which is why I said Qt does not offer this. QDialog::setNameFiler() does nothing other than control what existing files QFileDialog displays. It does not even have any effect on the string(s) returned, which are just the current path in the viewport. Which may or may not have a .txt extension. You have to deal with that yourself in code. Also, the solution you have now is a file dialog for opening a file with the intention of reading. You should add dialog.setAcceptMode(QFileDialog::AcceptSave) for your intended "File Save operation". This will (a) change the title of the dialog (from "Open" to "Save As") and (b) change behaviour if an existing file name is selected or typed in (so that it asks about overwriting, as a user would expect). It's still not great as if there is a file named abc.txt and rather than selecting it the user types abc the file dialog does not treat this as abc.txt for checking, even though your code is likely to be appending the .txt according to your rule. But it's still better than leaving it on the default QFileDialog::AcceptOpen. So far as I can see, your requirement is reasonable, and may be implemented in other applications, but is not well supported in Qt.
  • :-1: error: error: unrecognized command-line option '-mylibrary'

    Unsolved
    3
    0 Votes
    3 Posts
    332 Views
    C
    Further to @SGaist's observation, I would guess that the calculator PRO file has an incorrect LIBS variable, e.g.. LIBS += ... -mylibrary rather than LIBS += ... -lmylibrary
  • Problem with scrolling in QScrollArea

    Solved
    7
    0 Votes
    7 Posts
    2k Views
    supergS
    @JonB Thank you! I tried QTimer::singleShot(0, ...) and it kind of worked, but still I found that my code had several problems. I have decided to do some refactoring so that I'll be easier to make this and other functionalities work better and easier. I was trying to avoid that but seems like it's the only way. Thanks again for your help, I'll mark it as a solution.
  • Location of SYSTEMSCOPE preferences (MacOS)

    Unsolved
    2
    0 Votes
    2 Posts
    146 Views
    SGaistS
    Hi, Which version of Qt is it ? On which version of macOS ?
  • Save QImage to Base64 String

    Unsolved qimage qbytearray qbuffer base64
    11
    0 Votes
    11 Posts
    17k Views
    M
    This works QBuffer buffer; buffer.open(QIODevice::WriteOnly); QImage qp(fileName()); qp.save(&buffer, "PNG"); QString base64 = buffer.data().toBase64(); https://stackoverflow.com/questions/69165252/how-to-convert-png-image-into-base-64-format-in-qt
  • 0 Votes
    1 Posts
    590 Views
    No one has replied
  • Qt Native Stye for macOS

    Solved
    3
    0 Votes
    3 Posts
    566 Views
    J
    @SGaist Thanks for the answer. In Qt 6.5, it finally support native macOS message box!
  • White screen on launching application on SurfacePro

    Unsolved
    5
    0 Votes
    5 Posts
    500 Views
    M
    @Abderrahmene_Rayene yes i have looked and found this thread https://forum.qt.io/topic/52625/qopenglshaderprogram-could-not-create-shader-program/8?_=1681473494310 As mentioned in this thread i am planning to check use DirectX via ANGLE but i am not sure if this will work QCoreApplication::setAttribute( Qt::AA_UseOpenGLES ); do you have any better suggestion than this please let me know
  • QStateMachine: How To Implement Logical OR Between States

    Unsolved
    1
    0 Votes
    1 Posts
    298 Views
    No one has replied
  • 0 Votes
    3 Posts
    693 Views
    A
    @SGaist Hey thank you, I removed the QObject heredity for every class since I don't need ^^ I made every copy constructor and operator= overload not usable (= delete) I made for each a static clone() method which makes a deep copy CueTrack * CueTrack::clone(CueTrack *other) { if(!other) return nullptr; CueTrack * trackToReturn = new CueTrack(); if(other->_animationsList) { delete trackToReturn->_animationsList; trackToReturn->_animationsList = AnimationsSubTrack::clone(other->_animationsList); } QVectorIterator<FxSubTrack*> it(other->_fxList); while (it.hasNext()) { auto p = it.next(); FxSubTrack * fx = FxSubTrack::clone(p); trackToReturn->appendFx(fx); } if(other->_zoneChase) trackToReturn->_zoneChase = ZoneChaseSubTrack::clone(other->_zoneChase); return trackToReturn; }
  • QComboBox - few questions

    Unsolved
    3
    0 Votes
    3 Posts
    239 Views
    Axel SpoerlA
    ...and for the records: It's all nicely written down here.
  • Memory leak in QAbstractSocketPrivate::readFromSocket() ?

    Solved
    12
    0 Votes
    12 Posts
    1k Views
    Axel SpoerlA
    @Alexey-Volkov thanks for letting us know what it was. Glad that it works. Please don’t forget to mark the issue solved.
  • QScrollBar slider shadow

    Unsolved qscrollbar shadow qt5.9.0
    1
    0 Votes
    1 Posts
    282 Views
    No one has replied
  • Updating Qt Line Series in Real-Time is not working

    Solved
    9
    0 Votes
    9 Posts
    1k Views
    X
    The real-Time Plot not working is already resolved above, and the blank chart area can be resolved by adding the following line. chartView->setMinimumSize( ui->frame->size() );