Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.5k Topics 457.3k Posts
  • QByteArray qUncompress on non-Qt apps

    Unsolved
    4
    0 Votes
    4 Posts
    254 Views
    Christian EhrlicherC
    @Jeevo It's properly documented: https://doc.qt.io/qt-6/qbytearray.html#qCompress and https://doc.qt.io/qt-6/qbytearray.html#qUncompress-1
  • Button loses styling!

    Solved
    5
    0 Votes
    5 Posts
    426 Views
    K
    omg i am stupid for not noticing this sooner... scrollAreaMatrix->setStyleSheet("border: none;background: transparent; "); you see it when you see it... it needs to be scrollAreaMatrix->setStyleSheet("QScrollArea { border: none;background: transparent; }");
  • GUI sending commands even after exiting it.

    Unsolved
    5
    0 Votes
    5 Posts
    311 Views
    S
    An infinite loop is an infinite loop. Why do you expect it to end? The normal Qt application has something like this: int main() { QApplication app; //... app.exec(); } app.exec() starts a loop that handles events (much faster than calling processEvents()!!!!). In a normal application (not yours) when you close the app a close event is send which terminates the event loop started by app.exec(). Your while(1), however, blocks the event loop and never returns to app.exec(). So, app.exec() cannot figure out that the app was terminated. You must return from your function for Qt to work properly. while(1) { sleep(1); /* ... */ }: If you want to do something once every second use a QTimer with a timeout of one second. Basically, this is what @JonB said, just with other words.
  • Qt 5.15.9 static compilation issue

    Solved
    10
    0 Votes
    10 Posts
    740 Views
    Cobra91151C
    Hello! Great! I have successfully built Qt 5.15.9 statically. The issue is resolved. Thank you.
  • Multiple qrc files

    Unsolved
    3
    0 Votes
    3 Posts
    531 Views
    S
    @Perdrix said in Multiple qrc files: Can we have a qrc file in that project with (I assume) a different name than "translations" that looks like: Multiple qrc files are not a problem for Qt. You should just make sure that you don't have the same file names in different qrc files. This is not the case in your example. @Perdrix said in Multiple qrc files: So that both DSS and DSSKernel qm files are picked up? You cannot use a wildcard for this. Wildcards are usually resolved by the command line. So, you would need explicit code in any application (Qt or not) to resolve wildcards. However, the documentation for QTranslator talks about multiple translations: Multiple translation files can be installed in an application. Translations are searched for in the reverse order in which they were installed, so the most recently installed translation file is searched for translations first and the earliest translation file is searched last. The search stops as soon as a translation containing a matching string is found. So, you need to manually install both translation files to use them. The origin (i.e. two different qrc files) does not matter to QTranslator.
  • Qt eror: Underfined Reference To

    Moved Solved
    6
    0 Votes
    6 Posts
    617 Views
    SGaistS
    @ChrisW67 The issue was that the slot was declared in both classes and not implemented in MainWindow however, it was a useless slot so its removal fixed the issue at hand.
  • How to put QWidget objects on top of a QWindow?

    Unsolved
    3
    0 Votes
    3 Posts
    320 Views
    ?
    @JoeCFD I can only use QWindow, so the soluton inside the link doesn't apply. Thanks.
  • Default background colour for QToolbar?

    Unsolved
    3
    0 Votes
    3 Posts
    263 Views
    PerdrixP
    @SimonSchroeder Thank you
  • QNetworkAccessManager causes startup errors

    Solved
    6
    0 Votes
    6 Posts
    773 Views
    mzimmersM
    @JoeCFD @JonB ugh...this again. I think I was victimized by my own pedantry. When coding a function (including main), I really, really like to have all my variables declared before any code appears. Unfortunately, this doesn't seem to be possible in one case: // need to enable the keyboard via environment variable. // must be done before creation of QGuiApplication. qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; My old solution was to have this code after all the other variable declarations; moving it to the top of main() did indeed fix the problem. Thanks guys.
  • How to make tableWidget.setItem accept a python list?

    Solved
    4
    0 Votes
    4 Posts
    486 Views
    SGaistS
    Hi, There's currently no real benefit with what you ask. QTableWidgetItem does not handle lists the way you want it. You would also need a custom delegate to render that list which, while not complicated, would mean a lot of list to string operation. This mean burning CPUs for nothing. Doing a join when creating the item and a split when you want to retrieve the data is both simple and cost effective.
  • QT 5.8 - how to get DIR list from FTP Server

    Unsolved
    6
    0 Votes
    6 Posts
    4k Views
    JonBJ
    @Peladosok As @VRonin said You can either recompile the old QFtp Module or use an external library like libcurl These days you're probably best using libcurl. There might be some sample FTP client code in Qt example https://doc.qt.io/qt-6/qtscxml-ftpclient-example.html
  • How to get the string list divided by QPainter with Qt::TextWordWrap?

    Solved
    2
    0 Votes
    2 Posts
    186 Views
    Christian EhrlicherC
    You're looking for QTextLayout - see https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/painting/qpainter.cpp#n7200
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    19 Views
    No one has replied
  • QGraphicsItem - automatically rearrange positions (space out)?

    Unsolved
    2
    0 Votes
    2 Posts
    163 Views
    JonBJ
    @nicholas_yue Not so far as I know. There is no "Tile" or "Cascade". Just write it yourself.
  • How to adapt the font size to the resolution of my image?

    Unsolved
    3
    0 Votes
    3 Posts
    365 Views
    JoeCFDJ
    @lincoln said in How to adapt the font size to the resolution of my image?: QImage Now you hard-coded the font size. You can set coefficient which is determined by the width or height of your image. painter.setFont(QFont("Arial", coef * newImage.width() Or coef * newImage.height())); Note that your image may need to be scaled as well for your widget. I use pixel size in font. Yours is not pixel size and you may need a global and consistent usage of font unit. QFont("Arial", 20 ) 20 is point size, not pixel size.
  • How do I get Qt-Versions on my Raspberry Pi to create the kit?

    Unsolved
    2
    0 Votes
    2 Posts
    199 Views
    JoeCFDJ
    @Samuel123 I guess you need to install a Qt version for qt creator.
  • Setting a backgroung image for a QPushButton does not work

    Unsolved
    7
    0 Votes
    7 Posts
    1k Views
    Q
    @JoeCFD I tried to set the button size first and I am still getting the same behavior. I was wondering if you could share your code, I am sure I'm missing something obvious. Many thanks!
  • How to get a pointer to a specific widget when you know only its name?

    Solved
    8
    0 Votes
    8 Posts
    812 Views
    JonBJ
    @Ylvy Yes, if you want to find a top-level window, assuming your QMainWindow is such, and you are somewhere that does not have access to your QMainWindow* variable, walk (don't descend) QWidgetList QApplication::topLevelWidgets() for a QMainWindow*. Then use that for mainWindow->findChild<YourWidgetClass*>("SpecificWidgetObjectName"); I use this for debugging purposes. It may not be a sign of great design if your code really needs to find the main window for this purpose.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • QRegExp does not support unicode 16 bit character?

    Solved
    9
    0 Votes
    9 Posts
    847 Views
    C
    @king558 I use this little gem r12a >> apps >> Unicode code converter. Paste in the text to convert (e.g. 📉) and out pops it encoded in various ways ready to paste in elsewhere. Or, provide the 16-bit words of a UTF-16 encoding and out pop the characters. The Wikipedia page for UTF-16 describes how the surrogates encode the higher code points.